Dismount vehicle by bumping into wall B?
Moderators: marionline, SDHawk
- sheamkennedy
- Liquid Metal Slime
- Posts: 1110
- Joined: Mon Sep 16, 2013 9:29 pm
- Location: Tama-shi, Tokyo, Japan
- Contact:
Dismount vehicle by bumping into wall B?
I have this vehicle I made which is essentially a raft. When the player steps on it they mount it, then as they move it appears as though they are riding this raft. I'd like to make the player dismount it whenever they bump into wall B since wall B is what allows the vehicle to only access a contained region of water. How can I make it so the player dismounts when bumping in to wall B (without using the "use" button)?
⊕ 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
â� C O L L A B M U S I C: https://dustpuppets.bandcamp.com/releases
An "on touch" or "on step" NPC that calls a script with "dismount vehicle" and perhaps moves the player onto the nearest land block. I can't remember how dismounting works exactly - whether it automatically moves you 1 square in the direction you are facing or not.
Last edited by guo on Sun Mar 27, 2016 2:32 am, edited 1 time in total.
vvight.wordpress.com
If I remember correctly, on-touch activation only activates when the hero or the npc tries to move into the other, not when they simply move next to each other.
If you didn't want to use touch-activated NPCs, I would adapt the hero will move script on the wiki. Something like this:
That calls other scripts, which you can find on the wiki page.
If you didn't want to use touch-activated NPCs, I would adapt the hero will move script on the wiki. Something like this:
Code: Select all
script, check for raft dismount, begin
variable (dir, npc, wall)
if (hero is walking(0)) then (exit script)
# Check for player input
dir := trying to move direction
if (dir == -1) then (exit returning (false))
# Don't check for walls in the way, like "hero will move" does.
# Check for an NPC in the way which you can't step on
# (this isn't correct either if obstruction is suspended, or other edge cases)
npc := npc at spot (hero x(0) + dir x(dir), hero y(0) + dir y(dir))
if (npc && readNPC(npc, NPCstat:activation) <> NPCactivation:stepon) then (exit script)
wall := read pass block (hero x(0) + dir x(dir), hero y(0) + dir y(dir))
if (wall, and, vehicleB) then (
# OK, the player is trying to move onto a tile with the B vehicle bit set.
dismount vehicle
)
end
Last edited by TMC on Sun Mar 27, 2016 3:08 am, edited 1 time in total.