//TESH.scrollpos=0
//TESH.alwaysfold=0
globals
boolean array player_cam
real array player_res
real array player_pow
integer array player_race
dialog dialog_race
button array dialog_race_buttons
endglobals
Name | Type | is_array | initial_value |
dialogtest | dialog | No |
//TESH.scrollpos=24
//TESH.alwaysfold=0
function Trig_Globals_Actions takes nothing returns nothing
local integer index = 0
call CameraSetSmoothingFactor( 10.00 )
loop
exitwhen(index==11)
set player_cam[index] = false
set player_res[index] = 160
set player_pow[index] = 120
if (GetLocalPlayer()==Player(index) ) then
call SetCameraField(CAMERA_FIELD_FARZ, 100000.00, 0.5)
call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE, 1450.00, 0)
endif
set index = index + 1
endloop
set dialog_race = DialogCreate()
call DialogClear(dialog_race)
call DialogSetMessage(dialog_race,"Select Faction")
set dialog_race_buttons[0] = DialogAddButton(dialog_race,"Human",'H')
set dialog_race_buttons[1] = DialogAddButton(dialog_race,"Scourge",'S')
set dialog_race_buttons[2] = DialogAddButton(dialog_race,"Corax",'C')
set dialog_race_buttons[3] = DialogAddButton(dialog_race,"Load Existing",'L')
endfunction
function InitTrig_Globals takes nothing returns nothing
set gg_trg_Globals = CreateTrigger( )
call TriggerAddAction( gg_trg_Globals, function Trig_Globals_Actions )
endfunction
//TESH.scrollpos=42
//TESH.alwaysfold=0
function Trig_Race_Selection_Buttons_Actions takes nothing returns nothing
local player clicker = GetTriggerPlayer()
local real X = GetLocationX(GetStartLocationLoc(GetPlayerStartLocation(clicker)))
local real Y = GetLocationY(GetStartLocationLoc(GetPlayerStartLocation(clicker)))
local integer ID = GetPlayerId(clicker)
local real range = 0
local real range2 = 0
local integer index = 0
if( GetClickedButton() == dialog_race_buttons[0] ) then
set player_race[ID] = 0
call CreateUnit(clicker,'h000',X,Y,270)
set range = GetRandomReal(-600,600)
loop
exitwhen(index == 3)
call CreateUnit(clicker,'h006',X+range,Y+range,270)
set index = index + 1
endloop
set range = GetRandomReal(-800,800)
set index = 0
loop
exitwhen(index == 24)
call CreateUnit(clicker,'o000',X+range,Y+range,270)
set index = index + 1
endloop
set range = GetRandomReal(-1200,1200)
set index = 0
loop
exitwhen(index == 5)
call CreateUnit(clicker,'n00E',X+range,Y+range,270)
set index = index + 1
endloop
set range = GetRandomReal(-1400,1400)
set index = 0
call CreateUnit(clicker,'h008',X+range,Y+range,270)
loop
exitwhen(index == 4)
set range2 = range + GetRandomReal(-50,50)
call CreateUnit(clicker,'h009',X+range2,Y+range2,270)
set index = index + 1
endloop
elseif ( GetClickedButton() == dialog_race_buttons[1] ) then
elseif ( GetClickedButton() == dialog_race_buttons[2] ) then
else
endif
endfunction
function InitTrig_Race_Selection_Buttons takes nothing returns nothing
set gg_trg_Race_Selection_Buttons = CreateTrigger( )
call TriggerAddAction( gg_trg_Race_Selection_Buttons, function Trig_Race_Selection_Buttons_Actions )
endfunction
//TESH.scrollpos=6
//TESH.alwaysfold=0
function Trig_Race_Selection_Actions takes nothing returns nothing
local integer index = 0
set dialog_race = DialogCreate()
call DialogClear(dialog_race)
call DialogSetMessage(dialog_race,"Select Faction")
set dialog_race_buttons[0] = DialogAddButton(dialog_race,"|cff00ffffH|r|cff0080c0uman|r",'H')
//set dialog_race_buttons[1] = DialogAddButton(dialog_race,"|cffff0000S|r|cff800000courge|r",'S')
//set dialog_race_buttons[2] = DialogAddButton(dialog_race,"|cff00ff80C|r|cff00954aorax|r",'C')
//set dialog_race_buttons[3] = DialogAddButton(dialog_race,"|cffc0c0c0L|r|cff8080c0oad Existing|r",'L')
loop
exitwhen(index == 13)
call DialogDisplay(Player(index),dialog_race,true)
call SetPlayerState(Player(index),PLAYER_STATE_RESOURCE_GOLD,500)
call SetPlayerState(Player(index),PLAYER_STATE_RESOURCE_LUMBER,800)
set index = index + 1
endloop
call TriggerRegisterDialogEvent(gg_trg_Race_Selection_Buttons,dialog_race)
endfunction
function InitTrig_Race_Selection takes nothing returns nothing
set gg_trg_Race_Selection = CreateTrigger( )
call TriggerRegisterTimerEvent( gg_trg_Race_Selection, 0.01, false )
call TriggerAddAction( gg_trg_Race_Selection, function Trig_Race_Selection_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Resources_Actions takes nothing returns nothing
local integer index = 0
local player current
loop
exitwhen(index==11)
set current = Player(index)
call SetPlayerState(current,PLAYER_STATE_RESOURCE_GOLD,GetPlayerState(current,PLAYER_STATE_RESOURCE_LUMBER)+R2I(player_res[index]/60))
call SetPlayerState(current,PLAYER_STATE_RESOURCE_LUMBER,GetPlayerState(current,PLAYER_STATE_RESOURCE_GOLD)+R2I(player_pow[index]/60))
set index = index + 1
endloop
endfunction
function InitTrig_Resource_Income takes nothing returns nothing
set gg_trg_Resource_Income = CreateTrigger( )
call TriggerRegisterTimerEvent( gg_trg_Resource_Income, 1.00, true )
call TriggerAddAction( gg_trg_Resource_Income, function Trig_Resources_Actions )
endfunction
//TESH.scrollpos=24
//TESH.alwaysfold=0
function Trig_Camera_Controls_Actions takes nothing returns nothing
local player user = GetTriggerPlayer()
local integer index = GetPlayerId(user)
if( player_cam[index] == false ) then
if (GetLocalPlayer() == user) then
call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE, 9000.00, 0.5)
call SetCameraField(CAMERA_FIELD_FARZ, 100000.00, 0.5)
call SetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK, 270.00, 0.5)
set player_cam[index] = true
endif
else
if (GetLocalPlayer() == user) then
call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE, 1450.00, 0.5)
call SetCameraField(CAMERA_FIELD_FARZ, 100000.00, 0.5)
call SetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK, 304.00, 0.5)
set player_cam[index] = false
endif
endif
endfunction
function InitTrig_Camera_Controls takes nothing returns nothing
local integer index = 0
set gg_trg_Camera_Controls = CreateTrigger( )
loop
exitwhen(index==11)
call TriggerRegisterPlayerEvent(gg_trg_Camera_Controls, Player(index), EVENT_PLAYER_END_CINEMATIC)
set index = index + 1
endloop
call TriggerAddAction( gg_trg_Camera_Controls, function Trig_Camera_Controls_Actions )
endfunction
//TESH.scrollpos=15
//TESH.alwaysfold=0
function Trig_Mine_Built_Conditions takes nothing returns boolean
if ( GetUnitRace(GetConstructedStructure()) == RACE_UNDEAD ) then
return true
endif
return false
endfunction
function Trig_Mine_Built_Actions takes nothing returns nothing
local unit mine = GetConstructedStructure()
local integer index = GetPlayerId(GetOwningPlayer(mine))
set player_res[index] = player_res[index] + GetUnitPointValue(mine)
set player_pow[index] = player_pow[index] + GetUnitFlyHeight(mine)
endfunction
function InitTrig_Mine_Built takes nothing returns nothing
local integer index = 0
set gg_trg_Mine_Built = CreateTrigger( )
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_Mine_Built, Player(index), EVENT_PLAYER_UNIT_CONSTRUCT_FINISH, null)
set index = index + 1
exitwhen index == 16
endloop
call TriggerAddCondition( gg_trg_Mine_Built, Condition( function Trig_Mine_Built_Conditions ) )
call TriggerAddAction( gg_trg_Mine_Built, function Trig_Mine_Built_Actions )
endfunction
//TESH.scrollpos=15
//TESH.alwaysfold=0
function Trig_Mine_Death_Conditions takes nothing returns boolean
if ( GetUnitRace(GetConstructedStructure()) == RACE_UNDEAD ) then
return true
endif
return false
endfunction
function Trig_Mine_Death_Actions takes nothing returns nothing
local unit mine = GetConstructedStructure()
local integer index = GetPlayerId(GetOwningPlayer(mine))
set player_res[index] = player_res[index] - GetUnitPointValue(mine)
set player_pow[index] = player_pow[index] - GetUnitFlyHeight(mine)
endfunction
function InitTrig_Mine_Death takes nothing returns nothing
local integer index = 0
set gg_trg_Mine_Death = CreateTrigger( )
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_Mine_Death, Player(index), EVENT_PLAYER_UNIT_DEATH, null)
set index = index + 1
exitwhen index == 16
endloop
call TriggerAddCondition( gg_trg_Mine_Death, Condition( function Trig_Mine_Death_Conditions ) )
call TriggerAddAction( gg_trg_Mine_Death, function Trig_Mine_Death_Actions )
endfunction
//TESH.scrollpos=33
//TESH.alwaysfold=0
function Trig_Infantry_Built_Conditions takes nothing returns boolean
if ( IsUnitType(GetTrainedUnit(), UNIT_TYPE_STRUCTURE) == false) then
return true
endif
return false
endfunction
function Trig_Infantry_Built_Actions takes nothing returns nothing
local unit trained = GetTrainedUnit()
local location destination = GetUnitRallyPoint(GetTriggerUnit())
local integer count = GetUnitPointValue(trained)
local integer index = 0
local player owner = GetOwningPlayer(trained)
local integer id = GetUnitTypeId(trained)
local real X = GetUnitX(trained)
local real Y = GetUnitY(trained)
local real face = GetUnitFacing(trained)
call RemoveUnit(trained)
loop
exitwhen(index == count)
call IssuePointOrderLoc(CreateUnit(owner,id,X,Y,face),"attack",destination)
set index = index + 1
endloop
call RemoveLocation(destination)
endfunction
function InitTrig_Infantry_Built takes nothing returns nothing
local integer index = 0
set gg_trg_Infantry_Built = CreateTrigger( )
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_Infantry_Built, Player(index), EVENT_PLAYER_UNIT_TRAIN_FINISH, null)
set index = index + 1
exitwhen index == 16
endloop
call TriggerAddCondition( gg_trg_Infantry_Built, Condition( function Trig_Infantry_Built_Conditions ) )
call TriggerAddAction( gg_trg_Infantry_Built, function Trig_Infantry_Built_Actions )
endfunction
//TESH.scrollpos=12
//TESH.alwaysfold=0
function Trig_safety_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A001' ) ) then
return false
endif
return true
endfunction
function Trig_safety_Func001C takes nothing returns boolean
local location LOC = GetUnitLoc(GetTriggerUnit())
if ( not ( GetTerrainTypeBJ(LOC) == 'Oaby' ) ) then
call RemoveLocation(LOC)
return false
endif
call RemoveLocation(LOC)
return true
endfunction
function Trig_safety_Actions takes nothing returns nothing
if ( Trig_safety_Func001C() ) then
call IssueImmediateOrderBJ( GetTriggerUnit(), "stop" )
else
endif
endfunction
function InitTrig_safety takes nothing returns nothing
set gg_trg_safety = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_safety, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_safety, Condition( function Trig_safety_Conditions ) )
call TriggerAddAction( gg_trg_safety, function Trig_safety_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Large_Ones_Func001001002 takes nothing returns boolean
return ( IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) == true )
endfunction
function Trig_Large_Ones_Func001A takes nothing returns nothing
local integer index = 0
local real X = GetUnitX(GetEnumUnit())
local real Y = GetUnitY(GetEnumUnit())
loop
exitwhen(index == 4)
call CreateDestructable('B00J',X+GetRandomReal(-150,150),Y+GetRandomReal(-150,150),GetRandomReal(0,180),GetRandomReal(0.6,1),GetRandomInt(1,5))
set index = index + 1
endloop
endfunction
function Trig_Large_Ones_Func002A takes nothing returns nothing
local integer index = 0
local unit buffer = null
local unit pick = GetEnumUnit()
local real X = GetUnitX(pick)
local real Y = GetUnitY(pick)
call SetUnitFacingTimed( pick, GetRandomReal(0, 360.00), 0 )
call SetUnitVertexColor(pick, GetRandomInt(0, 100), GetRandomInt(0, 100), GetRandomInt(0, 100), 255)
call SetUnitFlyHeight(pick,GetRandomReal(2400,3700),0)
loop
exitwhen(index == 10)
set buffer = CreateUnit(Player(PLAYER_NEUTRAL_AGGRESSIVE),'o00A',X+GetRandomReal(500,2000),Y+GetRandomReal(500,2000),0)
call SetUnitFlyHeight(pick,GetRandomReal(2000,4000),0)
call SetUnitVertexColor( buffer, GetRandomInt(0, 100), GetRandomInt(0, 100), GetRandomInt(0, 100), 255 )
set index = index + 1
endloop
endfunction
function Trig_Large_Ones_Actions takes nothing returns nothing
call ForGroupBJ( GetUnitsOfPlayerMatching(Player(PLAYER_NEUTRAL_PASSIVE), Condition(function Trig_Large_Ones_Func001001002)), function Trig_Large_Ones_Func001A )
call ForGroupBJ( GetUnitsOfTypeIdAll('o00A'), function Trig_Large_Ones_Func002A )
endfunction
function InitTrig_Large_Ones takes nothing returns nothing
set gg_trg_Large_Ones = CreateTrigger( )
call TriggerAddAction( gg_trg_Large_Ones, function Trig_Large_Ones_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Meteors_Actions takes nothing returns nothing
call CreateUnit(Player(PLAYER_NEUTRAL_AGGRESSIVE),'n00G',GetRandomReal(-30000,30000),GetRandomReal(-30000,30000),0)
endfunction
function InitTrig_Meteors takes nothing returns nothing
set gg_trg_Meteors = CreateTrigger( )
call TriggerRegisterTimerEvent( gg_trg_Meteors, 2.00,true )
call TriggerAddAction( gg_trg_Meteors, function Trig_Meteors_Actions )
endfunction