Post new topic    
Liquid Metal Slime
Send private message
Issue Reading Zone During Script 
 PostSat Apr 12, 2014 12:20 am
Send private message Reply with quote
I have a script that changes the hero's walkabout depending on whether they are in that specific zone or not (Sheam's ladder idea). As a standalone "each step" script, it works fine.

Unfortunately, it doesn't appear to work if you move the hero into said zone via another script. For example, if I had the hero climb up a ladder via a script, it doesn't seem to recognize the on "each step" script when it runs it.

I've already figured out a workaround to this, but I thought it was worth mentioning in case it was an actual engine bug. If I need to provide scripts let me know.
Cornbread Chemist
Metal King Slime
Send private message
Re: Issue Reading Zone During Script 
 PostSat Apr 12, 2014 6:55 am
Send private message Reply with quote
I don't understand, particularly this part:

Meatballsub wrote:
it doesn't seem to recognize the on "each step" script when it runs it.


If you post scripts I can tell you why it's not working.
Liquid Metal Slime
Send private message
 
 PostSat Apr 12, 2014 12:18 pm
Send private message Reply with quote
Blame my mastery of the English language for that V

Here's the each step script:

Quote:
plotscript,cadaverladder,begin
if (read zone (1,herox(find hero(hero:Fred)),heroy(find hero(hero:Fred))) == true) then (
set hero picture (find hero (hero:Fred),190,outside battle))
else (
set hero picture (find hero(hero:Fred),54,outside battle))

if (read zone (1,herox(find hero(hero:Gluep)),heroy(find hero(hero:Gluep))) == true) then (
set hero picture (find hero (hero:Gluep),191,outside battle))
else (
set hero picture (find hero(hero:Gluep),30,outside battle))

if (read zone (1,herox(find hero(hero:Harvey)),heroy(find hero(hero:Harvey))) == true) then (
set hero picture (find hero (hero:Harvey),192,outside battle))
else (
set hero picture (find hero(hero:Harvey),56,outside battle))

if (read zone (1,herox(find hero(hero:Arnold)),heroy(find hero(hero:Arnold))) == true) then (
set hero picture (find hero (hero:Arnold),193,outside battle))
else (
set hero picture (find hero(hero:Arnold),55,outside battle))
end


And here's the other script that causes the hero to walk into zone 1:

Quote:
plotscript,entercadaver,begin
suspend player
suspend hero walls
walk hero (0,up,1)
play sound (11,false)
wait (3)
play sound (2,false)
wait for all
wait (10)
walk hero (0,up,1)
play sound (11,false)
wait (3)
play sound (2,false)
wait for all
wait (10)
walk hero (0,up,1)
play sound (11,false)
wait (3)
play sound (2,false)
wait for all
wait (10)
walk hero (0,up,1)
play sound (11,false)
wait (3)
play sound (2,false)
wait for all
wait (10)
resume player
resume hero walls
end

Cornbread Chemist
Liquid Metal King Slime
Send private message
 
 PostSat Apr 12, 2014 10:06 pm
Send private message Reply with quote
Going to make a guess that it might be because On Step scripts don't activate when you're force walking the hero via script. Could be wrong, I've never tried it myself. Other than that it could also be some sort of dual script launching collision where one of the scripts is getting in the way of the other. It's possible that you'll have to combine these scripts into a single script in order for them to work.
Hope this helped.
Metal King Slime
Send private message
 
 PostSun Apr 13, 2014 2:11 am
Send private message Reply with quote
Heh, enter cadaver?

Each-step scripts trigger when the heroes are moved by script commands too. I can't see any reason for the scripts to not work. But as Spoon said, if some other script is getting triggered on the same tick that could prevent it from working. I would investigate whether the script is actually getting run at the moment you expect it to.
Liquid Metal King Slime
Send private message
 
 PostSun Apr 13, 2014 5:49 pm
Send private message Reply with quote
Each-step scripts only trigger for the leader. If you turn off the caterpillar party, and make a non-leader hero walk with a script, you won't get each-step triggers.

Also, I see a problem with the script

Code:

if (read zone (1,herox(find hero(hero:Fred)),heroy(find hero(hero:Fred))) == true) then (


you are using "find hero" which finds the position of the hero in the party not their position in the caterpillar. The correct command in this case is "rank in caterpillar"

Code:

if (read zone (1,herox(rank in caterpillar(hero:Fred)),heroy(rank in caterpillar(hero:Fred))) == true) then (


Find hero is the correct command to use together with "set hero picture"

The reason that the script is working okay for you is because your party happens to not have any gaps in it. If someone re-orders the party using the "Order" or "Team" menu, the script will break.

This article has a list of which hero-related commands you should use with "find hero" and which you should use with "rank in caterpillar"

http://rpg.hamsterrepublic.com/ohrrpgce/Ways_to_refer_to_a_hero_in_a_script
Liquid Metal Slime
Send private message
 
 PostMon Apr 14, 2014 1:43 pm
Send private message Reply with quote
Thanks, and good to know about find hero. The team/order option isn't allowed in Ruin, but it's good to know that for future projects.
Cornbread Chemist
Metal King Slime
Send private message
 
 PostMon Apr 14, 2014 2:19 pm
Send private message Reply with quote
Ugh, at first I thought the 'findhero's looked odd, but I mistakenly convinced myself they were correct by looking only at the 'setheropicture' calls. It's so easy to mix them up. When we add types to HS I am going to be very pleased to get rid of the need to remember the difference between hero IDs, party slots and caterpillar slots: instead we can convert each to the necessary type.
Liquid Metal Slime
Send private message
 
 PostMon Apr 14, 2014 3:26 pm
Send private message Reply with quote
TMC wrote:
Ugh, at first I thought the 'findhero's looked odd, but I mistakenly convinced myself they were correct by looking only at the 'setheropicture' calls. It's so easy to mix them up. When we add types to HS I am going to be very pleased to get rid of the need to remember the difference between hero IDs, party slots and caterpillar slots: instead we can convert each to the necessary type.


That would be great. This has always been a huge area of confusion for me. I'll read that article for now too.
⊕ P E R S O N A L M U S I C: https://open.spotify.com/album/6fEo3fCm5C3XhtFRflfANr
⍠ C O L L A B M U S I C: https://dustpuppets.bandcamp.com/releases
Display posts from previous: