YesNoOk
avatar

hoverboard move. (Read 1225 times)

Started by BC, September 19, 2008, 07:46:09 pm
Share this topic:

BC

hoverboard move.
#1  September 19, 2008, 07:46:09 pm
  • ****
    • UK
    • www.mugenevolution.co.uk/Forum
im helping a friend code a move

basically he has a hoverboard that will hover above the floor during the course of the round....which will be available to jump on or off it.


when he is standing on it then ill need to make it invisible as sprites have him standing on the hoverboard already.

so my questions

-how would i go about making the hoverboard available each round? would i code a helper under statedef - 2
(i tried this, and it kept repeating the animation, so i changed it to persistent = 0 which worked, but then i was doing an air jump it kept repeating the animation)(figure i need to use numhelper(blah) = 0)

-how would i got about over riding the walking, Turn, crouch, basically all the movement animations? would i use a variable in each of them, like var(10) != 1 or whatever, and the 1 being anim = 10000 which could be him on the board?

-or is there a completely different approach to this?

also when i get him to jump on the hoverboard, do i just flag it as invisible using assertspecial when he goes into that state or animation?(making it invisible as stated above because he has sprites drawn with him on the hoverboard)
click the image to join my forum ;)
Last Edit: September 19, 2008, 08:21:21 pm by blackchaos07
Re: hoverboard move.
#2  September 19, 2008, 07:59:09 pm
  • ******
  • [E]
    • Mexico

  • Online
use a var in the character to know whether or not you are on the board; varX = 1 if on board, 0 if off of it., in state5900 reset it to 0.

for ease of coding you need states for getting on/off the board.

knowing how helpers act in mugen, in st-2 create the helper, use as triggers varX=0 (off the board) and
numhelperID=0 ; using whichever id you gave to the board.

in the change anims in the walking, etc.. states, add the variable as a condition to change to a different anim.

[EDIT]

I am not going into any detail on the last part because you did not specify how would the board move.

BC

Re: hoverboard move.
#3  September 19, 2008, 08:01:02 pm
  • ****
    • UK
    • www.mugenevolution.co.uk/Forum
ah ok thats alot easier than i thought thanks :)

one question what would the trigger be for the varset?


p.s your right i didnt.

i want the board to move along the ground back and forth, like walking, and be able to just jump(and air jump)



EDIT: so whats the varset trigger? the stateno of himon the board when it equals 1?

also where do i set the var? state -1, -2, -3?   state 0? lol
click the image to join my forum ;)
Last Edit: September 19, 2008, 08:16:42 pm by blackchaos07

BC

Re: hoverboard move.
#4  September 19, 2008, 08:30:20 pm
  • ****
    • UK
    • www.mugenevolution.co.uk/Forum
ok heres what i got so far(the board now shows)

[mcode][statedef -2]

[State -2, Helper]
type = Helper
triggerall = var(10)=0
trigger1 = NumHelper(10000)=0
helpertype = normal
name = "hoverboard"
ID =  10000
stateno = 10000
pos = -59,0
postype = p1
facing = 1
keyctrl = 0
ownpal = 1
supermovetime = 9999999
pausemovetime = 9999999[/mcode]

[mcode][State 0, VarSet]
type = VarSet
trigger1 = stateno = 11000
v = 10
value = 1 

[State 0, VarSet]
type = VarSet
trigger1 = stateno = 0
v = 10
value = 0[/mcode]

i set the variable to equal 1 when state number is 11000 which is him on the board. correct?

and to 0 when he is in stance?


[mcode][statedef 10000]
type = A
physics = N
anim = 10000
ctrl = 0
sprpriority = -6

[State 10000, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA
time = 1[/mcode]

helper state.


it shows up fine at the moment, was my variable triggers ok?


or for the value could i just use ifelse(stateno = 11000,1,0)



EDIT: also something else i need help with, say i want the command of hopping on to the hoverboard as hard punch(Z) how would i code it so that he sucessfully jumps on the board when near it?........like he'll just jump and land on the floor if not near it....how does he identify, say where the board is?
click the image to join my forum ;)
Last Edit: September 19, 2008, 08:47:55 pm by blackchaos07
Re: hoverboard move.
#5  September 19, 2008, 10:43:33 pm
  • ******
  • [E]
    • Mexico

  • Online
use helper(10000), posX and compare it with yours; same for Y.

BC

Re: hoverboard move.
#6  September 19, 2008, 11:17:12 pm
  • ****
    • UK
    • www.mugenevolution.co.uk/Forum
do i set the variables in state -2?


also what are the triggers for the varsets?


ok scrap that, lets start again, coz im over tired and confusing myself

right step 1

i wanna use state 900 as the hop on board state.....

state 901 as on the board....(in which ill have to make the helper invisible because it has sprites on the board already)

state 902 jumping off the board.


i coded the helper with the trigger1's as numhelper(10000)=0 and also trigger1 as var(1)=0

where do i set these variables......

and when i code the helper state do i get it to change to a blank anim state when rootdist x = [-10,10](when the player is right near the board) (gave it a better range of -10,10 instead of 0

im just stuck on how to go about all of this,.......its confusing me


click the image to join my forum ;)
Last Edit: September 19, 2008, 11:31:03 pm by blackchaos07
Re: hoverboard move.
#7  September 19, 2008, 11:23:02 pm
  • ******
  • [E]
    • Mexico

  • Online
do not set them in negative states, make it so if helperdist in the parent's cmd is in a certain range, the chaarcter changes to the "hopping up" state, and use the varset in there, same for coming down.

BC

Re: hoverboard move.
#8  September 20, 2008, 03:54:36 pm
  • ****
    • UK
    • www.mugenevolution.co.uk/Forum
is helperdist a trigger? couldnt find it in the docs.......  also "parent's cmd"? did you mean cns?


how i check p1's distance for a helper is use rootdist which ive used, how would i check a helpers distance for p1?
click the image to join my forum ;)
Re: hoverboard move.
#9  September 20, 2008, 04:15:41 pm
  • ******
  • [E]
    • Mexico

  • Online
helperdist is Abs( (pos x)- (helper(10000), pos X) ) , if that value is < let's say 40 you have something in your cmd like:

[State -1]
type = ChangeState
value = 620
triggerall = command = "z"
trigger1 = ctrl = 1
trigger1 = Abs( (pos x)- (helper(10000), pos X) ) < 40


620 is a state in which your char hops into the hover.

BC

Re: hoverboard move.
#10  September 20, 2008, 04:40:50 pm
  • ****
    • UK
    • www.mugenevolution.co.uk/Forum
ok thnks for that, finally im getting somewhere, the move isnt complete yet, but so far so good.

obv i havent used state 620, as thats jump strong punch, so instead i used 6000.
click the image to join my forum ;)

BC

Re: hoverboard move.
#11  September 20, 2008, 05:09:41 pm
  • ****
    • UK
    • www.mugenevolution.co.uk/Forum
i think im making this out to be more difficult than it is, but im a little stuck still....... :-\

apologies for my slowness lol, this is something ive never coded before.

ok ill break down what i have so far.

helper code
[mcode][State -2, Helper]
type = Helper
trigger1 = NumHelper(10000)=0
trigger1 = var(1)=0
helpertype = normal
name = "hoverboard"
ID =  10000
stateno = 10000
pos = -59,0
postype = p1
facing = 1
keyctrl = 0
ownpal = 1
supermovetime = 9999999
pausemovetime = 9999999[/mcode]


helper state
[mcode][statedef 10000]
type = A
physics = N
ctrl = 0
anim = 10000
sprpriority = -6

[State 10000, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA
time = 1
[/mcode]

not sure if that needed a changestate.........? because i need the helper to dissapear when on the board...as i explained before, the sprites have him already on the board.


hop on state(UNFINISHED)
[mcode][statedef 6000]
type = S
physics = S
movetype = I
ctrl = 0
anim = 900
sprpriority = 2

[State 6000, StateTypeSet]
type = StateTypeSet
trigger1 = time = 0
statetype = A
physics = N

[State 6000, VelSet]
type = VelSet
trigger1 = time = 0
x = 0
y = -11

[State 6000, StateTypeSet]
type = StateTypeSet
trigger1 = time = 5
physics = A

[State 6000, VelSet]
type = VelSet
trigger1 = time = 5
x = 0
y = 0[/mcode]

ok this is the hop on state, basically when near the helper pressing Z makes him jump up like a hop then land again.


what my problem is, and apologies if you already mentioned, what is the trigger for the varset in state 6000(hopping state)

and does this state need a changestate.

click the image to join my forum ;)
Re: hoverboard move.
#12  September 20, 2008, 05:43:29 pm
  • ******
  • [E]
    • Mexico

  • Online
the trigger is how you want ti to be, you can use animtime= 0, like

type = varsert
trigger1 = animtime=0
var(1) = 1

about the changestate it depends on who do you want him to move while on the hover, so explain that next.

BC

Re: hoverboard move.
#13  September 20, 2008, 06:04:47 pm
  • ****
    • UK
    • www.mugenevolution.co.uk/Forum
ok, also when jumping up, when he reaches a certain height(on the way down......... 4.84 y vel exactly i want him to change to the "on board animation"....then for the board to dissapear. while in that animation.


basically he will move back and forwards while on the board.......also be allowed to jump and air jump........thats about it.....crouching might be allowed on the board too ill have to ask the creator that bit(crouch).

also forgot to mention.......when he is hit by the opponent he will fall off the board also.



reason for the Vel Y value is because the helper is hovering above the ground.
click the image to join my forum ;)
Last Edit: September 20, 2008, 08:02:16 pm by blackchaos07

BC

Re: hoverboard move.
#14  September 20, 2008, 08:32:28 pm
  • ****
    • UK
    • www.mugenevolution.co.uk/Forum
EDIT: got him on and off the board.

now all i need help with is the movement. how to make him move back and foth from his position(pos Y = -20)


EDIT2:

another problem. Z makes him jump on the board.........using normal jump while in the air above the board if you press Z itll land in mid air

click the image to join my forum ;)
Last Edit: September 20, 2008, 08:40:05 pm by blackchaos07
Re: hoverboard move.
#15  September 20, 2008, 08:49:16 pm
  • ******
  • [E]
    • Mexico

  • Online
fr problem 2 add stateype!= A in the cmd triggers.

about the movement, you will have to explain exactly how you want him to move, in the meanwhile, just play around with satte0 and state 20 in common1.cns (put a copy of that file in your character's folder).

BC

Re: hoverboard move.
#16  September 21, 2008, 12:35:19 am
  • ****
    • UK
    • www.mugenevolution.co.uk/Forum
ok im having problems overriding the walking state.

[mcode][Statedef 20]
type    = S
physics = S
sprpriority = 0

[State 20, 1]
type = VelSet
trigger1 = command = "holdfwd"
x = const(velocity.walk.fwd.x)

[State 20, 2]
type = VelSet
trigger1 = command = "holdback"
x = const(velocity.walk.back.x)

[State 20, 3]
type = ChangeAnim
triggerall = var(1)=0
triggerall = vel x > 0
trigger1 = Anim != 20 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0
value = 20

[State 20, 4]
type = ChangeAnim
triggerall = var(1)=0
triggerall = vel x < 0
trigger1 = Anim != 21 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0
value = 21

[State 20, 3]
type = ChangeAnim
triggerall = var(1)=1 && anim = 900
triggerall = vel x > 0
trigger1 = Anim != 950 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0
value = 950

[State 20, 4]
type = ChangeAnim
triggerall = var(1)=1
triggerall = vel x < 0
trigger1 = Anim != 951 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0
value = 951[/mcode]

var(1) is set to 1 when on the board. so i thought when var(1) = 1 he can use anims 950 for move forward on the board and 951 for move back.  and i set var(1) to 0 in state 0, so he can use 20 and 21.

well when on the board he still uses anim 20 and 21 for move forward and back.




EDIT: nmv figured it out. the varset was in the wrong place.  setting var(1) to equal 0 needed to be put into the jumping off board state.

click the image to join my forum ;)
Last Edit: September 21, 2008, 12:43:34 am by blackchaos07

BC

Re: hoverboard move.
#17  September 21, 2008, 12:46:48 am
  • ****
    • UK
    • www.mugenevolution.co.uk/Forum
ok now when i dismount from the board, the helper appears back where it started.

how do i change it so that it appears wherever i dismount?

at the start of each round it appears here

pos = -59,0
postype = p1


when i dismount it appears there again.
click the image to join my forum ;)
Re: hoverboard move.
#18  September 21, 2008, 12:55:33 am
  • ******
  • [E]
    • Mexico

  • Online
make the helper using teh sae Id, but in the dismount state.

BC

Re: hoverboard move.
#19  September 21, 2008, 01:08:45 am
  • ****
    • UK
    • www.mugenevolution.co.uk/Forum
state -1 of the dismount

or 6002(dismount state)

 i didnt quite understand what you mean by make the helper use the same id in the dismount state.

i have given the helper the id of 10000......so what do i exactly code in the dismount state?, be it -1 or 6002.



p.s what trigger do i give when i want him to turn when passing p2?(i knew it but forgot lol)
click the image to join my forum ;)
Re: hoverboard move.
#20  September 21, 2008, 01:17:03 am
  • ******
  • [E]
    • Mexico

  • Online
in 6002.

the trigger is p2dist <0 , the sctrl is named turn.

BC

Re: hoverboard move.
#21  September 21, 2008, 01:32:26 am
  • ****
    • UK
    • www.mugenevolution.co.uk/Forum
ok the turn works good thanks.(although you missed out the X  in the trigger :P)


what am i exactly coding in state 6002


am i coding the helper again?.....

i didnt really understand what you meant
click the image to join my forum ;)
Re: hoverboard move.
#22  September 21, 2008, 04:54:15 am
  • ******
  • [E]
    • Mexico

  • Online
the hopdown state, is not it ? you just create the helper 10000 again when you hop down of it.

BC

Re: hoverboard move.
#23  September 21, 2008, 12:43:18 pm
  • ****
    • UK
    • www.mugenevolution.co.uk/Forum
yup thats the hop down state but the problem is

in the helper state the changestate is:

[mcode][State 10000, ChangeState]
type = ChangeState
trigger1 = root,pos y = -20
value = 19000
ctrl = 0[/mcode]


and in statedef 19000 which is the invisible animation state for the helper i have...


[mcode][State 10000, ChangeState]
type = ChangeState
trigger1 = root,pos y = 0
value = 10000
ctrl = 0[/mcode]


so when im dismounted the invisible helper state goes back to 10000 in which the board appears to its original state.


and also in the dismount state (6002) adding the same helper, wont appear because of the trigger numhelper(10000) = 0.....the helper already exisits all the way through doesnt it?
click the image to join my forum ;)
Re: hoverboard move.
#24  September 21, 2008, 07:57:38 pm
  • ******
  • [E]
    • Mexico

  • Online
oh, I tought you were killing the helper while mounted on it.

BC

Re: hoverboard move.
#25  September 21, 2008, 08:14:31 pm
  • ****
    • UK
    • www.mugenevolution.co.uk/Forum
no i was just putting it in a invisible state.

but then again killing it wouldnt be a bad idea right?


EDIT: ok instead of the changestate i just deleted the invisible state, changed the helper changestate to a destroyself then in the dismount added the helper works perfect ;)
click the image to join my forum ;)
Last Edit: September 21, 2008, 08:17:47 pm by blackchaos07

BC

Re: hoverboard move.
New #26  September 21, 2008, 08:22:10 pm
  • ****
    • UK
    • www.mugenevolution.co.uk/Forum
ok debuged it and got an error.

warning player dan emp(33) in state 6001 has no helper 10000.   (6001 = on board state)


only happens when i press Z

think i know why, seeing as the helpers are using the same ID and stateno........... i asked the first helper to be destroyed, when the roots position Y is lvl on the ground.

so that destroys the helper i need to appear on the dismount frame.


so mayb i need to give the helper the same id but a different stateno right?



EDIT: ok that didnt make much difference. done the same,   although the move works why the debug error


EDIT": Fixed it.......kept the invisible state just used a destroy self so it doesnt go back to the original helper state, then kept the other helper in the dismount state........works great with no debug error erm............yay? lol
click the image to join my forum ;)
Last Edit: September 21, 2008, 08:40:56 pm by blackchaos07