The Mugen Fighters Guild

Help => M.U.G.E.N Development Help => Code Library => Topic started by: 2OS on August 24, 2012, 10:13:41 pm

Title: Training Mode Detector
Post by: 2OS on August 24, 2012, 10:13:41 pm
[Statedef -1]

[State ]
type=helper
trigger1=(stateno=0||stateno=5900)&&!ctrl&&!numhelper(20)
id=20
stateno=5150
keyctrl=1
ignorehitpause=1
pausemovetime=9999999
supermovetime=9999999

[State ]
type=assertspecial
trigger1=ishelper(20)
flag=invisible
ignorehitpause=1

[State ]
type=statetypeset
trigger1=ishelper(20)
movetype=i
ignorehitpause=1

[State ]
type=changeanim
trigger1=ishelper(20)
value=root,anim
ignorehitpause=1

[State ]
type=ctrlset
trigger1=ishelper(20)
value=0
ignorehitpause=1

[State ]
type=velset
trigger1=ishelper(20)
x=rootdist x
y=rootdist y
ignorehitpause=1

[State ]
type=parentvarset
trigger1=ishelper(20)
trigger1=stateno=5120
var(0)=1
ignorehitpause=1

[State ]
type=destroyself
trigger1=ishelper(20)
trigger1=time=100
ignorehitpause=1

[State ]
type=displaytoclipboard
trigger1=!ishelper
text="Training Mode = %d 0=No 1=Yes"
params=var(0)
ignorehitpause=1
Title: Re: Training Mode Detector
Post by: Seravy on August 25, 2012, 08:21:18 am
So, that means there is a hardcoded state change from 5150 to 5120 when in training mode? Nice to know.
I guess this is a safer and better method than checking the powerbar during intro.
Title: Re: Training Mode Detector
Post by: 2OS on August 25, 2012, 08:42:00 am
that pretty much sums it up yes.

it'll work if the intro is or is not skipped. the only ( not so major ) downside is it takes roughly 100 ticks upon spawn.
Title: Re: Training Mode Detector
Post by: Cybaster on August 27, 2012, 04:06:36 pm
I know this is kind of trivial for someone who's intending to use this type of code, but you could use the [ code ] tags and a short intro/comment each time :
- Create the helper in state XXX.
- This is the code for the helper itself : ...
- This line does this, this state does that.
- Put this in state -2 to display blabla.

This would make the tutorials much more understandable and easy to read. ;)
Title: Re: Training Mode Detector
Post by: Cyanide on August 28, 2012, 03:14:32 am
Well it is the code library rather than tutorials. But explaining what is happening is always useful so if you want to tweak it you don't need to work out what bits of the code do.
Title: Re: Training Mode Detector
Post by: Sheng Long on November 17, 2012, 02:08:09 am
that pretty much sums it up yes.

it'll work if the intro is or is not skipped. the only ( not so major ) downside is it takes roughly 100 ticks upon spawn.

Hate to bring this back up, but I wanted to say something about this.
I think you're saying 100 ticks upon respawn because that is what is written in the code. If you wanted to change the time, couldn't you say something like 50, 10, or time > 0 instead? Or does it really need exactly 100 game ticks for this code to work?

Also, why 5150? I thought that was already used for something. Is it not? Wait.... Isn't 5150 the dead KO state?
Can it be any state number, or does it have to be 5150?
Title: Re: Training Mode Detector
Post by: Cyanide on November 17, 2012, 02:14:24 am
Training mode forces a state change from 5150 to 5120, that is clear enough isn't it? Because of the way mugen works it takes 100 ticks to achieve this.

And of course you can't use another state. That's obviously not how this works.

If you have further questions redirect them to the dev help forum not here.
Title: Re: Training Mode Detector
Post by: mabskmk on November 06, 2014, 05:39:00 am
This work for me

Code:
[State -3];Demo mode
type=Varset
triggerall=!Var(10)
trigger1= (Stateno=190||Stateno=5900) && roundno=1 && Power>=1000 && Ailevel!=0 ;<--Mugen1.0+
v=10
value=1
[State -3];Demo mode error ;<--Only for same characters/fullgame+
type=Varset
triggerall=Var(10)
trigger1=Roundstate=2 && Enemy,var(10)=0
v=14
value=0
Title: Re: Training Mode Detector
Post by: Алексей on November 06, 2014, 01:25:17 pm
Dude, what's with the necro?

Also, your method isn't exclusively going to pin-point demo mode. Your conditions would be true for any character ready to do a standard, 1-bar super.