Back to "peace" tags

Auto-PEACE by dennozz

1#Auto-PEACE 1.20
2
3#********** INFORMATION **********# 
4
5#Made by @dennozz on discord. 
6#Inspired/learned by other scrips in https://outlands.uorazorscripts.com/
7
8#This script will auto peace the closest gray creature, if the creature is already peaced it will start looking for other nearby creatures.
9
10#Optional: Set overhead messages on Razor > Display/Counters > Overhead messages
11           #Add overhead messages when success peacemaking, fail peacemaking or skill needs to wait for use.
12           
13#********** SET YOUR SETTINGS **********#            
14
15@setvar! attackAfterBarding 1
16
17#********** DO NOT EDIT FROM HERE UNLESS YOU KNOW HOW TO SCRIPT **********# 
18
19@setvar! currentTarget 0
20@setvar! foundTarget 0
21
22removelist peacedCreatures
23createlist peacedCreatures
24
25#********** SET INSTRUMENT **********# 
26
27if not varexist myInstruz
28    @setvar! myInstruz 0
29endif
30
31while findtype 3740|3742|3762|3763|10245|20006|20008|20010|20012|20014|20016 backpack as inst 
32    getlabel inst myLabel
33    
34    if "supremely" in myLabel or "exceedingly" in myLabel
35        @setvar! myInstruz inst
36        break
37    endif
38    
39    @ignore inst
40endwhile
41
42@clearignore
43
44if not find myInstruz backpack
45    clearsysmsg
46    overhead "Select instrument:" 55
47    @setvar! myInstruz
48    wait 100
49    while not targetexists and not insysmsg "Select"
50        @setvar! myInstruz    
51    endwhile
52    wait 100
53    if find myInstruz backpack as inst
54        getlabel inst iLabel
55        
56        if "flute" in iLabel or "drums" in iLabel or "harp" in iLabel or "lute" in iLabel or "tambourine" in iLabel or "gemshorn" in iLabel or "hurdy" in iLabel or "psaltery" in iLabel or "sackbut" in iLabel or "shawm" in iLabel or "Vielle" in iLabel
57            dclick inst
58            wait 200
59        else 
60            @setvar! myInstruz 0
61            overhead "Not an instrument!" 33
62            stop
63        endif
64    else
65        @setvar! myInstruz 0
66        overhead "Not in backpack" 33
67        stop    
68    endif
69endif
70
71clearsysmsg
72
73if targetexists
74    hotkey 'cancel current target'
75endif
76
77getlabel myInstruz myLabel
78sysmsg myLabel 44
79
80#********* AUTO-SELECT NEW TARGET *********
81
82sysmsg "Peace Start.." 65
83hotkey 'target closest grey monster'
84wait 25
85
86if not find lasttarget ground -1 -1 12
87    overhead 'No target found' 33
88else
89    while index != 20
90        @setvar! tempTarget lasttarget 
91        if index != 0 
92            hotkey "next non-friendly monster target"
93            @setvar! tempTarget lasttarget 
94            #overhead "*{{index}}*" 34 tempTarget
95            
96            if index = 1
97                @setvar! firstTarget lasttarget
98            elseif firstTarget = tempTarget
99                @setvar! foundTarget 2
100                break
101            endif
102        endif
103        
104        if find tempTarget ground -1 -1 12
105            getlabel tempTarget targetLabel
106                        
107            if "pacified" in targetLabel or "provoked" in targetLabel
108                #next
109                pushlist peacedCreatures tempTarget
110            elseif "-" in targetLabel
111                sysmsg "Label error, replaying search.." 34
112                replay
113            else 
114                clearsysmsg
115                
116                skill 'begging'
117                waitfortarget 325
118                target tempTarget
119                wait 100
120                
121                if insysmsg "Target cannot be seen"
122                    sysmsg "*Not visible* [{{index}}]" 44
123                    overhead  "*Not visible* [{{index}}]" 44 tempTarget
124                elseif insysmsg "That is too far away"
125                    overhead "*Too far* [{{index}}]" 44 tempTarget
126                elseif insysmsg "You must wait"
127                    overhead "*Skill cooldown*" 11
128                    sysmsg "*Skill cooldown*" 11
129                    break
130                else
131                    @setvar! foundTarget 1 
132                    @setvar! currentTarget tempTarget
133                    getlabel currentTarget myLabel
134                    sysmsg "Target: {{myLabel}}" 55
135                    break
136                endif
137                
138            endif
139        endif
140        wait 50
141    endwhile
142endif
143
144#********* PEACE IF TARGET FOUND *********
145
146if 1 = foundTarget
147    skill 'peacemaking'
148    waitfortarget 650  
149    
150    if insysmsg "What instrument"    
151        target myInstruz
152        replay
153    else 
154        target currentTarget
155    endif
156    
157    wait 100
158    
159    if insysmsg 'You fail to peace'
160        overhead "Peace FAILED" 44 currentTarget
161    elseif insysmsg "You play successfully, disrupting" 
162        getlabel currentTarget myLabel
163        overhead "{{myLabel}}" 88 currentTarget
164    endif
165    
166    getlabel myInstruz instLabel
167    
168    if "(10/" in instLabel
169        overhead "Instrument : 10 uses left" 33
170        sysmsg "Instrument : 10 uses left" 33
171    elseif "(8/" in instLabel
172        overhead "Instrument : 8 uses left" 33
173        sysmsg "Instrument : 8 uses left" 33
174    elseif "(6/" in instLabel
175        overhead "Instrument : 6 uses left" 33
176        sysmsg "Instrument : 6 uses left" 33
177    elseif "(4/" in instLabel
178        overhead "Instrument : 4 uses left" 33
179        sysmsg "Instrument : 4 uses left" 33
180    elseif "(2/" in instLabel
181        overhead "Instrument : 2 uses left" 33
182        sysmsg "Instrument : 2 uses left" 33
183    elseif "(1/" in instLabel
184        overhead "Instrument : 1 use left" 33
185        sysmsg "Instrument : 1 use left" 33
186    endif
187    
188    if followers > 0
189        say 'all guard me' 32
190    endif
191    
192    if 1 = attackAfterBarding
193        attack currentTarget
194    endif
195    
196elseif 2 = foundTarget
197    if followers > 0
198        say 'all guard me' 32
199    endif
200    
201    if 1 = attackAfterBarding
202        hotkey 'target closest grey monster'
203        attack lasttarget
204    endif
205    
206    #look here for closest peaced target
207    #foreach creature in peacedCreatures
208        
209    #endfor
210    ###
211endif
212
213#********* SONG BUFF *********
214
215if not findbuff "Song Of Peacemaking"
216    wait 650
217    skill 'peacemaking'
218    wait 200
219    
220    if insysmsg "You must wait"
221        overhead "Peace buff skill cooldown" 11
222    else
223        waitfortarget 650
224        target backpack
225    endif
226endif
227
228sysmsg "Peace Finish!" 44