"Parry" mechanic ((Sort of fixed))

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!
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.

"Parry" mechanic ((Sort of fixed))

Postby Niphura » Wed Jan 16, 2019 1:03 am

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 9:52 am, edited 1 time in total.
User avatar
Niphura
 
Joined: 16 Jun 2017
Location: Argentina
Discord: ---

Re: "Parry" mechanic (Help)

Postby Matt » Wed Jan 16, 2019 3:14 am

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 LineTrace check.
User avatar
Matt
Putting the XD into *xdeath since 2007
 
 
 
Joined: 04 Jan 2004
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: "Parry" mechanic (Help)

Postby Niphura » Sun Jan 20, 2019 11:20 pm

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 12:12 pm, edited 3 times in total.
User avatar
Niphura
 
Joined: 16 Jun 2017
Location: Argentina
Discord: ---

Re: "Parry" mechanic (Help)

Postby Matt » Sun Jan 20, 2019 11:42 pm

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...
User avatar
Matt
Putting the XD into *xdeath since 2007
 
 
 
Joined: 04 Jan 2004
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: "Parry" mechanic (Help)

Postby Niphura » Mon Jan 21, 2019 5:31 pm

Should it look something like this? I already test it out but for some reason it doesn't work :?
Code: Select allExpand view
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 allExpand view
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
}
}
User avatar
Niphura
 
Joined: 16 Jun 2017
Location: Argentina
Discord: ---

Re: "Parry" mechanic (Help)

Postby Matt » Mon Jan 21, 2019 7:27 pm

The enemy is never given the "Covered" item.

Who's supposed to be blocking whom here?
User avatar
Matt
Putting the XD into *xdeath since 2007
 
 
 
Joined: 04 Jan 2004
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: "Parry" mechanic (Help)

Postby Niphura » Mon Jan 21, 2019 9:37 pm

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
User avatar
Niphura
 
Joined: 16 Jun 2017
Location: Argentina
Discord: ---

Re: "Parry" mechanic (Help)

Postby Matt » Tue Jan 22, 2019 3:20 am

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:

Code: Select allExpand view
Death:
TNT1 A 0 A_JumpIfInTargetInventory("Covered",1)
stop
TNT1 A 0 A_TakeFromTarget("Covered", 1)
TNT1 A 0 A_GiveInventory("Covered", 1)
stop
User avatar
Matt
Putting the XD into *xdeath since 2007
 
 
 
Joined: 04 Jan 2004
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: "Parry" mechanic (Help)

Postby Niphura » Tue Jan 22, 2019 10:00 am

That would go on the enemy? or in the projectile?
User avatar
Niphura
 
Joined: 16 Jun 2017
Location: Argentina
Discord: ---

Re: "Parry" mechanic (Help)

Postby Matt » Tue Jan 22, 2019 3:07 pm

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)
User avatar
Matt
Putting the XD into *xdeath since 2007
 
 
 
Joined: 04 Jan 2004
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: "Parry" mechanic (Help)

Postby Niphura » Wed Jan 23, 2019 8:29 am

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
User avatar
Niphura
 
Joined: 16 Jun 2017
Location: Argentina
Discord: ---

Re: "Parry" mechanic (Help)

Postby Matt » Wed Jan 23, 2019 11:08 am

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.
User avatar
Matt
Putting the XD into *xdeath since 2007
 
 
 
Joined: 04 Jan 2004
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: "Parry" mechanic (Help)

Postby Matt » Thu Jan 24, 2019 6:14 pm

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.
User avatar
Matt
Putting the XD into *xdeath since 2007
 
 
 
Joined: 04 Jan 2004
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: "Parry" mechanic (Help)

Postby Niphura » Fri Jan 25, 2019 11:39 am

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 :?
User avatar
Niphura
 
Joined: 16 Jun 2017
Location: Argentina
Discord: ---

Re: "Parry" mechanic (Help)

Postby Matt » Fri Jan 25, 2019 12:06 pm

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.
User avatar
Matt
Putting the XD into *xdeath since 2007
 
 
 
Joined: 04 Jan 2004
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Next

Return to Scripting

Who is online

Users browsing this forum: No registered users and 4 guests