Advanced Search

Author Topic: The "How do I make a weapon do that?" thread  (Read 91840 times)

0 Members and 1 Guest are viewing this topic.

September 28, 2013, 03:52:10 PM
Reply #450

Offline TheDoc

  • Standard Member
  • Date Registered: August 31, 2011, 10:37:33 PM

    • View Profile
Re: The "How do I make a weapon do that?" thread
« Reply #450 on: September 28, 2013, 03:52:10 PM »
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 saying
Code: [Select]
A_JumpIf(momx==0,"Death")but it just skipped past it completely and flew backwards into the wall. Shouldn't momx have worked?

September 28, 2013, 04:02:15 PM
Reply #451

Offline tsukiyomaru0

  • MM8BDM Extender
  • *
  • Date Registered: November 07, 2010, 05:01:56 PM

    • View Profile
Re: The "How do I make a weapon do that?" thread
« Reply #451 on: September 28, 2013, 04:02:15 PM »
Quote from: "TheDoc"
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 saying
Code: [Select]
A_JumpIf(momx==0,"Death")but it just skipped past it completely and flew backwards into the wall. Shouldn't momx have worked?
Use A_ScaleVelocity to gradually cause it so slow, then use A_JumpIf(1>momx>-1 && 1>momy>-1 && 1>momz>-1, "death") after or before every frame that scales velocity. Not sure if the jumpif example here works, I'll test later

EDIT: Didn't work. But this one did:
Code: [Select]
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")

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")

September 28, 2013, 09:47:50 PM
Reply #452

Offline TheDoc

  • Standard Member
  • Date Registered: August 31, 2011, 10:37:33 PM

    • View Profile
Re: The "How do I make a weapon do that?" thread
« Reply #452 on: September 28, 2013, 09:47:50 PM »
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 :D . However, sometimes it just stops dead in its tracks and dies. I'm not completely sure why. :?

September 28, 2013, 10:06:40 PM
Reply #453

Offline tsukiyomaru0

  • MM8BDM Extender
  • *
  • Date Registered: November 07, 2010, 05:01:56 PM

    • View Profile
Re: The "How do I make a weapon do that?" thread
« Reply #453 on: September 28, 2013, 10:06:40 PM »
Quote from: "TheDoc"
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 :D . However, sometimes it just stops dead in its tracks and dies. I'm not completely sure why. :?
Change that "<1" to a higher value if you want it to die before it comes to a dead stop. But, well, close enough :D

September 28, 2013, 11:17:58 PM
Reply #454

Offline TheDoc

  • Standard Member
  • Date Registered: August 31, 2011, 10:37:33 PM

    • View Profile
Re: The "How do I make a weapon do that?" thread
« Reply #454 on: September 28, 2013, 11:17:58 PM »
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 timing
FLB2 A 1 A_ScaleVelocity(0.8)
FLB2 A 0 A_JumpIf(momx*momx<1,"NearDeath")
Goto Spawn+1
NearDeath:
FLB2 A 1 A_ChangeVelocity(0,0,0,CVF_REPLACE)
FLB2 A 5
Death:
TNT1 A 0
TNT1 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.

September 29, 2013, 01:26:58 AM
Reply #455

Offline tsukiyomaru0

  • MM8BDM Extender
  • *
  • Date Registered: November 07, 2010, 05:01:56 PM

    • View Profile
Re: The "How do I make a weapon do that?" thread
« Reply #455 on: September 29, 2013, 01:26:58 AM »
Quote from: "TheDoc"
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 timing
FLB2 A 1 A_ScaleVelocity(0.8)
FLB2 A 0 A_JumpIf(momx*momx<1,"NearDeath")
Goto Spawn+1
NearDeath:
FLB2 A 1 A_ChangeVelocity(0,0,0,CVF_REPLACE)
FLB2 A 5
Death:
TNT1 A 0
TNT1 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.
You forgot part of the code I showed you. The "momx*momx*momx<1 && momy*momy<1 && momz*momz<1", means it checks that X², Y² AND Z² speed are lower than 1. If you want it to ignore Z speed, just remove the "&& momz*momz<1" part

September 29, 2013, 12:19:53 PM
Reply #456

Offline TheDoc

  • Standard Member
  • Date Registered: August 31, 2011, 10:37:33 PM

    • View Profile
Re: The "How do I make a weapon do that?" thread
« Reply #456 on: September 29, 2013, 12:19:53 PM »
But why would you need momy? Oh wait,
Quote from: "ZDoom Wiki"
momx — Actor's velocity along the absolute X axis
Ah, makes sense now.

Anyway, it works, so thank you again!

November 01, 2013, 10:37:30 PM
Reply #457

Offline BombHornet

  • Standard Member
  • Date Registered: September 25, 2013, 11:18:23 PM

    • View Profile
Re: The "How do I make a weapon do that?" thread
« Reply #457 on: November 01, 2013, 10:37:30 PM »
I have a few questions. How do I make the Z-Saber for the HUD? And how do I make it slash three times?

November 02, 2013, 02:47:50 AM
Reply #458

Offline Russel

  • MM8BDM Extender

  • Doc Croc
  • **********
  • Date Registered: December 17, 2010, 11:11:25 PM

    • View Profile
Re: The "How do I make a weapon do that?" thread
« Reply #458 on: November 02, 2013, 02:47:50 AM »
The answer to this is to learn DECORATE.
My apologies for the very ambiguous answer, but animation is one of the most basic yet complex things in DECORATE and it is very hard to explain properly.

I suggest you look at the weapon template.

Also, you would need to play the animation three times and fire a projectile three times.
Hope this helped...not sure how it would if you don't want to put in the time to learn...

November 20, 2013, 10:27:39 PM
Reply #459

Offline Senkle

  • Standard Member

  • I'm also known as Light and Kiseki.
  • Date Registered: June 15, 2012, 12:37:57 AM

    • View Profile
Re: The "How do I make a weapon do that?" thread
« Reply #459 on: November 20, 2013, 10:27:39 PM »
Is there a way to make it where an actor/player gets an item/attack/weapon depending on the type of terrain?

November 20, 2013, 10:32:59 PM
Reply #460

Offline Gummywormz

  • Standard Member

  • Air Man Tile Enthusiast
  • Date Registered: December 23, 2010, 01:05:44 AM

    • View Profile
    • Github Page
Re: The "How do I make a weapon do that?" thread
« Reply #460 on: November 20, 2013, 10:32:59 PM »
If it's for when you are in water, just check for whatever the underwater flag is. If you want specific things like sand / grass, you can try an ACS script that's based on checkactorfloortexture. Though if it's animated like lava you may have to check for every individual subtexture rather than the one in animdefs / the animated one.

November 25, 2013, 04:50:36 PM
Reply #461

Offline Davregis

  • Standard Member
  • Date Registered: August 16, 2011, 07:44:46 PM

    • View Profile
Re: The "How do I make a weapon do that?" thread
« Reply #461 on: November 25, 2013, 04:50:36 PM »
How do I make a projectile give the class a flag on crash?

class as in the playerclass

November 25, 2013, 05:25:38 PM
Reply #462

Offline tsukiyomaru0

  • MM8BDM Extender
  • *
  • Date Registered: November 07, 2010, 05:01:56 PM

    • View Profile
Re: The "How do I make a weapon do that?" thread
« Reply #462 on: November 25, 2013, 05:25:38 PM »
Quote from: "Davregis"
How do I make a projectile give the class a flag on crash?

class as in the playerclass
Pain 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.

November 25, 2013, 05:33:33 PM
Reply #463

Offline Davregis

  • Standard Member
  • Date Registered: August 16, 2011, 07:44:46 PM

    • View Profile
Re: The "How do I make a weapon do that?" thread
« Reply #463 on: November 25, 2013, 05:33:33 PM »
Quote from: "tsukiyomaru0"
Quote from: "Davregis"
How do I make a projectile give the class a flag on crash?

class as in the playerclass
Pain 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. and didn't actually work
An exploding projectile with the painstate as you describe works perfectly. Thanks!

November 25, 2013, 05:38:15 PM
Reply #464

Offline tsukiyomaru0

  • MM8BDM Extender
  • *
  • Date Registered: November 07, 2010, 05:01:56 PM

    • View Profile
Re: The "How do I make a weapon do that?" thread
« Reply #464 on: November 25, 2013, 05:38:15 PM »
Quote from: "Davregis"
Quote from: "tsukiyomaru0"
Quote from: "Davregis"
How do I make a projectile give the class a flag on crash?

class as in the playerclass
Pain 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!
Oh, so you meant give a flag to their master? You need CustomInventory instead. Make a CustomInventory that changes the flag on pickup and have the projectile use A_GiveToTarget said item.