YesNoOk
avatar

a code for auto blocking, once every X ticks? (Read 1896 times)

Started by ziaker, June 20, 2019, 11:50:05 pm
Share this topic:
a code for auto blocking, once every X ticks?
#1  June 20, 2019, 11:50:05 pm
  • *
    • Brazil
Has a code that causes the character to block an attack automatically but only one time every X ticks?
Re: a code for auto blocking, once every X ticks?
#2  June 21, 2019, 07:27:17 am
  • ******
  • Legendary XIII
  • I am the eye of the storm to come!
    • New Zealand
    • network.mugenguild.com/cyanide/
Human controlled or ai? Do you want it to break out of attacks to block or should it only be allowed when the character can block?


In M.U.G.E.N there is no magic button

They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance.
Re: a code for auto blocking, once every X ticks?
#3  June 21, 2019, 04:11:50 pm
  • *
    • Brazil
Code:
;---------------------------------------------------------------------------
[State -1, Auto Guard]
type = ChangeState
value = 150
triggerall = power >= 500
triggerall = Alive = 1
trigger1 = (GameTime%8100) = 0
trigger1 = statetype != A
trigger2 = (stateno = [5000,5020]) && (GameTime%200) = 0
trigger1 = ctrl = 1
poweradd = 500
;---------------------------------------------------------------------------


 "trigger2 = (stateno = [5000,5020]) && (GameTime%200) = 0"  I used this code and apparently it works the way I wanted it but I would like it to be an counter where the character would block an attack automatically and then the counter would restart.
Re: a code for auto blocking, once every X ticks?
#4  June 21, 2019, 06:49:55 pm
  • ****
  • Robotics Engineer
    • USA
    • altoiddealer@gmail.com
First off, I want to point out that you have an error with the last trigger1 which I think you wanted to be trigger2. (the triggers do not have to be grouped together by number, m'bad!)

You'll have to use a Var (or Explod/NumExplod method) in this fashion

Code:
;---------------------------------------------------------------------------
[State -1, Auto Guard]
type = ChangeState
value = 150
triggerall = power >= 500
triggerall = Alive = 1
trigger1 = (GameTime%8100) = 0
trigger1 = statetype != A
trigger1 = ctrl = 1
trigger2 = var(10) > GameTime + 20 ;Prevents the Auto-Blocking from triggering until 20 ticks have passed from the previous successful block.
trigger2 = (stateno = [5000,5020]) && (GameTime%200) = 0
trigger2 = var(10) := GameTime ;This will set var(10) to the current GameTIme
poweradd = 500
;---------------------------------------------------------------------------

That should do it.  Just replace the Var # with an available one, and adjust the "20" to however many ticks.

Last Edit: June 24, 2019, 03:17:49 pm by altoiddealer
Re: a code for auto blocking, once every X ticks?
#5  June 22, 2019, 02:22:35 am
  • ******
  • Legendary XIII
  • I am the eye of the storm to come!
    • New Zealand
    • network.mugenguild.com/cyanide/
Ctrl will never be 1 inside the hitstates. Other than organisation and maybe a fraction of a fraction of a second of processing there is nothing wrong with that setup. Triggers can go like this

1
3
4
3
2
2
1

Mugen won't give a shit.


In M.U.G.E.N there is no magic button

They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance.
Re: a code for auto blocking, once every X ticks?
#6  June 24, 2019, 03:16:24 pm
  • ****
  • Robotics Engineer
    • USA
    • altoiddealer@gmail.com