0 Members and 1 Guest are viewing this topic.
A_JumpIf(momx==0,"Death")
How would I make a projectile die after it stops moving across the x-axis? I'm making a projectile that slows to a stop in the same manner of Quick Boomerang, then dies (I had to time A_Countdown perfectly), but the problem is if I shoot it upwards, it goes backwards before stopping. So I tried sayingCode: [Select]A_JumpIf(momx==0,"Death")but it just skipped past it completely and flew backwards into the wall. Shouldn't momx have worked?
ATBU A 1 A_ScaleVelocity(0.90)ATBU A 0 A_JumpIf(5>momx && 5>momy && 5>momz,"Death")ATBU A 0 A_JumpIf(momx>-5 && momy>-5 && momz>-5,"Death")
ATBU A 1 A_ScaleVelocity(0.90)ATBU A 0 A_JumpIf(momx*momx<1 && momy*momy<1 && momz*momz<1,"Death")
EDIT2: This one ALSO worked:Code: [Select]ATBU A 1 A_ScaleVelocity(0.90)ATBU A 0 A_JumpIf(momx*momx<1 && momy*momy<1 && momz*momz<1,"Death")
Quote from: "tsukiyomaru0"EDIT2: This one ALSO worked:Code: [Select]ATBU A 1 A_ScaleVelocity(0.90)ATBU A 0 A_JumpIf(momx*momx<1 && momy*momy<1 && momz*momz<1,"Death")So I did this one (bcuz it looked like the same thing you put earlier except shorter) except I took out the momy and momz parts bcuz it should be allowed to be fired in the air (and it's not gonna go sideways, so...). For the most part, it works; it slows to a stop and then dies, so thank you for that . However, sometimes it just stops dead in its tracks and dies. I'm not completely sure why. :?
Spawn:FLB2 A 5 //This just helps me with the timingFLB2 A 1 A_ScaleVelocity(0.8)FLB2 A 0 A_JumpIf(momx*momx<1,"NearDeath")Goto Spawn+1NearDeath:FLB2 A 1 A_ChangeVelocity(0,0,0,CVF_REPLACE)FLB2 A 5Death:TNT1 A 0TNT1 A 0 A_SpawnItemEx("OilPitIgnite",0,0,8)stop}}
Nononononono what I'm saying is that merely seconds after spawning, it will just stop and die.Here's the code for reference:Code: [Select]Spawn:FLB2 A 5 //This just helps me with the timingFLB2 A 1 A_ScaleVelocity(0.8)FLB2 A 0 A_JumpIf(momx*momx<1,"NearDeath")Goto Spawn+1NearDeath:FLB2 A 1 A_ChangeVelocity(0,0,0,CVF_REPLACE)FLB2 A 5Death:TNT1 A 0TNT1 A 0 A_SpawnItemEx("OilPitIgnite",0,0,8)stop}}I want it to slow to a stop, float in mid-air for a brief moment, then die, and it works perfectly 85% of the time, but sometimes it will spawn, go at full speed like normal, but then after a half-second go straight to NearDeath.
momx — Actor's velocity along the absolute X axis
How do I make a projectile give the class a flag on crash?class as in the playerclass
Quote from: "Davregis"How do I make a projectile give the class a flag on crash?class as in the playerclassPain state in the class and damage type in the projectile.Example: if DamageType of the projectile is "GravityBreaker", the playerclass will need a pain state defined "Pain.GravityBreaker", with an A_ChangeFlag action function in said pain state.
Quote from: "tsukiyomaru0"Quote from: "Davregis"How do I make a projectile give the class a flag on crash?class as in the playerclassPain state in the class and damage type in the projectile.Example: if DamageType of the projectile is "GravityBreaker", the playerclass will need a pain state defined "Pain.GravityBreaker", with an A_ChangeFlag action function in said pain state.I referred to the calling playerclass, yet this was part of the solution that resulted.An exploding projectile with the painstate as you describe works perfectly. Thanks!