A_JumpIf MeleeRange possible ? (Melee Weapon)

Ask about editing graphics, sounds, models, music, etc here!
Shaders (GLSL) and SNDINFO questions also go here!

Moderators: GZDoom Developers, Raze 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.

A_JumpIf MeleeRange possible ? (Melee Weapon)

Postby Narset » Tue Apr 21, 2020 8:49 pm

Hello,

With the function "A_JumpIf" or another jumps functions, jump X lines if a shootable thing is in the MeleeRange (128 in my CustomPunch)

Anyone have any idea how to do that ? (Decorate code)
Narset
 
Joined: 21 Apr 2020

Re: A_JumpIf MeleeRange possible ? (Melee Weapon)

Postby Jarewill » Wed Apr 22, 2020 1:39 am

You could fire a hitscan attack with a limited range that gives a dummy item if it hits an enemy and then add a jump into your weapon.
Something like this:

Spoiler:

Edit: Nevermind that above, A_JumpIfCloser is a better solution.
Jarewill
 
 
 
Joined: 21 Jul 2019

Re: A_JumpIf MeleeRange possible ? (Melee Weapon)

Postby Narset » Wed Apr 22, 2020 7:04 am

That's what i did first,

Problem : The value of the Closer range is slightly different from the value of the CustomPunch
-> The value of the closer is smaller than the value of the CustomPunch, the Closer also varies depending on the Hitbox's thing (The Radius)

Here is the code :

Code: Select allExpand view
   Fire:
      FPCH B 4 Offset (5, 40)
      FPCH C 4 Offset (5, 40)
      FPCH D 0 A_JumpIfCloser(128, "Fist1")
      FPCH D 4 Offset (5, 40) A_CustomPunch(random(0, 0), 1, 0, "GauntletPuff", 128)
      FPCH C 4 Offset (5, 40) A_TakeInventory("FistCheck", 2)
      FPCH B 4 Offset (5, 40) A_ReFire
      Goto Ready
   Fist1:
      FPCH D 0 A_JumpIfInventory("FistCheck", 2, "Fist2")
      FPCH D 4 Offset (5, 40) A_CustomPunch(random(40, 55), 1, 0, "GauntletPuff", 128)
      FPCH C 4 Offset (5, 40) A_GiveInventory("FistCheck", 1)
      FPCH B 4 Offset (5, 40) A_ReFire
      Goto Ready
   Fist2:
      FPCH D 0 A_PlaySound ("*fistgrunt", CHAN_VOICE)
      FPCH D 0 A_CustomPunch(random(80, 110), 1, 0, "GauntletPuff", 128)
      FPCH DE 4 Offset (5, 40) A_TakeInventory("FistCheck", 2)
      FPCH E 1 Offset (15, 50)
      FPCH E 1 Offset (25, 60)
      FPCH E 1 Offset (35, 70)
      FPCH E 1 Offset (45, 80)
      FPCH E 1 Offset (55, 90)
      FPCH E 1 Offset (65, 90)
      FPCH E 10 Offset (0, 150)
      Goto Ready


ACTOR FistCheck : Inventory
{
   Inventory.Amount 1
   Inventory.MaxAmount 2
}


In that case, I can be far enough away to touch the Thing without jumping with the "A_JumpIfCloser"
And i can't change the value of the Closer to make it equivalent, since it also depends on the Hitbox of the targeted thing...

Thx for the answer above, it can help me, and i will give you my results !
Narset
 
Joined: 21 Apr 2020

Re: A_JumpIf MeleeRange possible ? (Melee Weapon)

Postby Narset » Wed Apr 22, 2020 10:19 am

I kept looking, we can actually use other functions like "radius+128" : A_JumpIfCloser(radius+128, "Fist1"), but the problem persists.

If anyone possibly knows what I can put in to take into account the target's radius, that could be the solution
Narset
 
Joined: 21 Apr 2020

Re: A_JumpIf MeleeRange possible ? (Melee Weapon)

Postby neoworm » Thu Apr 23, 2020 6:19 am

Look at what HeXen weapons are using - Mage's frost spell and cleric's Serpent staff.
User avatar
neoworm
 
Joined: 23 Sep 2005
Location: Czech Republic

Re: A_JumpIf MeleeRange possible ? (Melee Weapon)

Postby Lagi » Fri May 01, 2020 2:54 pm

neoworm wrote:Look at what HeXen weapons are using - Mage's frost spell and cleric's Serpent staff.

that would be a very good advice, if the wiki dont look like below "school essay", but provide an actual code you could copy paste modify
https://zdoom.org/wiki/A_FireConePL1
https://zdoom.org/wiki/A_CStaffCheck
User avatar
Lagi
 
Joined: 23 Jun 2018
Location: Thou shalt alter thy beliefs with new evidence

Re: A_JumpIf MeleeRange possible ? (Melee Weapon)

Postby Snarboo » Sun May 03, 2020 11:54 am

A_JumpIfTargetInLOS might also work for melee weapons. You can even set the distance to be checked for, and how it behaves at close range.
User avatar
Snarboo
Bacon doesn't know it's not dogs
 
Joined: 29 Nov 2005

Re: A_JumpIf MeleeRange possible ? (Melee Weapon)

Postby Narset » Tue May 19, 2020 11:22 am

The problem, they have specific functions for the actor, and cannot be modified

This is how i did it :

Code: Select allExpand view
----------
   Fire:
      FPCH B 4 Offset (5, 40)
      FPCH C 4 Offset (5, 40)
      FPCH D 1 Offset (5, 40) A_CustomPunch(0, 1, 0, "GauntletsPuff", 90)
      FPCH D 3 Offset (5, 40) A_JumpIfInventory("Punch1Check", 1, "Punch1")
      FPCH C 4 Offset (5, 40) A_TakeInventory("Punch2Check", 2)
      FPCH B 4 Offset (5, 40) A_ReFire
      Goto Ready
   Punch1:
      FPCH D 0 Offset (5, 40) A_JumpIfInventory("Punch2Check", 2, "Punch2")
      FPCH D 3 Offset (5, 40) A_CustomPunch(random(40, 55), 1, 0, "PunchPuffX", 110)
      FPCH C 4 Offset (5, 40) A_TakeInventory("Punch1Check", 1)
      FPCH B 4 Offset (5, 40) A_ReFire
      Goto Ready
   Punch2:
      FPCH D 0 A_PlaySound("*fistgrunt", CHAN_VOICE)
      FPCH D 0 A_CustomPunch(random(80, 110), 1, 0, 0, 110)
      FPCH D 3 Offset (5, 40) A_TakeInventory("Punch2Check", 2)
      FPCH E 4 Offset (5, 40)
      FPCH E 1 Offset (15, 50)
      FPCH E 1 Offset (25, 60)
      FPCH E 1 Offset (35, 70)
      FPCH E 1 Offset (45, 80)
      FPCH E 1 Offset (55, 90)
      FPCH E 1 Offset (65, 90)
      FPCH E 10 Offset (0, 150)
      Goto Ready
----------

ACTOR GauntletsPuff : PunchPuff replaces PunchPuff
{
   Radius 8
   Height 8
   Alpha 0.6
   VSpeed 1
   RenderStyle "Translucent"
   +NOGRAVITY
   +NOBLOCKMAP
   +PUFFONACTORS
   +PUFFGETSOWNER
   +NOEXTREMEDEATH
   +NOTIMEFREEZE
   SeeSound "FighterPunchHitThing"
   AttackSound "FighterPunchHitWall"
   ActiveSound "FighterPunchMiss"
   States
   {
   Spawn:
      FHFX S 0
      FHFX S 4 A_GiveToTarget("Punch1Check", 1)
      FHFX TUVW 4
      Stop
   Crash:
      FHFX STUVW 4
      Stop
   }
}


ACTOR Punch1Check : Inventory
{
   Inventory.Amount 1
   Inventory.MaxAmount 1
}


ACTOR PunchPuffX
{
   Radius 8
   Height 8
   +PUFFONACTORS
   +PUFFGETSOWNER
   +NOTIMEFREEZE
   States
   {
   Spawn:
      TNT1 A 0
      TNT1 A 1 A_GiveToTarget("Punch2Check", 1)
      Stop
   }
}


ACTOR Punch2Check : Inventory
{
   Inventory.Amount 1
   Inventory.MaxAmount 2
}
Narset
 
Joined: 21 Apr 2020

Re: A_JumpIf MeleeRange possible ? (Melee Weapon)

Postby Lagi » Tue May 19, 2020 1:40 pm

just for information

all hardcoded actor functions are here, code in Zscript
https://github.com/coelckers/gzdoom/tre ... rs/heretic

f.ex. A_CStaffCheck
https://github.com/coelckers/gzdoom/blo ... icstaff.zs
User avatar
Lagi
 
Joined: 23 Jun 2018
Location: Thou shalt alter thy beliefs with new evidence


Return to Assets (and other stuff)

Who is online

Users browsing this forum: No registered users and 1 guest