YesNoOk
avatar

Detect a custom state of P2 (Read 1577 times)

Started by sergeus, April 29, 2020, 05:35:38 pm
Share this topic:
Detect a custom state of P2
#1  April 29, 2020, 05:35:38 pm
  • ***
  • AVP Project
    • Spain
    • sergeusmugen.blogspot.com
Hi, everyone!

Well, i´ll try to explain, sorry for my bad english in advance...  :P

Is there any trigger or anything to make my char detect that the enemy puts him into a custom state (throws, for example)?
What i want to do is to create a helper in Statedef -2 when the char is not in his own state.
I know, the easy way could be to add all throws target states from all the chars of my project to be sure, but maybe there´s something better that i´m not watching right now... 

The helper code at this moment:
Code:
[state -2]
type = Helper
triggerall = var(2) != 3 && life > 0
triggerall = var(3) = 0
trigger1 = stateno = 5100 && time = 1
trigger2 = stateno = 5110 && time = 1
trigger3 = stateno = 970 && time = 1
id = 3110
name = "xxx"
sprpriority = 4
pos = 0,-70
postype = p1
stateno = ifelse(FrontEdgeBodyDist <= 80, 3131, 3130)
helpertype = normal
keyctrl = 0
ownpal = 1
persistent = 0

Thanks in advance, my friends!
Last Edit: April 29, 2020, 08:38:27 pm by sergeus
Re: Detect a custom state of P2
#2  April 29, 2020, 06:52:04 pm
  • ******
  • Hedgehog Whisperer
  • Red Bull addict
    • Spain
    • xgargoyle.mgbr.net
In statedef -3, you need to set this variable:

[State -3, VarSet] ;custom state check reset
type = VarSet
trigger1 =  1
var(59) = gametime
ignorehitpause = 1

Now in statedef -2, this line will detect if your character are in a custom state placed by the enemy:
triggerX = var(59)!=gametime

In other words, your helper will look like this:
    [state -2]
    type = Helper
triggerall = !NumHelper(3110)
    triggerall = var(2) != 3 && life > 0
    triggerall = var(3) = 0
    trigger1 = stateno = 5100 && time = 1
    trigger2 = stateno = 5110 && time = 1
    trigger3 = stateno = 970 && time = 1
trigger4 = var(59)!=gametime
    id = 3110
    name = "xxx"
    sprpriority = 4
    pos = 0,-70
    postype = p1
    stateno = ifelse(FrontEdgeBodyDist <= 80, 3131, 3130)
    helpertype = normal
    keyctrl = 0
    ownpal = 1
    persistent = 0 ;this line does not work on negative states
XGargoyle: Battle posing since 1979
http://xgargoyle.mgbr.net
http://www.pandorabots.com/pandora/talk?botid=e71c0d43fe35093a  <-- Please click that link
http://paypal.me/XGargoyle  <-- Donations welcome!
Re: Detect a custom state of P2
#3  April 29, 2020, 08:37:49 pm
  • ***
  • AVP Project
    • Spain
    • sergeusmugen.blogspot.com
Perfect!!
It works exactly how i wanted! Thanks Master XGargoyle!  :purerox: