-#Script made by Rosstail
-
-#SPAWN RANDOM NPCS
spawn_random_npcs:
type: task
debug: false
script:
- #CHOOSE THE MINIUM AND MAXIMUM AMOUNT OF NPCS SPAWNED IN A ROW
- - flag global min_spawn:3
- - flag global max_spawn:7
- ###############################################"
- - flag global debug_spawn:off
- - flag global nb_spawn:<util.random.int[<global.flag[min_spawn]>].to[<global.flag[max_spawn]>]>
- - flag global nb_spawn_ds:<global.flag[nb_spawn]>
- - while <global.flag[nb_spawn].is[MORE].than[0]> {
- - run npc_name_choose instantly
- - flag global spawn_no%loop_index%:<global.flag[npc_name]>
- - execute as_server "npc spawn <global.flag[npc_name]>"
- - flag global nb_spawn:--
- }
-#DELETE THE RANDOMLY SPAWNED NPCS
+ #CHOOSE THE FORK OF NPC SPAWNED AS SAME TIME
+ - define min_npc 3.0
+ - define max_npc 7.0
+ ###############################################
+ - flag server nb_npc_st:<util.random.int[<def[min_npc]>].to[<def[max_npc]>]>
+ - flag server nb_npc_sp:<server.flag[nb_npc_st]>
+ - while <server.flag[nb_npc_sp].is[MORE].than[0]>:
+ #CHOOSE THE FORK OF NPC'S ID
+ - define min_id 0
+ - define max_id 29
+ - define ids <util.random.int[<def[min_id]>].to[<def[max_id]>]>
+ ##########################################
+ - flag server npc_no_<server.flag[nb_npc_sp]>:<def[ids]>
+ - execute as_server "npc spawn <def[ids]>"
+ - flag server nb_npc_sp:--
+
delete_random_npcs:
type: task
debug: false
script:
- - flag global debug_spawn:off
- - while <global.flag[nb_spawn_ds].is[MORE].than[0]> {
- - despawn <global.flag[spawn_no%loop_index%]>
- - flag global nb_spawn_ds:--
- }
+ - flag server nb_npc_ds:<server.flag[nb_npc_st]>
+ - while <server.flag[nb_npc_ds].is[MORE].than[0]>:
+ - execute as_server "npc despawn <server.flag[npc_no_<server.flag[nb_npc_ds]>]>"
+ - flag server nb_npc_ds:--
+
- - flag global nb_spawn:0
-
-#PUT ALL THE NAMES YOU WANT
-npc_name_choose:
- type: task
- debug: false
- script:
- - choose "<global.flag[debug_spawn]>":
- #WHEN THE DEBUG MODE IS OFF
- - case "off":
- - random:
- #REPEAT THESES FLAGS FOR EACH NPC YOU WANT
- - flag global npc_name:<name>
- - flag global npc_name:<name2>
- #WHEN THE DEBUG MODE IS ON
- - case "on":
- #REPEAT THESES FLAGS FOR EACH NPC YOU WANT
- - despawn <name>
- - despawn <name2>
- etc...
-
-#DELETE CURRENT NPS AND SPAWN ANOTHER EACH HOURS
actions_npcs:
type: world
debug: false
events:
on system time hourly:
- run delete_random_npcs instantly
- wait 10s
- run spawn_random_npcs instantly
-
-#IF ONE DAY TOO MANY NPCS ARE SPAWNED IN THE SAME TIME
-debug_npc:
- type: world
- debug: false
- events:
- on server start:
- #PUT IT "ON" TO DESPAWN ALL NPCS AFTER A SERVER RESTART
- - flag global debug_spawn:off
- - run npc_name_choose instantly
- #DON'T TOUCH THIS
- - flag global debug_spawn:off