Date: 2016/12/02 10:58:54 UTC-08:00
Type: Denizen Script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Once the server starts, it gets the loop for NPC-actions going. You can also just write /ex run s@NPCKampfLoop_Soldat
# Notice that I basically removed like every security check to not blow up the script for testing
"One Big NPC Fighting Loop":
type: world
debug: false
events:
on server start:
- run s@NPCKampfLoop_Soldat delay:10s
# Command I use for testing and creating NPC real quick /createsoldier
on createsoldier command:
- create player <red>Soldat <player.location> traits:health save:newNPC
- wait 1t
- adjust <npc[<entry[newNPC].created_npc>]> skin:NikolaiSergeyev
- vulnerable state:true npc:<npc[<entry[newNPC].created_npc>]>
- equip <npc[<entry[newNPC].created_npc>]> head:chainmail_helmet chest:chainmail_chestplate legs:chainmail_leggings boots:chainmail_boots
- flag <entry[newNPC].created_npc> Soldat:true
- flag <entry[newNPC].created_npc> Respawnposition:<player.location.simple>
# Every NPC flagged Soldat should move around
NPCKampfLoop_Soldat:
type: task
debug: false
script:
- foreach <server.get_spawned_npcs_flagged[Soldat]> {
- run s@NPCAction_Soldat def:%value%
}
- run s@NPCKampfLoop_Soldat delay:1s
NPCAction_Soldat:
type: task
debug : false
script:
- walk <def[1]> <def[1].location.center.find.surface_blocks.within[5].random.add[0,1,0]> speed:0.9 radius:25
# Now this is the simple action that runs, once the NPC dies. Since The NPC have the health trait and a respawn time of 15 minutes, I respawn them manually for testing faster after only 10 seconds.
"TheOneAndOnlyNPCDeathEvent":
type: world
debug: false
events:
On npc dies:
- if <npc.has_flag[Soldat]> {
- run s@ReplaceDeadSoldier def:<npc> delay:10s
- determine passively no_drops
- determine "<gray>[Ger<ü>cht] Es finden K<ä>mpfe auf einer Milit<ä>rbasis statt."
}
ReplaceDeadSoldier:
type: task
debug: false
script:
- spawn <def[1]> <def[1].flag[Respawnposition]>