Post new topic    
Red Slime
Send private message
HELP!! Can't make this plotscript work and I'm going mad! 
 PostFri Jun 04, 2010 9:43 am
Send private message Reply with quote
Mabye its because I'm really tird from staying up late every night latley pumeling code for a new project but I desperately need help with this code.

It consists of 4 sprites.
1) Hero is Standing 2) Walkup1
3) Walkup middle 4) Walkup 2

#### I want the code to run through the sprites as the hero walks. Starts from Standing (13) to Walkup1 (15) then to Walkup middle (14), then to Walkup 2 (16), then back to Walkup middle (14) and back to (15) and starts all over again. (Like if the hero has 3 walkabout animations)

Code gives me no issues, goes from sprite (13) through to (16) as I want it to. But when it goes back to (14) again for the second time and I want it now to go back to (15) (If walkMid = true [Meaning its already been passed the middlesprite]) but instead it still assumes that (WalkMid = False) and takes me back to (16) and just goes 16, 14, 16 , 14, 16, 14 till I quit the game.

Please help! The actual code is below.

variable (WALKMID)

If ((get sprite set number (HEROBOY))==(13)) then, begin

replace small enemy sprite (HEROBOY, 15, 5)
WALKMID := false

end, else, begin

If ((get sprite set number (HEROBOY))==(15)) then, begin

replace small enemy sprite (HEROBOY, 14, 5)

end, else, begin

If ((get sprite set number (HEROBOY))==(14)) then, begin

If ((WALKMID)==(FALSE)) then, begin

replace small enemy sprite (HEROBOY, 16, 5)
WALKMID := True

end, else, begin

replace small enemy sprite (HEROBOY, 15, 5)
WALKMID := false

end


end, else, begin

If ((get sprite set number (HEROBOY))==(16)) then, begin

replace small enemy sprite (HEROBOY, 14, 5)

end
end
end
end
Reigning Smash Champion
Send private message
 
 PostFri Jun 04, 2010 9:54 am
Send private message Reply with quote
How are you calling this script? It might be because I can barely read this code with much effort, but I don't seem to be seeing any loops.
<TheGiz> oh hai doggy, oh no that's the straw that broke tjhe came baclsb
Metal Slime
Send private message
 
 PostFri Jun 04, 2010 12:59 pm
Send private message Reply with quote
Also you might want to use the code bbcode so that your spacing is kept. It makes it easier to read for us.
Liquid Metal King Slime
Send private message
 
 PostFri Jun 04, 2010 1:38 pm
Send private message Reply with quote
So, am I to understand that the problem arises when the script is run for the second time? If this is true then the answer is you need to use a GLOBAL variable instead of a local one.
Red Slime
Send private message
 
 PostFri Jun 04, 2010 4:31 pm
Send private message Reply with quote
Haha sorry, thats the way I type. Its messy but for some reason I've etched it into my head. Surprised

Thanks for the replys guys. I think it is that the variable must be global for the script to work. Thanks. Smile

Regards

New-Gen
Display posts from previous: