-
Notifications
You must be signed in to change notification settings - Fork 34
/
Blizzard3VAI.eai
83 lines (75 loc) · 2.82 KB
/
Blizzard3VAI.eai
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
//***************************************************************************
//*
//* Melee Template Starting AI Scripts
//*
//***************************************************************************
//===========================================================================
function PickMeleeAI takes player num, string s1, string s2, string s3 returns nothing
local integer pick
local integer i = 0
local integer player_number = 0
local integer team = GetPlayerTeam(num)
// easy difficulty never uses any custom AI scripts
// that are designed to be a bit more challenging
//
loop
exitwhen i >= GetBJMaxPlayers()
if GetPlayerSlotState(Player(i)) == PLAYER_SLOT_STATE_PLAYING then
set player_number = player_number + 1
endif
set i = i + 1
endloop
if R2I(I2R(team) / 2) != I2R(team) / 2 then
set pick = 2 // odd team is AMAI
else
set pick = 1 // even team is AI
endif
if pick == 1 then
call StartMeleeAI(num,s1)
elseif pick == 2 then
call StartMeleeAI(num,s2)
else
call StartMeleeAI(num,s3)
endif
endfunction
//===========================================================================
function MeleeStartingAI takes nothing returns nothing
local integer index
local player indexPlayer
local race indexRace
set index = 0
loop
set indexPlayer = Player(index)
if (GetPlayerSlotState(indexPlayer) == PLAYER_SLOT_STATE_PLAYING) then
set indexRace = GetPlayerRace(indexPlayer)
if (GetPlayerController(indexPlayer) == MAP_CONTROL_COMPUTER) then
// Run a race-specific melee AI script.
if (indexRace == RACE_HUMAN) then
#INCLUDETABLE <$VER$\races.txt> #COND "%1" eq "HUMAN"
call PickMeleeAI(indexPlayer, "%2", "%3", null)
#ENDINCLUDE
elseif (indexRace == RACE_ORC) then
#INCLUDETABLE <$VER$\races.txt> #COND "%1" eq "ORC"
call PickMeleeAI(indexPlayer, "%2", "%3", null)
#ENDINCLUDE
elseif (indexRace == RACE_UNDEAD) then
#INCLUDETABLE <$VER$\races.txt> #COND "%1" eq "UNDEAD"
call PickMeleeAI(indexPlayer, "%2", "%3", null)
#ENDINCLUDE
call RecycleGuardPosition(bj_ghoul[index])
elseif (indexRace == RACE_NIGHTELF) then
#INCLUDETABLE <$VER$\races.txt> #COND "%1" eq "ELF"
call PickMeleeAI(indexPlayer, "%2", "%3", null)
#ENDINCLUDE
else
// Unrecognized race.
endif
call ShareEverythingWithTeamAI(indexPlayer)
endif
endif
set index = index + 1
exitwhen index == GetBJMaxPlayers()
endloop
set indexPlayer = null
set indexRace = null
endfunction