YesNoOk
avatar

Code for Slow p2 (Read 1575 times)

Started by icare26, February 13, 2020, 09:19:30 pm
Share this topic:
Code for Slow p2
#1  February 13, 2020, 09:19:30 pm
  • **
    • France
Please help me.

Code:
[Statedef 650];        
type = S
movetype= A
physics = S
velset = 0,0
ctrl = 0
anim = 650

[State 650]
type = Projectile
trigger1 = AnimElem = 25
ProjID = 3400
projanim = 3400
..........................

[state 650]
type = varadd
trigger1 = projhit3400 = 1
var(44) = 300
ignorehitpause = 1

and state-2 ------------------------------

Code:
[State -2] 
type = pause
triggerall = var(44) = 300
trigger1 = gametime%3= 0
time = 1
movetime = 1

[State -2]
type = VarAdd
trigger1 = var(44) = 300
v = 2
value = -1

out works p2 slows down its movements !

My problem is that I would like it to only last 300ticks

but here player 2 remains slow indefinitely during the round !!

Can someone tell me where my error (s) is ???

Thnak you for answers.


Re: Code for Slow p2
#2  February 13, 2020, 10:04:45 pm
  • ******
  • Hedgehog Whisperer
  • Red Bull addict
    • Spain
    • xgargoyle.mgbr.net
[State -2]
type = VarAdd
trigger1 = var(44) = 300
v = 2
value = -1

This triggers the first time that var(44)=300, but when var(44)=299 there's no code that keeps decreasing the value
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: Code for Slow p2
#3  February 13, 2020, 11:28:05 pm
  • **
    • France
should i put this so? 

trigger1 = var(44) <= 300

?
Re: Code for Slow p2
#4  February 14, 2020, 09:50:03 am
  • ******
  • Hedgehog Whisperer
  • Red Bull addict
    • Spain
    • xgargoyle.mgbr.net
you could have tested it instead of posting. That's how people learn.

Assuming that var(44) only goes from 300 to 0, you could use var(44)>0. If not, then you will need to specify the correct ranges
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: Code for Slow p2
#5  February 14, 2020, 11:10:47 am
  • *****
  • Shame on you!
    • USA
So your original VarAdd, should probably be a varSet.
Your method could make var(44) sky rocket if that animation's elem 25 is long. Each tic it could be adding 300 to it.
Use DisplayToClipboard to see the value.
 
[State -2]
type = VarAdd
trigger1 = var(44) = 300
v = 2         ;What does Var(2) control??
value = -1

You could probably change
Spoiler: This (click to see content)
Into
Spoiler: This (click to see content)
vVv Ryuko718 Updated 10/31/22 vVv
Re: Code for Slow p2
#6  February 14, 2020, 11:31:47 am
  • **
    • France

"please,I have been working on my project for more than ten years, and I rarely post a help message, generally yes I do my research myself and test too."

Thank you for your answer.

Code:
[State -2] 
type = pause
trigger1 = var(44)> 0
trigger1 = gametime%3= 0
time = 1
movetime = 1

[State -2]
type = VarAdd
trigger1 = var(44)> 0
v = 44  ; v= 2
value = -1   

Re: Code for Slow p2
#7  February 14, 2020, 11:35:10 am
  • **
    • France
Thank you XGargoyle and Odb718 ! ^^

It's good !