Best way to tell where the player is standing?
Displaying 1-5 of 5 total.
1
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
ErayMan

I'm making a classic RPG and I need to be able to tell if the player is in a desert, plain, forest, etc, in the same map so I can spawn the matching monster to fight.

The same thing would be use to make splash sounds when walking on water or cover the player's entity with grass up to the knee when walking in tall grass.

What would be the best way to know on what type of environment the player is standing?

Is it to put zones in every tiles of the map, linked to different effects?
In a map 200x200, that makes lots of zones. I think there was, a long time ago, a limit of 255 zones per map. Or might have been different zones. Might also have been Verge 1. Well, that limit is probably gone, but still, it's tedious.

Arrays of tiles? From (1,1) to (12,17) it's grass, etc. But everything has to be square or I fear it'll take 3 megabytes of data.

What's the best way to accomplish this?
Thanks

Posted on 2009-04-07 23:28:45

pthaloearth

The best way I know of is to use getTile. Pass the entities tile cords and the layer of your map that determines terrain type. After grabbing that you pass it to your splash sound function and your set.

Posted on 2009-04-08 11:19:54

Overkill

You can do any of the following:
1) Use zones to mark every spot in the area. But then you can't have any other zones on different terrains.
2) Use zones to mark the outer perimeter of each type of terrain. Better, since you can still have other event zones inside these regions. So for instance, you have a zone for shallow water, and another zone around that denoting the beach surrounding the water.
3) Use GetTile and manually figure out what sort of terrain you're in. Most difficult and annoying.

I recommend option 2. It requires the least code to happen. You just need a variable tracking the player's current terrain. And switch the terrain type in the specific zone events.

In the case of splashing and whatnot, you could use trigger.onStep = "PlaySplashEffect";

Posted on 2009-04-08 18:31:22 (last edited on 2009-04-08 19:00:53)

resident

Actually, 3 doesn't sound all that hard. Just use a case statement based on the tile index number returned, and set the default to a "generic" battle that works anywhere, then add further statements based on the tile index that gets returned. Though obviously you'd need to create a new list for every tileset you create.

then, if you're standing on a recognised tileset number, you get an area specific type of battle, and if it's unrecognised, you still get a default encounter that makes sense.

Posted on 2009-04-09 15:09:26

Overkill

Well it isn't REALLY that hard, but you'd need to hook in a custom HookRetraced loop. Which I try to avoid for small, small things. Though this isn't something you can always sidestep around.

Posted on 2009-04-09 17:41:58 (last edited on 2009-04-09 17:43:34)


Displaying 1-5 of 5 total.
1
 
Newest messages

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.