YesNoOk
avatar

Code for character doesn't work  (Read 5398 times)

Started by ModalCobalt, July 31, 2024, 12:21:28 pm
Share this topic:
Code for character doesn't work
#1  July 31, 2024, 12:21:28 pm
  • avatar
  • *
    • Italy
Hi, sorry I am asking so many questions these days, but I am a newbie and I don't know how to solve this.
The first code i wrote was :

[State -2, StopMoving]
type = VelSet
trigger1 = StageVar(info.name) = "Stage1"
trigger1 = time = (300,600)
x = 0
y = 0
 
Didn't work.
The second code i tried was:

[State -2, PosFreeze]
type = PosFreeze
trigger1 = StageVar(info.name) = "Stage1"
trigger1 = time >= 300
trigger1 = time <= 600
value = 1

Didn't work either.
What I wanted to do was to make p1 stop moving between 5 and 10 sec from the start,and it doesn't work.I've tried also with VelMul or setting trigger1 = time >= 300 and trigger1 = time <= 600.
I'd like the p1 also not to be able to attack in that timeframe.
Another way it could work would maybe set some sort of stage damage that stuns the player under certain conditions but idk how to do that.
Again i am sorry if I am spamming and I am trying not to ask too many things but I don't know other places where to find the solution
Last Edit: July 31, 2024, 01:24:06 pm by ModalCobalt
Re: Code for character doesn't work
#2  July 31, 2024, 02:14:27 pm
  • ****
  • Formerly DeathScythe
    • Brazil
    • lyricasky.neocities.org
"trigger1 = time = (300,600)" won't work. The correct would be:
Code:
trigger1 = (time = [300,600])

But even this won't work because time resets whenever you change states. In this case you have two options, use GameTime (https://mugenguild.com/forum/topics/gametime-triggers-169646.0.html) however this is not reliable, or, use a variable to simulate time. I'm not at my pc right now to test, but is a simple varadd with trigger1 = 1 in state -2.

Code:
[State -2, Game Time]
type = VarAdd
trigger1 = 1
var(58) = 1
ignorehitpause = 1

Then change your posfreeze to this:

Code:
[State -2, PosFreeze]
type = PosFreeze
trigger1 = StageVar(info.name) = "Stage1"
trigger1 = (var(58) = [300,600])
value = 1
Re: Code for character doesn't work
#3  July 31, 2024, 02:59:44 pm
  • **
  • Sr. Símio Enfermo
    • Brazil
    • www.mediafire.com/folder/utha9mw5dg7tn/My_Chars
[State -2, PosFreeze]
type = PosFreeze
trigger1 = StageVar(info.name) = "Stage1"
trigger1 = GameTime = [300,600]
value = 1


Edit: Nevermind. I didn't know how unreliable GameTime would be in this scenario.
DeathScythe solution is really good.

If you want, you could do that way too:
Code:
[State -2, PosFreeze]
type = PosFreeze
trigger1 = StageVar(info.name) = "Stage1"
trigger1 = var(58):= (var(58)+1)
trigger1 = var(58) = [300,600]
value = 1
ignorehitpause = 1




Last Edit: July 31, 2024, 03:12:16 pm by Manson Rees
Re: Code for character doesn't work
#4  July 31, 2024, 03:23:28 pm
  • avatar
  • *
    • Italy
[State -2, PosFreeze]
type = PosFreeze
trigger1 = StageVar(info.name) = "Stage1"
trigger1 = GameTime = [300,600]
value = 1


Edit: Nevermind. I didn't know how unreliable GameTime would be in this scenario.
DeathScythe solution is really good.

If you want, you could do that way too:
Code:
[State -2, PosFreeze]
type = PosFreeze
trigger1 = StageVar(info.name) = "Stage1"
trigger1 = var(58):= (var(58)+1)
trigger1 = var(58) = [300,600]
value = 1
ignorehitpause = 1


Hi,do I have to paste it for every animation in the .cns file?
Re: Code for character doesn't work
#5  July 31, 2024, 03:33:53 pm
  • **
  • Sr. Símio Enfermo
    • Brazil
    • www.mediafire.com/folder/utha9mw5dg7tn/My_Chars
Just in the Statedef -2.
Re: Code for character doesn't work
#6  July 31, 2024, 03:42:45 pm
  • avatar
  • *
    • Italy
It works! Thank you both very much
Re: Code for character doesn't work
#7  July 31, 2024, 05:17:04 pm
  • ******
    • Portugal
    • network.mugenguild.com/pots/
In Ikemen you can also use StageTime.
You can help with Ikemen GO's development by trying out the latest development build and reporting any bugs on GitHub.
My Mugen and Ikemen content can also be found here.
Re: Code for character doesn't work
#8  July 31, 2024, 08:20:34 pm
  • avatar
  • *
    • Italy