Paste #3607: proc

Date: 2014/04/19 15:41:38 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21


BasicAttackProc:
    type: procedure
    definitions: radius|anchor
    script:
## This proc will search for a new target.
    - if <npc.has_flag[<player>]> {
        - flag <npc> <player>:!
        foreach <location.find.players.within[<%radius%>]> {
            - if <npc.has_flag[<%value%>]> {
                - flag <npc> newtarget
                - attack <npc> target:<%value%>
                - foreach stop
                }
            }
## if it fails to find a new target return to anchor
        - if <npc.has_flag[newtarget]> {
            else {
            - anchor walkto id:%anchor%
            }
            }
        }