YesNoOk
avatar

Coding an intro for the next round after a lose (Read 25731 times)

Started by MaligeX, March 13, 2020, 01:35:33 am
Share this topic:
Coding an intro for the next round after a lose
#1  March 13, 2020, 01:35:33 am
  • avatar
  • ***
  • If you rip sprites i´ll rip your code
    • Mexico
    • www.m3xweb.260mb.com
This semi tutorial is based on a question by @MELUNIVERSE in the Discord chat about having a special intro in the next round after lose for the first time.
 
I Will try to explain in the most rought,noobish and friendly manner.

First you need an X variable which will be the activator.
Put it under or below any Statedef you want, recomended [Statedef 5900] or [Statedef 190], personally not recomended [Statedef -2] or [Statedef -3]
 X is any number your character doesnt use for variable in the range 0-59.

Code:
[State 0, varX]
Type= varset
Trigger1=1
Var(21)=0 ; example num,start at zero by default anyway

Code:
[State 0, varXdetector]
Type= varset
Trigger1= roundstate= 3 ;round finalized,before win poses
; Trigger1=roundno= 1 ;only triggered in first round,optional
Trigger1= lose ; you lose the round regardless how
Trigger1= var(21) != 34; has not been activated before
Var(21) = 69 ;if requirements achieved, adquire the value

When your character lose the first time regardless the round or the how ,you have two options, a lose pose activated by the variable or in the next round a unique intro activated by the same variable, even you can have both.

Code:
[State 0, exlose]
Type= changestate
; Trigger1= roundstate >= 3 ;round is over, reiterative opt
Trigger1= Var(21)= 69 ; imediate when activated
Value = 666 ;the lose pose Statedef

Code:
[State 0, exintro]
Type= changestate
Trigger1= roundstate <=2 ;the round is starting, next one
Trigger1= Var(21)=69 ; detected in following round
Value= 999 ;the intro pose statedef

Remember that only one time will work, as the code prevent to be activated every time you lose or a new round start;  of course if your team members are the same character and all lose ,all will activate the same poses.

You can still use the variable for other things you want to store, assingning it other values

I forgot one last state , in your intro pose for the next round you need to put the variable in another value to never be active again.

Code:
[Statedef 0, nomoreX]
Type= varset
Trigger1= 1 ;it will trigger imediately when intro is viewed
Var(21)= 34 ;enought activations

Code:
[State 0, fin]
Type=changestate
Trigger1= animtime = 0
Value= 0 ; idle animation

The code before represent this in the" !=" Line (different than) so, finally we have the following values in the example:

Code:
Var(21)= 0 ;inactive
Var(21)= 69 ;activated
Var(21)= 34 ;no more activation

With this now the code prevent that the intro or lose or even the variable be active again ; in the example i use rare numbers but you can use simple ones as 0,1 & 2 respectively.

You can even reuse the variable to activate a new iddle pose for your character too, add this state in the [Statedef 0] the stand animation.

Code:
[State 0, angrybird]
Type= changeanim
Trigger1= Var(21)= 34 ; reuse the final var value for this
Value= 777 ; animation in air file to reflect the change

Or to a completely new stand Statedef if you put under the same intro [Statedef 999] (the example) or specifically for this, is better in the [Statedef -3] or [Statedef-2] because we don't want to edit every state who changes to idle and those negatives are always reloaded forcing its function.

Code:
[State 0, furyroad]
Type= changestate
Trigger1= Var (21)= 34  ;the variable final form
Trigger1 = stateno= 0 ; if we are in iddle force to change
Value= 1234 ;the new idle more elaborated with fire and ice

The last addition is if you want ,to reflect the resurrection or the angrier state for your character from the lose point beyond rounds.

There is no knowledge that is not power
--------------------------------------
My Web Site
Last Edit: March 13, 2020, 01:43:13 am by MangeX
Re: Coding an intro for the next round after a lose
#2  March 13, 2020, 04:00:34 am
  • avatar
  • **
    • Vietnam
You should at least consider of character's intpersistindex. Before doing this technique.
------Tremble Mortal and Despair. Doom has come to this world------
Re: Coding an intro for the next round after a lose
#3  March 14, 2020, 05:07:58 am
  • ****
    • Peru
Interesting...could you upload a video to see an example, please?