Post new topic    
Liquid Metal Slime
Send private message
Set Hero Speed causing script to crash 
 PostSun Jan 10, 2010 12:58 pm
Send private message Reply with quote
I have a simple "powerup" thingy in my script and everything works fine with it until I add "set hero speed" to it. I'm not sure why either:

Code:
      if (hero x (0) == npc x (0) ,and, hero y (0) == npc y (0)) then (
      destroy npc (0)
      play sound (6,false,false)
   power := true
   set hero speed (0,5)
   set hero palette (0,5,outside battle)
   wait for hero (0)
   set timer (5, 5,18,@calmdown)
      )


I'm guessing it has to do with some other part of the code, but I'm not sure what I'm looking for at this point. Any help would be much appreciated.
Cornbread Chemist
Liquid Metal Slime
Send private message
 
 PostSun Jan 10, 2010 2:27 pm
Send private message Reply with quote
What error are you getting?

The indentation on lines 2 and 3 leads me to believe there was supposed to be a ) after line 3, but that might just be your formatting.
My website, the home of Motrya:
http://www.jshgaming.com
Liquid Metal Slime
Send private message
 
 PostMon Jan 11, 2010 6:35 am
Send private message Reply with quote
Yeah, the formatting is all messed up right now. I've made a lot of changes to the code recently and have not kept up with the format, so it does look a bit odd.

Basically, when that part is triggered in-game, the hero just runs in place and your controls are frozen. You basically have to exit out of the game manually.
Cornbread Chemist
Liquid Metal Slime
Send private message
 
 PostMon Jan 11, 2010 1:27 pm
Send private message Reply with quote
Is the hero already in motion when this segment of code is activated? I see a waitforhero, but no walkhero.
My website, the home of Motrya:
http://www.jshgaming.com
Liquid Metal King Slime
Send private message
 
 PostMon Jan 11, 2010 3:47 pm
Send private message Reply with quote
Yes, if you change walking speed in the middle of a move, your hero (or NPC) can become misaligned with the tiles, and will get stuck.

If you move the "wait for hero" right before the "set hero speed" then he will finish his previous step, and change speeds while aligned, so he will not get stuck.
Liquid Metal Slime
Send private message
 
 PostMon Jan 11, 2010 7:06 pm
Send private message Reply with quote
That fixed it. Thank you, sirs Smile
Cornbread Chemist
Liquid Metal King Slime
Send private message
 
 PostMon Jan 11, 2010 9:14 pm
Send private message Reply with quote
See also bug 810 for making the engine handle this sort of situation more gracefully.
Display posts from previous: