A coding issue

Started by Lord Mike, August 28, 2011, 07:31:03 PM

Previous topic - Next topic

Lord Mike

Hello. I find myself in the need for help with some coding issue i've been having.
I have this char that has a special fatal ko system. After 7 attacks that are "special" he has the opportunity to use a one shot kill move.
Now, the author enabled some of this specials in combos (you can normally chain 3 of these special attacks with valid effect on the fatal ko system, the rest of the hits will not modify it anymore), but i want to enable it for another combo that probably slipped him.
This system is coded through fvar(1). Which starts at fvar(1)=7, and decreases until fvar(1)=0, point in which you can perform that one shot kill i was talking about. I have searched through all 8 cns files and could not figure out how he modifies this setting, but couldn't find it anywhere. All i found was the initialization.
So, plan B, make the modification manually in the respective statedef, i added conditions and figure i could use a varadd:
[state ]
type=varadd
trigger1=movehit=1
fv=1
value=1

Obviously, this adds 1 to fvar(1)'s value, which is not good, and it's not what i want since fvar(1) decreases from 7 to 0, adding 1 would head me in the opposite way.
So i figured i could use value=-1, but nothing happened.
And this brings me to my question: how do i decrease fvar(1)?
何故諦める必要がある? 何を迷うことがある奪い取れ。今は悪魔が微笑む時代なんだ。

Rajaa Retired


Lord Mike

Twas the first thing i've tried. :)
fvar(1) is only mentioned in statedef -3:
[[state ]
type=varset
trigger1=roundsexisted
trigger1=!roundstate
trigger1=var(1)&8388608
trigger2=fvar(1)>=7
trigger3=!roundstate
trigger3=var(1)&268435456
fvar(1)=7
何故諦める必要がある? 何を迷うことがある奪い取れ。今は悪魔が微笑む時代なんだ。

Rajaa Retired

If that's the only mention of fvar(1), and there is no varrangeset or fvar(1):=blah, then I don't know how it's decreasing and preventing itself from being decreased.

Did you check the .cmd file?

Lord Mike

In the *.cmd file fvar(1) is mentioned in 2 nulled states.
何故諦める必要がある? 何を迷うことがある奪い取れ。今は悪魔が微笑む時代なんだ。

Rajaa Retired


Lord Mike

#6
Here they are:
;--------------星取りリセット
[state ]
type=null
trigger1=!numtarget
trigger1=var(7)!=anim||movetype!=a||animelem=1,=1||!animtime
trigger1=var(2):=0||var(5):=0
[state ]
type=null
triggerall=var(6):=0||fvar(1)>0
triggerall=movehit=1
triggerall=var(5)<3
;-------衝破(腕)
trigger1=anim=1400+anim%5&&!(var(2)&1)
trigger1=var(1)&256||var(4)
trigger1=1||var(6):=(var(1)&256&&!(var(1)&512))*(var(5)<=2)
trigger1=1||var(6):=var(6)+!!var(4)*(var(5)+var(6)<=2)
trigger1=fvar(1):=fvar(1)-var(6)||var(2):=(var(2)+1)||var(5):=var(5)+var(6)||var(1):=var(1)+512*!!(var(1)&256)*!(var(1)&512)
;-------爆星(腕)
trigger2=anim=1500+anim%5&&!(var(2)&4)
trigger2=var(1)&256||var(4)
trigger2=1||var(6):=(var(1)&256&&!(var(1)&512))*(var(5)<=2)
trigger2=1||var(6):=var(6)+!!var(4)*(var(5)+var(6)<=2)
trigger2=fvar(1):=fvar(1)-var(6)||var(2):=(var(2)+4)||var(5):=var(5)+var(6)||var(1):=var(1)+512*!!(var(1)&256)*!(var(1)&512)
;-------不退
trigger3=anim=1000+anim%5&&!(var(2)&32)
trigger3=var(1)&256||var(4)
trigger3=1||var(6):=(var(1)&256&&!(var(1)&512))*(var(5)<=2)
trigger3=1||var(6):=var(6)+!!var(4)*(var(5)+var(6)<=2)
trigger3=fvar(1):=fvar(1)-var(6)||var(2):=(var(2)+32)||var(5):=var(5)+var(6)||var(1):=var(1)+512*!!(var(1)&256)*!(var(1)&512)
;------不媚
trigger4=(anim=[1100,1201])&&!(var(2)&64)
trigger4=var(1)&256||var(4)
trigger4=1||var(6):=(var(1)&256&&!(var(1)&512))*(var(5)<=2)
trigger4=1||var(6):=var(6)+!!var(4)*(var(5)+var(6)<=2)
trigger4=fvar(1):=fvar(1)-var(6)||var(2):=(var(2)+64)||var(5):=var(5)+var(6)||var(1):=var(1)+512*!!(var(1)&256)*!(var(1)&512)
;------不省
trigger5=(anim=[1300,1351])&&!(var(2)&128)&&palno<10
trigger5=var(1)&256||var(4)
trigger5=1||var(6):=(var(1)&256&&!(var(1)&512))*(var(5)<=2)
trigger5=1||var(6):=var(6)+!!var(4)*(var(5)+var(6)<=2)
trigger5=fvar(1):=fvar(1)-var(6)||var(2):=(var(2)+128)||var(5):=var(5)+var(6)||var(1):=var(1)+512*!!(var(1)&256)*!(var(1)&512)
;------彷翔
trigger6=(anim=[2000,2051])&&!(var(2)&256)
trigger6=1||var(6):=(var(1)&256&&!(var(1)&512))*(var(5)<=1)
trigger6=1||var(6):=var(6)+!!var(4)*(var(5)+var(6)<=1)
trigger6=fvar(1):=fvar(1)-var(6)-1||var(2):=(var(2)+256)||var(5):=var(5)+var(6)+1||var(1):=var(1)+512*!!(var(1)&256)*!(var(1)&512)
;------ヘヴィ
trigger7=anim=730+anim%5&&!(var(2)&512)
trigger7=fvar(1):=fvar(1)-1||var(2):=(var(2)+512)||var(5):=var(5)+1
;------バニ
trigger8=anim=760+anim%5&&!(var(2)&1024)
trigger8=fvar(1):=fvar(1)-1||var(2):=(var(2)+1024)||var(5):=var(5)+1
;------溜めバニ
trigger9=anim=765+anim%5&&!(var(2)&2048)
trigger9=fvar(1):=fvar(1)-1||var(2):=(var(2)+2048)||var(5):=var(5)+1
;------6A
trigger10=anim=700+anim%5&&var(4)
trigger10=fvar(1):=fvar(1)-1||var(5):=var(5)+1
;------6B
trigger11=anim=710+anim%5&&var(4)
trigger11=fvar(1):=fvar(1)-1||var(5):=var(5)+1
;------掴み投げ
trigger12=anim=740+anim%5
trigger12=fvar(1):=fvar(1)-1
;------不省(アレンジモード)
trigger13=(anim=[1300,1351])&&!(var(2)&128)&&palno>9
trigger13=1||var(6):=(var(1)&256&&!(var(1)&512))*(var(5)<=1)
trigger13=1||var(6):=var(6)+!!var(4)*(var(5)+var(6)<=1)
trigger13=fvar(1):=fvar(1)-var(6)-1||var(2):=(var(2)+128)||var(5):=var(5)+var(6)||var(1):=var(1)+512*!!(var(1)&256)*!(var(1)&512)


[state ]
type=null
triggerall=var(5)<3
;衝破
trigger1=!projhittime(1450)&&!(var(2)&2)&&var(4)
trigger1=fvar(1):=fvar(1)-1||var(2):=(var(2)+2)||var(5):=var(5)+1
trigger2=!projhittime(1451)&&!(var(2)&2)&&!(var(1)&512)
trigger2=1||var(6):=(var(5)<=2)
trigger2=1||var(6):=var(6)+!!var(4)*(var(5)+var(6)<=2)
trigger2=fvar(1):=fvar(1)-var(6)||var(2):=(var(2)+2)||var(5):=var(5)+var(6)||var(1):=var(1)+512*!!(var(1)&256)*!(var(1)&512)
;爆星
trigger3=!projhittime(1550)&&!(var(2)&8)&&var(4)
trigger3=fvar(1):=fvar(1)-1||var(2):=(var(2)+8)||var(5):=var(5)+1
trigger4=!projhittime(1551)&&!(var(2)&8)&&!(var(1)&512)
trigger4=1||var(6):=(var(5)<=2)
trigger4=1||var(6):=var(6)+!!var(4)*(var(5)+var(6)<=2)
trigger4=fvar(1):=fvar(1)-var(6)||var(2):=(var(2)+8)||var(5):=var(5)+var(6)||var(1):=var(1)+512*!!(var(1)&256)*!(var(1)&512)
;槍
trigger5=!projhittime(1650)&&!(var(2)&16)&&var(4)
trigger5=fvar(1):=fvar(1)-1||var(2):=(var(2)+16)||var(5):=var(5)+1
trigger6=!projhittime(1651)&&!(var(2)&16)&&!(var(1)&512)
trigger6=1||var(6):=(var(5)<=2)
trigger6=1||var(6):=var(6)+!!var(4)*(var(5)+var(6)<=2)
trigger6=fvar(1):=fvar(1)-var(6)||var(2):=(var(2)+16)||var(5):=var(5)+var(6)||var(1):=var(1)+512*!!(var(1)&256)*!(var(1)&512)
;十字陵1
trigger7=!projhittime(2205)&&var(4)
trigger7=fvar(1):=fvar(1)-1||var(5):=var(5)+1
;十字陵2
trigger8=!projhittime(2220)
trigger8=fvar(1):=fvar(1)-1||var(5):=var(5)+1
;十字陵3
trigger9=!projhittime(2206)
trigger9=fvar(1):=fvar(1)-1||var(5):=var(5)+1
[state ]
type=varset
trigger1=fvar(1)<0
fvar(1)=0


What i wanna do is shown here: http://lordmikehnk.blogspot.com/2011/08/combo-error.html

But since i can't understand what is going on there, can't i decrease that fvar with my own set of triggers?
何故諦める必要がある? 何を迷うことがある奪い取れ。今は悪魔が微笑む時代なんだ。

Rajaa Retired

That's how he's controlling the variables. Unlike what you thought before, the system isn't as simple as fvar(1), it's MUCH MORE complex than that. It's pretty impractical for me to try to decipher that because I don't know what each variable does. You'd need to sit down, retrace every variable you see there, and connect the dots. Well, maybe not every one, but a few of them.

fvar(1) := blah

That means to set the variable to whatever appears in the place of "blah."

Good luck with that.

Lord Mike

That's what i am trying. But that fvar(1) only shows in the bits i've posted, and except for that part in statedef -3, in statedef -1 it shows up in a null state.

The tracing part is what kills me. All his attacking states have a varset like that, with vars depending on vars depending on vars, and it's hard for me to trace and understand which is which and who does what and where...
For instance, this is a state that automatically decreases fvar(1) by 1 unit:
;------------ヘヴィストライク
[statedef 730]
movetype=a
[state ]
type=changeanim
trigger1=anim!=730
value=730
[state ]
type=turn
trigger1=animelem=1
trigger1=(var(1):=var(1)+4*(facing*(enemynear(!enemynear,alive&&numenemy>1&&enemynear(numenemy>1),alive),pos x-pos x)<0))&4
[state ]
type=explod
trigger1=animelem=1
id=735
anim=735
scale=.5,.5
removetime=-2
pos=-40,-85
sprpriority=2
ownpal=1
trans=add
[state ]
type=explod
trigger1=animelem=4
id=100
anim=6100
scale=.5,.5
pos=0,0
removetime=-2
sprpriority=1
ownpal=1
[state ]
type=varset
trigger1=animelem=4,>=0&&animelem=7,<0
sysfvar(2)=11.5
[state ]
type=playsnd
trigger1=animelem=1
value=s730,0
volume=255
[state ]
type=playsnd
trigger1=animelem=1
value=s730,1
channel=0
[state ]
type=playsnd
trigger1=animelem=8
value=s200,3
[state ]
type=varadd
trigger1=animelem=6
trigger1=var(0)<(var(1)&1)
var(1)=-(var(1)&2)
[state ]
type=hitdef
trigger1=var(0)<(var(1)&1)&&!(var(1)&2)
attr=s,na
hitflag=maf
guardflag=
damage=ifelse(6*5.6*fvar(10)*fvar(16)>6,ceil(6*5.6*fvar(10)*fvar(16)),6),0
getpower=ceil(1000*(.12+fvar(17))*fvar(10))*ifelse(var(1)&128,.6,1)*(fvar(18)<=0),ceil(1000*(.12+fvar(17))*fvar(10))*ifelse(var(1)&128,.6,1)*(fvar(18)<=0)
givepower=ceil(500*.12*fvar(10))*ifelse(var(1)&128,.6,1),ceil(333*.12*fvar(10))*ifelse(var(1)&128,.6,1)
animtype=hard
priority=7,hit
pausetime=0,13+4*!!var(4)
ground.hittime=17+(enemynear,statetype=c)
ground.slidetime=17+(enemynear,statetype=c)
guard.hittime=15+(enemynear,statetype=c)
ground.velocity=-3,-12.5
air.hittime=0
air.velocity=-3*!(var(1)&256),ifelse(var(1)&256,-6.6,-12.5)
fall=1
yaccel=ifelse(enemynear,statetype=a&&!(var(1)&256),.9,.6)+fvar(0)
fall.recovertime=45+6*!!var(4)
ground.cornerpush.veloff=0
sparkno=-1
hitsound=-1
guard.sparkno=-1
guardsound=-1
kill=0
[state ]
type=selfstate
trigger1=!animtime
value=0


However, fvar(1) is not mentioned here...
何故諦める必要がある? 何を迷うことがある奪い取れ。今は悪魔が微笑む時代なんだ。

Rajaa Retired

That's because it's primarily managed in the null states you posted. It probably has something to do with var(1). You're just going to need to study his system and figure out how things work. Nothing more to be said, really. =p

Cyanide

No. We cannot really assist with your overall desire. We can assist with bits of it. For example, as Rajaa has done, we can inform you that fvar(1) := is assigning values to fvar(1). However we cannot give you all the info.

As you trace things back we can help you with how to do that, or even how a specific varset is working, but you'll be doing most of it.

I would suggest to start, break down the fvar(1) := lines in the CMD to see what sort of values are being used. Pick some abitrary values for the variables already in there and run with it. You may have to break some things to figure it out.


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.