Page 1 of 1
Detonate projectiles while in air(SOLVED)
Posted: Sat Jan 04, 2014 3:20 am
by Faad3e_
Is there anyway that a player can detonate a projectile while its in the air with a weapon?
(Example: A projectile is flying, I use the ALTFIRE and the projectile is sent to death state)
RE: Detonate projectiles while in air
Posted: Sat Jan 04, 2014 3:39 am
by Catastrophe
Yeah, look at the ghostbuster traps in GvH
RE: Detonate projectiles while in air
Posted: Sat Jan 04, 2014 3:41 am
by Ivan
Catastrophe wrote:
Yeah, look at the ghostbuster traps in GvH
Or Ragnarok DM, which has an example that works exactly the way OP describes.
RE: Detonate projectiles while in air
Posted: Sat Jan 04, 2014 4:00 am
by Faad3e_
Ivan wrote:
Or Ragnarok DM, which has an example that works exactly the way OP describes.
Alright, i downloaded it, which gun haves the behavior i described?
RE: Detonate projectiles while in air
Posted: Sat Jan 04, 2014 4:15 am
by Ivan
The plasma cannon, found in 3rd or 4th map. Although you might need to define a new key to detonate it, still, it's the same for altfire really. (With enabling A_Weaponready and necessary flags to allow alt fire to pass)
RE: Detonate projectiles while in air
Posted: Sat Jan 04, 2014 4:23 am
by Faad3e_
Ivan wrote:
The plasma cannon, found in 3rd or 4th map. Although you might need to define a new key to detonate it, still, it's the same for altfire really. (With enabling A_Weaponready and necessary flags to allow alt fire to pass)
Alright, thanks a lot sir
RE: Detonate projectiles while in air
Posted: Sat Jan 04, 2014 4:49 am
by Ijon Tichy
It's simple, really. Have the projectile constantly check for an item in the player's inventory. If it's there, jump to a state where it does an A_Stop (to stop in midair), then do some explosion shit and disappear. Alternately, have it call A_Die, which would drop its health to 0 and put it in the Death state, and have the A_Stop there.
This grenade lays on the ground and does not detonate until the player gets the DakkaDetonateGrenades item.
Code: Select all
// This is the inventory item that will be placed in the player's inventory
// to detonate it; give it through whatever method, take it immediately after
actor DakkaDetonateGrenades: Inventory { Inventory.MaxAmount 1 +UNDROPPABLE }
// The grenade itself
actor DakkaRemoteGrenade
{
// irrelevant
States
{
Spawn:
SGRN A 1 bright
SGRN A 0 A_JumpIfInTargetInventory("DakkaDetonateGrenades", 1, "Detonate")
loop
Detonate:
SGRN A 0 A_Die
goto Death2 // should never be reached
Death:
SGRN A 0 A_Stop
SGRN A 0 A_ChangeFlag("NOGRAVITY", 1)
SGRN A 0 A_JumpIfInTargetInventory("DakkaDetonateGrenades", 1, "Death2")
goto OnGround
OnGround:
SGRN A 1 bright
loop
Death2:
SGRN A 0 A_Stop
SGRN A 0 A_ChangeFlag("NOGRAVITY", 1)
MISL B 0 A_SetTranslucent(1, 1)
MISL B 0 bright A_PlaySound("dakka/explode")
MISL B 0 bright A_Explode(96, 144, 0)
MISL B 0 bright A_Explode(64, 144)
MISL B 8 bright
MISL C 6 bright
MISL D 4 bright
stop
}
}
RE: Detonate projectiles while in air
Posted: Sat Jan 04, 2014 5:26 am
by Faad3e_
Ijon Tichy wrote:
It's simple, really. Have the projectile constantly check for an item in the player's inventory. If it's there, jump to a state where it does an A_Stop (to stop in midair), then do some explosion shit and disappear. Alternately, have it call A_Die, which would drop its health to 0 and put it in the Death state, and have the A_Stop there.
This grenade lays on the ground and does not detonate until the player gets the DakkaDetonateGrenades item.
Code: Select all
// This is the inventory item that will be placed in the player's inventory
// to detonate it; give it through whatever method, take it immediately after
actor DakkaDetonateGrenades: Inventory { Inventory.MaxAmount 1 +UNDROPPABLE }
// The grenade itself
actor DakkaRemoteGrenade
{
// irrelevant
States
{
Spawn:
SGRN A 1 bright
SGRN A 0 A_JumpIfInTargetInventory("DakkaDetonateGrenades", 1, "Detonate")
loop
Detonate:
SGRN A 0 A_Die
goto Death2 // should never be reached
Death:
SGRN A 0 A_Stop
SGRN A 0 A_ChangeFlag("NOGRAVITY", 1)
SGRN A 0 A_JumpIfInTargetInventory("DakkaDetonateGrenades", 1, "Death2")
goto OnGround
OnGround:
SGRN A 1 bright
loop
Death2:
SGRN A 0 A_Stop
SGRN A 0 A_ChangeFlag("NOGRAVITY", 1)
MISL B 0 A_SetTranslucent(1, 1)
MISL B 0 bright A_PlaySound("dakka/explode")
MISL B 0 bright A_Explode(96, 144, 0)
MISL B 0 bright A_Explode(64, 144)
MISL B 8 bright
MISL C 6 bright
MISL D 4 bright
stop
}
}
whoa, you made it so simple, thanks even more sir!
guess im just too dumb at this :(
EDIT: one question, projectiles always take as target the thing that shot them?
RE: Detonate projectiles while in air
Posted: Sat Jan 04, 2014 5:58 am
by Ijon Tichy
Yeah, a projectile's target is its firer. Change the target of the projectile, that target is now considered the firer. Kinda backwards, but welcome to hacks.