Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

RPG in a Box

Bring your stories and ideas to life! · By Justin Arnold

How to have a script to activate when stepping onto a tile?

A topic by Daza created Apr 24, 2017 Views: 89 Replies: 4
Viewing posts 1 to 5

I would like to have a script where the Player walks onto a lava tile and takes damage per second while standing there or walking into objects such as thorns or cactus?

No doubt in time you will be adding more script examples in the game editor itself or on the wiki which i look forward to, but i hope to cut my teeth with some basics that would be useful for me to create a basic game, until i can tackle something more complex as i get used to the system.

Another beginner example could be stepping onto a certain tile which perhaps a enemy spawns or appears to rise from the ground (if that is possible) or a room trap where a gap in the wall behind the player suddenly closes with a wall tile or object spawns there in the room that appears to have no exits. Step by step guides are great but also actual example in the editor to tinker with can be handy in learning how things work, trying variations etc. Perhaps in time the community can contribute to these examples or guides for common basic functions or gameplay mechanics.

Hey Daza - in order to have a script activate when stepping onto the tile, you can double click the tile in the Map Editor while in Edit Mode (or right-click and go to Properties), and set a script for the tile. The script will then be automatically activated when the player steps onto the tile. This is the same idea used when linking maps together, for example when the player walks onto a dungeon entrance tile.

There isn't any scripting yet relating to damaging the player, but there are some other things you could play around with for now. For example, you could make a tile script that plays a "close" animation on a gate or door and then removes the navigation path through it so the player is stuck inside the room until they figure out how to open the gate again.

I agree that having some basic examples would be very beneficial. I plan to have some tutorials and other things like this on my wiki once I get some of the other pages created.

Okay look forward to any new tutorials and examples to load in game and tinker with. In the meantime I can experiment which is often a good way to learn, and can ask questions if i get stuck.

Yep, experimenting is definitely a good way to learn! Always feel free to ask any questions in the Discord channel also if you need help figuring out how to create a script for anything.

Okay will do thanks. Perhaps you can create a text channel for different aspects of the RPGinABox, like scripting, animation for example so future members can read old posts and learn something as much as using it to refresh ourshelves when we run into a similar problem and can refer back to those questions and answers as a reminder.