YesNoOk
avatar

Weird problem coding random intros/win states I'm having (Read 4296 times)

Started by #Shaun, October 09, 2007, 04:28:20 pm
Share this topic:
Weird problem coding random intros/win states I'm having
#1  October 09, 2007, 04:28:20 pm
  • *****
  • corner push pusher
Once I get this problem solved I'm releasing a new update to Evil Lucky, or should I say, Real Lucky (changed the name. Don't like the evil gimmick anymore  ;P)

I read a post of another forum member asking how to do it and DemonicDrPhil showed him some code posted somewhere else in the forum. I have three intros following the same basic code down below. Well after reading it this is what I came up with for my CNS


;===================================================================
; Introduction 1a
;===================================================================
[Statedef 191]
type = S
physics = N
ctrl = 0
anim = 190
velset = 0,0



;===================================================================
; Introduction 1b
[State 191, IB]
type = Explod
trigger1 = RoundState = 0
persistent = 0
anim = 19000
postype = p1
pos = 44, 0
removetime = 190


;===================================================================
; Introduction 1c
[State 191, IC]
type = Explod
trigger1 = AnimElem = 1,=190
persistent = 0
anim = 19001
postype = p1
pos = 44, 0
velocity = 0, -8
removetime = 100


;===================================================================
; Introduction 1d
[State 191, ID]
type = Explod
trigger1 = RoundState = 0
persistent = 0
anim = 19002
postype = p1
pos = 60, 0
removetime = 230  ;<=== amount of time before this anim goes away...


;===================================================================
; Introduction 1e
[State 191, IE]
type = Explod
trigger1 = AnimElem = 1,=230 ;<===...and when this one begins
persistent = 0
anim = 19003
postype = p1
pos = 60, 0
velocity = 10, -10
removetime = 100

[State 191, 2] ;Assert this until you want "round 1, fight" to begin
type = AssertSpecial
trigger1 = 1
flag = Intro



[State 191, 3] ;Change to stand state when done
type = ChangeState
trigger1 = AnimTime = 0
value = random%3
value = iflese((random<191),190,ifelse((random=[191,193]),191,192)) && (0) <===============not working right!!


value = iflese((random<191),190,ifelse((random=[191,193]),191,192)) && (0) is what I thought would work for random intros, then put the fighter in his standing state.

Then I tried Demitri Maximoff's simpler method of just using value = (stateno)=random%3. It works half-assed. It plays the animation of one of the intros for my fighter and the explods graphics I have set for another intro. It's actually combing 2 intros in one and disregarding the other (because of the Exlpods).

Rest of the CNS

;===================================================================
; Introduction 2a
;===================================================================
[Statedef 192]
type = S
physics = N
ctrl = 0
anim = 191
velset = 0,0



;===================================================================
; Introduction 2b
[State 191, IB]
type = Explod
trigger1 = RoundState = 0
persistent = 0
ontop = 1
anim = 19100
postype = p1
pos = 40, -101
removetime = 60


;===================================================================
; Introduction 2c
[State 191, IC]
type = Explod
trigger1 = AnimElem = 1,=60
persistent = 0
anim = 19101
ontop = 1
postype = p1
pos = -2, -96
velocity = -7, -6
removetime = 100

[State 191, 3] ;Change to stand state when done
type = ChangeState
trigger1 = AnimTime = 0
value = 0




;===================================================================
; Introduction 3a
;===================================================================
[Statedef 193]
type = S
physics = N
ctrl = 0
anim = 192
velset = 0,0

;===================================================================
; Introduction 3b
[State 191, IB]
type = Explod
trigger1 = RoundState = 0
persistent = 0
ontop = 1
anim = 19200
postype = p1
pos = 6, -92
removetime = 89

;===================================================================
; Introduction 3c
[State 191, IC]
type = Explod
trigger1 = AnimElem = 1,=89
persistent = 0
anim = 19201
ontop = 1
postype = p1
pos = 6, -92
velocity = 5, -5
removetime = 100

[State 191, 3] ;Change to stand state when done
type = ChangeState
trigger1 = AnimTime = 0
value = 0


I just learned fluently how Sander did his basketball attacks (explods are my new best friend. Helpers are my acquaintences), you'd think I'd be able to get this simple stuff down. I guess I'm having a brain fart or somethin.....help anyone?
Re: Weird problem coding random intros/win states I'm having
#2  October 09, 2007, 06:06:16 pm
  • ******
  • [E]
    • Mexico
i personally use a relatively more thorough, , yet simpler setup for it, i make one state for each intro, each with it'sw own anim(s), that way i changestate on var random.
Re: Weird problem coding random intros/win states I'm having
#3  October 09, 2007, 06:06:24 pm
  • ****
  • "Moyashi tsuku shite yaru..."
value = iflese((random<191),190,ifelse((random=[191,193]),191,192)) && (0)
Of course it wouldn't work right. What's with that zero in the end? If you put it like this the value would be always "0", isn't it? (1 && 0 = 0)  Also, Random trigger has a range of values [0,999]. You ask MUGEN to go to state 190 with 191/1000 probability, to state 191 with 3/1000 probability and to state 192 with 806/1000 probability. (But again, this should always give "0" because of the last expression) I'll give you an advice: try not to use something you cannot understand at all.
i personally use a relatively more thorough, , yet simpler setup for it, i make one state for each intro, each with it'sw own anim(s), that way i changestate on var random.
+1
Re: Weird problem coding random intros/win states I'm having
#4  October 09, 2007, 06:13:29 pm
  • *****
  • corner push pusher
The "0" was there so that he'd go back to his standing state. That's what I though anyway. It's been scratched though.


Quote
I'll give you an advice: try not to use something you cannot understand at all.

Sensible.  :( Harsh, but sensible
Re: Weird problem coding random intros/win states I'm having
#5  October 09, 2007, 06:45:09 pm
  • ****
  • "Moyashi tsuku shite yaru..."
Use VarRandom to determine which intro your char should go to.
Re: Weird problem coding random intros/win states I'm having
#6  October 09, 2007, 07:38:33 pm
  • ******
  • [E]
    • Mexico
do not ever spend your time optimizing code, you are better off spending your time coding (unless you work in the code optimizing area). the varrandom thing might look like.

type =varset
trigger 1 = time = 0
var X = random % 10

type=changestate
value = 69876666
trigger1 = varX = 2

type=changestate
value = 6666
trigger1 = varX > 6

etc..
Re: Weird problem coding random intros/win states I'm having
#7  October 09, 2007, 09:59:19 pm
  • ******
  • Limited time to use Infinite power !
    • France
    • network.mugenguild.com/cybaster/
Quote
Then I tried Demitri Maximoff's simpler method of just using value = (stateno)=random%3. It works half-assed. It plays the animation of one of the intros for my fighter and the explods graphics I have set for another intro. It's actually combing 2 intros in one and disregarding the other (because of the Exlpods).
o_O You've obviously done something wrong there.

Also, I hope that it's a typo you made only on the forum, but you wrote iflese instead of ifelse. :P
Re: Weird problem coding random intros/win states I'm having
#8  October 10, 2007, 05:05:27 pm
  • *****
  • corner push pusher
Quote
Then I tried Demitri Maximoff's simpler method of just using value = (stateno)=random%3. It works half-assed. It plays the animation of one of the intros for my fighter and the explods graphics I have set for another intro. It's actually combing 2 intros in one and disregarding the other (because of the Exlpods).
o_O You've obviously done something wrong there.

Also, I hope that it's a typo you made only on the forum, but you wrote iflese instead of ifelse. :P

It was a typo that was in the topic I saved. It's changed for the code in my CNS but yeah, typo for posting it here.  Anyways thanks to you for the feedback. I'll get cracking on it  :)
Re: Weird problem coding random intros/win states I'm having
#9  October 10, 2007, 05:21:50 pm
  • *****
  • Horrible
    • Sweden
    • http://network.mugenguild.com/anjel/
value = iflese((random<191),190,ifelse((random=[191,193]),191,192)) && (0)

Why dont you just simplyfy it?

value = iflese(random<500,190,ifelse(random<500,191,192))

Does like the same thing.
My shitty mugen stuff: