3
//1: Ranged Combat: Get in position
4
//2: Ranged Combat: Aim
5
//3: Ranged Combat: Shoot
8
//6: Attack training dolls
9
//7: Move towards the trouble
11
//On spawn the content equals the character state (Which AI script to run)
12
//After spawn the content determines the speech trigger (0 equals to speak, higher does not)
14
//-----------------------------------------------------------------------------------------
15
//Special for bishopia
17
JoinGoodTeam //Just in case
21
//-----------------------------------------------------------------------------------------
22
//What to do if target is dead
25
IfStateIsNot //Dont stop coming for aid
26
SetTargetToNearestEnemy
28
SetTime //Engage next target
30
tmpargument = 0 //Or return to post
39
//-----------------------------------------------------------------------------------------
42
CallForHelp //Warn friends
52
tmpdistance = rand & 1027 + 11000
63
// Make the character body
67
//-----------------------------------------------------------------------------------------
68
// Get mean if characters wanna be bad
70
tmpargument = rand & 1 + 4
71
tmpdistance = rand & 6000 + 7000
73
SetTargetToWhoeverAttacked
75
CallForHelp //Enemy attacked
77
IfTargetIsAPlayer //Player got into trouble
80
Else //Wops, a friendly NPC attacked
97
//-----------------------------------------------------------------------------------------
100
SetContent //Reset speech counter
102
//MOVE AROUND - GUARD
104
Sneak //Move at 33% speed
105
tmpargument = rand & 60 + 60
107
SetTargetToNearestEnemy
108
tmpargument = rand & 20 + 20
109
IfHoldingRangedWeapon //Engage ranged attack code
112
IfHoldingMeleeWeapon //Charge in melee!
115
Else //Else wander around
116
SetTurnModeToVelocity
117
tmpx = rand & 1024 - 512 + selfx
118
tmpy = rand & 1024 - 512 + selfy
119
tmpturn = rand & 512 - 256 + selfturn
124
// RANGED COMBAT - GET IN POSITON
129
SetTurnModeToVelocity
130
SetTargetToNearestEnemy
133
tmpturn = targetturnto + 32768
141
tmpargument = 0 //No enemies, return to guard mode
144
// RANGED COMBAT - AIM
146
tmpargument = rand & 15 + 15
150
SetTurnModeToVelocity
154
// Keep distance from friends
155
SetTargetToNearestFriend
156
tmpx = targetdistance
169
tmpturn = xyturnto + 32768
170
tmpdistance = 500 // Desired range
175
// Check distance to target
176
tmpx = targetx - selfx
177
tmpy = targety - selfy
178
tmpx = xydistance // Pythag thing... targetdistance isn't as good
179
tmpy = 200 // The desired range ( MIN )
181
tmpy = 1100 // The desired range ( MAX )
183
// Target is in range, so switch to fire state
186
SetTurnModeToWatchTarget
187
tmpargument = 30 // Time before shooting
190
// RANGED COMBAT - SHOOT
193
tmpargument = rand & 7 + 10
196
//Is the target to far away or too close?
198
tmpx = targetdistance
199
IfXIsLessThanY //Too close
201
SetState //If so, go back to positioning
204
IfXIsMoreThanY //Too far away
205
tmpargument = 1 //If so, go back to positioning
208
// Don't shoot if friends are too close
209
SetTargetToNearestFriend
210
tmpx = targetdistance
213
// Keep distance from friends
216
tmpturn = rand & 8191 + 28000 + targetturnto
224
SetTurnModeToWatchTarget
226
tmpargument = LATCHRIGHT
231
IfTargetIsOnHatedTeam
232
tmpargument = LATCHRIGHT
235
SetTargetToNearestEnemy
238
IfHoldingRangedWeapon
242
tmpargument = ACTIONMC
245
RestockTargetAmmoIDFirst
247
RestockTargetAmmoIDFirst
251
tmpdistance = rand & 8000 + 11000
256
//MELEE COMBAT - CHARGE AND FIGHT
261
SetTargetToNearestEnemy //Move towards enemy
264
tmpturn = targetturnto
269
Else //No enemies in sight
270
tmpargument = 0 //begin guarding again
272
tmpx = targetdistance
273
tmpy = 200 //Can we attack?
277
IfTargetIsOnHatedTeam
278
tmpargument = LATCHRIGHT //Yep!
281
//STAND GROUND - GUARD
283
tmpargument = rand & 10 + 5
285
SetTargetToWideEnemy //Enemy in sight
286
IfHoldingMeleeWeapon //charge in melee
290
tmpargument = 1 //Keep distance with ranged
293
tmpx = selfspawnx //Go back to start position
299
//MOVING AROUND - COMING FOR AID
303
SetTargetToWideEnemy //Enemy located, attack him
307
SetTargetToWhoeverCalledForHelp
308
tmpx = targetx //Move towards the trouble
310
tmpturn = targetturnto
314
//-----------------------------------------------------------------------------------------
315
//Use shield against attacking enemies
316
IfTargetIsAttacking //Must be attacking
317
IfTargetIsOnHatedTeam //Must be enemy
318
tmpargument = [SHIE] //Holding shield?
321
tmpx = targetdistance
322
tmpy = 300 + rand & 500
324
tmpargument = LATCHLEFT
325
PressLatchButton //Yep, defend!
327
GetAttackTurn //Position from the attack
335
//-----------------------------------------------------------------------------------------
336
//How to react if bumped
338
SetTargetToWhoeverBumped //
339
IfTargetIsOnHatedTeam //Enemy!
340
IfHoldingRangedWeapon
341
tmpargument = 1 //Run away and get in position
344
tmpargument = 4 //Attack melee
346
Else //Friendly bumper
348
//If its a player, find out what to say
349
IfStateIs0 //Not in combat
350
IfTargetIsAPlayer //Only talk to players
352
IfContentIs //Check speak counter
354
SetContent //Set to no more talking
355
tmpx = rand % 5 //Randomize speech
357
//We serve and protect
363
tmpdistance = rand & 6000 + 8000
366
//Hey! (If male) or Hey baby! (If female), Rouges get a warning instead
370
IfTargetHasSkillID //Obey the law or...
376
IfTargetIsFemale //Hey baby...
386
//Stay out of trouble!
410
//Try to move out of the way of friendlies
411
tmpx = rand & 511 + targetx - 256
412
tmpy = rand & 511 + targety - 256
414
tmpdistance = rand & 250
421
//Guard Captain words
425
IfContentIs //Check speak counter
427
SetContent //Set to no more talking
434
tmpargument = 12 //TODO: Add Griffin Tower quest
437
tmpargument = 11 //Sorry, too low level
445
//-----------------------------------------------------------------------------------------
447
//-----------------------------------------------------------------------------------------