Var questions..

Started by Rōjenomu, November 28, 2007, 03:24:45 AM

Previous topic - Next topic

Rōjenomu

this is to me the most confusing thing when coding
most of the time i read the docs and (by trial and error) i get it
but i get pretty confused using var's

i read that you can set a var with the varset sctrl
and with varadd to change the var's integer (?)
but it's just a number to me which you can alter as it stands now

but how do you link a var with an attack/fx?
for example
lets say you want to slow down a fx with a var every game tick just a little bit till it destroys itself
how can one link the var so mugen understands it's connected with the fx?

another question
does it matter if you set a var in the right statedef?
or does it work for all the codes and you must reset it everytime you wish to use the same value but for another statedef. I thought i read that somewhere

and a final question
might be asked before, but what is the difference between fvar and var?
f is a float and var an integer or something?
is there a big difference between the two and if someone can give an example on where he would rather use a fvar then a var and vice versa, that would clear things up by a lot

sorry for all the questions
but this has been bugging me for quite some time now  :S
Spoiler (click to show)

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

Elix


Cybaster

What Elix said. :P

Quotedoes it matter if you set a var in the right statedef?
or does it work for all the codes and you must reset it everytime you wish to use the same value but for another statedef. I thought i read that somewhere
You set it in a particular statedef so that it's set at the right value at the right moment. But other than that, the variable has its own value and can be used for all the statedefs in the code.

Quotemight be asked before, but what is the difference between fvar and var?
f is a float and var an integer or something?
is there a big difference between the two and if someone can give an example on where he would rather use a fvar then a var and vice versa, that would clear things up by a lot
You answered your first question : fvar is for floats, and var for integers.
You use fvar when you absolutely need floating numbers.
If you use the attackmulset sctrl, you'll definitely use fvar, because you don't want to be able to multiply the danage of the char by only 2, 3, 4,etc. but you mat want to be able to multiply it by 1.2, 1.43 or whatever.

Rōjenomu

ahh yes
i saw that topic before already but thanks for the redirect  :sugoi:

so if i understand correctly you can connect a var with any code you want
for example you can link it with damage, triggers, alpha (for trans and palfx)

hmm i've seen different ways to set a var i think

is this
type = varset
trigger1 = ..
v = 1
value = 1

the same as
type = VarSet
trigger1 = ..
var(1) = 1


ohh i see what you mean about the difference between fvar and var
var only uses round nrs and fvar nrs with significant figures

so if i want to use let's say a damage dampener which takes off 3.33 percent of damage each combohit it would be better to use a fvar with ciels?

QuoteYou set it in a particular statedef so that it's set at the right value at the right moment. But other than that, the variable has its own value and can be used for all the statedefs in the code.

so once you set a var in a statedef
you have to change it to its beginning value in the next state def?




Spoiler (click to show)

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

Makkah

Quoteso if i want to use let's say a damage dampener which takes off 3.33 percent of damage each combohit it would be better to use a fvar with ciels?
Personally, I'm quite bad at actually making these, but from what I've seen there are 2 ways to code them. The first of which uses attackmulset, (if that's the name for it...gah, I haven't touched MUGEN code in a LONG time) in this case, you would not use ceil because you actually want a decimal value by which to multiply your damages, gradually reducing it, and ceil rounds it off to the highest number. The other way uses a formula in every hitdef which factors in the number of hits dealt, and gradually reduce the damage. In this case ceil (or floor) would be used since hitdefs only accept integers.

Quoteso once you set a var in a statedef
you have to change it to its beginning value in the next state def?
If you want the value to be reset, yes, otherwise, no.

Hope that helps.