The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with terrain type
Author Message
Dullais
Journeyman
*

Posts: 65
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Feb 2013
Reputation: 0



Post: #1
Problem with terrain type
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 ?
(This post was last modified: 04-03-2013 12:23 AM by Dullais.)
04-03-2013 12:23 AM
Find all posts by this user Like Post Quote this message in a reply
Mordaunt
Super Moderator
****

Posts: 1,237
Likes Given: 26
Likes Received: 55 in 43 posts
Joined: Mar 2012
Reputation: 35



Post: #2
RE: Problem with terrain type
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....wnload=169

[Image: 2nis46r.jpg]
04-03-2013 12:29 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Dullais
Journeyman
*

Posts: 65
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Feb 2013
Reputation: 0



Post: #3
RE: Problem with terrain type
(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....wnload=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
04-03-2013 12:39 AM
Find all posts by this user Like Post Quote this message in a reply
Mordaunt
Super Moderator
****

Posts: 1,237
Likes Given: 26
Likes Received: 55 in 43 posts
Joined: Mar 2012
Reputation: 35



Post: #4
RE: Problem with terrain type
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.

[Image: 2nis46r.jpg]
(This post was last modified: 04-03-2013 12:45 AM by Mordaunt.)
04-03-2013 12:44 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Dullais
Journeyman
*

Posts: 65
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Feb 2013
Reputation: 0



Post: #5
RE: Problem with terrain type
(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
04-03-2013 12:48 AM
Find all posts by this user Like Post Quote this message in a reply
Mordaunt
Super Moderator
****

Posts: 1,237
Likes Given: 26
Likes Received: 55 in 43 posts
Joined: Mar 2012
Reputation: 35



Post: #6
RE: Problem with terrain type
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

[Image: 2nis46r.jpg]
(This post was last modified: 04-03-2013 01:33 AM by Mordaunt.)
04-03-2013 12:52 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Dullais
Journeyman
*

Posts: 65
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Feb 2013
Reputation: 0



Post: #7
RE: Problem with terrain type
(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
04-03-2013 02:03 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)