Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Getting boats to work on only water [Resolved]

Status
Not open for further replies.
I'm new here and haven't been able to go through all the forums, but I have been trying to use terrain tags to have boats only moveable on water then stop if there is land or shallow water. Here is what I was trying for a code...

Code:
def passable?(x,y,d)
(...)
  elsif @terrain_tags = 2
    if @character = 10 or #number character that is a canoe
      @character = 11 #number character that is a boat
    end
  return true

This way I was trying to have terrain with a tag of 2 be passable by only those 2 characters. It doesn't come up with any errors it just doesn't work. I can tell this is probably a completely wrong way of doing it...
Please help.
 

OS

Sponsor

I don't use those scripts that much, but I think I can see the problem. Place return true underneath @character = 11, with the end command AFTER the return statement. Then, change that end into an else, and after else put return false. Then, after that return statement, put end.

Like this:
Code:
  elsif @terrain_tags = 2
    if @character = 10 or #number character that is a canoe
      @character = 11 #number character that is a boat
      return true
    else
      return false
    end

Let me know if it works. Peace.
 
Scripting isn't the answer, Events work better with terrain and stuff. make a Common event Like this
Variable [xx]= terrain tag
If hero is touching terrain 2
change graphic to the boat
Else
Change graphic to hero
End

o.o that should do it. Just make a Event in a corner (Call the common event)and make it a parrallel.

If it doesnt work tell me. I did it in my head because meh other comp messed up
 
Hmm...probably doing this wrong, but I set it as a parallel with switch 1. Then had an event in the corner turn on the switch and erase itself. I thought it should've work, but still no.':|
 
Sorry i think i told you wrong.Make a Common event and set the Trigger to none then put this in the CE

Variable [xx]= Players Terrain Tag
Chage Players Graphic to ' (boat's Graphic file here)'
Else
Chage Players Graphic to ' (Hero's Graphic file here)'
End

Then make a event on the map that calls that common event and set that event as a parrallel process

I tested it and it works
 

ccoa

Member

This topic has been resolved. If 4StarGeneral or any other users have any questions or further problems regarding this topic, please create a new thread about them.

Thank you!
 
Status
Not open for further replies.

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top