Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Random Spawn (new map)
Author Message
cele_35
Apprentice
*

Posts: 7
Likes Given: 1
Likes Received: 0 in 0 posts
Joined: May 2019
Reputation: 0



Post: #1
Random Spawn (new map)
hi im write new quest system but I could not.. Random coordinate spawner and after 1 day will be delete.. how do i write ?

[function f_golden_monster]
local.x <Rxxx> //// ???
local.y <Rxxx> //// ???

serv.newnpc c_golden
new.p xxxx ///////////////// this problem ?
ref1=<new>
new.timerf 86400,remove
06-03-2019 07:53 AM
Find all posts by this user Like Post Quote this message in a reply
Coruja
Sphere Developer
*****

Posts: 987
Likes Given: 5
Likes Received: 226 in 187 posts
Joined: Jul 2012
Reputation: 7

Dimension Shard

Post: #2
RE: Random Spawn (new map)
try using this, I didn't tested it but it should work

Code:
[FUNCTION f_golden_monster]
SERV.NEWNPC c_golden
NEW.MoveToRandomLocation
NEW.TIMERF 86400,REMOVE

[FUNCTION MoveToRandomLocation]
FOR 1000
  ARGS=<R5000>,<R4000>,0,<P.M>
  IF (<SERV.MAP(<ARGS>).REGION>)
    P=<ARGS>
    IF !(<REGION.FLAGS> & region_flag_ship|region_flag_nobuilding|region_flag_underground|region_flag_safe​|region_flag_guarded)
      FIX    // move char to ground Z level
      return 1
    ENDIF
  ENDIF
ENDFOR
you just need to create the NPC and then call MoveToRandomLocation
06-03-2019 11:22 AM
Find all posts by this user Like Post Quote this message in a reply
[Nores]
Apprentice
*

Posts: 8
Likes Given: 1
Likes Received: 3 in 2 posts
Joined: Jun 2014
Reputation: 0



Post: #3
RE: Random Spawn (new map)
How can we see in which location the creature spawns?
09-26-2023 02:30 AM
Find all posts by this user Like Post Quote this message in a reply
cele_35
Apprentice
*

Posts: 7
Likes Given: 1
Likes Received: 0 in 0 posts
Joined: May 2019
Reputation: 0



Post: #4
RE: Random Spawn (new map)
.goname (chardef(ID))
e.g.= .goname Llama

but you need to edit the code that coruja threw a little bit, I did something like this, you can do it in another way. by the way, the coordinates I made are for the Ilshenar map

Code:
[FUNCTION f_golden_monster]
SERV.NEWNPC c_golden_dragon
new.timerf 86400,remove
ref2=<new.uid>

FOR 1000
  local.randomloca <R266,1544>
  local.randomloca2 <R228,1262>
  ARGS=<dlocal.randomloca>,<dlocal.randomloca2>,0,2,<P.M>
  //ARGS=<R5000>,<R5000>,0,2,<P.M>
  IF (<SERV.MAP(<ARGS>).REGION>)
    new.P=<ARGS>
       if (!<serv.uid.<ref2>.isneartype t_tree 1>) && (!<serv.uid.<ref2>.isneartype t_water 1>) && (!<serv.uid.<ref2>.isneartype t_rock 1>) && (<serv.uid.<ref2>.isneartype t_grass 1>) && (!<serv.uid.<ref2>.region.guarded>) && (!<serv.uid.<ref2>.region.safe>) && (<serv.uid.<ref2>.region.type>!=t_multi) && (<serv.uid.<ref2>.region.type>!=t_multi_custom) && !(<serv.uid.<ref2>.flags>&statf_indoors)
        ref2.FIX    // move char to ground Z level
      return 1
    ENDIF
  ENDIF
ENDFOR
(This post was last modified: 09-29-2023 07:59 PM by cele_35.)
09-29-2023 07:54 PM
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)