"Parry" mechanic ((Sort of fixed))
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!)
"Parry" mechanic ((Sort of fixed))
I want to create a sort of a parry mechanic (like in dark souls)
I had the idea that when the player is covering himself, the enemy impact on the shield gives a item to the enemy and it goes to a certain state but...how can i detect when the enemy hits the shield? has this been done in a mod? Is there an example? Could you help me?
I had the idea that when the player is covering himself, the enemy impact on the shield gives a item to the enemy and it goes to a certain state but...how can i detect when the enemy hits the shield? has this been done in a mod? Is there an example? Could you help me?
Last edited by Niphura on Wed Feb 06, 2019 8:52 am, edited 1 time in total.
- Matt
- Posts: 9696
- Joined: Sun Jan 04, 2004 5:37 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Debian Bullseye
- Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
- Contact:
Re: "Parry" mechanic (Help)
This is definitely doable even without ZScript.
Without ZS, the attack would be in the form of a missile that has +hittracer, and the shield would have a specific inventory item that no other object would normally have.
On the missile's impact, it would check to see if its tracer has that item, then give another item to its target; if this is not the case, then it would call A_TakeFromTarget to make sure its target does not have that item.
Right after that happens, the missile's target (i.e. the attacker) would check to see if it is in possession of that item. If it is, then it goes to its "blocked attack" state.
With ZS, the same principles apply, except you can replace the inventory item with an "is" check, and the missile might be ditched in favour of a [wiki]LineTrace[/wiki] check.
Without ZS, the attack would be in the form of a missile that has +hittracer, and the shield would have a specific inventory item that no other object would normally have.
On the missile's impact, it would check to see if its tracer has that item, then give another item to its target; if this is not the case, then it would call A_TakeFromTarget to make sure its target does not have that item.
Right after that happens, the missile's target (i.e. the attacker) would check to see if it is in possession of that item. If it is, then it goes to its "blocked attack" state.
With ZS, the same principles apply, except you can replace the inventory item with an "is" check, and the missile might be ditched in favour of a [wiki]LineTrace[/wiki] check.
Re: "Parry" mechanic (Help)
I don't understand how that last tracer part works (i got a little bit confused with the giveinventoryitem, the takefromtarget and with the +hittracer flag) i've never done it before so that's why i asked for help.
Last edited by Niphura on Mon Jan 21, 2019 11:12 am, edited 3 times in total.
- Matt
- Posts: 9696
- Joined: Sun Jan 04, 2004 5:37 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Debian Bullseye
- Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
- Contact:
Re: "Parry" mechanic (Help)
Every actor has a "target", "tracer" and "master" pointer.
For projectiles, the "target" tracer is actually the actor that fired it.
The "tracer" pointer is unused if the projectile is not a seeker missile.
The +hittracer flag means that, if a projectile hits something, that thing becomes its "tracer" from that moment onwards.
All this lets you get and store the information as to:
1. Who the projectile belongs to
2. What the projectile has hit
This can be used to have the projectile provide feedback to its owner (by means of A_GiveToTarget or any other Decorate action function that interacts with the "target" in any way), based on whatever information can be gleaned using the "tracer"-related action functions.
For all this to work against "melee attacks", however, it might be better to go straight to ZScript...
For projectiles, the "target" tracer is actually the actor that fired it.
The "tracer" pointer is unused if the projectile is not a seeker missile.
The +hittracer flag means that, if a projectile hits something, that thing becomes its "tracer" from that moment onwards.
All this lets you get and store the information as to:
1. Who the projectile belongs to
2. What the projectile has hit
This can be used to have the projectile provide feedback to its owner (by means of A_GiveToTarget or any other Decorate action function that interacts with the "target" in any way), based on whatever information can be gleaned using the "tracer"-related action functions.
For all this to work against "melee attacks", however, it might be better to go straight to ZScript...
Re: "Parry" mechanic (Help)
Should it look something like this? I already test it out but for some reason it doesn't work
Code: Select all
ACTOR Axe n' Shield : Weapon 12345
{
+WEAPON.MELEEWEAPON
+WEAPON.NOALERT
Tag "Axe"
States
{
Spawn:
AXEP A -1
Stop
Select:
AXEG AAAAAAAAAA 0 A_Raise
TNT1 A 6
AXEG EDCBA 2
Goto Ready
Deselect:
AXEG ABCDE 2
TNT1 A 6
AXEG A 0 A_Lower
Wait
Ready:
AXEG A 1 A_WeaponReady
loop
Preready:
TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
TNT1 A 0 A_ChangeFlag("NODAMAGE", 0)
goto Ready
Fire:
AXEG ABCDE 3
TNT1 A 4
AXEG I 2 A_PlaySound("weapons/axeswing", CHAN_WEAPON)
AXEG A 0 A_JumpIfInventory("PowerStrength", 1, "ToughFire")
AXEG J 2 A_CustomPunch(20+random(4, 16), 1, 0, "AxeHitPuff")
AXEG K 2
TNT1 A 4
AXEG EDCBA 2
AXEG A 6
Goto Ready
ToughFire:
AXEG J 2 A_CustomPunch(60+random(4, 16), 1, 0, "AxeHitPuff")
Goto Fire+9
AltFire:
TNT1 A 0
W01D ABC 1
AltHold:
TNT1 A 0
TNT1 A 0 A_GiveInventory ("Covered", 1) //"Covered" in this case is the item that only the shield has //
W01D D 1 A_ChangeFlag("NOPAIN", 1)
W01D D 1 A_ChangeFlag("NODAMAGE", 1)
W01D D 1 A_Refire
W01D DDCBA 1 A_WeaponReady
Goto Preready
}
}
Actor Covered : Inventory //Here is defined //
{
inventory.maxamount 1
}
Code: Select all
Actor Enemy 18989
{
Health 300
Radius 20
Height 56
Mass 500
Speed 8
PainChance 100
MeleeDamage 4
+DONTHURTSPECIES
MONSTER
+FLOORCLIP
States
{
Spawn:
AGUR AB 10 A_Look
loop
See:
AGUR AABBCCDD 3 A_Chase
TNT1 A 0 A_JumpIfInventory("Covered", 1, "ConstantPain") //if the monster have the item of the shield it should jump to a "stunned" state in this case "Constant Pain"//
loop
Melee:
AGUR W 8 A_FaceTarget
AGUR X 1 A_PlaySound("agaures/swing")
AGUR X 7 A_FaceTarget
AGUR Y 6 A_MeleeAttack
TNT1 A 0 A_CustomMissile("CheckForItem") //When the projectile dies it steals the item "covered" from the player (when he is covering with the shield)//
goto See
ConstantPain: //The stunned state//
AGUR H 2 A_Pain
AGUR H 2 A_Pain
AGUR H 2 A_Pain
AGUR H 2 A_Pain
AGUR H 2 A_Pain
AGUR H 2 A_Pain
goto See
Pain:
AGUR H 2
AGUR H 2 A_Pain
goto See
Death:
AGUR I 8
AGUR J 8 A_Scream
AGUR KL 6
AGUR M 6 A_NoBlocking
AGUR N -1
stop
}
}
Actor CheckForItem //The projectile that steals the player's item//
{
Speed 80
Projectile
+HITTRACER
states
{
Spawn:
TNT1 A 1
Stop
Death:
TNT1 A 0 A_TakeFromTarget("Covered", 1)
Stop
Crash:
XDeath:
TNT1 A 0
Stop
}
}
- Matt
- Posts: 9696
- Joined: Sun Jan 04, 2004 5:37 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Debian Bullseye
- Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
- Contact:
Re: "Parry" mechanic (Help)
The enemy is never given the "Covered" item.
Who's supposed to be blocking whom here?
Who's supposed to be blocking whom here?
Re: "Parry" mechanic (Help)
Why is not giving the item? The player is the one blocking the attack, when he enters the altfirehold state it gives to the player the item that the enemy steals when it attacks, once the enemy has that item it sends him to a stunned state...or at least that's what i wanted to do
- Matt
- Posts: 9696
- Joined: Sun Jan 04, 2004 5:37 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Debian Bullseye
- Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
- Contact:
Re: "Parry" mechanic (Help)
A_TakeInventory doesn't literally take anything, it just deletes the given number of the item from the affected owner's inventory.
See if this works:
See if this works:
Code: Select all
Death:
TNT1 A 0 A_JumpIfInTargetInventory("Covered",1)
stop
TNT1 A 0 A_TakeFromTarget("Covered", 1)
TNT1 A 0 A_GiveInventory("Covered", 1)
stop
Re: "Parry" mechanic (Help)
That would go on the enemy? or in the projectile?
- Matt
- Posts: 9696
- Joined: Sun Jan 04, 2004 5:37 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Debian Bullseye
- Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
- Contact:
Re: "Parry" mechanic (Help)
As a replacement for the projectile's current death state... I thought it was obvious from the imitation of the formatting
(you might want to fix that, by the way, with proper tabs the way things are structured becomes much more obvious)
(you might want to fix that, by the way, with proper tabs the way things are structured becomes much more obvious)
Re: "Parry" mechanic (Help)
Does the method that i explained works?: make the enemy launch a missile when he attacks to check if the player received the item when covering, and if he has it the enemy steals it from the player and then the enemy goes to another state. I changed the things on the projectile that you said, but it keeps not working, look i don't have much experience on decorate, just the basics on how to do enemies and weapons work that's why i asked for help
- Matt
- Posts: 9696
- Joined: Sun Jan 04, 2004 5:37 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Debian Bullseye
- Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
- Contact:
Re: "Parry" mechanic (Help)
Now that I look at it the projectile might not be hitting at all.
Sorry, there are just so many things that could be wrong here that it would take literally a year of familiarization with how Doom actors work that I could even explain it.
Sorry, there are just so many things that could be wrong here that it would take literally a year of familiarization with how Doom actors work that I could even explain it.
- Matt
- Posts: 9696
- Joined: Sun Jan 04, 2004 5:37 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Debian Bullseye
- Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
- Contact:
Re: "Parry" mechanic (Help)
I feel bad about ending like that, so here's a thought:
1.
short-range rapid-fire projectile fired by player
does no real damage
+shootable, -solid, -noblockmap and +noblood flags
2.
somewhat less short-range projectile fired by monster
does the monster's melee damage
if it hits a bleeding actor, does nothing more than a usual projectile
if it hits a non-bleeding actor or wall, call A_DamageTarget to make it hopefully go into a painstate
If that works, then go back and adjust (changing the A_DamageTarget to a giving of inventory item and having the monster check for it after the time it should have been given, etc.) as desired.
1.
short-range rapid-fire projectile fired by player
does no real damage
+shootable, -solid, -noblockmap and +noblood flags
2.
somewhat less short-range projectile fired by monster
does the monster's melee damage
if it hits a bleeding actor, does nothing more than a usual projectile
if it hits a non-bleeding actor or wall, call A_DamageTarget to make it hopefully go into a painstate
If that works, then go back and adjust (changing the A_DamageTarget to a giving of inventory item and having the monster check for it after the time it should have been given, etc.) as desired.
Re: "Parry" mechanic (Help)
Do you know if the flag Hitowner works? i've tried to apply it on the projectile but it doesn't appear to work...or doesn't appear on purple like other flags
- Matt
- Posts: 9696
- Joined: Sun Jan 04, 2004 5:37 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Debian Bullseye
- Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
- Contact:
Re: "Parry" mechanic (Help)
I cannot imagine why you would need +hitowner for any of this. All it would do is let a projectile explode upon hitting the actor that shot it.
I have no idea what "appear on purple" means.
I have no idea what "appear on purple" means.