mount and dismount vehicle + altering hero walkabout

Ask and answer questions about making games and related topics. Unrelated topics go in that other forum.

Moderators: marionline, SDHawk

Post Reply
User avatar
marionline
Metal Slime
Posts: 673
Joined: Sat Feb 26, 2011 9:23 pm

mount and dismount vehicle + altering hero walkabout

Post by marionline »

I made a mount-script that changes the hero's walkabout images from normal to riding.
The dismount script should change the the heros back to their former looks.
They change back to normal, but only for a second. Then the heroes are reset to look like their riding.

Does the dismounting of a vehicle automatically reset the hero's image to what it was before and 'get's confused'?
Or are the effects of the dismount script be erased after the dismounting process is done?

Or is there a mistake with the script?

Code: Select all

plotscript, ride_mount, begin,
    show textbox(2)
    wait for textbox
    
    #settag(2,ON)
    #set hero speed (me, 1)
    
    set hero picture (0, 48, outside battle)
    wait for hero
    set hero picture (1, 48, outside battle)
    wait for hero
    set hero picture (2, 48, outside battle)
    wait for hero
    set hero picture (3, 48, outside battle)
    wait for hero
end

plotscript, ride_dismount, begin,
    show textbox(3)
    wait for textbox
    
    #set hero speed (me, 4)
    #settag(2,OFF)
        
    set hero picture (0, 1, outside battle)
    wait for hero
    set hero picture (1, 2, outside battle)
    wait for hero
    set hero picture (2, 3, outside battle)
    wait for hero
    set hero picture (3, 4, outside battle)
    wait for hero
end
User avatar
Bob the Hamster
Lord of the Slimes
Posts: 7660
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

Well, that is strange! "set hero picture" should work even when mounting a vehicle.

One thing I notice about your script, is that all those "wait for hero" commands are doing absolutely nothing. Those only wait for hero walkabout movement on the map. They are never needed for any other hero changes.... but that could not be causing your problem

The next thing I am wondering is if you have any other scripts that are changing hero pictures... maybe an each-step script?
User avatar
marionline
Metal Slime
Posts: 673
Joined: Sat Feb 26, 2011 9:23 pm

Post by marionline »

Hello!
Thanks for the fast reply. :)

Image

After talking the screenshot, I figured a part of the problem with the 'vehicle':
The vehicle is triggered by an NPC, and the NPC's sprite is shown at the same spot where the hero is after mounting. It was 'overlaying' the changed hero sprite. If I use an "invisible" NPC, the hero sprite is shown properly.

But for changing the hero back to its normal walkabout, I don't know what causes the trouble.
There are no other scripts running that could interfere with the picture change.
User avatar
Greenyel
Slime
Posts: 23
Joined: Mon Jan 16, 2017 2:58 pm
Location: Tubarao/SC - Brazil

Post by Greenyel »

I had the same problem before.

It seem this can be solved if you show a textbox right after you dismount.
I made this simple script that solved my problem:

Code: Select all

script, mount, begin
  set hero picture(me,150,outside battle)
end

script, dismount, begin
  set hero picture(me,0,outside battle)
  showtextbox (521) #the hero may say something like "lets go!"
end
About the NPC overlaying the hero, this can be changed on map sethings:
"Edit general map data" > "Walkabout layering" > "Heroes over NPCs"
But using an invisible NPC works too.

I hope this will help you. If yes, let me know!
Last edited by Greenyel on Fri Jan 27, 2017 2:28 am, edited 3 times in total.
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

Really, both of you? I tried using greenyel's mount and dismount scripts, with the showtextbox removed, and had no problem.
What you describe sounds like a script double-triggering problem. So I tried pressing F8 and selected "Toggle script logging" (Ctrl-F10), then mounted and dismounted and checked the script_log.txt file. To my surprise, mount is called twice and dismount is called once. Definitely an engine bug. If the mount script contains a wait command before changing the hero picture, then this will cause the symptom you saw. Thanks for reporting this.

Script logging can solve a lot of problems.
Last edited by TMC on Sat Jan 28, 2017 1:30 pm, edited 3 times in total.
User avatar
marionline
Metal Slime
Posts: 673
Joined: Sat Feb 26, 2011 9:23 pm

Post by marionline »

Hello!
Thanks for checking and telling me how to use script-logging. :D

F8 seems to hide a lot of useful-interesting things. :o
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

I put them in the F8 menu to unhide them! Before that, you had to look up the key combination on the wiki :)

F8 is the one debug key everyone should know.
Post Reply