News:

MFG's Character of the Month: October 2026 Nominations

Main Menu

Ifelse Help

Started by Mossbell, February 04, 2008, 02:02:06 AM

Previous topic - Next topic

Mossbell

I tried asking in my local forum but they have no idea, so I have come to the big boys for help.

[State 0, Explod]
type = Explod
trigger1 = p2stateno = 5000
anim = 2000
pos = -5,-70
postype = p2 ;p2,front,back,left,right
facing = ifelse((p2facing)=0, 1, ifelse((p2facing)=1, 0))
sprpriority = 2

I would like to know what's wrong with the ifelse. I would ask my great friend Anjel but he's been away for a long time.
Thank you in advance.

Byakko

#1
The second ifelse doesn't have any "else".
ifelse((p2facing)=0, 1, ifelse((p2facing)=1, 0))
=>
if p2facing = 0
.then "1"
else
.
if p2facing = 1
..then "0"
.else
..??!??
.end if

end if


Also... p2facing can't be used as a trigger, so you'll get problems regardless. ..... You want the explod to be facing the same way as the p2, right ? You're better off making it a helper, I suppose, since using "enemynear,facing" instead might not work properly in team mode.
By the way, the "facing" trigger returns either -1 or 1, not 0.
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.