interactive weapons

Started by YoungSamurai5, April 09, 2013, 09:28:40 AM

Previous topic - Next topic

YoungSamurai5

im trying to get it where when p1 gets to a certain distance of a helper then p1 goes into a state where he pretty much picks up the helper(the helper dissapears).

i got the destroyself where the helper dissapears when p2 goes into the state and is at a certain distance.

[State 4090]
type = destroyself
triggerall = parent, stateno = 4091
trigger1 = parentdist X= [-5,5]


but how would i make it to where p1 goes to the state when he is a certain distance from the helper? would i do it in the cmd?
mugen or nothin


Алексей

Just check your distance against your helper's distance like this:


trigger1 = NumHelper(xxx)
trigger1 = abs(helper(xxx),pos x - pos x) < 30

This will trigger when your helper is within 30 pixels of you, P1. Abs is used to normalize the value coming back, so it's independent of the direction you're facing in.

-[Все слова это только слова.]-

YoungSamurai5

thanks this works perfectly. do you think you could help me with one more thing. i put the improper triggers on the hellper to spawn. i dont know the right trigger.

[State -2, Helper]
type = Helper
triggerall = Numhelper(xxxx) = x
trigger1 = time = x
helpertype = normal ;player
name = ""
ID = xxxx
stateno = xxxx
pos = 0,0
postype = p1    ;p2,front,back,left,right
facing = 1
keyctrl = 0
ownpal = 0
supermovetime = 0
pausemovetime = 0
;ignorehitpause =
;persistent =
mugen or nothin


Алексей

That depends on when you want it to spawn. At the beginning of the state, you would use "!time" or "time = 0." If there's some other condition, you have to be more specific. :P

-[Все слова это только слова.]-

YoungSamurai5

Quote from: Алексей on April 09, 2013, 07:54:22 PM
That depends on when you want it to spawn. At the beginning of the state, you would use "!time" or "time = 0." If there's some other condition, you have to be more specific. :P

yes i wanted it to spawn at the begging of the state :) i was trying to make it disappear when p1 goes to a certain state then reappear when p1 goes out of that state but the helper never leaves because of the triggers


[State 4090]
type = destroyself
trigger1 = parent, stateno = 1060
trigger1 = abs(parent,pos x - pos x) < 30

as soon as it destroys it respawns as soon as it destroys basically like it never left because of the triggers in the helper

(i put this in the stance anim)
[State xxxx, Helper]
type = Helper
triggerall = Numhelper(xxxx) = 0
trigger1 = time = 0
helpertype = normal ;player
name = ""
ID = xxxx
stateno = xxxx
pos = 0,0
postype = p1    ;p2,front,back,left,right
facing = 1
keyctrl = 0
ownpal = 0
supermovetime = 0
pausemovetime = 0
;ignorehitpause =
;persistent =
mugen or nothin


Алексей

Is this helper only going to be used in one state? If so, you should be spawning it from the root's state where it's needed. Otherwise, you should spawn it from the negative states, either -2 or -3. Now, in the event that it re-spawns, you should set a var in the parent, using ParentVarSet, right before the helper is destroyed. Then, use this variable in your trigger for the helper. This would only need to be done if you have the helper spawned from the -2 or -3 states.

-[Все слова это только слова.]-