Hi, people.
Having a little trouble with some script I'm doing. I'm pretty much a newbie and have only done basic stuff - was hoping I could get some help here.
I have a class with only 3 int variables in it, all at 0 by default. Extending from that is a class with a mesh as default (this class spawns from another class - specifically when another mesh is destroyed), and a touch function that adds 1 to one of the ints in the parent class. Now, when I touch it, a destroy function destroys it and the int goes up by 1.
My problem is that if another one spawns, the int appears to reset. Is there a way to spawn more without resetting the int in the parent class? Essentially, in gameplay, the mesh class is a pickup. The intent is that the more of the pickup the player obtains, the more powerful their weapon gets. However, I can't increase the powerstage because everytime a new pickup spawns, the int resets. I figured I'd need to properly store the value in some way. I imagine I'm just being an idiot and not seeing the simple solution.
I also have the problem of not fully knowing when and when not to use class specifiers like abstract here, though I've tried this script both with and without it.
Parent class (PowerUp):
Extension class (PowerupLaser):Code:class PowerUp extends Actor abstract; var int LaserPowerStage; var int RocketPowerStage; var int AcidPowerStage; DefaultProperties { LaserPowerStage = 0 RocketPowerStage = 0 AcidPowerStage = 0 }
Any help at all would be appreciated, thanks.Code:class PowerupLaser extends PowerUp; var EmitterSpawnable BoomEmitter; function PostBeginPlay() { `log("POWERSTAGE IS:"$LaserPowerStage); } function Touch ( Actor Other, PrimitiveComponent OtherComp, vector HitLocation, vector HitNormal ) { local Pawn P; P = Pawn(Other); if (P != none) { PlaySound(SoundCue'A_Pickups.Armor.Cue.A_Pickups_Armor_Respawn_Cue'); LaserPowerStage++; Destroy(); spawnPickup(); `Log("POWERSTAGE IS:"$LaserPowerStage); } } function spawnPickup() { BoomEmitter = Spawn(class'EmitterSpawnable'); BoomEmitter.SetLocation(Location); BoomEmitter.SetTemplate(ParticleSystem'CTF_Flag_IronGuard.Effects.P_CTF_Flag_IronGuard_Spawn_Blue',true); } DefaultProperties { begin object class=StaticMeshComponent Name=StaticMeshComponent0 StaticMesh=StaticMesh'NEC_Lights.SM.Mesh.S_NEC_Lights_SM_WallLight01' end object CollisionComponent=StaticMeshComponent0 bCollideActors = true DrawScale=0.6 Components.Add(StaticMeshComponent0) }![]()




Reply With Quote



Bookmarks