SphereCommunity

Full Version: Random Spawn (new map)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
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
How can we see in which location the creature spawns?
.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
Reference URL's