News:

MFG's Character of the Month: October 2026 Nominations

Main Menu

How to turn varadd off?

Started by Zankai99, January 25, 2014, 06:24:03 PM

Previous topic - Next topic

Zankai99

So basically my var add on code for a sharingan mode is :
[State 0, VarAdd] ;Sharingan on
type = VarAdd
trigger1 = !var(10)
v = 10    ;fv =
value = 1
so how do i turn it off now?

Websta

Well you can't exactly "turn it off", you can however have it stop adding. I'm not sure how your move works, or what it's supposed to do but you can change the trigger to "time = 0". Maybe that'll help?

Zankai99

Quote from: Websta on January 25, 2014, 06:29:57 PM
Well you can't exactly "turn it off", you can however have it stop adding. I'm not sure how your move works, or what it's supposed to do but you can change the trigger to "time = 0". Maybe that'll help?

I was trying to learn vars and all and the moves pretty simple like when i press "x" sasuke turns to his sharingan form and when i press "x" again he goes back to normal
but i pretty much screwed it up.

Websta

I suggest using Varset rather than Varadd for that.

Zankai99

Quote from: Websta on January 25, 2014, 06:39:24 PM
I suggest using Varset rather than Varadd for that.

Tried it but like i said i do not know how to turn it off

vgma2

What you want is basically a variable that turns on and off depending on the form right?

Use "VarSet" to set your variable to 1, thus turning it "on".
Use it again when you want, to set your variable to 0, thus turning it "off".

Cybaster

Turn off what ? A variable ? THat doesn't make any sense.

All variables have a certain value, that usually starts at 0.
Then, through a bunch of varsets and varadds, depending on moves and triggers, the value of the variable can change.

For example, a varset can set var(30) to 5 :

type = varset
trigger1 = !time
var(30) = 5


And a varadd can add 1 to var(27) each tick, until var(27)=50

type = varadd
trigger1 = var(27) < 50
var(27) = 1


So basically, you change the values of the variables, but you can't "destroy" them or "turn them off".
You can set their value back to 0 though.

Zankai99

Quote from: Cybaster on January 26, 2014, 12:23:09 PM
You can set their value back to 0 though.
Thats what i meant
but the problem is i tried turning the value to 0
and in mugen when i activate var(10) = 1 it stays like that and i cant make it var(10) = 0 :\

Infinite Daze

Post the var's and triggers you are using.

Zankai99

[Statedef 1100]
type = S
ctrl = 0
velset = 0,0
anim = 1100
movetype = I
physics = S
sprpriority = 2

[State 0, Helper]
type = Helper
trigger1 = AnimElem = 3
helpertype = normal ;player
name = "Sharingan"
ID = 556
stateno = 556
pos = 4,-58
postype = p1    ;p2,front,back,left,right
facing = 1
keyctrl = 0
ownpal = 0
supermove
pausemove
size.xscale = 0.4
size.yscale = 0.4

[State 0, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 1
value = S4,7
volume = 0
channel = -1

[State 0, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 3
value = S4,6
volume = 0
channel = -1

[State 1, VarAdd]
type = VarAdd
trigger1 = !var(1)
v = 1    ;fv = 10
value = 1

[State 1100, 1]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1
so when ever i do this move it goes to var(1) = 1
but i can get var(1) = 0 when i press the same button again
Sorry for bothering all you because im just that dump :\

Infinite Daze

#10
Quote from: Zankai99 on January 26, 2014, 05:18:06 PM
[Statedef 1100]
type = S
ctrl = 0
velset = 0,0
anim = 1100
movetype = I
physics = S
sprpriority = 2

[State 0, Helper]
type = Helper
trigger1 = AnimElem = 3
helpertype = normal ;player
name = "Sharingan"
ID = 556
stateno = 556
pos = 4,-58
postype = p1    ;p2,front,back,left,right
facing = 1
keyctrl = 0
ownpal = 0
supermove
pausemove
size.xscale = 0.4
size.yscale = 0.4

[State 0, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 1
value = S4,7
volume = 0
channel = -1

[State 0, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 3
value = S4,6
volume = 0
channel = -1

[State 1, VarAdd]
type = VarAdd
trigger1 = !var(1)
v = 1    ;fv = 10
value = 1

[State 1100, 1]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1
so when ever i do this move it goes to var(1) = 1
but i can get var(1) = 0 when i press the same button again
Sorry for bothering all you because im just that dump :\
That  is because of your trigger on the varadd
trigger1 = !var(1)

!var(1)=not equal to var(1) or no var(1). var(1)=0 is not equal to var(1)
so even if you had you var(1) set to =0 it would always add to that var(1) because of your trigger !var(1).

Is the purpose of your var(1) for your Sharingan helper?

Zankai99

Quote from: Infinite Crisis on January 26, 2014, 05:30:59 PM
Quote from: Zankai99 on January 26, 2014, 05:18:06 PM


!var(1)=not equal to var(1) or no var(1). var(1)=0 is not equal to var(1)
so even if you had you var(1) set to =0 it would always add to that var(1) because of your trigger !var(1).

Is the purpose of your var(1) for your Sharingan helper?

well no, a friend of mine was gonna teach me sharingan transformation so that i could use different attacks when im in the sharingan mode and when i press the transforming button again he would deactivate his sharingan and go back to normal

Infinite Daze

So is var(1) your sharingan mode?

Zankai99

Quote from: Infinite Crisis on January 26, 2014, 05:55:29 PM
So is var(1) your sharingan mode?

yeah var(1) = 1 is the sharingan mode

Infinite Daze

Do you have a varset for the var(1) and a var(1) countdown set for him in his -2 statedef or something?

Zankai99

Quote from: Infinite Crisis on January 26, 2014, 07:16:36 PM
Do you have a varset for the var(1) and a var(1) countdown set for him in his -2 statedef or something?

uhhh noo

Infinite Daze

So is this the move that is supposed to activate/deactivate his Sharingan?

Infinite Daze

I think this is what you are trying to do...
[State 0, VarSet]
type = VarSet ;Use a varadd when you want to add or subtract to an existing var otherwise you should use a varset.
trigger1 = !time ;or whatever animelem you want the var to start
var(1)=Ifelse(var(1)=1,0,1) ; basically if var(1)/ sharingan mode is already active it will deactivate, if it is not active it will activate. 
ignorehitpause=1

Zankai99

Quote from: Infinite Crisis on January 27, 2014, 04:05:22 AM
I think this is what you are trying to do...
[State 0, VarSet]
type = VarSet ;Use a varadd when you want to add or subtract to an existing var otherwise you should use a varset.
trigger1 = !time ;or whatever animelem you want the var to start
var(1)=Ifelse(var(1)=1,0,1) ; basically if var(1)/ sharingan mode is already active it will deactivate, if it is not active it will activate. 
ignorehitpause=1

Thnx bro it worked ^__^
if i could rep+ you i would
and another help bro
can you show me an example for coding a move in sharingan form as in like the hitdef part like trigger = what?

QuickFist

You mean damage increased by the sharingan?