The Mugen Fighters Guild

Help => M.U.G.E.N Development Help => Code Library => Topic started by: Black_Dahlia_Isis on February 22, 2005, 03:10:46 pm

Title: Demo mode detection
Post by: Black_Dahlia_Isis on February 22, 2005, 03:10:46 pm
If someone cares...

May be the most easy mode to detect. As when the round start you're already full of power. (In training mode, the power grows at the beginning).


So, to detect demo mode (to set AI->ON), go to the pre-intro state of your char (the [state 190], may be in mugen\data\common1.cns, and copy/paste it in your char.cns file. Then add only these lines :

Code:
[State 190, 4] ; AI in demo mode
type = VarSet
trigger1 = Power > 2990    ; This number has to be close to char's power max value
trigger1 = Time = 0
value = 1                            ; <- The var value is set to 1
v = 0                                   ; <- This is var(0)

May be you can test :
Code:
trigger1 = Power = 3000
This would work but as I don't know how the engine fill the power bar at this time... I prefered to put the version above.

As far as I remember it's compatible with Winane's Activation code, where Var(0)=1 means AI is activated.

AFAIK, Winane didn't add a special part for that demo mode.
The good point here, is that we can be 100% sure* that AI is going to be activated even before the start of the show.


* : Except may be if you add Winane's Training detection mode bonus :
Code:
; ONLY if desired:
[State -2, Start Full]
...
or some same stuffs...
Title: Re: Demo mode detection
Post by: Byakko on February 22, 2005, 03:15:47 pm
Quote
trigger1 = Power > 2990
... > const.powermax-10 or something that would more or less look like that (rarely touch anything about those consts - and don't even tell me about the new trigger shortcuts in WinMugen)
That would be more universal, eh
Title: Re: Demo mode detection
Post by: Black_Dahlia_Isis on February 22, 2005, 03:17:55 pm
True, you pointed some syntax I don't master yet, thxs. :-*

EDIT : fixed
, and btw if anyone else (especially W. ;)) has some things to say to improve this code, be my guest. :)

:P

EDIT2 : disfixed ;D
Title: Re: Demo mode detection
Post by: Byakko on February 22, 2005, 03:33:47 pm
I don't master it either, this syntax is probably wrong, actually  :-*  :grin3:
Title: Re: Demo mode detection
Post by: Black_Dahlia_Isis on February 22, 2005, 03:42:13 pm
Bwaaaa ! :P This may explain why I didn't remember it ! :P

Let's have a look... ::)
Title: Re: Demo mode detection
Post by: PotS on February 22, 2005, 10:46:30 pm
that will activate the a.i. if your simul mode partner starts the round already with power

and pre-intro state is 5900 :tongue2:
Title: Re: Demo mode detection
Post by: Black_Dahlia_Isis on February 23, 2005, 09:24:47 am
that will activate the a.i. if your simul mode partner starts the round already with power

??? :)

Can you give more details ?

In which mode ? with how many players ? CPUs ? in which round state/number ?

and pre-intro state is 5900 :tongue2:

common1.cns said:
;---------------------------------------------------------------------------
; PREINTRO
[Statedef 190]
type = S
ctrl = 0
velset = 0,0

[State 190, 1]
type = ChangeAnim
trigger1 = SelfAnimExist(190)
value = 190

[State 190, 2] ;Go straight to intro.
type = ChangeState
trigger1 = Time = 0
value = 191

5900 (which is not "pre-intro" but "initialize") appears only at round 2 and 3 not at the first one AFAIK.

Anyway, I add the feature to Pocket_Chun-li so you'll be able to test it on your own and if bug there is, please kick me violently ! ;D

Well in fact, feedback would be enough... ^_^
Title: Re: Demo mode detection
Post by: Sheng Long on February 23, 2005, 05:07:22 pm
Actually, State 5900 does activate in round 1. We just don't see that because it goes strait into the characters intro state, 190, or 191.

Code:
;---------------------------------------------------------------------------
; Initialize (at the start of the round)
[Statedef 5900]
type = S

[State 5900, 1] ;Clear all int variables
type = VarRangeSet
trigger1 = roundsexisted = 0
value = 0

[State 5900, 2] ;Clear all float variables
type = VarRangeSet
trigger1 = roundsexisted = 0
fvalue = 0

[State 5900, 3] ;Intro for round 1
type = ChangeState
trigger1 = roundno = 1
value = 190
Title: Re: Demo mode detection
Post by: Byakko on February 23, 2005, 05:52:19 pm
the docs said:
------------------------------------------------------------
PowerMax
------------------------------------------------------------
 
Returns the maximum amount of power the player can have. This is normally 3000 (level 3).
Format:
  PowerMax
Arguments:
  none
Return type:
  int
Error conditions:
  none
Example:
  trigger1 = power < powermax / 2
    True if player has less than half his maximum power.
There...
WinMugen version, won't work with DOS
I'm pretty sure there's something with const.data(power) or something like that (I still don't know) for DOS
But that'll still be more universal than power > 2990 for chars that have 2 or 9 powerbars (like, your own Pocket ChunLi ??)
Kissu :-*
Title: Re: Demo mode detection
Post by: Kung Fu Man on February 23, 2005, 08:19:37 pm
I think I get what Phantom is pointing out...try putting Chun-Li in training mode, and tap F4: Demo Mode will kick on.
Title: Re: Demo mode detection
Post by: PotS on February 23, 2005, 11:40:07 pm
Can you give more details ?

In which mode ? with how many players ? CPUs ? in which round state/number ?
simul mode (with partner), any round
there are chars that start with a full power bar (especially sfa3 and dbz chars), so trigger1 = Power > 2990 will activate the a.i.

tested it already

add this to any char other than chun-li:
[State -2, power]
type=poweradd
trigger1=1
value=9999

then play in simul mode, choosing chun-li and that other char as your team
bam, a.i. activated  >:)

EDIT: or add that piece of code in chun-li and play in any mode :P

Quote
5900 (which is not "pre-intro" but "initialize") appears only at round 2 and 3 not at the first one AFAIK.
all the same
5900 occurs every round, usually to reset the variables

Quote
Anyway, I add the feature to Pocket_Chun-li so you'll be able to test it on your own and if bug there is, please kick me violently ! ;D
:smash:

and what k.f.m. said is also true
Title: Re: Demo mode detection
Post by: Byakko on February 23, 2005, 11:57:23 pm
Short :
this thread has no useful purpose.
BDI, owned by the Guild. :laugh: ;)


|| Yes, I'm just teasing him around a bit ;)
V
Title: Re: Demo mode detection
Post by: Kung Fu Man on February 24, 2005, 01:26:11 am
Not quite. The code is flawed, but not worthless :P Just needs to be adjusted.
Title: Re: Demo mode detection
Post by: Black_Dahlia_Isis on February 24, 2005, 02:47:03 pm
I think I get what Phantom is pointing out...try putting Chun-Li in training mode, and tap F4: Demo Mode will kick on.

Damn !  >:( :'( your right...

simul mode (with partner), any round
there are chars that start with a full power bar (especially sfa3 and dbz chars), so trigger1 = Power > 2990 will activate the a.i.

tested it already

add this to any char other than chun-li:
[State -2, power]
type=poweradd
trigger1=1
value=9999

then play in simul mode, choosing chun-li and that other char as your team
bam, a.i. activated  >:)
:o Right ? ??? I'll have a look.

...

Tested, and.. I guess I missed something because I didn't see any unwished demo mode activation ??? I added your code to a char, made him partner of Pocket Chun, and tested various Team mode with partnership set as "simul" and noticed nothing wrong... ???

EDIT: or add that piece of code in chun-li and play in any mode :P
Mwahahaha :D this is a new mission for captain obvious ! :P Of course this works ONLY if your char doesn't start fighting with fullfilled power gauge... The thing I was ignoring was :
there are chars that start with a full power bar (especially sfa3 and dbz chars)
That.  :-\

all the same
5900 occurs every round, usually to reset the variables
Yeah you're right I was wrong, sorry. :)

Short :
this thread has no useful purpose.
BDI, owned by the Guild. :laugh: ;)
Yeah, i need to be lashed on public place for that crappy attempt ! :yes:

Not quite. The code is flawed, but not worthless :P Just needs to be adjusted.
Damn KFM, you're too kind, kick me too ! ;D
Title: Re: Demo mode detection
Post by: PotS on February 25, 2005, 11:32:32 pm
you're right
i wasn't aware that mugen fills the powerbar slowly during roundstate=1
so only with F4
Title: Re: Demo mode detection
Post by: Black_Dahlia_Isis on February 27, 2005, 03:28:52 pm
oooh, soka.

So may be this code is not as damn crappy shit as I though.

Is F4 reinitialise gametime too ?

may be that should be a keypoint to prevent this bug.
Title: Re: Demo mode detection
Post by: PotS on March 02, 2005, 12:13:15 am
Is F4 reinitialise gametime too ?

may be that should be a keypoint to prevent this bug.
yep
just add a var that says if those triggers were already read
that way if you press F4 the triggers won't work again
Title: Re: Demo mode detection
Post by: BlackJack on April 13, 2005, 04:23:48 am
IIRC Faye managed to set up a code to achieve the same goal as yours, on Dev. Maybe should you ask her, or The Slipator?


When you say "demo", you mean "training", correct? And "CPU mode" = "AI", right?
Because if you want "to activate AI in that CPU mode", you only need to set "Dummy Control" to AI, wait, then put it back to "Cooperative" or "Manual": the opponent will now do the moves you've coded in his custom AI.
Title: Re: Demo mode detection
Post by: S.D. on April 13, 2005, 04:39:50 am
Maybe demo as in, don't press anything in the menu?
Title: Re: Demo mode detection
Post by: Byakko on April 13, 2005, 10:49:35 am
Faye's code was for the Training mode as far as I recall, not Demo. Difference is how fast power increases :P
Title: Re: Demo mode detection
Post by: BlackJack on April 13, 2005, 01:09:24 pm
My bad; I thought he said "demo" to say "training"... because I didn't know he'd be so crazy to think about Demo detection. :P