SphereCommunity
Problem with terrain type - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: Problem with terrain type (/Thread-Problem-with-terrain-type)



Problem with terrain type - Dullais - 04-03-2013 12:23 AM

Hello guys.
I decided that i don't like that mounts are spawned every time at the same points of map, so i decided to make my own function, that's spawns them randomly across the map, but i got some problem. Here is the function witch tells me if the random coordinates are good for spawn:
Code:
[FUNCTION spawn_mounts]
VAR.DEST=<EVAL.rand(1,5000)>,<EVAL.rand(1,4000)>

VAR.FALSE=0
IF !(STRCMP(<SERV.MAP(<VAR.DEST>,<SERV.MAP(<VAR.DEST>,0).TERRAIN.Z>).TYPE>, t_water))
VAR.FALSE=1
ELSE
ENDIF
IF !(STRCMP(<SERV.MAP(<VAR.DEST>,<SERV.MAP(<VAR.DEST>,0).TERRAIN.Z>).TYPE>, t_rock))
VAR.FALSE=1
ELSE
ENDIF
IF !(STRCMP(<SERV.MAP(<VAR.DEST>,<SERV.MAP(<VAR.DEST>,0).TERRAIN.Z>).REGION.FLAGS>, 00))
ELSE
VAR.FALSE=1
ENDIF


IF (<EVAL.<VAR.FALSE>> == 1)
SRC.SAY Can't
ELSE
SRC.SAY Can
ENDIF

SRC.GO <VAR.DEST>,<SERV.MAP(<VAR.DEST>,0).TERRAIN.Z>,0

My problem is that sometimes water terrain has a type of t_normal, and script thinks that there is good spot to spawn the creature, so that's it.
How do i make it work ?


RE: Problem with terrain type - Mordaunt - 04-03-2013 12:29 AM

Rather than looking for type t_water to prevent it...
Why not look for type t_grass, t_forest & t_jungle to allow it?

Take a look at my spawer... it uses the same principal to spawn the map:
http://forum.spherecommunity.net/sshare.php?download=169


RE: Problem with terrain type - Dullais - 04-03-2013 12:39 AM

(04-03-2013 12:29 AM)Mordaunt Wrote:  Rather than looking for type t_water to prevent it...
Why not look for type t_grass, t_forest & t_jungle to allow it?

Take a look at my spawer... it uses the same principal to spawn the map:
http://forum.spherecommunity.net/sshare.php?download=169

I could but then i cut the way to spawn anything on t_normal, (in my case, i could not allow that terrain and it would work as well).
I researched for that and did find that there are places on map with grass and type t_normal


RE: Problem with terrain type - Mordaunt - 04-03-2013 12:44 AM

I honestly haven't seen a problem with water tiles having type t_normal, in my experience they have always detected as being the correct type.
However...

If you do locate any that show as type t_normal what you do it open sphere_types.scp and you will see this:

Code:
[TYPEDEF t_water]
TERRAIN = 0a8    0ab
TERRAIN = 0136    0137

Get the ID of the tile, if it falls outside of the perameters set under typedef t_water you can add them in a similar fashion.
The server will need restarting for the changes to take effect.
When I get a few spare minutes I will run through the tile types and check to see if any slipped through the net.


RE: Problem with terrain type - Dullais - 04-03-2013 12:48 AM

(04-03-2013 12:44 AM)Mordaunt Wrote:  I honestly haven't seen a problem with water tiles having type t_normal, in my experience they have always detected as being the correct type.
However...

If you do locate any that show as type t_normal what you do it open sphere_types.scp and you will see this:

Code:
[TYPEDEF t_water]
TERRAIN = 0a8    0ab
TERRAIN = 0136    0137

Get the ID of the tile, if it falls outside of the perameters set under typedef t_water you can add them in a similar fashion.
The server will need restarting for the changes to take effect.
When I get a few spare minutes I will run through the tile types and check to see if any slipped through the net.
Run the script i inserted and eventualy you will be teleported to water with type t_normal Smile


RE: Problem with terrain type - Mordaunt - 04-03-2013 12:52 AM

Ok, I see...


I'll run through and find the missing tiles later and see if I can get ben to add the new file to the nightly

Update your sphere_types.scp t_water section to this, and restart your server,

Code:
[TYPEDEF t_water]
TERRAIN = 0a8    0ab
TERRAIN = 0136    0137
TERRAIN = 064
TERRAIN = 03ff0 03ff3



RE: Problem with terrain type - Dullais - 04-03-2013 02:03 AM

(04-03-2013 12:52 AM)Mordaunt Wrote:  Ok, I see...


I'll run through and find the missing tiles later and see if I can get ben to add the new file to the nightly

Update your sphere_types.scp t_water section to this, and restart your server,

Code:
[TYPEDEF t_water]
TERRAIN = 0a8    0ab
TERRAIN = 0136    0137
TERRAIN = 064
TERRAIN = 03ff0 03ff3

Ok, thanks Smile