Freezing projectiles
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
-
camaxide
- Posts: 388
- Joined: Thu Jun 11, 2015 8:38 am
Freezing projectiles
So, I'd like to make some freezing projectiles, which would slow down those hit by it, and also make the view of the player (if a player is hit) blue for the same amount of time that he is slowed down.
How can I best go into this?
I've been thinking that the best way might be to make the projectile give the hit target a powerup, and have that powerup as stackable, meaning that a player hit multiple times will be slowed down for a longer time. and a powerup also is easy to give a tint color too, though not sure if I can disable the flashing at the end, and I mean to have only a 1-2 second time on it. - not sure if its doable though to make a projectile hit give the hit target a powerup - or if monsters can have a powerup-effect..
Second way would be through SetActorProperty script, though how to make that activated by a projectile hit.. and to make it activate on the hit target rather than the monster shooting the projectile?
third way I can think off would be through A_ScaleVelocity, but like the above I'm not sure how to give that to the player rather than the projectile or monster shooting it.. - and then also if it could be stackable, how to define the time for it or to give a blue tint..
I hope someone can push me in the right direction here - as I'm not sure if this is even possible, or which way that best could do this, if possible.
How can I best go into this?
I've been thinking that the best way might be to make the projectile give the hit target a powerup, and have that powerup as stackable, meaning that a player hit multiple times will be slowed down for a longer time. and a powerup also is easy to give a tint color too, though not sure if I can disable the flashing at the end, and I mean to have only a 1-2 second time on it. - not sure if its doable though to make a projectile hit give the hit target a powerup - or if monsters can have a powerup-effect..
Second way would be through SetActorProperty script, though how to make that activated by a projectile hit.. and to make it activate on the hit target rather than the monster shooting the projectile?
third way I can think off would be through A_ScaleVelocity, but like the above I'm not sure how to give that to the player rather than the projectile or monster shooting it.. - and then also if it could be stackable, how to define the time for it or to give a blue tint..
I hope someone can push me in the right direction here - as I'm not sure if this is even possible, or which way that best could do this, if possible.
-
Blue Shadow
- Posts: 5046
- Joined: Sun Nov 14, 2010 12:59 am
Re: Freezing projectiles
Tip: If one of the [wiki=Actor_flags#HITTARGET]HIT* flags[/wiki] is used on a projectile, the hit actor becomes the target, master, or tracer of said projectile.
-
camaxide
- Posts: 388
- Joined: Thu Jun 11, 2015 8:38 am
Re: Freezing projectiles
Thanks, that should open up some possibilities
I'll play around with that shortly 
Got it working, now giving things to actor when hit, rest is to make the powerup which I expect to be a breeze. thanks a lot for the input
Got it working, now giving things to actor when hit, rest is to make the powerup which I expect to be a breeze. thanks a lot for the input
-
Blue Shadow
- Posts: 5046
- Joined: Sun Nov 14, 2010 12:59 am
Re: Freezing projectiles
You're welcome.
If you're going to use PowerSpeed (which I assume you are), you should know that it has no effect on monsters, only the player.camaxide wrote:rest is to make the powerup which I expect to be a breeze.
-
camaxide
- Posts: 388
- Joined: Thu Jun 11, 2015 8:38 am
Re: Freezing projectiles
Yeah, I think powerup's in general can only be given to the player - but the powerup makes it easy to add the screen-tint in combo with the speed-fx.
I guess there might be some more delicate script-ways to go into giving something if target is a player, and to use a different code if the target is a monster..
I just got all the code and function up and running how I wanted it now. - feel free to tell if there is some not overly complicated way to make the effect also apply to monsters.
ps: Inventory.PickupSound only applies if the object is actually picked up, and not if it's given through command? - I wanted also to add a 'freeze' sound to the effect (not when it hits a wall) , but it seem not to play
I guess there might be some more delicate script-ways to go into giving something if target is a player, and to use a different code if the target is a monster..
I just got all the code and function up and running how I wanted it now. - feel free to tell if there is some not overly complicated way to make the effect also apply to monsters.
ps: Inventory.PickupSound only applies if the object is actually picked up, and not if it's given through command? - I wanted also to add a 'freeze' sound to the effect (not when it hits a wall) , but it seem not to play
-
Blue Shadow
- Posts: 5046
- Joined: Sun Nov 14, 2010 12:59 am
Re: Freezing projectiles
It's not all powerups, some of them do work on monsters, like PowerDamage and PowerProtection.camaxide wrote:Yeah, I think powerup's in general can only be given to the player
Could you post what you have from code so far? I need to see how you're setting things up before I offer any solution.ps: Inventory.PickupSound only applies if the object is actually picked up, and not if it's given through command? - I wanted also to add a 'freeze' sound to the effect (not when it hits a wall) , but it seem not to play
-
camaxide
- Posts: 388
- Joined: Thu Jun 11, 2015 8:38 am
Re: Freezing projectiles
This is the current code for slowing down the player depending on the strength of the attack - it works very well as is (but only on player I assume)
For the projectile I've added this as the first line of the death sequence: TNT1 A 0 A_GiveToTarget("SmallFreeze", 1, AAPTR_DEFAULT)
and that triggers the freeze-effect just fine.
I'd like the freeze effects blue tint to not flash though, but I think I asked that in a different post earlier for another use, and think it can't be done as it's hard-coded.. it might be possible when/if that function is going over to zscript sometime
Spoiler:The pickupsound does not trigger however, I might have to trigger a sound from the projectile hitting the player but not sure how to make that only happen for the player being hit.. I don't want that sound to be played whenever a wall is hit etc.
For the projectile I've added this as the first line of the death sequence: TNT1 A 0 A_GiveToTarget("SmallFreeze", 1, AAPTR_DEFAULT)
and that triggers the freeze-effect just fine.
I'd like the freeze effects blue tint to not flash though, but I think I asked that in a different post earlier for another use, and think it can't be done as it's hard-coded.. it might be possible when/if that function is going over to zscript sometime
-
Blue Shadow
- Posts: 5046
- Joined: Sun Nov 14, 2010 12:59 am
Re: Freezing projectiles
Instead of giving the powerup directly, give a CustomInventory which acts as a medium:
Code: Select all
actor SmallFreezeGiver : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_GiveInventory("SmallFreeze")
TNT1 A 0 A_PlaySound("BDFROZEN")
Stop
}
}Set the [wiki=Inventory_flags#INVENTORY.NOSCREENBLINK]INVENTORY.NOSCREENBLINK[/wiki] flag on the Powerup actor (not the PowerupGiver).camaxide wrote:I'd like the freeze effects blue tint to not flash though
-
camaxide
- Posts: 388
- Joined: Thu Jun 11, 2015 8:38 am
Re: Freezing projectiles
Hm, strange enough that causes all the projectiles to play the BDFROZEN sound when they die, even if they die against a wall.
is there a way to only play the sound for the target the missile die against? I already use the +HITTARGET flag on the projectiles to ensure they give the item to the target it dies against.
Also the +INVENTORY.NOSCREENBLINK does not turn blue in slade3 as they use to, and it does not seem to work in game
is there a way to only play the sound for the target the missile die against? I already use the +HITTARGET flag on the projectiles to ensure they give the item to the target it dies against.
Also the +INVENTORY.NOSCREENBLINK does not turn blue in slade3 as they use to, and it does not seem to work in game
-
Blue Shadow
- Posts: 5046
- Joined: Sun Nov 14, 2010 12:59 am
Re: Freezing projectiles
To rule it out, what version of GZDoom are you using?
-
Blue Shadow
- Posts: 5046
- Joined: Sun Nov 14, 2010 12:59 am
Re: Freezing projectiles
I did a bit of research. When a projectile hits a non-actor, its target/master/tracer fields aren't changed, even if it has those HIT flags. The thing is, projectiles already use their target field to keep track of the actor that shot them. So when a projectile hits a wall, its shooter will get the item, in this case, as the target field didn't change upon impact.
To solve this, it's better to use HITMASTER instead, and give the item to the master (AAPTR_MASTER). Projectiles don't use the master field by default for anything.
After getting the powerup, the screen blend disappears without blinking after two seconds.
To solve this, it's better to use HITMASTER instead, and give the item to the master (AAPTR_MASTER). Projectiles don't use the master field by default for anything.
The syntax highlighter for DECORATE in SLADE is outdated. As for the flag not working in the game, you're probably doing something wrong, because it works for me. This is the code I tested:camaxide wrote:Also the +INVENTORY.NOSCREENBLINK does not turn blue in slade3 as they use to, and it does not seem to work in game
Code: Select all
actor PowerFreeze1 : PowerSpeed
{
Speed 0.7
+INVENTORY.NOSCREENBLINK
}
actor SmallFreeze : Powerupgiver
{
Powerup.Type PowerFreeze1
Powerup.Duration -2
powerup.color "60 70 FF", 0.2
+INVENTORY.AUTOACTIVATE
+INVENTORY.ALWAYSPICKUP
} -
camaxide
- Posts: 388
- Joined: Thu Jun 11, 2015 8:38 am
Re: Freezing projectiles
I'm not sure why, as reading about those two triggers should do exactly as you say - but when I change HitTarget with HitMaster, and AAPTR_DEFAULT with AAPTR_MASTER the attack no longer gives the player the effect.. - the missing projectiles also makes no sound though.Blue Shadow wrote:To solve this, it's better to use HITMASTER instead, and give the item to the master (AAPTR_MASTER). Projectiles don't use the master field by default for anything.
That's because I did exactly what you told me not to, I gave it to the powergiver rather than the power - I miss-read itBlue Shadow wrote:After getting the powerup, the screen blend disappears without blinking after two seconds.
-
camaxide
- Posts: 388
- Joined: Thu Jun 11, 2015 8:38 am
Re: Freezing projectiles
AAPTR_DEFAULT — The calling actor's target (default value).
AAPTR_MASTER — The master of the calling actor's target, if any.
I guess this is where the problem is - to work it should say 'The calling actor's master' - as that's how its set with the +HitMaster
Since to make HitTarget to work I can't use AAPTR_TARGET, but Default, which states the "opposite" (The target of the calling actor's target) as opposed to Default's (The calling actor's target)
AAPTR_MASTER — The master of the calling actor's target, if any.
I guess this is where the problem is - to work it should say 'The calling actor's master' - as that's how its set with the +HitMaster
Since to make HitTarget to work I can't use AAPTR_TARGET, but Default, which states the "opposite" (The target of the calling actor's target) as opposed to Default's (The calling actor's target)
-
Blue Shadow
- Posts: 5046
- Joined: Sun Nov 14, 2010 12:59 am
Re: Freezing projectiles
Switch to using [wiki]A_GiveInventory[/wiki] instead of A_GiveToTarget.