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!)
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?
Last edited by Niphura on Wed Feb 06, 2019 8:52 am, edited 1 time in total.
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.
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.
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...
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
}
}
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
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
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.
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.
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