intro decider

Started by Rōjenomu, February 12, 2008, 05:56:52 PM

Previous topic - Next topic

Rōjenomu

im trying to add a new intro to an existing char
and he already got 2 intro's (states 190&191)

this is the code that decides which intro plays right?

[State 190]
type = ChangeState
trigger1 = 1
value = ifelse(random<=500,190,191)

so what is the best way to add more intro's

Spoiler (click to show)

QuoteLord Canti Says:
i was playing FFVII and I accidently named Red XIII Cyanide D:

Bastard Mami

create a sensible intro system.

personally i use:

Quote;___________________________________________________
;
;winposes etc 9000
;___________________________________________________

;___________________________________________________
;
;Intros
;___________________________________________________

;intro snaps                  9100


;___________________________________________________
;
;Winposes
;___________________________________________________

;Winpose jump n P            9200

;Winpose jump n V            9210

;___________________________________________________
;
;Lose poses
;___________________________________________________

;falls to ground            9500

extract from a text file with the whole character planing.

Quote
in state 190

[State select pose ]
type      = varRandom
trigger1   = !Time
v          = 14
Range          = 0,0; this covers the amount of winposes/ intro etc.. you have,m depending on the case.
[State esp ]
type       = ChangeState
trigger1    = !Time
Value          = 9100+ var(14)*10

optimized code is not optimum if it makes the code harder to work with and has no real impact on performance.

Fallen_angel

yes that is the intro code decider

value = ifelse(random<=500,190,191) ;these means when the random number is <= 500 the char changes to statedef 190, if the random number is  >500 he will change to the statedef 191.

to add more you can use these ifelse(random =[0,300],190,ifelse(random=[301,600],191,ifelse(random......)))

these means that if the random number isn't from o to 300 goes to the next condition (301 to 600) and it continues doing that.

if you find these a little bit complicated you can make the same thing using more than 1 changestate using as a trigger1 = random=[xx,yy]

Bastard Mami

i actually find chains of ifelse harder because fine tuning the probabilities in them is much cmore complex than a single varset.

Rōjenomu

yeah you got a point there [E]
it's more easy (for me) to make mistakes that way so
i go with your solution thanks!

on a sidenote,

i trying to think of how to begin the round dark and slowly fade in the match

i tried this:
[State -2:          Bgpalfx]
type                = Bgpalfx
trigger1            = roundstate=0
time                = 200
sinadd              = -255,-255,-255,600
persistent          = 0

but i think it's because of the sinadd it doesnt start out black -_-
but it goes from normal to black to normal
any idea how to get it just to go from black to normal?
Spoiler (click to show)

QuoteLord Canti Says:
i was playing FFVII and I accidently named Red XIII Cyanide D:

Bastard Mami

sinadd gives a ncie sin effect and is there to make that effect more accesible.. but for more advanced or simpler effects it's bets to use a time/var based mini system.

Quote[State -2:          Bgpalfx]
type                = varset
trigger1            = roundstate=0
trigger1            = time                = 200
fvar(X)              = 0

[State -2:          Bgpalfx]
type                = varadd
trigger1            = roundstate=0
trigger1            = time                > 200
fvar(X)              = 0.001

[State -2:          Bgpalfx]
type                = Bgpalfx
trigger1            = roundstate=0
time                = 1
add              = -255 * fvar(X),-255 * fvar(X),-255 * fvar(X)

tweak the values, add ceil or floor where necesary, and ask if you have any doubts on the code.

Rōjenomu

#6
well ummm... where to begin...
i fiddled alot with it
but debug keeps telling me 'expression truncated to integer'
which i think that because i most likely messed up the fvar's

it now starts out black which is good
but when the match begins, the black fade isnt noticable

here is as it is now:

Quote[State -2:          Bgpalfx]
type                = varset
trigger1            = roundstate=0
trigger1            = time =1
fvar(1)             = 1

[State -2:          Bgpalfx]
type                = varadd
trigger1            = roundstate=0
trigger1            = time                > 20
fvar(1)             = ceil(0.0004)

[State -2:          Bgpalfx]
type                = Bgpalfx
trigger1            = roundstate=0
time                = 56
add                 = -255 * fvar(1),-255 * fvar(1),-255 * fvar(1)

so basically i know ceil and floor both rounds the number to whole digits
ceil (from ceiling i assume) rounds it to above
and floor to below
and fvars are decimals
but still dont have a clear vision on how this works together as a whole..
Spoiler (click to show)

QuoteLord Canti Says:
i was playing FFVII and I accidently named Red XIII Cyanide D:

Bastard Mami

good try.

the ceil bit should go in the palfx, and should not exist at all in the fvar setting:

you are using a fvar so it can scale up nicely, in increments of .001 or smaller. the bg palfx should last just one tick, since what is wanted here is for it to havea  different value every tick.

Rōjenomu

so if i understand correctly
the bg is the darkest color for 1 tick
and you add a negative color for each colorgroup
multiplied by the fvar it should fade in time
that my theory..

[State -2:          Bgpalfx]
type                = Bgpalfx
trigger1            = roundstate=0
time                = 1
add=ceil(fvar(1)*-255),ceil(fvar(1)*-255),ceil(fvar(1)*-255)

still got me clueless, cuz that also didnt work lol
Spoiler (click to show)

QuoteLord Canti Says:
i was playing FFVII and I accidently named Red XIII Cyanide D:

Bastard Mami

does the fvar1 still has the ceil stuff ?  it should not, btw.

the 255 value that youu take from the colorsget's slowly added to, if you use a var add of 0.1 it will take 10 ticks until the screen goes completely black.

the point of this is that for every tick, you use a different add value in the palfx, so the actual fx changes over time, this is useful for both advanced and basic pal fx.

Rōjenomu

ok i think i somewhat have an visual on how it works

but how did you know 0.1 takes 10 ticks?
is it becasue you have -255 (darkest black) and you multiply it with 0,1 = -25.5
-255/-25.5 = 10 ticks?
so every 1 tick -25.5 is added to -255?

so you cannot have to big of a fvar or else it will get whiter (-255 becomes a positive value)
to make it fade to nothing its got to be near 0, right

lets say i want to make the duration 60 gameticks
the fvar would be 0,01666666?

or am i wayy off?

and i still dont know how ceil finishes the equation...
ceil the -255 alone in the "add" line isnt going to help because it's already a round nr.
Spoiler (click to show)

QuoteLord Canti Says:
i was playing FFVII and I accidently named Red XIII Cyanide D:

Cyanide

ceil doesn't finish anything. It just rounds up the result if it's a decimal.

Floor rounds it down. This is to prevent debug. Functionality would be exactly the same if you left it out. Except you'd get "value blah in state blah truncated to integer" messages during debug.


In M.U.G.E.N there is no magic button

They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance.

Rōjenomu

yeah i thought i already said what it meant, cya
but where to put it then?

[E] said ceil is placed in the bgpalfx state but
Quotedoes the fvar1 still has the ceil stuff ?  it should not, btw.
so the only number left is the -255 which is already rounded
Spoiler (click to show)

QuoteLord Canti Says:
i was playing FFVII and I accidently named Red XIII Cyanide D:

Bastard Mami

Quote[State -2:          Bgpalfx]
type                = varset
trigger1            = roundstate=0
trigger1            = time =1
fvar(1)             = 1

[State -2:          Bgpalfx]
type                = varadd
trigger1            = roundstate=0
trigger1            = time                > 20
fvar(1)             = 0.0004

[State -2:          Bgpalfx]
type                = Bgpalfx
trigger1            = roundstate=0
time                = 1
add                 = ceil( -255 * fvar(1) ),-255 * fvar(1),-255 * fvar(1)

fixed some parts.

Rōjenomu

call me a baka but it still doesn't work r[e]ika    :-\
i also tested it on kfm just in case

; Introduction
; CNS difficulty: basic
; CNS ƒŒƒxƒ‹: Šî–{
[Statedef 191]
type = S
ctrl = 0
anim = 190
velset = 0,0

[State -2:          Bgpalfx]
type                = varset
trigger1            = roundstate=0
trigger1            = time =1
fvar(1)             = 1

[State -2:          Bgpalfx]
type                = varadd
trigger1            = roundstate=0
trigger1            = time > 20
fvar(1)             = 0.0004

[State -2:          Bgpalfx]
type                = Bgpalfx
trigger1            = roundstate=0
time                = 1
add                 = ceil(-255*fvar(1)),-255*fvar(1),-255*fvar(1)

[State 191, 1] ;Freeze animation until PreIntro is over
type = ChangeAnim
trigger1 = RoundState = 0
value = 190

[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 = 0

with this as result:

http://tinypic.com/view.php?pic=29lk2ed&s=3

am i missing something here?
Spoiler (click to show)

QuoteLord Canti Says:
i was playing FFVII and I accidently named Red XIII Cyanide D:

Bastard Mami

the value in the var add is too small, try using soething like 0.05 and the adjust it.

also, since you want to start in black, and then make it normal, you might want to slightly alter the code

; Introduction
; CNS difficulty: basic
; CNS ƒŒƒxƒ‹: Šî–{
[Statedef 191]
type = S
ctrl = 0
anim = 190
velset = 0,0

[State -2:          Bgpalfx]
type                = varset
trigger1            = roundstate=0
trigger1            = time =1
fvar(1)             = 1 no idea what you are doing here, iirc you should have started it at 0, though for the changed effect, 1 is right.

[State -2:          Bgpalfx]
type                = varadd
trigger1            = roundstate=0
trigger1            = time > 20
fvar(1)             = -0.0004

[State -2:          Bgpalfx]
type                = Bgpalfx
trigger1            = roundstate=0
time                = 1
add                 = ceil(-255*fvar(1)),-255*fvar(1),-255*fvar(1)

[State 191, 1] ;Freeze animation until PreIntro is over
type = ChangeAnim
trigger1 = RoundState = 0
value = 190

[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 = 0

maybe you want to use something other than bgpalfx, since bg palfx only affects the bg.

Rōjenomu

i still dont get it  :'(
tried everthing in the range of 0.03 to 0.07 (with 3 decimals)

isnt it easier to put 1 black sprite in the sff
and trans the anim?
Spoiler (click to show)

QuoteLord Canti Says:
i was playing FFVII and I accidently named Red XIII Cyanide D:

Cyanide

Well, what's happening? Anything, nothing, it's turning white, what?


In M.U.G.E.N there is no magic button

They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance.

Rōjenomu

when i have the fvar set at 0 and add it with ~0,05 i dont see it starting out black but flashes black for like a second
and when i set it as a negative number it changes to white very rapid (like a sudden flash)
Spoiler (click to show)

QuoteLord Canti Says:
i was playing FFVII and I accidently named Red XIII Cyanide D:

Bastard Mami

i overlooked the fact that you don't have a time trigger in your palfx. add a tiem trigger with the same value the one in teh varadd has.