News:

MFG's Character of the Month: September 2026 Voting

Main Menu

Regarding a problem with a xplod sprite.

Started by dimension_w, November 24, 2007, 01:05:15 AM

Previous topic - Next topic

dimension_w

I have a xplod sprite containing a comic book sound effect = "Eillm", that pops up as my characters runs around. Problem with that is when he faces left the word is backwards. Can any scripting in my [State 100, Eillm] and [State 105, Eillm] sort this problem out? What needs to be typed?

PotS

Try "facing = ifelse(facing=-1, -1, 1)".

Which is the same as saying "facing = facing".
You can help with Ikemen GO's development by trying out the latest development build and reporting any bugs on GitHub.
My Mugen and Ikemen content can also be found here.

dimension_w

Thanks P.O.T.S. It works fine. Can this be applied to Portraits too? On the select screen my portrait looks distorted when its on the right side (p2). Where abouts would I code such a thing to keep it as its displayed on p1?

PotS

That would be in the screenpack's coding, so it's not something you can code your char to change.
You can help with Ikemen GO's development by trying out the latest development build and reporting any bugs on GitHub.
My Mugen and Ikemen content can also be found here.

dimension_w

Oh a shame about the portrait. Suppose I'll have to draw a new one that is suitable for either player. Oh and regarding the xplod, mirroring it on the other side changes its position slightly to p1's side. Is there a similar script to facing = ifelse(facing=-1, -1, 1) that'll help align it to the same position as p1's side? Perhaps something like: pos = ifelse(pos=-1, -1, 1) ? I've tried this and I get a error message.


Byakko

#5
I'm not quite sure an ifelse in the pos parameter would work since ifelse(a,b,c) separates each "member" of the expression with a coma and so does pos, so it might not work properly / crash.
Better just try to put facing in the trigger for the explod, and create two expold controllers, one triggered if facing = -1, the other triggered if facing = 1. With different pos parameters accordingly.

And by the way, you misunderstood facing = ifelse(facing=-1, -1, 1).
"facing" as a trigger refers to that of the character. the parameter "facing" in the explod controller sets the facing of the explod (according to the postype - i.e. set it at -1 and it will be facing the opposite way of the postype you put it at).
If facing (of the character !) equals -1, then set the facing (of the explod !) at -1. Otherwise, set it (the facing of the explod) at 1.
If I struggled to the end of my determination, to the end of my way of life with my followers, if the result is ruin, then this ruin is inevitable. Grieve. Shed tears. But you cannot regret.

dimension_w

Pardon me for being a bit slow. I'm not sure I understood that. Here is the code in question.
So you say I should put facing on a trigger? I don't know what you mean. Here are some framegrabs to show what this script it doing. At the moment.
As you can see, corresponding to the [state 100, Eillm] in pic 1, the "Eillm Text is nicely placed and so is the backwards run [state 105, Eillm] in pic two. But Picture 3 and 4 are the problem. As you can see I've yet to add any code in to tweak the position of the mirrored text (facing = ifelse(facing=-1, -1, 1).




; run_fwd
[statedef 100]
type    = s
physics = s
anim = 100
sprpriority = 1
ctrl = 0

[State 100, Cloud]
type = Explod
trigger1 = time = 0
anim = 107
ID = 107 ; these isnt necesary
pos = -5,-5
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
removetime = -2

[State 100, Eilm]
type = Explod
trigger1 = time = 1
anim = 109
ID = 109 ; these isnt necesary
pos = 125,0
postype = p1  ;p2,front,back,left,right
facing = ifelse(facing=-1, -1, 1)
vfacing = 1
bindtime = 1
removetime = -2


[state 100, 1]
type = velset
trigger1 = 1
x = const(velocity.run.fwd.x)

[state 100, 2] ;prevent run From canceling into walk
type = assertspecial
trigger1 = 1
flag = nowalk

[state 100, 3] ;prevent From turning
type = assertspecial
trigger1 = 1
flag = noautoturn

[state 100, 4]
type = changestate
trigger1 = time= 21
value = 0
ctrl = 1

[state 100, 5]
type = playsnd
trigger1 = time = 1
value = 6,1

-------

; run_bwd
[statedef 105]
type    = s
physics = s
anim = 105
sprpriority = 1
ctrl = 0

[State 105, Cloud]
type = Explod
trigger1 = time = 0
anim = 107
ID = 107 ; these isnt necesary
pos = -5,-5
postype = p1  ;p2,front,back,left,right
facing = -1
vfacing = 1
bindtime = 1
removetime = -2

[State 105, Eilm]
type = Explod
trigger1 = time = 1
anim = 109
ID = 109 ; these isnt necesary
pos = -25,0
postype = p1  ;p2,front,back,left,right
facing = ifelse(facing=-1, -1, 1)
vfacing = 1
bindtime = 1
removetime = -2

[state 105, 1]
type = velset
trigger1 = 1
x = const(velocity.run.back.x)

[state 105, 2] ;prevent run From canceling into walk
type = assertspecial
trigger1 = 1
flag = nowalk

[state 105, 3] ;prevent From turning
type = assertspecial
trigger1 = 1
flag = noautoturn

[state 105, 4]
type = changestate
trigger1 = time= 21
value = 0
ctrl = 1

[state 105, 5]
type = playsnd
trigger1 = time = 1
value = 6,1

PotS

Quote from: Baiken on November 27, 2007, 04:25:43 PM
I'm not quite sure an ifelse in the pos parameter would work since ifelse(a,b,c) separates each "member" of the expression with a coma and so does pos, so it might not work properly / crash.
Doesn't clash, Mugen only switches from reading the x value to y when it finds a comma outside the ifelse (or generally speaking outside any expression).

Would be written like this btw (for dimension_w):

pos= ifelse(facing=-1, 50, 100), ifelse(facing=-1, 50, 100)


But there's a simpler solution to it, just align the sprite by its center, so that whatever flipping/rotation it suffers doesn't affect the position it takes.
You can help with Ikemen GO's development by trying out the latest development build and reporting any bugs on GitHub.
My Mugen and Ikemen content can also be found here.

dimension_w

A wise suggestion. Thank you for all the alternatives. I shall implement.

dimension_w

#9
I have a new xplod problem. I have made a xplod called "Blocking Field" Basically its similar to Cammy's guarding effect where a shield of energy rotates around the player when he blocks an attack.
I've posted so many queries over the last few weeks and learnt so much about scripting, I didn't think another xplod could be a problem. Here's what I've done.
First off, Most constants regarding Guarding is already in Common1, so I've long since made sure my chars folder has a Common1 in it. And Then I searched for the appropriate State in Common1 that would need the explod animation and began to edit it in.
I want to add it to the various Stand/Crouch/Air "Hit Back While Guarding" States. Well I couldn't find anything by that name in Common1, but I managed to find "SGUARDHIT (shaking)" and so forth. SGUARDHIT (shaking) had the statedef 150, the same as the group number that many other chars have assigned to "Hit Back While Guarding". So I've assumed this is the write constant to add the xplod? Tell me if I'm wrong.
Here's what I've put in the Standing Block State for starters [State 150, Blocking Field]. Before I try Crouch and Air. At this point the xplod fails to show up. I've made sure that the Begin Action No is 120, same as the xplod states value, What am I doing wrong?

; SGUARDHIT (shaking)
[Statedef 150]
type    = S
movetype= H
physics = N
velset = 0,0

[State 150, 1]
type = ChangeAnim
trigger1 = 1
value = 150

[State 150, Blocking Field]
type = Explod
trigger1 = time = 0
anim = 120
pos = 0,0
postype = p1

[State 150, 2]
type = ChangeState
trigger1 = HitShakeOver
value = 151 + 2*(command = "holddown")

[State 150, Hi to Lo]
type = StateTypeSet
trigger1 = statetype = S && command = "holddown"
statetype = C
physics = C

[State 150, Lo to Hi]
type = StateTypeSet
trigger1 = statetype = C && command != "holddown"
statetype = S
physics = S

[State 150, 3]
type = ForceFeedback
trigger1 = time = 0
waveform = square
time = 3