Pretty much what it says on the tin. I'm working on a multiplayer mod of sorts and one of the weapons I've added is supposed to be a knife that shocks targets for a moment upon impact. Problem is, I have no earthly idea how to make the stun effect happen.
Ideally, I'd like the stun to happen once the CustomMelee attack connects with the enemy, causing them to stop in their feet for a few tics to give the player some breathing room or time to pull out a stronger gun. As I understand it, this would be accomplished via a custom puff, but I for the life of me cannot figure this out. I've tried various methods to spawn some kinda projectile that hugs around a target to cause pain, but nothing I've tried works out.
Here's the code I currently have written for the weapon:
[code]actor ScoutKnife : Weapon
{
+Weapon.MeleeWeapon
+Weapon.NoAlert
+Inventory.Untossable
+Inventory.Undroppable
Inventory.RestrictedTo "HawkeScout"
+INVENTORY.QUIET
DamageType "Electric"
Inventory.PickupMessage "You got the Taser Knife!"
Obituary "%o was quite shocked to find %k had a Taser Knife."
States
{
Spawn:
SCKW A -1
Loop
Ready:
SCKN A 1 A_WeaponReady
Loop
Deselect:
SCKN A 0 A_Lower
SCKN A 1 A_Lower
Loop
Select:
SCKN A 0 A_Raise
SCKN A 1 A_Raise
Loop
Fire:
SCKN G 1
SCKN B 1
SCKN H 0 A_PlaySound("weapons/scoutknifeswing")
SCKN H 2 A_CustomPunch(10,0,0,"ScoutKnifePuff")
SCKN I 1
SCKN C 2
SCKN J 1
SCKN F 2
SCKN O 2
SCKN N 2
SCKN M 1
SCKN A 2 A_ReFire
Goto Ready
}
}
actor ScoutKnifePuff
{
+NOEXTREMEDEATH
+NOBLOCKMAP
+NOEXTREMEDEATH
+PUFFONACTORS
+FORCEPAIN
+NOGRAVITY
+HITTRACER
+RIPPER
RenderStyle Translucent
Alpha 0.6
Speed 1
Damage 0
VSpeed 1
States
{
Spawn:
SCSH ABCDEFGHIJ 1 A_CustomMissile ("ScoutShocker",0)
Stop
Crash:
SCSH ABCDEFGHIJ 1 A_CustomMissile ("ScoutShocker",0)
Stop
}
}
actor ScoutShocker
{
Radius 4
Height 4
Speed 10
Damage 0
RenderStyle ADD
Alpha 0.6
Projectile
+NOGRAVITY
+SOLID
+NOEXTREMEDEATH
+FORCEPAIN
+RIPPER
States
{
Spawn:
SCSH ABCDEFGHIJ 1 Bright
Stop
}
}
[/code]
DECORATE: Help With Create a Stunning Melee Attack
Moderator: GZDoom Developers
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Re: DECORATE: Help With Create a Stunning Melee Attack
You could try using A_Warp to place the puff at the monster's position as it spawns the stun actor.
This is what I did for such attacks:
This is what I did for such attacks:
Spoiler:
-
- Posts: 280
- Joined: Sat Jan 27, 2018 9:12 pm
- Graphics Processor: nVidia (Modern GZDoom)
- Location: The Deepest Reaches of Space
- Contact:
Re: DECORATE: Help With Create a Stunning Melee Attack
So I wound up basically just copying and pasting your code into the mod and made changes where necessary to fit it with the actors I need. Thing is, since I'm building this with Zandronum in mind, it doesn't seem to recognize A_SpawnProjectile. I'm blaming that on the fact that Zandy is on a much outdated version of GZDoom. Changing it to A_CustomMissile, which does work with Zandronum, does fix that issue.
I also had to add some code in front of the missile and warp lines, as otherwise Zandy would not launch since the actions don't have associated sprites to go with them.
Now that it is set to A_CustomMissile and not SpawnProjectile, I've run into another issue, and that's the fact that it won't launch with AAPTR_TRACER written in the A_CustomMissile code, gives me this error:
Execution could not continue.
Script error, "WIPClassMod.wad:GUNS" line 1104:
Expected ')', got ','.
It launches and kinda works in GZDoom (For a reason I don't yet understand it just causes pain twice - once when I attack a monster, and once before the puff disappears) but for Zandy, what the mod is built for, it does not work.
Out of curiosity, I decided to remove AAPTR_TRACER knowing full well that it likely wouldn't work without it, and to nobody's surprise, it ain't working. The puff appears and animates, but it doesn't stick to the enemy nor does it do any stunning. Not a clue how to proceed from here.
I also had to add some code in front of the missile and warp lines, as otherwise Zandy would not launch since the actions don't have associated sprites to go with them.
Now that it is set to A_CustomMissile and not SpawnProjectile, I've run into another issue, and that's the fact that it won't launch with AAPTR_TRACER written in the A_CustomMissile code, gives me this error:
Execution could not continue.
Script error, "WIPClassMod.wad:GUNS" line 1104:
Expected ')', got ','.
It launches and kinda works in GZDoom (For a reason I don't yet understand it just causes pain twice - once when I attack a monster, and once before the puff disappears) but for Zandy, what the mod is built for, it does not work.
Out of curiosity, I decided to remove AAPTR_TRACER knowing full well that it likely wouldn't work without it, and to nobody's surprise, it ain't working. The puff appears and animates, but it doesn't stick to the enemy nor does it do any stunning. Not a clue how to proceed from here.