Name | Type | is_array | initial_value |
//TESH.scrollpos=0
//TESH.alwaysfold=0
function InitTrig_replay takes nothing returns nothing
endfunction
//======================================================================
library replay requires config
globals
public boolean game=true
endglobals
function B2S takes boolean b returns string
if b then
return "true"
endif
return "false"
endfunction
public function Init takes nothing returns nothing
local real CameraX=GetCameraTargetPositionX()
local real CameraY=GetCameraTargetPositionY()
call EnableUserControl(false)
call PauseGame(true)
call TriggerSleepAction(0)
call SetCameraPosition(CameraX+50,CameraY+50)
call TriggerSyncReady()
call TriggerSleepAction(0)
call PauseGame(false)
if R2I(GetCameraTargetPositionX())!=R2I(CameraX) then
call SetCameraPosition(CameraX,CameraY)
set game=true
else
//call msg(Player(0),R2S(GetCameraTargetPositionX())+" / "+R2S(CameraX+1),"")
set game=false
endif
call EnableUserControl(true)
//call msg(Player(0),"is this replay? "+B2S(not game),"")
endfunction
endlibrary
//TESH.scrollpos=14
//TESH.alwaysfold=0
function InitTrig_Safety takes nothing returns nothing
endfunction
//======================================================================
library Safety
//######################################################################
//#
//# library Safety
//#
//######################################################################
globals
private timer H
private timer array T
private integer N=0
endglobals
//======================================================================
function NewTimer takes nothing returns timer
if N==0 then
set H=CreateTimer()
else
set N=N-1
set H=T[N]
endif
return H
endfunction
function ReleaseTimer takes timer t returns nothing
call PauseTimer(t)
if N==8191 then
//stack is full, the map already has much more troubles than the chance of bug
call DestroyTimer(t)
else
set T[N]=t
set N=N+1
endif
endfunction
endlibrary
//TESH.scrollpos=1178
//TESH.alwaysfold=0
function InitTrig_config takes nothing returns nothing
endfunction
//===========================================================================
library config initializer Init requires Safety
globals
constant integer FILES=64
integer FILE=0
real FILEPROCESS=0.
constant integer FORCES=2
constant integer MAXPLAYERS=10
integer map=6
rect rect_map
boolean loaded=false
integer main_cliff=0
constant integer min_map=3
constant integer max_map=8
constant real MAP_SELECT=40.
constant real ROUND_SETUP_DELAY=2.5
constant real ROUND_END_DELAY=6.
constant real ROUND_END_WAIT=30.
constant real GAME_END_WAIT=60.
constant real ROUND_CLASS=15.
constant real ROUND_ZOMBIE=25.
real ROUND_MAX=0
constant real CAMERA_DELAY=0.3
constant real CAMERA_ZOFFSET=1675.
constant real SOUND_FOG_DIST=700.
constant real UNIT_HEIGHT=80.
constant real UNIT_MAX_HEIGHT=1000.
constant real ITEM_RANGE=92.
constant string MODEL_WINNER="Abilities\\Spells\\Orc\\MirrorImage\\MirrorImageCaster.mdl"
constant string MODEL_WATER_SPLASH="water.mdl"
constant string MODEL_DUST_SPLASH="dust.mdl"
constant string MODEL_DUST_IMPACT="impactdust.mdl"
//constant string MODEL_BACKSTAB="Abilities\\Spells\\Undead\\DeathCoil\\DeathCoilSpecialArt.mdl"
constant string MODEL_ITEM="Objects\\Spawnmodels\\Other\\ToonBoom\\ToonBoom.mdl"
//constant string MODEL_ARROW="Abilities\\Weapons\\GuardTowerMissile\\GuardTowerMissile.mdl"
//constant string MODEL_WALL="Abilities\\Weapons\\AncientProtectorMissile\\AncientProtectorMissile.mdl"
//constant string MODEL_WAVE="Abilities\\Spells\\Other\\CrushingWave\\CrushingWaveMissile.mdl"
//constant string MODEL_NINJAKIN="Abilities\\Weapons\\LavaSpawnMissile\\LavaSpawnBirthMissile.mdl"
//constant string MODEL_GRIND="Abilities\\Spells\\Human\\Thunderclap\\ThunderClapCaster.mdl"
//constant string MODEL_STUN="Abilities\\Weapons\\FarseerMissile\\FarseerMissile.mdl"
//constant string MODEL_FIREBALL="Abilities\\Weapons\\RedDragonBreath\\RedDragonMissile.mdl"
//constant string MODEL_SHURIKEN="Abilities\\Weapons\\SentinelMissile\\SentinelMissile.mdl"
//constant string MODEL_BIG_EXPLOSION="Abilities\\Weapons\\DemolisherFireMissile\\DemolisherFireMissile.mdl"
//constant string MODEL_HUGE_EXPLOSION="Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl"
//constant string MODEL_SMALL_EXPLOSION="Abilities\\Spells\\Other\\TinkerRocket\\TinkerRocketMissile.mdl"
//constant string MODEL_HEAL="Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl"
//constant string MODEL_MJOLNIR="Abilities\\Spells\\Human\\StormBolt\\StormBoltMissile.mdl"
//constant string MODEL_DAMAGEBONUS="damagebonus.mdl"
//constant string MODEL_ACID="acid.mdl"
// salamander
constant string MODEL_HIT="hit.mdl"
constant string MODEL_HIT2="hit2.mdl"
constant string MODEL_HITW="hit_wood.mdl"
constant string MODEL_EXPLO_AIR="Model\\EXair.mdl"
constant string MODEL_EXPLO_GROUND="Model\\EXground.mdl"
constant string MODEL_ALCHEMY="Model\\Nade.mdl"
constant string MODEL_BONES="Model\\Bones.mdl"
constant string MODEL_BLOOD="Model\\Blood.mdl"
constant string MODEL_BULLET="Model\\Bullet.mdl"
constant string MODEL_BULLET2="Model\\Bullet2.mdl"
constant string MODEL_EXPLO_FLARE="Model\\Flare.mdl"
constant string MODEL_EXPLO_FLARE2="Model\\FlareKnife.mdl"
constant string MODEL_FIRE="Model\\Fire.mdl"
constant string MODEL_AIRSTRIKE="Abilities\\Weapons\\GyroCopter\\GyroCopterMissile.mdl"
constant string MODEL_ROCKET="Model\\bluerocket.mdl"
constant string MODEL_ROCKET2="Model\\redrocket.mdl"
constant string MODEL_AOE="Model\\AOE.mdl"
constant string MODEL_ICON_BOMB="Model\\ping_bomb.mdl"
constant string MODEL_ICON_NADE="Model\\ping_nade.mdl"
constant string MODEL_ICON_SMOKE="Model\\ping_smoke.mdl"
constant string MODEL_ICON_LSD="Model\\ping_lsd.mdl"
constant string MODEL_ICON_STICKY="Model\\ping_sticky.mdl"
constant string MODEL_ICON_DEATH="Model\\ping_death.mdl"
//constant string MODEL_AOE="Abilities\\Spells\\NightElf\\TrueshotAura\\TrueshotAura.mdl"
constant string SOUND_GUN="Units\\Human\\Rifleman\\RiflemanAttack1.wav"
constant string SOUND_BOUNCE="Sound\\Flechete.wav"
constant string SOUND_FEET="Sound\\Feet.wav"
constant string SOUND_PICKUP="Sound\\pickup.wav"
constant string SOUND_GIBS="Sound\\gibs.wav"
constant string SOUND_MSG="Sound\\Interface\\hint.wav"
constant string SOUND_LEAVER="Abilities\\Spells\\NightElf\\shadowstrike\\ShadowStrikeBirth1.wav"
constant string SOUND_HIT_FLESH="Sound\\hitflesh.mp3"
constant string SOUND_HIT_WOOD="Sound\\hitwood.mp3"
constant integer RAW_ABIL_ATTACK= 'A000'
constant integer RAW_ABIL_NADEGLOW= 'AId8'
// toy soldier
constant integer RAW_MISSION= 'hrtt'
constant integer RAW_BOMB= 'n001'
constant integer RAW_ABIL_NADE= 'A002'
constant integer RAW_MARINE= 'Hapm'
constant integer RAW_MEDIC= 'Hart'
constant integer RAW_SCOUT= 'Hpb2'
constant integer RAW_SNIPER= 'Hgam'
constant integer RAW_OPERATOR= 'Hant'
constant integer RAW_GUNNER= 'Hmgd'
constant integer RAW_STALKER= 'Hpb1'
constant integer RAW_CLOAKED= 'Harf'
constant integer RAW_ZOMBIE= 'Huth'
constant integer RAW_MINION= 'ugho'
constant integer RAW_FLYHACK= 'Amrf'
constant integer RAW_DUMMY= 'ushd'
constant integer RAW_MIRROR= 'negf'
constant integer RAW_WALL_WOODEN= 'h003'
constant integer RAW_CLASS= 'hhou'
constant string COLOR_TEAM1= "|c00FF4040"
constant string COLOR_TEAM2= "|c000080FF"
constant string COLOR_TEAM3= "|c00808080"
constant string COLOR_END= "|r"
constant string STRING_NOTICE= "|c00FFFF00Notice:|r "
constant string STRING_GAME= "|c0080FF00Game:|r "
boolexpr BOOLEXPR_TRUE
boolexpr BOOLEXPR_FALSE
real MAX_X=0
real MIN_X=0
real MAX_Y=0
real MIN_Y=0
real SPAWN_X=0
real SPAWN_Y=0
unit placeholdunit=null
mobile placeholdmobile=0
Item placeholditem=0
item lastitem=null
boolean itempickup=true
location Z_HACK=null
group TREES=null
integer array STATS_CLASSES_USED
string array STATS_CLASSES_ID
endglobals
function echo takes string m returns nothing
if autor!=null then
call DisplayTimedTextToPlayer(autor,0,0,10,m)
endif
endfunction
function CinematicFadeWithUI takes real sred, real sgreen, real sblue, real red, real green, real blue, real duration, string tex, real startTrans, real endTrans returns nothing
if duration==0 then
set startTrans=endTrans
endif
call SetCineFilterTexture(tex)
call SetCineFilterBlendMode(BLEND_MODE_BLEND)
call SetCineFilterTexMapFlags(TEXMAP_FLAG_NONE)
call SetCineFilterStartUV(0,0,1,1)
call SetCineFilterEndUV(0,0,1,1)
call SetCineFilterStartColor(PercentTo255(sred),PercentTo255(sgreen),PercentTo255(sblue),PercentTo255(100-startTrans))
call SetCineFilterEndColor(PercentTo255(red),PercentTo255(green),PercentTo255(blue),PercentTo255(100-endTrans))
call SetCineFilterDuration(duration)
call DisplayCineFilter(true)
endfunction
function CinematicFadeWithUI2 takes real red, real green, real blue, real duration, string tex, real startTrans, real endTrans returns nothing
if duration==0 then
set startTrans=endTrans
endif
call SetCineFilterTexture(tex)
call SetCineFilterBlendMode(BLEND_MODE_BLEND)
call SetCineFilterTexMapFlags(TEXMAP_FLAG_NONE)
call SetCineFilterStartUV(0, 0, 1, 1)
call SetCineFilterEndUV(0, 0, 1, 1)
call SetCineFilterStartColor(PercentTo255(red),PercentTo255(green),PercentTo255(blue),PercentTo255(100-startTrans))
call SetCineFilterEndColor(PercentTo255(red),PercentTo255(green),PercentTo255(blue),PercentTo255(100-endTrans))
call SetCineFilterDuration(duration)
call DisplayCineFilter(true)
endfunction
function SOUND_EXPLO takes nothing returns string
//return "Sound\\explosion"+I2S(GetRandomInt(1,1))+".mp3"
return "Sound\\explosion1.mp3"
endfunction
function SOUND_IMPACT takes nothing returns string
local integer r=GetRandomInt(0,3)
if r>0 then
return "Sound\\impact7.wav"
endif
return "Sound\\impact"+I2S(GetRandomInt(4,6))+".wav"
endfunction
function SOUND_METAL_IMPACT takes nothing returns string
return "Sound\\impact"+I2S(GetRandomInt(1,3))+".wav"
endfunction
private function returnfalse takes nothing returns boolean
return false
endfunction
private function returntrue takes nothing returns boolean
return true
endfunction
function KillUnitA takes unit a returns nothing
call ShowUnit(a,false)
call SetUnitExploded(a,true)
call KillUnit(a)
endfunction
//######################################################################
//#
//# Init
//#
//######################################################################
function AddSound takes unit u, string file returns nothing
local sound s=CreateSound(file,false,true,false,10,10,"")
call SetSoundPitch(s,GetRandomReal(0.75,1.25))
call SetSoundVolume(s,128)
call SetSoundDistances(s,600,10000)
call SetSoundDistanceCutoff(s,3000)
call AttachSoundToUnit(s,u)
call StartSound(s)
call KillSoundWhenDone(s)
set s=null
endfunction
function PreloadSnd3d takes string file returns nothing
local sound s=CreateSound(file,false,true,false,10,10,"")
call SetSoundVolume(s,1)
call SetSoundPosition(s,0,0,0)
call SetSoundDistances(s,1000000,1000000)
call SetSoundDistanceCutoff(s,1000000)
call StartSound(s)
call KillSoundWhenDone(s)
set s=null
endfunction
function PreloadSnd2d takes string file returns nothing
local sound s=CreateSound(file,false,false,false,10,10,"")
call SetSoundVolume(s,1)
call StartSound(s)
call KillSoundWhenDone(s)
set s=null
endfunction
function PreloadSnd takes string file, boolean s returns nothing
//call FogEnable(false)
if s then
call PreloadSnd3d(file)
else
call PreloadSnd2d(file)
endif
call TriggerSleepAction(0)
set FILE=FILE+1
//call FogEnable(true)
endfunction
function PreloadProcessFinal takes nothing returns nothing
local integer s=100
local real x=GetStartLocationX(GetPlayerStartLocation(Player(0)))
local real y=GetStartLocationY(GetPlayerStartLocation(Player(0)))
local real a
local real b
local integer i=2
loop
set i=i-1
set a=x+GetRandomInt(-s,s)
set b=y+GetRandomInt(-s,s)
//call KillDestructable(CreateDestructableZ('B000',a,b,650,GetRandomReal(0,360),1.5,1))
call KillDestructable(CreateDestructableZ('B000',a,b,660,GetRandomReal(0,360),.7,1))
exitwhen i<=0
endloop
set s=160
set i=5
loop
set i=i-1
call KillDestructable(CreateDestructableZ('B001',x+GetRandomInt(-s,s),y+GetRandomInt(-s,s),661,GetRandomReal(0,360),.5,1))
exitwhen i<=0
endloop
call AddSound(gg_unit_hpea_0010,"Sound\\shotgun.wav")
call UnitApplyTimedLife(gg_unit_hpea_0010,0,5)
endfunction
function PreloadProcess takes nothing returns nothing
local timer t=GetExpiredTimer()
local real bit=100./FILES
//local integer s=150
//local real x=GetStartLocationX(GetPlayerStartLocation(Player(0)))
//local real y=GetStartLocationY(GetPlayerStartLocation(Player(0)))
//call echo(I2S(FILE)+"/"+I2S(FILES))
if FILEPROCESS<FILE*bit then
set FILEPROCESS=FILEPROCESS+1.
//call KillDestructable(CreateDestructableZ('B00C',x+GetRandomInt(-s,s),y+GetRandomInt(-s,s),650,GetRandomReal(0,360),0.1,1))
endif
call SetTextTagText(LABELPROCESS.t,I2S(R2I(RMinBJ(FILEPROCESS+.5,100)))+"%",TextTagSize2Height(LABELPROCESS.size))
if FILEPROCESS>=100. then
call ReleaseTimer(t)
//call SetTextTagPermanent(LABELPROCESS.t,false)
call LABELPROCESS.timed(1,2.5)
set FILE=-1
set loaded=true
call PreloadProcessFinal()
endif
set t=null
endfunction
private function Init takes nothing returns nothing
local integer i=0
call SetAllyColorFilterState(0)
call EnableMinimapFilterButtons(false,false)
//konfiguracie premennych
set BOOLEXPR_TRUE= Condition(function returntrue)
set BOOLEXPR_FALSE=Condition(function returnfalse)
set MAX_X=GetCameraBoundMaxX()
set MIN_X=GetCameraBoundMinX()
set MAX_Y=GetCameraBoundMaxY()
set MIN_Y=GetCameraBoundMinY()
set Z_HACK=Location(0,0)
set mission_unit[0]=null
set mission_unit[1]=null
set TREES=CreateGroup()
//statistika
set STATS_CLASSES_USED[0]=7
loop
set i=i+1
set STATS_CLASSES_USED[i]=0
exitwhen i==STATS_CLASSES_USED[0]
endloop
set STATS_CLASSES_ID[1]="Mar"
set STATS_CLASSES_ID[2]="Rec"
set STATS_CLASSES_ID[3]="Med"
set STATS_CLASSES_ID[4]="Sni"
set STATS_CLASSES_ID[5]="Op"
set STATS_CLASSES_ID[6]="MG"
set STATS_CLASSES_ID[7]="St"
//vypnutie blbych zvukov, rusivych :P
call StopSound(bj_dayAmbientSound,true,true)
call StopSound(bj_nightAmbientSound,true,true)
set bj_useDawnDuskSounds=false
call VolumeGroupSetVolume(SOUND_VOLUMEGROUP_AMBIENTSOUNDS,.5)
//loading
call ShowUnit(gg_unit_hpea_0010,false)
call TimerStart(NewTimer(),.05,true,function PreloadProcess)
call CinematicFadeWithUI2(0,0,0,1,"ReplaceableTextures\\CameraMasks\\Black_mask.blp",0,255)
//loading
//blbosti
call CameraSetSmoothingFactor(100)
call FogMaskEnable(false)
call FogEnable(false)
call SetFloatGameState(GAME_STATE_TIME_OF_DAY,0)
call SetTimeOfDayScale(0) //200% cas, default 2
//call SetDayNightModels("","")
//masivny preload
call ShowInterface(false,.01)
call TriggerSleepAction(0)
// pocet suborov je riadok posledneho - riadok prveho + 1
//call ExecuteFunc("replay_Init")
//call PreloadSnd("Sound\\Interface\\QuestNew.wav",false)
//call PreloadSnd("Sound\\Interface\\QuestCompleted.wav",false)
//call PreloadSnd("Sound\\Interface\\QuestFailed.wav",false)
//call PreloadSnd("Abilities\\Spells\\Human\\Slow\\SlowTarget.wav",false)
call PreloadSnd("Sound\\Interface\\ArrangedTeamInvitation.wav",false)
call PreloadSnd("Abilities\\Spells\\Other\\AcidBomb\\AlchemistAcidBurnMissileDeath1.wav",true)
call PreloadSnd("Abilities\\Spells\\Other\\FrostBolt\\FrostBoltHit1.wav",true)
call PreloadSnd("sound\\buildings\\shared\\BuildingPlacement.wav",true)
call PreloadSnd("Sound\\alarm.mp3",false)
call PreloadSnd("Sound\\explosion1.mp3",true)
call PreloadSnd("Sound\\explosion_blast.mp3",true)
call PreloadSnd("Sound\\explosion_L.mp3",false)
call PreloadSnd("Sound\\explosion_R.mp3",false)
call PreloadSnd("Sound\\turret.mp3",true)
call PreloadSnd("Sound\\machinegun.wav",true)
call PreloadSnd("Sound\\machinegun_.mp3",false)
call PreloadSnd("Sound\\shotgun.wav",true)
call PreloadSnd("Sound\\smoke.mp3",true)
call PreloadSnd("Sound\\silencer.mp3",true)
call PreloadSnd("Sound\\sticky.mp3",true)
call PreloadSnd("Abilities\\Spells\\Human\\FlakCannons\\FlakCannon.wav",true)
call PreloadSnd("Sound\\impact1.wav",true)
call PreloadSnd("Sound\\impact2.wav",true)
call PreloadSnd("Sound\\impact3.wav",true)
call PreloadSnd("Sound\\impact4.wav",true)
call PreloadSnd("Sound\\impact5.wav",true)
call PreloadSnd("Sound\\impact6.wav",true)
call PreloadSnd("Sound\\impact7.wav",true)
call PreloadSnd("Sound\\Step\\inwater.wav",true)
call PreloadSnd("Sound\\Step\\dirt1.wav",true)
call PreloadSnd("Sound\\Step\\dirt2.wav",true)
call PreloadSnd("Sound\\Step\\dirt3.wav",true)
call PreloadSnd("Sound\\Step\\dirt4.wav",true)
call PreloadSnd("Sound\\Step\\grass1.wav",true)
call PreloadSnd("Sound\\Step\\grass2.wav",true)
call PreloadSnd("Sound\\Step\\grass3.wav",true)
call PreloadSnd("Sound\\Step\\grass4.wav",true)
call PreloadSnd("Sound\\Step\\gravel1.wav",true)
call PreloadSnd("Sound\\Step\\gravel2.wav",true)
call PreloadSnd("Sound\\Step\\gravel3.wav",true)
call PreloadSnd("Sound\\Step\\gravel4.wav",true)
call PreloadSnd("Sound\\Step\\slosh1.wav",true)
call PreloadSnd("Sound\\Step\\slosh2.wav",true)
call PreloadSnd("Sound\\Step\\slosh3.wav",true)
call PreloadSnd("Sound\\Step\\slosh4.wav",true)
call PreloadSnd("Sound\\gibs.wav",true)
call PreloadSnd("Sound\\drug.mp3",true)
call PreloadSnd("Sound\\pills.mp3",true)
call PreloadSnd("Sound\\satellite.mp3",true)
call PreloadSnd("Sound\\flyby.mp3",false)
call PreloadSnd("Units\\Orc\\HeroBladeMaster\\HeroBladeMasterAttack1.wav",true)
call PreloadSnd("Sound\\knife.mp3",true)
call PreloadSnd("Units\\Undead\\Ghoul\\Cannibalize.wav",true)
call PreloadSnd(SOUND_GUN,true)
call PreloadSnd(SOUND_BOUNCE,true)
call PreloadSnd(SOUND_FEET,true)
call PreloadSnd(SOUND_PICKUP,true)
call PreloadSnd(SOUND_MSG,false)
call PreloadSnd("Sound\\hit.mp3",false)
call PreloadSnd("Sound\\hitflesh.mp3",true)
call PreloadSnd("Sound\\hitwood.mp3",true)
call PreloadSnd("Sound\\Whistle.mp3",true)
call PreloadSnd("Sound\\UI\\redteamwins.mp3",false)
call PreloadSnd("Sound\\UI\\blueteamwins.mp3",false)
call PreloadSnd("Sound\\UI\\neitherteamwins.mp3",false)
call PreloadSnd("Sound\\UI\\firstblood.mp3",false)
call PreloadSnd("Sound\\UI\\bombplant.mp3",false)
call PreloadSnd("Sound\\UI\\bombdefuse.mp3",false)
//call TriggerSleepAction(2)
call ShowInterface(true,.01)
//set loaded=true
endfunction
function AddSound2D takes player p, string file returns nothing
local sound s=CreateSound(file,false,false,false,10,10,"")
local integer vol=0
//call SetSoundPitch(s,GetRandomReal(0.5,0.75))
if GetLocalPlayer()==p then
set vol=100
endif
call SetSoundVolume(s,vol)
call StartSound(s)
call KillSoundWhenDone(s)
set s=null
endfunction
function AddSound2DForce takes integer p, string file returns nothing
local sound s=CreateSound(file,false,false,false,10,10,"")
local integer vol=0
if IsPlayerInForce(GetLocalPlayer(),player_Force[p]) then
set vol=100
endif
call SetSoundVolume(s,vol)
call StartSound(s)
call KillSoundWhenDone(s)
set s=null
endfunction
function msg takes player p, string m, string snd returns nothing
call DisplayTimedTextToPlayer(p,0,0,1,m)
if snd!="" then
call AddSound2D(p,snd)
endif
endfunction
function msg_timed takes player p, real t, string m, string snd returns nothing
call DisplayTimedTextToPlayer(p,0,0,t,m)
if snd!="" then
call AddSound2D(p,snd)
endif
endfunction
function statistics takes nothing returns nothing
local real t=30
local string s=""
local integer i=0
local integer n=0
local integer z
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,t,"Statistics:")
loop
set i=i+1
set n=n+STATS_CLASSES_USED[i]
exitwhen i==STATS_CLASSES_USED[0]
endloop
set i=0
loop
set i=i+1
set z=R2I(I2R(STATS_CLASSES_USED[i])/n*100+0.5)
set s=s+"|c00FFB3FF"+STATS_CLASSES_ID[i]+"|r=|c0080FFFF"+I2S(z)+"|r% ; "
exitwhen i==STATS_CLASSES_USED[0]
endloop
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,t,"|c0080FF00Classes used:|r
"+s)
set i=0
set z=0
loop
exitwhen i==MAXPLAYERS
if player_drug[i]>z then
set z=player_drug[i]
set n=i
endif
set i=i+1
endloop
if z>0 then
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,t,"|c0080FF00Drug abuser:|r "+GetPlayerName(Player(n)))
endif
set i=0
set z=0
loop
exitwhen i==MAXPLAYERS
if player_stats_kill[i]>z then
set z=player_stats_kill[i]
set n=i
endif
set i=i+1
endloop
if z>0 then
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,t,"|c0080FF00Most kills:|r "+GetPlayerName(Player(n)))
endif
set i=0
set z=0
loop
exitwhen i==MAXPLAYERS
if player_stats_death[i]>z then
set z=player_stats_death[i]
set n=i
endif
set i=i+1
endloop
if z>0 then
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,t,"|c0080FF00Most deaths:|r "+GetPlayerName(Player(n)))
endif
set i=0
set z=0
loop
exitwhen i==MAXPLAYERS
if player_stats_fb[i]>z then
set z=player_stats_fb[i]
set n=i
endif
set i=i+1
endloop
if z>0 then
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,t,"|c0080FF00Most firstblood:|r "+GetPlayerName(Player(n)))
endif
endfunction
function DamageArea takes real distance, real radius, real maxdmg returns real
return (radius-distance)/radius*maxdmg
endfunction
function GetZ takes real x, real y returns real
call MoveLocation(Z_HACK,x,y)
return GetLocationZ(Z_HACK)
return 0.
endfunction
function GetAngleFix takes real a returns real
// set a=-2120
// call BJDebugMsg("calc="+R2S(a))
if a>360 then
set a=a - R2I(a/360.)*360.
elseif a<0 then
// call BJDebugMsg("calc x="+R2S(I2R(R2I(RAbsBJ(a)/360.)+1)))
// call BJDebugMsg("calc base="+R2S((R2I(RAbsBJ(a)/360.)+1)*360.))
set a=I2R(R2I(RAbsBJ(a)/360.)+1)*360. + a
endif
// call BJDebugMsg("calc end="+R2S(a))
return a
endfunction
function AddSoundFog takes unit u, string file returns nothing
local sound s=CreateSound(file,false,false,false,10,10,"")
local integer vol=0
call SetSoundPitch(s,GetRandomReal(0.5,0.75))
if GetLocalPlayer()!=Player(12) then
if RAbsBJ(GetCameraTargetPositionX()-GetUnitX(u))>SOUND_FOG_DIST and RAbsBJ(GetCameraTargetPositionY()-GetUnitY(u))>SOUND_FOG_DIST then
set vol=32
endif
endif
if IsFoggedToPlayer(GetUnitX(u),GetUnitY(u),GetLocalPlayer()) then
set vol=32
endif
call SetSoundVolume(s,vol)
call StartSound(s)
call KillSoundWhenDone(s)
set s=null
endfunction
//function AddSoundFogStereo takes unit u, string file, boolean left returns nothing
// local sound s=CreateSound(file,false,false,false,10,10,"")
// local integer vol=0
// call SetSoundPitch(s,GetRandomReal(0.75,0.8))
// if IsFoggedToPlayer(GetUnitX(u),GetUnitY(u),GetLocalPlayer()) then
// if GetCameraEyePositionX()>GetUnitX(u) and left then
// set vol=32
// elseif GetCameraEyePositionX()<GetUnitX(u) and not left then
// set vol=32
// endif
// endif
// call SetSoundVolume(s,vol)
// call StartSound(s)
// call KillSoundWhenDone(s)
// set s=null
//endfunction
function AddSoundStereo takes unit u, string left, string right returns nothing
local sound s1=CreateSound(left,false,false,false,10,10,"")
local sound s2=CreateSound(right,false,false,false,10,10,"")
local integer vol1=0
local integer vol2=0
local real x=0
local real y=0
local real a=0
local real d=100
local real range=3500
local real hyp=0
//GetLocalPlayer()==GetLocalPlayer()
if GetLocalPlayer()!=Player(12) then
set x=GetCameraEyePositionX()-GetUnitX(u)
set y=GetCameraEyePositionY()-GetUnitY(u)
set hyp=SquareRoot(x*x+y+y)
if hyp==0 then
set hyp=1
endif
set a=y/hyp
if a<0 then
set a=a*-1
endif
set d=(range-hyp)/range//SquareRoot(x*x+y+y)
//set a=bj_RADTODEG*Atan2(y,x)
if x>0 then
set vol1=R2I(d*75*a)
set vol2=R2I(d*55)
call SetSoundPitch(s1,GetRandomReal(.8,1.1))
call SetSoundPitch(s2,.5+a*0.45)
elseif x<0 then
set vol1=R2I(d*55)
set vol2=R2I(d*75*a)
call SetSoundPitch(s1,.5+a*0.45)
call SetSoundPitch(s2,GetRandomReal(.8,1.1))
endif
//call msg(GetLocalPlayer(),"a: "+R2S(a),"")
//call msg(GetLocalPlayer(),"l: "+I2S(vol1),"")
//call msg(GetLocalPlayer(),"r: "+I2S(vol2),"")
endif
call SetSoundVolume(s1,vol1)
call SetSoundVolume(s2,vol2)
call StartSound(s1)
call StartSound(s2)
call KillSoundWhenDone(s1)
call KillSoundWhenDone(s2)
set s1=null
set s2=null
endfunction
function SetSpawn takes player p returns nothing
if IsPlayerInForce(p,player_Force[0]) then
set SPAWN_X=player_SpawnX[0]
set SPAWN_Y=player_SpawnY[0]
elseif IsPlayerInForce(p,player_Force[1]) then
set SPAWN_X=player_SpawnX[1]
set SPAWN_Y=player_SpawnY[1]
endif
endfunction
function IsWallFilter takes nothing returns boolean
return(GetUnitAbilityLevel(GetFilterUnit(),'Avul')==1 and IsUnitType(GetFilterUnit(),UNIT_TYPE_MECHANICAL))
endfunction
function TreeHide takes destructable d returns nothing
local real x=GetDestructableX(d)
local real y=GetDestructableY(d)
local group g=CreateGroup()
local boolexpr filter=Condition(function IsWallFilter)
local unit c
call GroupEnumUnitsInRange(g,x,y,48.,filter)
call DestroyBoolExpr(filter)
set filter=null
loop
set c=FirstOfGroup(g)
exitwhen c==null
call GroupRemoveUnit(g,c)
call ShowUnit(c,false)
call GroupAddUnit(TREES,c)
endloop
call DestroyGroup(g)
set g=null
set c=null
//call echo("TreeHide")
endfunction
function TreeShake takes nothing returns nothing
local destructable d=GetEnumDestructable()
if GetDestructableLife(d)>.405 then
call SetDestructableLife(d,GetDestructableLife(GetEnumDestructable())-10)
if GetDestructableLife(d)>.405 then
//call SetDestructableAnimationSpeed(d,0.35)
call SetDestructableAnimation(d,"stand - hit")
else
call TreeHide(d)
endif
endif
set d=null
endfunction
function TreeKill takes nothing returns nothing
call KillDestructable(GetEnumDestructable())
call TreeHide(GetEnumDestructable())
endfunction
function TreeRevive takes nothing returns nothing
call DestructableRestoreLife(GetEnumDestructable(),GetDestructableMaxLife(GetEnumDestructable()),true)
endfunction
function TreeShowRespawn takes nothing returns nothing
call ShowUnit(GetEnumUnit(),true)
endfunction
function TreeRespawn takes nothing returns nothing
call EnumDestructablesInRect(bj_mapInitialPlayableArea,null,function TreeRevive)
call ForGroup(TREES,function TreeShowRespawn)
call GroupClear(TREES)
endfunction
function EnumDestructablesInCircleFilter takes nothing returns boolean
local location d
local boolean result=false
if GetDestructableTypeId(GetFilterDestructable())=='ATtr' then
set d=GetDestructableLoc(GetFilterDestructable())
set result=DistanceBetweenPoints(d,bj_enumDestructableCenter)<=bj_enumDestructableRadius
call RemoveLocation(d)
set d=null
endif
return result
endfunction
function EnumDestructablesInCircle takes real x, real y, real radius, code actionFunc returns nothing
local rect r
local boolexpr filter
//call echo("EnumDestructablesInCircle")
if radius>0. then
set bj_enumDestructableCenter=Location(x,y)
set bj_enumDestructableRadius=radius
set r=Rect(x-radius,y-radius,x+radius,y+radius)
set filter=Condition(function EnumDestructablesInCircleFilter)
call EnumDestructablesInRect(r,filter,actionFunc)
call DestroyBoolExpr(filter)
set filter=null
call RemoveRect(r)
set r=null
call RemoveLocation(bj_enumDestructableCenter)
endif
endfunction
// To make the dummy face a 2 dimensional orientation instantly:
function SetDummyFacing takes unit u, real angle returns nothing
call SetUnitLookAt(u, "Bone_Head", u, Cos(angle)*1000000., Sin(angle)*1000000., 0.)
endfunction
// To make the dummy face a 3 dimensional orientation instantly:
function SetDummyOrientation takes unit u, real x, real y, real z returns nothing
call SetUnitLookAt(u, "Bone_Head", u, x*1000000., y*1000000., z*1000000.)
endfunction
//To make the dummy always face a particular unit, for homing missiles:
function SetDummyHomingTarget takes unit u, unit target returns nothing
call SetUnitLookAt(u, "Bone_Head", target, 0., 0., 0.)
endfunction
//######################################################################
//#
//# Maps
//#
//######################################################################
function MAP_STATS takes nothing returns nothing
local integer m=R2I(ROUND_MAX/60)
local integer s=R2I(ROUND_MAX-m*60)
local string x=""
if s>0 then
set x=I2S(s)+"|c00808080s|r"
endif
call msg_timed(GetLocalPlayer(),15,"|c00FFFF00Grenades:|r "+I2S(max_grenades),null)
if mod!=4 then
call msg_timed(GetLocalPlayer(),15,"|c00FFFF00Round length:|r "+I2S(m)+"|c00808080m|r "+x,null)
endif
call CinematicFadeWithUI2(0,0,0,3,"ReplaceableTextures\\CameraMasks\\Black_mask.blp",0,255)
endfunction
function MAP_BOMBAREA_DO takes nothing returns nothing
local unit u
if mod==2 then
//call UnitSetUsesAltIcon(u,true)
call SetUnitVertexColor(u,32,0,0,0)
call UnitAddAbility(u,'ACav')
if GetUnitUserData(u)==0 then
call IssueImmediateOrder(u,"waterelemental")
endif
call SetUnitUserData(u,1)
else
//call UnitSetUsesAltIcon(u,false)
call SetUnitVertexColor(u,0,0,0,0)
call UnitRemoveAbility(u,'ACav')
call IssuePointOrder(u,"dispel",GetUnitX(u),GetUnitY(u))
call SetUnitUserData(u,0)
endif
set u=null
endfunction
function MAP_0 takes nothing returns nothing
local group g
call SetWaterBaseColor(128,128,255,255)
call SetTerrainFogEx(0,1000,6000,0,0,0,0)
call SetSkyModel("Environment\\Sky\\FelwoodSky\\FelwoodSky.mdl")
set ROUND_MAX=60*4
set max_grenades=6
set mod=1
set player_SpawnX[0]=-3700
set player_SpawnY[0]=3000
set player_SpawnX[1]=4300
set player_SpawnY[1]=-4200
set rect_map=gg_rct_MAP0
set g=GetUnitsOfTypeIdAll('h001')
call ForGroup(g,function MAP_BOMBAREA_DO)
call DestroyGroup(g)
set g=null
set player_ObsCam[0]=gg_cam_MAP0_1
set player_ObsCam[1]=gg_cam_MAP0_2
set player_ObsCam[2]=gg_cam_MAP0_3
set player_ObsCam[3]=gg_cam_MAP0_4
set player_ObsCam[4]=gg_cam_MAP0_5
set player_actual_ObsCam=0
set player_max_ObsCam=4
call ClearTextMessages()
call msg_timed(GetLocalPlayer(),15,"|c0080FF00Operation:|r C A N D Y B O X
|c0080FF00Assault:|r
Destroy tank at enemy spawn or kill all opponents !
",SOUND_MSG)
call MAP_STATS()
endfunction
function MAP_1 takes nothing returns nothing
local group g
call SetWaterBaseColor(128,128,255,255)
call SetTerrainFogEx(0,1000,6000,0,0,0,0)
call SetSkyModel("Environment\\Sky\\DalaranSky\\DalaranSky.mdl")
set ROUND_MAX=60*2.5
set max_grenades=5
set mod=0
set player_SpawnX[0]=-3700
set player_SpawnY[0]=3000
set player_SpawnX[1]=4300
set player_SpawnY[1]=-4200
set rect_map=gg_rct_MAP0
set g=GetUnitsOfTypeIdAll('h001')
call ForGroup(g,function MAP_BOMBAREA_DO)
call DestroyGroup(g)
set g=null
set player_ObsCam[0]=gg_cam_MAP0_5
set player_ObsCam[1]=gg_cam_MAP0_2
set player_ObsCam[2]=gg_cam_MAP0_3
set player_ObsCam[3]=gg_cam_MAP0_4
set player_ObsCam[4]=gg_cam_MAP0_1
set player_actual_ObsCam=0
set player_max_ObsCam=4
call ClearTextMessages()
call msg_timed(GetLocalPlayer(),15,"|c0080FF00Operation:|r C A N D Y B O X
|c0080FF00Team Deathmatch:|r
Kill all your opponents !
",SOUND_MSG)
call MAP_STATS()
endfunction
function MAP_2 takes nothing returns nothing
local group g
call SetWaterBaseColor(128,128,255,255)
call SetTerrainFogEx(0,1000,6000,0,0,0,0)
call SetSkyModel("Environment\\Sky\\DalaranSky\\DalaranSky.mdl")
set ROUND_MAX=60*1.75
set max_grenades=6
set mod=2
set player_SpawnX[0]=-3700
set player_SpawnY[0]=3000
set player_SpawnX[1]=4300
set player_SpawnY[1]=-4200
set rect_map=gg_rct_MAP0
//set max_areas=3
call SetAltMinimapIcon("UI\\MiniMap\\MinimapIcon\\MinimapIconStartLoc.blp")
set g=GetUnitsOfTypeIdAll('h001')
call ForGroup(g,function MAP_BOMBAREA_DO)
call DestroyGroup(g)
set g=null
set player_ObsCam[0]=gg_cam_MAP0_BOMB1
set player_ObsCam[1]=gg_cam_MAP0_BOMB2
set player_ObsCam[2]=gg_cam_MAP0_BOMB3
set player_actual_ObsCam=0
set player_max_ObsCam=2
call ClearTextMessages()
call msg_timed(GetLocalPlayer(),15,"|c0080FF00Operation:|r C A N D Y B O X
|c0080FF00Bomb/Defuse:|r
Attackers - plant bomb in one of the bomb area and let it explode
Defenders - defend bomb areas, prevent bomb to be planted, defuse bomb (use Knife)
",SOUND_MSG)
call MAP_STATS()
endfunction
function MAP_3 takes nothing returns nothing
local group g
call SetWaterBaseColor(128,255,0,255)
call SetTerrainFogEx(0,1000,6000,0,0.627,0.471,0.294)
call SetSkyModel("Environment\\Sky\\DalaranSky\\DalaranSky.mdl")
set ROUND_MAX=115
set max_grenades=6
set mod=2
set player_SpawnX[1]=7700
set player_SpawnY[1]=2700
set player_SpawnX[0]=10000
set player_SpawnY[0]=-2800
set player_Force_rotate[0]=0
set player_Force_rotate[1]=0//180
set rect_map=gg_rct_MAP1
call SetAltMinimapIcon("UI\\MiniMap\\MinimapIcon\\MinimapIconStartLoc.blp")
set g=GetUnitsOfTypeIdAll('h001')
call ForGroup(g,function MAP_BOMBAREA_DO)
call DestroyGroup(g)
set g=null
set player_ObsCam[0]=gg_cam_MAP1_1
set player_actual_ObsCam=0
set player_max_ObsCam=0
call ClearTextMessages()
call msg_timed(GetLocalPlayer(),15,"|c0080FF00Operation:|r I N F E R N O
|c0080FF00Bomb/Defuse:|r
|c00FF4040Red Team|r - plant bomb in one of the bomb site and let it explode
|c000080FFBlue Team|r - defend bomb sites, prevent bomb to be planted, defuse bomb
",SOUND_MSG)
call MAP_STATS()
endfunction
function MAP_4 takes nothing returns nothing
local group g
call SetWaterBaseColor(128,255,0,255)
call SetTerrainFogEx(0,600,5900,0,0.115,0.055,0.195)
call SetSkyModel("Environment\\Sky\\DalaranSky\\DalaranSky.mdl")
set ROUND_MAX=180
set max_grenades=4
set mod=3
set mission_player=11
set player_SpawnX[1]=10360
set player_SpawnY[1]=-315
set player_SpawnX[0]=10360
set player_SpawnY[0]=-315
set player_Force_rotate[0]=0
set player_Force_rotate[1]=0//180
set rect_map=gg_rct_MAP1
set g=GetUnitsOfTypeIdAll('h001')
call ForGroup(g,function MAP_BOMBAREA_DO)
call DestroyGroup(g)
set g=null
set player_ObsCam[0]=gg_cam_MAP1_1
set player_actual_ObsCam=0
set player_max_ObsCam=0
call ClearTextMessages()
call msg_timed(GetLocalPlayer(),15,"|c0080FF00Operation:|r I N F E R N O
|c0080FF00Zombie mode:|r
|c00FF4040Red Team|r - soldiers, kill all zombies and don't get killed
|c000080FFBlue Team|r - zombies, kill all soldiers to infect them
",SOUND_MSG)
call MAP_STATS()
endfunction
function MAP_5 takes nothing returns nothing
local group g
call SetWaterBaseColor(128,255,0,255)
call SetTerrainFogEx(0,1000,6000,0,0.725,0.525,0.305)
call SetSkyModel("Environment\\Sky\\DalaranSky\\DalaranSky.mdl")
set ROUND_MAX=300
set max_grenades=6
set mod=0
set player_SpawnX[1]=7700
set player_SpawnY[1]=2700
set player_SpawnX[0]=10000
set player_SpawnY[0]=-2800
set player_Force_rotate[0]=0
set player_Force_rotate[1]=0//180
set rect_map=gg_rct_MAP1
call SetAltMinimapIcon("UI\\MiniMap\\MinimapIcon\\MinimapIconStartLoc.blp")
set g=GetUnitsOfTypeIdAll('h001')
call ForGroup(g,function MAP_BOMBAREA_DO)
call DestroyGroup(g)
set g=null
set player_ObsCam[0]=gg_cam_MAP1_1
set player_actual_ObsCam=0
set player_max_ObsCam=0
call ClearTextMessages()
call msg_timed(GetLocalPlayer(),15,"|c0080FF00Operation:|r I N F E R N O
|c0080FF00Team Deathmatch:|r
Kill all your opponents !
",SOUND_MSG)
call MAP_STATS()
endfunction
function MAP_6 takes nothing returns nothing
local group g
call SetWaterBaseColor(128,128,255,255)
call SetTerrainFogEx(0,800,6000,0,0.325,0.425,0.635)
call SetSkyModel("Environment\\Sky\\FoggedSky\\FoggedSky.mdl")
set ROUND_MAX=300
set max_grenades=6
set mod=0
set player_SpawnX[1]=2270
set player_SpawnY[1]=3370
set player_SpawnX[0]=5340
set player_SpawnY[0]=-3530
set player_Force_rotate[0]=0
set player_Force_rotate[1]=0//180
set rect_map=gg_rct_MAP0
call SetAltMinimapIcon("UI\\MiniMap\\MinimapIcon\\MinimapIconStartLoc.blp")
set g=GetUnitsOfTypeIdAll('h001')
call ForGroup(g,function MAP_BOMBAREA_DO)
call DestroyGroup(g)
set g=null
set player_ObsCam[0]=gg_cam_MAP0_1
set player_ObsCam[1]=gg_cam_MAP0_2
set player_ObsCam[2]=gg_cam_MAP0_3
set player_ObsCam[3]=gg_cam_MAP0_4
set player_actual_ObsCam=0
set player_max_ObsCam=3
call ClearTextMessages()
call msg_timed(GetLocalPlayer(),15,"|c0080FF00Operation:|r T H O U S A N D C A N E S
|c0080FF00Team Deathmatch:|r
Kill all your opponents !
",SOUND_MSG)
call MAP_STATS()
endfunction
function MAP_7 takes nothing returns nothing
local group g
call SetWaterBaseColor(128,128,255,255)
call SetTerrainFogEx(0,600,5900,0,0.115,0.055,0.195)
call SetSkyModel("Environment\\Sky\\FoggedSky\\FoggedSky.mdl")
set ROUND_MAX=200
set max_grenades=4
set mod=3
set mission_player=11
set player_SpawnX[1]=2370
set player_SpawnY[1]=-300
set player_SpawnX[0]=2370
set player_SpawnY[0]=-300
set player_Force_rotate[0]=0
set player_Force_rotate[1]=0//180
set rect_map=gg_rct_MAP0
set g=GetUnitsOfTypeIdAll('h001')
call ForGroup(g,function MAP_BOMBAREA_DO)
call DestroyGroup(g)
set g=null
set player_ObsCam[0]=gg_cam_MAP0_1
set player_ObsCam[1]=gg_cam_MAP0_2
set player_ObsCam[2]=gg_cam_MAP0_3
set player_ObsCam[3]=gg_cam_MAP0_4
set player_actual_ObsCam=0
set player_max_ObsCam=3
call ClearTextMessages()
call msg_timed(GetLocalPlayer(),15,"|c0080FF00Operation:|r T H O U S A N D C A N E S
|c0080FF00Zombie mode:|r
|c00FF4040Red Team|r - soldiers, kill all zombies and don't get killed
|c000080FFBlue Team|r - zombies, kill all soldiers to infect them
",SOUND_MSG)
call MAP_STATS()
endfunction
function MAP_8 takes nothing returns nothing
local group g
call SetWaterBaseColor(128,128,255,255)
call SetTerrainFogEx(0,600,5900,0,0.115,0.055,0.195)
call SetSkyModel("Environment\\Sky\\FoggedSky\\FoggedSky.mdl")
set ROUND_MAX=200
set max_grenades=5
set mod=4
set main_cliff=5
set wave=1
set player_SpawnX[1]=2370
set player_SpawnY[1]=-300
set player_SpawnX[0]=2370
set player_SpawnY[0]=-300
set player_Force_rotate[0]=0
set player_Force_rotate[1]=0//180
set rect_map=gg_rct_MAP0
set g=GetUnitsOfTypeIdAll('h001')
call ForGroup(g,function MAP_BOMBAREA_DO)
call DestroyGroup(g)
set g=null
set player_ObsCam[0]=gg_cam_MAP0_1
set player_ObsCam[1]=gg_cam_MAP0_2
set player_ObsCam[2]=gg_cam_MAP0_3
set player_ObsCam[3]=gg_cam_MAP0_4
set player_actual_ObsCam=0
set player_max_ObsCam=3
call ClearTextMessages()
call msg_timed(GetLocalPlayer(),15,"|c0080FF00Operation:|r T H O U S A N D C A N E S
|c0080FF00Cooperative:|r
Survive creep waves !
",SOUND_MSG)
call MAP_STATS()
endfunction
function MAP_ObsCam takes nothing returns nothing
local integer i=0
loop
//exitwhen mission_unit[100]==null
call TriggerSleepAction(GetRandomReal(2,3))
call TriggerSleepAction(0)
call TriggerSleepAction(0)
set i=i+1
if i>player_max_ObsCam then
set i=0
endif
set player_actual_ObsCam=i
exitwhen mission_unit[100]==null
endloop
call echo("obs cam ended")
endfunction
function MAP_Timer takes nothing returns nothing
if mission_unit[100]!=null then
//call MAP_0()
//set map=0
call IssueImmediateOrder(mission_unit[100],"flamestrike")
endif
endfunction
function MAP_Init takes nothing returns nothing
local integer n=MAXPLAYERS
if game_timer_class==null or not possible_rr or game_About2End then
return
endif
if rounds>1 then
call ExecuteFunc("GameNull")
endif
set mission_unit[100]=CreateUnit(Player(0),'hbar',0,0,0)
call ExecuteFunc("Force5V5Start")
set rounds=0
set possible_rr=false
call ExecuteFunc("RoundClear")
call PauseTimer(game_timer_round)
call PauseTimer(game_timer_class)
call DestroyTimerDialog(game_td_round)
call DestroyTimerDialog(game_td_class)
call EnableWorldFogBoundary(false)
call SetCameraBoundsToRect(bj_mapInitialPlayableArea)
call ExecuteFunc("MAP_"+I2S(map))
//set map=5
call ExecuteFunc("MAP_ObsCam")
loop
set n=n-1
exitwhen n<0
if(GetPlayerSlotState(Player(n))==PLAYER_SLOT_STATE_PLAYING)then
call SetUnitOwner(mission_unit[100],Player(n),false)
//set n=0
endif
endloop
if GetLocalPlayer()==GetOwningPlayer(mission_unit[100]) then
call ClearSelection()
call SelectUnit(mission_unit[100],true)
endif
call TimerStart(game_timer_map,MAP_SELECT,false,function MAP_Timer)
set game_td_map=CreateTimerDialog(game_timer_map)
call TimerDialogSetTitle(game_td_map,"Select Operation")
call TimerDialogDisplay(game_td_map,true)
call CameraSetSourceNoiseEx(1,5,true)
endfunction
endlibrary
//TESH.scrollpos=145
//TESH.alwaysfold=0
function InitTrig_vectorsystem takes nothing returns nothing
endfunction
//===========================================================================
library vectorsystem requires config
// **********************
// ** VECTOR SYSTEM **
// **********************
// Original concept by iNfraNe
// Then Made by Anitarf
// ported to structs by vexorian (actually just copied the math)
struct vector
real x=0.
real y=0.
real z=0.
private boolean safety=true
private method onDestroy takes nothing returns nothing
set this.safety=false
endmethod
method created takes nothing returns boolean
return this.safety
endmethod
method length takes nothing returns real
return SquareRoot(this.x*this.x + this.y*this.y+this.z*this.z)
endmethod
method lengthSquare takes nothing returns real
return SquareRoot(this.x*this.x + this.y*this.y+this.z*this.z)
endmethod
method add takes vector B returns nothing
set this.x=this.x+B.x
set this.y=this.y+B.y
set this.z=this.z+B.z
endmethod
method add_factored takes vector B, real fc returns nothing
set this.x=this.x+fc*B.x
set this.y=this.y+fc*B.y
set this.z=this.z+fc*B.z
endmethod
method substract takes vector B returns nothing
set this.x=this.x-B.x
set this.y=this.y-B.y
set this.z=this.z-B.z
endmethod
static method sum takes vector A, vector B returns vector
local vector C=vector.create()
set C.x=A.x+B.x
set C.y=A.y+B.y
set C.z=A.z+B.z
return C
endmethod
static method difference takes vector A, vector B returns vector
local vector C=vector.create()
set C.x=A.x-B.x
set C.y=A.y-B.y
set C.z=A.z-B.z
return C
endmethod
method scale takes real factor returns nothing
set this.x=this.x*factor
set this.y=this.y*factor
set this.z=this.z*factor
endmethod
static method amplify takes vector A, real factor returns vector
local vector C=vector.create()
set C.x=A.x*factor
set C.y=A.y*factor
set C.z=A.z*factor
return C
endmethod
static method productScalar takes vector A, vector B returns real
return A.x*B.x+A.y*B.y+A.z*B.z
endmethod
method dot takes vector B returns real
return this.x*B.x+this.y*B.y+this.z*B.z
endmethod
static method productVector takes vector A, vector B returns vector
local vector C=vector.create()
set C.x= A.y*B.z - A.z*B.y
set C.y= A.z*B.x - A.x*B.z
set C.z= A.x*B.y - A.y*B.x
return C
endmethod
method project takes vector B returns vector
local vector C=vector.create()
local real r=this.dot(B)
local real l=B.dot(B)
if (l==0.) then
return 0
endif
return vector.amplify(B,r/l)
endmethod
method projectPlane takes vector planeNormal returns vector
local vector vect= this.project(planeNormal)
local vector vect2= vector.difference(this,vect)
call vect.destroy()
return vect2
endmethod
method setLength takes real length returns boolean
local real l=this.length()
if (l==0) then
return false
endif
call this.scale(length/l)
return true
endmethod
method clone takes nothing returns vector
local vector C=vector.create()
set C.x=this.x
set C.y=this.y
set C.z=this.z
return C
endmethod
static method angle takes vector A, vector B returns real
local real l1=A.length()
local real l2=B.length()
if (l1==0) or (l2==0) then
return 0.
endif
return Acos(vector.productScalar(A,B)/(l1*l2) )
endmethod
static method distance takes vector A, vector B returns real
return SquareRoot((A.x-B.x)*(A.x-B.x)+(A.x-B.x)*(A.y-B.y)+(A.z-B.z)*(A.z-B.z))
endmethod
static method distanceSquare takes vector A, vector B returns real
return (A.x-B.x)*(A.x-B.x)+(A.y-B.y)*(A.y-B.y)+(A.z-B.z)*(A.z-B.z)
endmethod
method rotate takes vector axis, real angle returns vector
local vector locX
local vector locY
local vector locZ= this.project(axis)
local vector result
if locZ == 0 then
return 0
endif
set locX = vector.difference(this,locZ)
set locY = vector.productVector(this, locX)
call locY.setLength(locX.length())
call locX.scale(Cos(angle))
call locY.scale(Sin(angle))
set result= vector.sum(locX,locY)
call result.add(locZ)
call locX.destroy()
call locY.destroy()
call locZ.destroy()
return result
endmethod
static method createFrom takes real x, real y, real z returns vector
local vector C=vector.create()
set C.x=x
set C.y=y
set C.z=z
return C
endmethod
static method getTerrainPosition takes real x, real y returns vector
local vector C=vector.create()
set C.x=x
set C.y=y
set C.z=GetZ(x,y)
return C
endmethod
static method getTerrainNormal takes real x, real y, real sampleRadius returns vector
local real z1=GetZ(x-sampleRadius,y)
local real z2=GetZ(x+sampleRadius,y)
local real z3=GetZ(x,y-sampleRadius)
local real z4=GetZ(x,y+sampleRadius)
local vector xvect=vector.createFrom(2*sampleRadius,0.,z2-z1)
local vector yvect=vector.createFrom(0.,2*sampleRadius,z4-z3)
local vector normvect=vector.productVector(xvect,yvect)
call xvect.destroy()
call yvect.destroy()
return normvect
endmethod
method inCylinder takes vector cylinderOriginV, vector cylinderHeightV, real cylinderRadius returns boolean
local vector v1
local vector v2
local vector v3
local boolean b = false
local real l = cylinderHeightV.length()
if (l > 0.) then
set v1=vector.difference(this, cylinderOriginV)
set v2=vector.difference(v1, cylinderHeightV)
set v3=v1.projectPlane( cylinderHeightV)
if vector.productScalar(v1, cylinderHeightV)>=0 and vector.productScalar(v2, cylinderHeightV)<=0 and vector.productScalar(v3, v3)<=cylinderRadius*cylinderRadius then
set b = true
endif
call v1.destroy()
call v2.destroy()
call v3.destroy()
endif
return b
endmethod
method move takes real x, real y, real z returns nothing
set this.x=x
set this.y=y
set this.z=z
endmethod
method inCone takes vector coneOriginV, vector coneHeightV, vector coneRadius returns boolean
local vector v1
local vector v2
local vector v3
local vector v4
local boolean b = false
local real r
local real l = coneHeightV.length()
if (l>0.0) then
set v1=vector.difference(this, coneOriginV)
set v2=vector.difference(v1, coneHeightV)
set v3=v1.project( coneHeightV)
set v4=vector.difference(v1,v3)
set r = 1.0-( v3.length()/l )
if vector.productScalar(v1, coneHeightV)>=0 and v4.length()<=(coneRadius*r) then
set b = true
endif
call v1.destroy()
call v2.destroy()
call v3.destroy()
call v4.destroy()
endif
return b
endmethod
method inSphere takes vector sphereOriginV, real sphereRadius returns boolean
local vector v
local boolean b
set v=vector.difference(this, sphereOriginV)
set b= (vector.productScalar(v,v)<= sphereRadius*sphereRadius)
call v.destroy()
return b
endmethod
endstruct
endlibrary
//TESH.scrollpos=186
//TESH.alwaysfold=0
function InitTrig_TextLabel takes nothing returns nothing
endfunction
//======================================================================
library Label initializer Init requires config
//######################################################################
//#
//# library Label
//#
//######################################################################
globals
private constant real period=0.04
private constant integer ui_bit=5
private constant integer ui_all=100/ui_bit
private constant string ui_char="||||"
private label array mobs
private integer N=0
label LABELPROCESS
endglobals
//======================================================================
function label_ui2 takes integer hp returns string
local string r="[|c0000FF00|||||||||||r]"
if hp<100 then
set r="[|c0080FF00|||||||||||r]"
endif
if hp<90 then
set r="[|c0080FF00|||||||||r|c00000000|||r]"
endif
if hp<75 then
set r="[|c00FFF900|||||||r|c00000000|||||r]"
endif
if hp<50 then
set r="[|c00FF8040|||||r|c00000000|||||||r]"
endif
if hp<25 then
set r="[|c00FF0000|||r|c00000000|||||||||r]"
endif
if hp<10 then
set r="[|c00000000|||||||||||r]"
endif
return r
endfunction
function label_ui takes integer hp returns string
local string r=""
local integer c=0
if hp<=100 then
set r=r+"|c0080FF00"
endif
if hp<90 then
set r=r+"|c0080FF00"
endif
if hp<75 then
set r=r+"|c00FFF900"
endif
if hp<60 then
set r=r+"|c00FF8040"
endif
if hp<45 then
set r=r+"|c00FF0000"
endif
if hp<25 then
set r=r+"|c00800000"
endif
loop
exitwhen hp<=0
set r=r+ui_char
set c=c+1
set hp=hp-ui_bit
endloop
set r=r+"|r|c00000000"
set c=ui_all-c
loop
exitwhen c<=0
set r=r+ui_char
set c=c-1
endloop
set r=r+"|r"
return r
endfunction
struct label
texttag t=null
unit u=null
real x
real y
real dur
player p=null
string text
integer slot
integer c
boolean ui=false
real size
static method Create takes player p, integer slot, real x, real y, string text, real size, integer r, integer g, integer b returns label
local label t=label.create()
local integer i=0
if slot<10 then
loop
exitwhen i==N
if(mobs[i].p==p)then
if(mobs[i].slot==slot)then
if p==Player(11) then
call SetTextTagVisibility(mobs[i].t,false)
else
//if GetLocalPlayer()==p then
// call SetTextTagVisibility(mobs[i].t,false)
//endif
set mobs[i].dur=0
endif
endif
endif
set i=i+1
endloop
endif
set t.x=x
set t.y=y
set t.text=text
set t.p=p
set t.slot=slot
set t.size=size
set t.dur=1
set t.c=0
set t.t=CreateTextTag()
call SetTextTagText(t.t,text,TextTagSize2Height(size))
call SetTextTagPos(t.t,0,0,0)
call SetTextTagColor(t.t,r,g,b,255)
call SetTextTagPermanent(t.t,false)
if p==Player(11) then
call SetTextTagVisibility(t.t,true)
else
call SetTextTagVisibility(t.t,(GetLocalPlayer()==p))
endif
return t
endmethod
method timed takes real fadefrom, real fadeto returns nothing
call SetTextTagFadepoint(.t,fadefrom)
call SetTextTagLifespan(.t,fadeto+period)
set .dur=fadeto
endmethod
method anim takes nothing returns boolean
local real x
local real y
local real z
//if GetLocalPlayer()==.p then
if .u!=null then
set x=GetUnitX(.u)
set y=GetUnitY(.u)
set z=GetUnitFlyHeight(.u)+GetZ(x,y)-GetZ(x+.x,y+.y)
call SetTextTagPos(.t,x+.x,y+.y,z)
if .ui then
if .c<=0 then
call SetTextTagText(.t,label_ui(R2I(GetUnitStatePercent(.u,UNIT_STATE_LIFE,UNIT_STATE_MAX_LIFE))),TextTagSize2Height(.size))
set .c=10
else
set .c=.c-1
endif
endif
else
if GetLocalPlayer()==GetLocalPlayer() then
set x=GetCameraTargetPositionX()
set y=GetCameraTargetPositionY()
set z=GetZ(x,y)-GetZ(x+.x,y+.y)
call SetTextTagPos(.t,x+.x,y+.y,z)
//GetCameraTargetPositionZ()/2
endif
set .dur=.dur-period
endif
//endif
return (.dur<=0)//and not(.dur<-1)
endmethod
method onDestroy takes nothing returns nothing
call SetTextTagPermanent(.t,false)
call SetTextTagLifespan(.t,0.)
//call DestroyTextTag(.t)
set .t=null
set .u=null
set .p=null
endmethod
endstruct
private function movelabels takes nothing returns nothing
local integer i=0
loop
exitwhen i==N
if (mobs[i].anim()) then
call mobs[i].destroy()
set mobs[i]=mobs[N-1]
set N=N-1
else
set i=i+1
endif
endloop
endfunction
public function addlabel takes label t returns nothing
set mobs[N]=t
set N=N+1
endfunction
public function count takes nothing returns integer
return N
endfunction
//######################################################################
//#
//# Init
//#
//######################################################################
private function Init takes nothing returns nothing
set LABELPROCESS=label.Create(Player(11),-1,-315,-135,"0%",10,255,255,255)
call SetTextTagPermanent(LABELPROCESS.t,true)
set LABELPROCESS.dur=999
call Label_addlabel(LABELPROCESS)
call TimerStart(CreateTimer(),period,true,function movelabels)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
function InitTrig_spell takes nothing returns nothing
endfunction
//===========================================================================
library spell initializer Init requires Safety, vectorsystem, Label
globals
private constant real period=0.025
constant real fadeduration=0.5
private mobile array mobs
private integer N=0
constant real spell_z=26
constant integer ping_delay=3
private unit placeholdunit2=null
unit conunit=null
real array filter_red
real array filter_green
real array filter_blue
timer ta=null
integer strike=0
private integer FIX=1
private integer MOVING=0
private real turret_x=0
private real turret_y=0
endglobals
function SpellDummy takes player p,real x,real y,real z,integer id,string o,integer lvl,unit u,real timed returns boolean
local boolean b
local unit d=CreateUnit(p,RAW_DUMMY,x,y,0)
call SetUnitX(d,x)
call SetUnitY(d,y)
call SetUnitFlyHeight(d,z,0.)
call UnitAddAbility(d,id)
call SetUnitAbilityLevel(d,id,lvl)
if timed==0 then
set timed=3
endif
call UnitApplyTimedLife(d,0,timed)
if u==null then
set b=IssueImmediateOrder(d,o)
else
set b=IssueTargetOrder(d,o,u)
endif
set d=null
return b
endfunction
function CreateBloodsplat takes real x, real y, real size returns nothing
local integer id='B000'+GetRandomInt(0,3)
call KillDestructable(CreateDestructable(id,x,y,GetRandomReal(0,360),size,1))
endfunction
function UnitColorByHP takes unit u returns nothing
local real a=GetUnitState(u,UNIT_STATE_MAX_LIFE)
local real b=GetWidgetLife(u)
local integer r=R2I(255*((b)/(a))+.5) //b*b / a*a
call SetUnitVertexColor(u,r,r,r,255)
//call echo(GetUnitName(u)+": "+I2S(R2I(b))+"/"+I2S(R2I(a)))
endfunction
function UnitBurn takes unit c, unit u returns nothing
call SpellDummy(GetOwningPlayer(c),GetUnitX(u),GetUnitY(u),0,'Auhf',"unholyfrenzy",1,u,16)
return //necem to teraz
if GetWidgetLife(u)>=100 then
call SpellDummy(GetOwningPlayer(u),GetUnitX(u),GetUnitY(u),0,'Auhf',"unholyfrenzy",1,u,0)
//call UnitAddAbility(u,'A001')
else
call SpellDummy(GetOwningPlayer(u),GetUnitX(u),GetUnitY(u),0,'Auhf',"unholyfrenzy",2,u,0)
//call echo(R2S(GetWidgetLife(u)))
call SetUnitVertexColor(u,0,0,0,255)
call IssuePointOrder(u,"move",GetUnitX(u)+GetRandomReal(-10,10)*50,GetUnitY(u)+GetRandomReal(-10,10)*50)
//call AddSpecialEffectTarget(MODEL_FIRE,u,"chest")
//call AddSpecialEffectTarget(MODEL_FIRE,u,"origin")
//call AddSpecialEffectTarget(MODEL_FIRE,u,"head")
call UnitRemoveAbility(u,'Aatk')
call UnitAddAbility(u,'Atwa')
call UnitApplyTimedLife(u,0,GetRandomReal(8,14))
call SetUnitPathing(u,true)
endif
endfunction
function IsNonLocust takes unit u returns boolean
return GetUnitAbilityLevel(u,'Aloc')==0
endfunction
function IsAnotherPlayer takes unit u, unit c returns boolean
return GetOwningPlayer(u)!=GetOwningPlayer(c)
endfunction
function IsAlive takes unit u returns boolean
return GetWidgetLife(u)>.405
endfunction
function IsGibbed takes unit u returns boolean
return (not IsAlive(u) and IsUnitHidden(u))
endfunction
function IsWall takes unit u returns boolean
return (GetUnitAbilityLevel(u,'Avul')==1 and not IsUnitHidden(u))or(GetUnitTypeId(u)=='h004')
endfunction
function IsAll takes nothing returns boolean
return (IsAlive(GetFilterUnit()) and IsNonLocust(GetFilterUnit()) and not IsUnitHidden(GetFilterUnit()))
endfunction
function IsRespawnable takes nothing returns boolean
//and GetPlayerSlotState(GetOwningPlayer(GetFilterUnit()))==PLAYER_SLOT_STATE_PLAYING
return (IsUnitAlly(GetFilterUnit(),GetOwningPlayer(conunit)) and GetUnitUserData(GetFilterUnit())>0 and not IsAlive(GetFilterUnit()) and IsNonLocust(GetFilterUnit()) )
endfunction
function IsAlly takes nothing returns boolean
return (IsAnotherPlayer(GetFilterUnit(),conunit) and IsUnitAlly(GetFilterUnit(),GetOwningPlayer(conunit)) and IsAlive(GetFilterUnit()) and IsNonLocust(GetFilterUnit()))
endfunction
function IsEnemy takes nothing returns boolean
return (not IsUnitInvisible(GetFilterUnit(),GetOwningPlayer(conunit)) and IsAnotherPlayer(GetFilterUnit(),conunit) and IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(conunit)) and IsAlive(GetFilterUnit()) )//and IsNonLocust(GetFilterUnit()))
endfunction
function IsOK takes nothing returns boolean
return (IsAnotherPlayer(GetFilterUnit(),conunit) and IsAlive(GetFilterUnit()) and IsNonLocust(GetFilterUnit()))
endfunction
function IsEnemyNoMirror takes nothing returns boolean
return (IsAnotherPlayer(GetFilterUnit(),conunit) and IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(conunit)) and IsAlive(GetFilterUnit()) and IsNonLocust(GetFilterUnit()) and GetUnitTypeId(GetFilterUnit())!=RAW_MIRROR)
endfunction
function IsEnemyMelee takes nothing returns boolean
return (not IsUnitInvisible(GetFilterUnit(),GetOwningPlayer(conunit)) and IsAnotherPlayer(GetFilterUnit(),conunit) and IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(conunit)) and IsAlive(GetFilterUnit()) and IsNonLocust(GetFilterUnit()) and GetUnitTypeId(GetFilterUnit())!=RAW_MIRROR)
endfunction
function IsShield takes unit u, unit s returns boolean
local missile m=GetUnitUserData(u)
local Hero h
if GetUnitTypeId(s)=='h004' then
set m.a=2*(GetUnitFacing(s)+90)-(GetUnitFacing(u)+GetRandomReal(-25,25))
call SetDummyFacing(u,m.a*bj_DEGTORAD)
set m.timed=m.timed*.5
set m.aux1=m.aux1*.66
call SetUnitOwner(u,GetOwningPlayer(s),false) //Player(11)
set h=player_PlayerHero[GetPlayerId(GetOwningPlayer(s))]
call GroupAddUnit(m.g,h.u)
return true
endif
return false
endfunction
function IsAbleToShot takes unit u returns boolean
return (IsAlive(u) and u!=null)
endfunction
function Con takes nothing returns boolean
return GetUnitTypeId(GetFilterUnit())!=RAW_DUMMY
endfunction
function DestroyBool takes boolexpr b returns nothing
if b!=BOOLEXPR_TRUE and b!=BOOLEXPR_FALSE then
call DestroyBoolExpr(b)
endif
endfunction
interface mobile
unit u
integer red=255
integer green=255
integer blue=255
integer alpha=255
real aux1=0
real aux2=0
real aux3=0
integer aux4=0
boolean terminate=false
method anim takes nothing returns boolean
method fade takes nothing returns boolean
endinterface
private function movemobiles takes nothing returns nothing
local integer i=0
loop
exitwhen i==N
if (mobs[i].terminate) then
if (mobs[i].fade()) then
call mobs[i].destroy()
set mobs[i]=mobs[N-1]
set N=N-1
else
set i=i+1
endif
elseif (mobs[i].anim()) then
if (mobs[i].fade()) then
call mobs[i].destroy()
set mobs[i]=mobs[N-1]
set N=N-1
else
set i=i+1
endif
else
set i=i+1
endif
endloop
endfunction
public function respawnmobiles takes nothing returns nothing
local integer i=0
loop
exitwhen i==N
//if not IsHeroUnitId(GetUnitTypeId(mobs[i].u)) then
set mobs[i].terminate=true
//endif
set i=i+1
endloop
endfunction
public function addmobile takes mobile m returns nothing
set mobs[N]=m
set N=N+1
endfunction
public function count takes nothing returns integer
return N
endfunction
struct ray extends mobile
real x1
real y1
real z1
real x2
real y2
real z2
real r=1
real g=1
real b=1
real a=1
lightning lx
real timed=-1.
real fadeduration=fadeduration
string funcdeath="DoNothing"
real random1=0
real random2=0
static method Create takes string id, real x1, real y1, real z1, real x2, real y2, real z2 returns ray
local ray s=ray.create()
set s.lx=AddLightningEx(id,false,x1,y1,z1,x2,y2,z2)
set s.x1=x1
set s.y1=y1
set s.z1=z1
set s.x2=x2
set s.y2=y2
set s.z2=z2
return s
endmethod
method anim takes nothing returns boolean
if .random1>0 or .random2>0 then
call MoveLightningEx(.lx,false,.x1+GetRandomReal(-.random1,.random1),.y1+GetRandomReal(-.random1,.random1),.z1+GetRandomReal(-.random1,.random1),.x2+GetRandomReal(-.random2,.random2),.y2+GetRandomReal(-.random2,.random2),.z2+GetRandomReal(-.random2,.random2))
endif
if .timed!=-1. then
set .timed=.timed-period
if .timed<=0 then
return true
endif
return false
endif
return true
endmethod
method fade takes nothing returns boolean
set .a=.a-period/this.fadeduration
if (.a<=0) then
call SetLightningColor(.lx,.r,.g,.b,0)
return true
endif
call SetLightningColor(.lx,.r,.g,.b,.a)
return false
endmethod
method onDestroy takes nothing returns nothing
set placeholdmobile=this
call ExecuteFunc(.funcdeath)
call DestroyLightning(.lx)
endmethod
endstruct
struct ping extends mobile
unit u
integer t=ping_delay
//lightning l1
//lightning l2
//lightning l3
//lightning l4
//lightning l5
unit u1
unit u2
unit u3
unit u4
unit u5
//string id="CLPB"
real z=900
static method Create takes unit u returns ping
local ping s=ping.create()
local real x=-6000
local real y=4800
local integer id='u000'
set s.u=u
set s.u1=CreateUnit(GetOwningPlayer(u),id,x,y,0)
set s.u2=CreateUnit(GetOwningPlayer(u),id,x,y,0)
set s.u3=CreateUnit(GetOwningPlayer(u),id,x,y,0)
set s.u4=CreateUnit(GetOwningPlayer(u),id,x,y,0)
set s.u5=CreateUnit(GetOwningPlayer(u),id,x,y,0)
call SetUnitVertexColor(s.u1,0,0,0,0)
call SetUnitVertexColor(s.u2,0,0,0,0)
call SetUnitVertexColor(s.u3,0,0,0,0)
call SetUnitVertexColor(s.u4,0,0,0,0)
call SetUnitVertexColor(s.u5,0,0,0,0)
//if GetLocalPlayer()==GetOwningPlayer(u) then
// call SetUnitVertexColor(s.u1,96,196,0,255)
// call SetUnitVertexColor(s.u2,96,196,0,255)
// call SetUnitVertexColor(s.u3,96,196,0,255)
// call SetUnitVertexColor(s.u4,96,196,0,255)
// call SetUnitVertexColor(s.u5,96,196,0,255)
//endif
return s
endmethod
method anim takes nothing returns boolean
local integer i=0
local real x
local real y
local real a
local unit u
local real d
local real d1=300
local real d2=800*800
local real d3=d2+1000000
local integer alpha=255
local player p
if IsAlive(.u) then
if .t==0 then
set .t=ping_delay
if not IsUnitAlly(.u,Player(0)) then
set i=5
endif
set x=GetUnitX(.u)
set y=GetUnitY(.u)
set p=GetOwningPlayer(.u)
// ---------------------------
set u=player_PlayerHero[0+i].u
if .u!=u and u!=null and IsUnitAlly(u,p) then
set d=SquareRoot((GetUnitX(u)-x)*(GetUnitX(u)-x)+(GetUnitY(u)-y)*(GetUnitY(u)-y))//-d3
//set alpha=255-R2I(DamageArea(d,d2,255))
//set alpha=255-R2I(DamageArea(d,d2,128))
set a=Atan2(GetUnitY(u)-y,GetUnitX(u)-x)
if d<d1 then
call SetUnitX(.u1,GetUnitX(u))
call SetUnitY(.u1,GetUnitY(u))
else
call SetUnitX(.u1,x+Cos(a)*d1)
call SetUnitY(.u1,y+Sin(a)*d1)
endif
if GetLocalPlayer()==GetOwningPlayer(.u) then
if IsAlive(u) then
call SetUnitVertexColor(.u1,96,196,0,alpha)
else
if IsGibbed(u) then
call SetUnitVertexColor(.u1,96,64,0,alpha)
else
call SetUnitVertexColor(.u1,255,8,0,alpha)
endif
endif
endif
//call MoveLightningEx(.l1,false,x+Cos(a)*d1,y+Sin(a)*d1,.z,x+Cos(a)*d2,y+Sin(a)*d2,.z)
else
call SetUnitVertexColor(.u1,0,0,0,0)
endif
// ---------------------------
set u=player_PlayerHero[1+i].u
if .u!=u and u!=null and IsUnitAlly(u,p) then
set d=SquareRoot((GetUnitX(u)-x)*(GetUnitX(u)-x)+(GetUnitY(u)-y)*(GetUnitY(u)-y))//-d3
//set alpha=255-R2I(DamageArea(d,d2,128))
set a=Atan2(GetUnitY(u)-y,GetUnitX(u)-x)
if d<d1 then
call SetUnitX(.u2,GetUnitX(u))
call SetUnitY(.u2,GetUnitY(u))
else
call SetUnitX(.u2,x+Cos(a)*d1)
call SetUnitY(.u2,y+Sin(a)*d1)
endif
if GetLocalPlayer()==GetOwningPlayer(.u) then
if IsAlive(u) then
call SetUnitVertexColor(.u2,96,196,0,alpha)
else
if IsGibbed(u) then
call SetUnitVertexColor(.u2,96,64,0,alpha)
else
call SetUnitVertexColor(.u2,255,8,0,alpha)
endif
endif
endif
else
call SetUnitVertexColor(.u2,0,0,0,0)
endif
// ---------------------------
set u=player_PlayerHero[2+i].u
if .u!=u and u!=null and IsUnitAlly(u,p) then
set d=SquareRoot((GetUnitX(u)-x)*(GetUnitX(u)-x)+(GetUnitY(u)-y)*(GetUnitY(u)-y))//-d3
//set alpha=255-R2I(DamageArea(d,d2,128))
set a=Atan2(GetUnitY(u)-y,GetUnitX(u)-x)
if d<d1 then
call SetUnitX(.u3,GetUnitX(u))
call SetUnitY(.u3,GetUnitY(u))
else
call SetUnitX(.u3,x+Cos(a)*d1)
call SetUnitY(.u3,y+Sin(a)*d1)
endif
if GetLocalPlayer()==GetOwningPlayer(.u) then
if IsAlive(u) then
call SetUnitVertexColor(.u3,96,196,0,alpha)
else
if IsGibbed(u) then
call SetUnitVertexColor(.u3,96,64,0,alpha)
else
call SetUnitVertexColor(.u3,255,8,0,alpha)
endif
endif
endif
else
call SetUnitVertexColor(.u3,0,0,0,0)
endif
// ---------------------------
set u=player_PlayerHero[3+i].u
if .u!=u and u!=null and IsUnitAlly(u,p) then
set d=SquareRoot((GetUnitX(u)-x)*(GetUnitX(u)-x)+(GetUnitY(u)-y)*(GetUnitY(u)-y))//-d3
//set alpha=255-R2I(DamageArea(d,d2,128))
set a=Atan2(GetUnitY(u)-y,GetUnitX(u)-x)
if d<d1 then
call SetUnitX(.u4,GetUnitX(u))
call SetUnitY(.u4,GetUnitY(u))
else
call SetUnitX(.u4,x+Cos(a)*d1)
call SetUnitY(.u4,y+Sin(a)*d1)
endif
if GetLocalPlayer()==GetOwningPlayer(.u) then
if IsAlive(u) then
call SetUnitVertexColor(.u4,96,196,0,alpha)
else
if IsGibbed(u) then
call SetUnitVertexColor(.u4,96,64,0,alpha)
else
call SetUnitVertexColor(.u4,255,8,0,alpha)
endif
endif
endif
else
call SetUnitVertexColor(.u4,0,0,0,0)
endif
// ---------------------------
set u=player_PlayerHero[4+i].u
if .u!=u and u!=null and IsUnitAlly(u,p) then
set d=SquareRoot((GetUnitX(u)-x)*(GetUnitX(u)-x)+(GetUnitY(u)-y)*(GetUnitY(u)-y))//-d3
//set alpha=255-R2I(DamageArea(d,d2,128))
set a=Atan2(GetUnitY(u)-y,GetUnitX(u)-x)
if d<d1 then
call SetUnitX(.u5,GetUnitX(u))
call SetUnitY(.u5,GetUnitY(u))
else
call SetUnitX(.u5,x+Cos(a)*d1)
call SetUnitY(.u5,y+Sin(a)*d1)
endif
if GetLocalPlayer()==GetOwningPlayer(.u) then
if IsAlive(u) then
call SetUnitVertexColor(.u5,96,196,0,alpha)
else
if IsGibbed(u) then
call SetUnitVertexColor(.u5,96,64,0,alpha)
else
call SetUnitVertexColor(.u5,255,8,0,alpha)
endif
endif
endif
else
call SetUnitVertexColor(.u5,0,0,0,0)
endif
set u=null
set p=null
else
set .t=.t-1
endif
return false
endif
return true
endmethod
method fade takes nothing returns boolean
return true
endmethod
method onDestroy takes nothing returns nothing
call KillUnitA(.u1)
call KillUnitA(.u2)
call KillUnitA(.u3)
call KillUnitA(.u4)
call KillUnitA(.u5)
endmethod
endstruct
function PingIcon takes integer p, string fx returns nothing
local integer n=MAXPLAYERS/2
local integer i=0
local unit u=null
local string s
if IsPlayerInForce(Player(p),player_Force[1]) then
set i=5
set n=n+i
set p=p-5
endif
loop
exitwhen i==n
if p==0 then
set u=player_PlayerHero[i].ping.u1
elseif p==1 then
set u=player_PlayerHero[i].ping.u2
elseif p==2 then
set u=player_PlayerHero[i].ping.u3
elseif p==3 then
set u=player_PlayerHero[i].ping.u4
elseif p==4 then
set u=player_PlayerHero[i].ping.u5
endif
set s=""
if fx==MODEL_ICON_DEATH then
if GetLocalPlayer()==Player(i) and GetUnitTypeId(player_PlayerHero[i].u)==RAW_MEDIC then
set s=fx
endif
else
if GetLocalPlayer()==Player(i) then
set s=fx
endif
endif
call DestroyEffect(AddSpecialEffectTarget(s,u,"origin"))
set i=i+1
endloop
set u=null
endfunction
struct blur extends mobile
unit u
effect fx
real timed=1.
real fadeduration=fadeduration
string funcdeath="DoNothing"
static method Create takes integer id, real x, real y, real z, real a, real aoa returns blur
local blur s=blur.create()
set s.u=CreateUnit(Player(15),id,x,y,a)
call SetUnitX(s.u,x)
call SetUnitY(s.u,y)
call SetUnitAnimationByIndex(s.u,R2I(aoa*100+.5)+90)
call UnitAddAbility(s.u,RAW_FLYHACK)
call UnitRemoveAbility(s.u,RAW_FLYHACK)
call SetUnitFlyHeight(s.u,z,0.)
set s.fx=null
return s
endmethod
method addfx takes string model, string part returns nothing
if this.fx!=null then
call DestroyEffect(this.fx)
endif
set this.fx=AddSpecialEffectTarget(model,this.u,part)
endmethod
method anim takes nothing returns boolean
if this.timed!=-1. then
set this.timed=this.timed-period
if this.timed<=0 then
return true
endif
return false
endif
return true
endmethod
method fade takes nothing returns boolean
set this.alpha=this.alpha-R2I((255*period)/this.fadeduration)
if (this.alpha<=0) then
call SetUnitVertexColor(this.u,this.red,this.green,this.blue,0)
return true
endif
call SetUnitVertexColor(this.u,this.red,this.green,this.blue,this.alpha)
return false
endmethod
method onDestroy takes nothing returns nothing
set placeholdmobile=this
call ExecuteFunc(.funcdeath)
call DestroyEffect(.fx)
call KillUnitA(.u)
endmethod
endstruct
struct foot extends mobile
unit u
unit detect=null
unit shield=null
item i_shield=null
real x
real y
integer delay=0
boolean moving=false
boolean water=false
unit vision
static method Create takes unit u returns foot
local foot s=foot.create()
set s.u=u
set s.x=GetUnitX(u)
set s.y=GetUnitY(u)
set s.vision=CreateUnit(GetOwningPlayer(u),'hphx',s.x,s.y,0)
if mod==3 then
set s.detect=CreateUnit(GetOwningPlayer(u),RAW_DUMMY,s.x,s.y,270)
call UnitAddAbility(s.detect,'AId2')
call SetUnitVertexColor(s.detect,0,0,0,0)
endif
return s
endmethod
method anim takes nothing returns boolean
local real x=GetUnitX(.u)
local real y=GetUnitY(.u)
local real a
local integer t
local string s
local sound snd
local boolean b=GetUnitTypeId(.u)!=RAW_CLOAKED
local boolean b2
local Hero h=GetUnitUserData(.u)
if .u==null then
return true
endif
if AI_active[GetPlayerId(GetOwningPlayer(.u))]==false then
if not IsUnitSelected(.u,GetOwningPlayer(.u)) then
set h.selected=false
call UnitRemoveItem(.u,h.i_weapon)
call SetItemVisible(h.i_weapon,false)
else
if h.selected==false then
call UnitRemoveItemFromSlot(.u,0)
call SetItemVisible(h.i_weapon,true)
call UnitAddItem(.u,h.i_weapon)
set h.selected=true
endif
endif
endif
if GetUnitAbilityLevel(.u,'AId0')>0 then
set a=GetUnitFacing(.u)
if .moving then
set a=a+15
endif
if .shield==null then
set .shield=CreateUnit(GetOwningPlayer(.u),'h004',x,y,a)
if GetItemCharges(.i_shield)>0 then
call SetWidgetLife(.shield,GetItemCharges(.i_shield))
endif
//call SetUnitPathing(.shield,true)
elseif not IsAlive(.shield) then
call RemoveItem(.i_shield)
call AddSound(.shield,"Abilities\\Spells\\Other\\FrostBolt\\FrostBoltHit1.wav")
endif
call SetUnitX(.shield,x+CosBJ(a)*50)
call SetUnitY(.shield,y+SinBJ(a)*50)
call SetUnitFacing(.shield,a)
call SetItemCharges(.i_shield,R2I(GetWidgetLife(.shield)+.5))
else
call KillUnitA(.shield)
set .shield=null
endif
if not b then
call SetUnitState(.u,UNIT_STATE_MANA,GetUnitState(.u,UNIT_STATE_MANA)-0.4)
if GetUnitState(.u,UNIT_STATE_MANA)<1.01 then
call IssueImmediateOrder(.u,"unstoneform")
endif
endif
//tower increased vision
//if GetUnitAbilityLevel(this.u,'BOae')==1 then
// call UnitAddAbility(.vision,'AIsi')
//else
// call UnitRemoveAbility(.vision,'AIsi')
//endif
call SetUnitX(.vision,x)
call SetUnitY(.vision,y)
if mod==3 and replay_game and IsAlive(.u) then
call SetUnitX(.detect,x)
call SetUnitY(.detect,y)
set b2=IsPlayerInForce(GetLocalPlayer(),player_Force[1])
if b2 and IsUnitFogged(.u,GetLocalPlayer()) then
call SetUnitVertexColor(.detect,255,255,255,255)
call SetTextTagVisibility(h.namepointer.t,false)
call SetTextTagVisibility(h.hppointer.t,false)
elseif b2 then
call SetUnitVertexColor(.detect,0,0,0,0)
call SetTextTagVisibility(h.namepointer.t,true)
call SetTextTagVisibility(h.hppointer.t,true)
else
call SetUnitVertexColor(.detect,0,0,0,0)
endif
endif
set this.delay=this.delay-1
// *'Adrt' *'Adrd' *'Agrs' 'Arck' *'Agrd' *'Adrg' 'Alvd'
if this.delay<=0 then
if (x!=this.x or y!=this.y) and GetUnitFlyHeight(this.u)<1 then
if not this.moving then
set this.moving=true
set MOVING=MOVING+1
endif
set this.delay=R2I(6000/GetUnitMoveSpeed(this.u))
if b then//
call SetUnitVertexColor(this.u,255,255,255,255)
if not IsTerrainPathable(x,y,PATHING_TYPE_FLOATABILITY) then
if not this.water then
set s="Sound\\Step\\inwater.wav"
set this.water=true
else
set s="Sound\\Step\\Slosh"+I2S(GetRandomInt(1,4))+".wav"
endif
call DestroyEffect(AddSpecialEffect(MODEL_WATER_SPLASH,x,y))
else
set this.water=false
set t=GetTerrainType(x,y)
if t=='Adrt' or t=='Adrg' then
set s="Sound\\Step\\Dirt"+I2S(GetRandomInt(1,4))+".wav"
elseif t=='Agrs' or t=='Agrd' then
set s="Sound\\Step\\Grass"+I2S(GetRandomInt(1,4))+".wav"
elseif t=='Arck' or t=='Adrd' then
set s="Sound\\Step\\Gravel"+I2S(GetRandomInt(1,4))+".wav"
else
set s="Sound\\Step\\Dirt"+I2S(GetRandomInt(1,4))+".wav"
endif
//call DestroyEffect(AddSpecialEffect(MODEL_DUST_SPLASH,x,y))
endif
set snd=CreateSound(s,false,true,false,10,10,"MissilesEAX")
//call SetSoundDuration(snd,GetSoundDuration(snd)-MOVING*40)
call SetSoundPitch(snd,GetRandomReal(0.8,1.1))
call SetSoundVolume(snd,127)
call SetSoundDistances(snd,100,1200)
call SetSoundDistanceCutoff(snd,1200)
call AttachSoundToUnit(snd,this.u)
call StartSound(snd)
call KillSoundWhenDone(snd)
set snd=null
else
call SetUnitVertexColor(this.u,72,200,64,60) // cloaked (moving)
endif
else
if b then
if GetUnitAbilityLevel(this.u,'BEar')==1 then
call SetUnitVertexColor(this.u,255,255,255,100) // normal (cover)
//call UnitAddAbility(this.u,'AId3')
else
call SetUnitVertexColor(this.u,255,255,255,255) // normal
//call UnitRemoveAbility(this.u,'AId3')
endif
else
call SetUnitVertexColor(this.u,72,255,64,20) // cloaked (standing)
endif
if this.moving then
set this.moving=false
set MOVING=MOVING-1
endif
endif
if GetUnitAbilityLevel(this.u,'AIlf')==1 or GetUnitAbilityLevel(this.u,'B004')==1 then
call SetUnitVertexColor(this.u,255,16,16,255) // painkiller
endif
//if GetWidgetLife(this.u)<.405 then
// return true
//endif
endif
if GetWidgetLife(this.u)<.405 then
return true
endif
set this.x=x
set this.y=y
return false
endmethod
method fade takes nothing returns boolean
return true
endmethod
method onDestroy takes nothing returns nothing
//call KillUnitA(.vision)
call SetUnitExploded(.vision,true)
call UnitApplyTimedLife(.vision,0,2)
call KillUnitA(.shield)
call RemoveItem(.i_shield)
call KillUnitA(.detect)
endmethod
endstruct
struct mover extends mobile
unit u
unit target=null
unit target2=null
real vx=0
real vy=0
real vz=0
real x
real y
real z
real range=0
real G=-20
real timed=-1.
effect fx
group g
boolean vertical=true
boolean horizontal=true
boolean zangle=false
string funchit="DoNothing"
boolexpr conhit=BOOLEXPR_FALSE
string funcimpact="DoNothing"
string funcgen="DoNothing"
string funcdeath="DoNothing"
real gen=-1.
real geno=-1.
static method Create takes unit u returns mover
local mover s=mover.create()
set s.u=u
set s.x=GetUnitX(u)
set s.y=GetUnitY(u)
set s.z=GetZ(s.x,s.y)+GetUnitFlyHeight(u)
call UnitAddAbility(u,RAW_FLYHACK)
call UnitRemoveAbility(u,RAW_FLYHACK)
set s.g=CreateGroup()
call SetUnitPathing(u,false)
call SetUnitX(s.u,s.x)
call SetUnitY(s.u,s.y)
set s.target=null
return s
endmethod
method addfx takes string model, string part returns nothing
if .fx!=null then
call DestroyEffect(.fx)
endif
set .fx=AddSpecialEffectTarget(model,.u,part)
endmethod
private method collision takes nothing returns boolean
local boolean r=false
local unit picked
local real z1
local real z2=GetUnitFlyHeight(this.u)
local real zz=20+RAbsBJ(.range*2)
local boolexpr con=Condition(function Con)
local group g=CreateGroup()
call GroupEnumUnitsInRange(g,this.x,this.y,this.range,con)//this.conhit)
call DestroyBool(con)
set con=null
call GroupRemoveUnit(g,this.u)
loop
set picked=FirstOfGroup(g)
exitwhen (picked==null or placeholdmobile==0)
if(not IsUnitInGroup(picked,this.g) and not IsUnitHidden(picked))then
set z1=GetUnitFlyHeight(picked)+UNIT_HEIGHT
//call BJDebugMsg("z1:"+R2S(z1) + " " + "z2:"+R2S(z2))
if z1<=z2+zz and z1>=z2-zz then
set placeholdunit=picked
set r=true
call ExecuteFunc(this.funchit)
endif
endif
call GroupRemoveUnit(g,picked)
endloop
call DestroyGroup(g)
set g=null
set picked=null
return r
endmethod
method anim takes nothing returns boolean
local real Gz=0
local real a
local real aoa
call SetUnitPathing(this.u,false)
set placeholdmobile=this
set conunit=this.u
if this.timed!=-1. then
set this.timed=this.timed-period
if this.timed<=0 then
//call BJDebugMsg("missile: time expired")
call ExecuteFunc(this.funcimpact)
return true
endif
endif
if this.gen!=-1. then
set this.gen=this.gen-period
if this.gen<=0 then
call ExecuteFunc(this.funcgen)
set this.gen=this.geno
endif
endif
if this.horizontal then
set this.x=this.x + this.vx*period
set this.y=this.y + this.vy*period
else
set this.x=GetUnitX(this.u)
set this.y=GetUnitY(this.u)
endif
set this.z=this.z + this.vz*period
set Gz=GetZ(this.x,this.y)
if this.z>UNIT_MAX_HEIGHT+Gz then
set this.z=UNIT_MAX_HEIGHT+Gz
set this.vz=-this.vz
endif
set this.vz=this.vz+this.G
// if(this.x>MAX_X) or (this.y>MAX_Y) or (this.x<MIN_X) or (this.y<MIN_Y)then
if IsTerrainPathable(.x,.y,PATHING_TYPE_FLYABILITY) then
if this.horizontal then
if (this.vx > 0. and IsTerrainPathable(this.x+8,this.y,PATHING_TYPE_FLYABILITY)) or (this.vx < 0. and IsTerrainPathable(this.x-8,this.y,PATHING_TYPE_FLYABILITY)) then
set this.vx=-this.vx
endif
if (this.vy > 0. and IsTerrainPathable(this.x,this.y+8,PATHING_TYPE_FLYABILITY)) or (this.vy < 0. and IsTerrainPathable(this.x,this.y-8,PATHING_TYPE_FLYABILITY)) then
set this.vy=-this.vy
endif
else
set a=GetUnitFacing(this.u)
if (this.vx > 0. and IsTerrainPathable(this.x+8,this.y,PATHING_TYPE_FLYABILITY)) or (this.vx < 0. and IsTerrainPathable(this.x-8,this.y,PATHING_TYPE_FLYABILITY)) then
call echo("bounce X")
set this.vx=CosBJ(-a)*600
else
set this.vx=CosBJ(a)*600
endif
if (this.vy > 0. and IsTerrainPathable(this.x,this.y+8,PATHING_TYPE_FLYABILITY)) or (this.vy < 0. and IsTerrainPathable(this.x,this.y-8,PATHING_TYPE_FLYABILITY)) then
call echo("bounce Y")
set this.vy=SinBJ(-a)*600
else
set this.vy=SinBJ(a)*600
endif
//set this.vz=this.G
set this.horizontal=true
endif
set this.x=this.x + this.vx*period
set this.y=this.y + this.vy*period
endif
if(this.z<Gz)then
call ExecuteFunc(this.funcimpact)
//call BJDebugMsg("missile: out of map")
return false
endif
if this.fx!=null and this.zangle then
set aoa=Atan2(.vz,SquareRoot(.vx*.vx+.vy*.vy))
call SetUnitAnimationByIndex(.u,R2I(aoa*50+.5)+90) //aoa*100+.5
endif
if this.horizontal then
call SetUnitX(.u,.x)
call SetUnitY(.u,.y)
endif
if this.vertical then
call SetUnitFlyHeight(.u,.z-Gz,0)
else
call SetUnitFlyHeight(.u,.0,0)
endif
//call SetUnitFacing(this.u,a)
if this.range>0. then
//set conunit=this.u
if this.collision() then
//call ExecuteFunc(this.funchit)
return this.terminate
endif
endif
return false
endmethod
method fade takes nothing returns boolean
return true
endmethod
method onDestroy takes nothing returns nothing
set placeholdmobile=this
call ExecuteFunc(.funcdeath)
call DestroyBool(.conhit)
call DestroyEffect(.fx)
call DestroyGroup(.g)
//call KillUnitA(.u)
call SetUnitPathing(.u,true)
endmethod
endstruct
struct missile extends mobile
unit u
unit target=null
unit target2=null
real speed
real x
real y
real z
real a
real G=-0.1
real range
real timed=-1.
effect fx
group g
string funchit="DoNothing"
boolexpr conhit=BOOLEXPR_FALSE
string funcimpact="DoNothing"
string funcgen="DoNothing"
string funcdeath="DoNothing"
real gen=-1.
real geno=-1.
static method Create takes player p, real x, real y, real z, real a returns missile
local missile s=missile.create()
set s.u=CreateUnit(p,RAW_DUMMY,x,y,a)
call SetUnitX(s.u,x)
call SetUnitY(s.u,y)
call SetUnitAnimationByIndex(s.u,90)
call UnitAddAbility(s.u,RAW_FLYHACK)
call UnitRemoveAbility(s.u,RAW_FLYHACK)
call SetUnitFlyHeight(s.u,z,0.)
set s.x=x
set s.y=y
set s.z=z+GetZ(x,y)
set s.a=-1.
set s.target=null
set s.fx=null
set s.g=CreateGroup()
call SetUnitUserData(s.u,s)
return s
endmethod
method addfx takes string model, string part returns nothing
if this.fx!=null then
call DestroyEffect(this.fx)
endif
set this.fx=AddSpecialEffectTarget(model,this.u,part)
endmethod
private method collision takes nothing returns boolean
local boolean r=false
local unit picked
local real z1
local real z2=GetUnitFlyHeight(this.u)
local real zz=this.range+20//this.speed*period*10
local boolexpr con=Condition(function Con)
local group g=CreateGroup()
call GroupEnumUnitsInRange(g,this.x,this.y,this.range,con)//this.conhit)
call DestroyBool(con)
set con=null
call GroupRemoveUnit(g,this.u)
loop
set picked=FirstOfGroup(g)
exitwhen (picked==null or placeholdmobile==0)
if(not IsUnitInGroup(picked,this.g) and not IsUnitHidden(picked))then
set z1=GetUnitFlyHeight(picked)+UNIT_HEIGHT
//call BJDebugMsg("z1:"+R2S(z1) + " " + "z2:"+R2S(z2))
if z1<=z2+zz and z1>=z2-zz then
set placeholdunit=picked
set r=true
call ExecuteFunc(this.funchit)
endif
endif
call GroupRemoveUnit(g,picked)
endloop
call DestroyGroup(g)
set g=null
set picked=null
return r
endmethod
method anim takes nothing returns boolean
local real x=0
local real y=0
local real z=0
local real Gz=0
local real a
local real aoa
set placeholdmobile=this
set conunit=this.u
if this.timed!=-1. then
set this.timed=this.timed-period
if this.timed<=0 then
//call BJDebugMsg("missile: time expired")
call ExecuteFunc(this.funcimpact)
return true
endif
endif
if this.gen!=-1. then
set this.gen=this.gen-period
if this.gen<=0 then
call ExecuteFunc(this.funcgen)
if this.terminate then
return true
endif
set this.gen=this.geno
endif
endif
if this.target!=null and IsAlive(this.target) then
set x=GetUnitX(this.target)-this.x
set y=GetUnitY(this.target)-this.y
set z=UNIT_HEIGHT+GetZ(GetUnitX(this.target),GetUnitY(this.target))+GetUnitFlyHeight(this.target)-this.z
set a=Atan2(y,x)*bj_RADTODEG
set aoa=Atan2(z,SquareRoot(x*x+y*y))
//call BJDebugMsg("missile: target found")
else
set a=GetUnitFacing(this.u)
set aoa=this.G
//call BJDebugMsg("missile: no target")
endif
if .a!=-1. then
set a=.a
endif
set this.x=this.x + Cos(a*bj_DEGTORAD)*this.speed*period
set this.y=this.y + Sin(a*bj_DEGTORAD)*this.speed*period
set this.z=this.z + Sin(aoa)*this.speed*period
set Gz=GetZ(this.x,this.y)
if (this.x>MAX_X) or (this.y>MAX_Y) or (this.x<MIN_X) or (this.y<MIN_Y) or (this.z<Gz) then
call ExecuteFunc(this.funcimpact)
//call BJDebugMsg("missile: out of map")
return true
endif
call SetUnitX(this.u,this.x)
call SetUnitY(this.u,this.y)
call SetUnitFlyHeight(this.u,this.z-Gz,0.)
if this.fx!=null then
call SetUnitAnimationByIndex(this.u,R2I(aoa*50+.5)+90) //aoa*100+.5
endif
if this.a!=-1. then
call SetUnitFacing(this.u,a)
endif
if this.range>0. then
//set conunit=this.u
if this.collision() then
//call BJDebugMsg("missile: collision")
//call ExecuteFunc(this.funchit)
//return true
return this.terminate
endif
endif
return false
endmethod
method fade takes nothing returns boolean
set this.alpha=this.alpha-R2I((255*period)/fadeduration)
if (this.alpha<=0) then
call SetUnitVertexColor(this.u,this.red,this.green,this.blue,0)
return true
endif
call SetUnitVertexColor(this.u,this.red,this.green,this.blue,this.alpha)
return false
endmethod
method onDestroy takes nothing returns nothing
set placeholdmobile=this
call ExecuteFunc(.funcdeath)
call DestroyBool(this.conhit)
call DestroyEffect(this.fx)
call DestroyGroup(this.g)
call KillUnitA(this.u)
endmethod
endstruct
struct wave extends mobile
unit u
unit target
real tx
real ty
real speed=0
real x
real y
real z
real range
real timed=-1.
effect fx
group g
string funchit="DoNothing"
boolexpr conhit=BOOLEXPR_FALSE
string funcimpact="DoNothing"
string funcgen="DoNothing"
real gen=-1.
real geno=-1.
static method Create takes player p, real x, real y, real z, real a returns wave
local wave s=wave.create()
set s.u=CreateUnit(p,RAW_DUMMY,x,y,a)
call SetUnitX(s.u,x)
call SetUnitY(s.u,y)
call SetUnitAnimationByIndex(s.u,90)
call UnitAddAbility(s.u,RAW_FLYHACK)
call UnitRemoveAbility(s.u,RAW_FLYHACK)
call SetUnitFlyHeight(s.u,z,0.)
set s.x=x
set s.y=y
set s.z=z
set s.tx=x
set s.ty=y
set s.target=null
set s.fx=null
set s.g=CreateGroup()
return s
endmethod
method addfx takes string model, string part returns nothing
if this.fx!=null then
call DestroyEffect(this.fx)
endif
set this.fx=AddSpecialEffectTarget(model,this.u,part)
endmethod
private method collision takes nothing returns boolean
local boolean r=false
local unit picked
local group g=CreateGroup()
call GroupEnumUnitsInRange(g,this.x,this.y,this.range,this.conhit)
call GroupRemoveUnit(g,this.u)
loop
set picked=FirstOfGroup(g)
exitwhen picked==null
if not IsUnitInGroup(picked,this.g) and not IsUnitHidden(picked) then
set r=true
set placeholdunit=picked
call ExecuteFunc(this.funchit)
endif
call GroupRemoveUnit(g,picked)
endloop
call DestroyGroup(g)
set g=null
set picked=null
return r
endmethod
method anim takes nothing returns boolean
local real x=0
local real y=0
local real a=0
set placeholdmobile=this
set conunit=.u
if this.timed!=-1. then
set this.timed=this.timed-period
if this.timed<=0 then
call ExecuteFunc(this.funcimpact)
return true
endif
endif
if this.gen!=-1. then
set this.gen=this.gen-period
if this.gen<=0 then
call ExecuteFunc(this.funcgen)
if this.terminate then
return true
endif
set this.gen=this.geno
endif
endif
if this.target!=null and IsAlive(this.target) then
set x=GetUnitX(this.target)-this.x
set y=GetUnitY(this.target)-this.y
set a=Atan2(y,x)*bj_RADTODEG
//call BJDebugMsg("missile: target found")
else
set x=this.tx-this.x
set y=this.ty-this.y
set this.tx=this.tx+x
set this.ty=this.ty+y
set a=Atan2(y,x)*bj_RADTODEG
//call BJDebugMsg("missile: no target")
endif
if .speed>0. then
set this.x=this.x + Cos(a*bj_DEGTORAD)*this.speed*period
set this.y=this.y + Sin(a*bj_DEGTORAD)*this.speed*period
if (this.x>MAX_X) or (this.y>MAX_Y) or (this.x<MIN_X) or (this.y<MIN_Y) then
call ExecuteFunc(this.funcimpact)
//call BJDebugMsg("missile: out of map")
return true
endif
call SetUnitX(this.u,this.x)
call SetUnitY(this.u,this.y)
call SetUnitFacing(this.u,a)
endif
if this.range>0. then
if this.collision() then
return this.terminate
endif
endif
return false
endmethod
method fade takes nothing returns boolean
set this.alpha=this.alpha-R2I((255*period)/fadeduration)
if (this.alpha<=0) then
call SetUnitVertexColor(this.u,this.red,this.green,this.blue,0)
return true
endif
call SetUnitVertexColor(this.u,this.red,this.green,this.blue,this.alpha)
return false
endmethod
method onDestroy takes nothing returns nothing
call DestroyBool(this.conhit)
call DestroyEffect(this.fx)
call DestroyGroup(this.g)
call KillUnitA(this.u)
endmethod
endstruct
//------------------------------------------------------------
function SpellGibDeath takes nothing returns nothing
local mover m=placeholdmobile
set m.terminate=true
call KillUnitA(m.u)
endfunction
function SpellGibImpact takes nothing returns nothing
local mover m=placeholdmobile
call CreateBloodsplat(GetUnitX(m.u),GetUnitY(m.u),GetRandomReal(1.6,1.8))
set m.timed=1.2
set m.funcimpact="DoNothing"
call SetUnitVertexColor(m.u,255,255,255,0)
endfunction
function CreateGib takes real x, real y, real z, real a, real v returns nothing
local mover s
local unit c
local real array V
local real aoa=.3
local real spread=150.
local integer n=10
local blur t
set V[5]=a
set V[1]=v
loop
exitwhen n<=0
set a=V[5]+GetRandomReal(-spread,spread)
set v=V[1]*GetRandomReal(0.66,1.)
set c=CreateUnit(Player(15),RAW_DUMMY,x,y,a)
set s=mover.Create(c)
call s.addfx(MODEL_BONES,"origin")
set a=a*bj_DEGTORAD
set s.z=s.z+z
set s.vx=Cos(a)*v
set s.vy=Sin(a)*v
set s.vz=Sin(aoa+GetRandomReal(-spread,spread*2)*0.05)*v
set s.G=-15
set s.funcimpact="SpellGibImpact"
//set s.funchit="SpellShardHit"
//set s.conhit=Condition(function IsEnemy)
set s.funcdeath="SpellGibDeath"
call SetUnitAnimationByIndex(s.u,90)
call addmobile(s)
//set s.range=0.
//set s.aux1=1
set n=n-1
endloop
call AddSound(c,SOUND_GIBS)
set c=null
set t=blur.Create(RAW_DUMMY,x,y,z+15,GetRandomReal(0,360),0)
set t.fadeduration=1
call t.addfx("Model\\GibSplash.mdl","origin")
call addmobile(t)
call SetUnitScale(t.u,6,0,0)
endfunction
function CreateBeep takes unit a, unit b returns nothing
local integer id=GetUnitTypeId(b)
if IsUnitFogged(b,GetOwningPlayer(a)) and not IsWall(b) then
call AddSound2D(GetOwningPlayer(a),"Sound\\hit.mp3")
endif
if id=='hwtw' or id=='hgtw' then //id=='ncg3'
call UnitColorByHP(b)
endif
endfunction
function DrugAilments takes player p returns nothing
local integer e=GetPlayerId(p)
local integer dep=player_drug[e]
local integer i=GetRandomInt(1,3)
local Hero h
if dep>500 then
set h=player_PlayerHero[e]
if i==1 then //headache
set i=GetRandomInt(0,100+R2I(dep*.01))
if i>85 then
call msg(p,"|c00FF0000Drug related:|r You've got a headache","")
call SpellDummy(p,GetUnitX(h.u),GetUnitY(h.u),0,'ANmr',"mindrot",1,h.u,.5)
endif
elseif i==2 then //sleep
set i=GetRandomInt(0,100+R2I(dep*.01))
if i>110 then
call msg(p,"|c00FF0000Drug related:|r You've fell into sleep","")
call SpellDummy(p,GetUnitX(h.u),GetUnitY(h.u),0,'ACsl',"sleep",1,h.u,.5)
endif
elseif i==3 then //pain
set i=GetRandomInt(0,100+R2I(dep*.01))
if i>100 then
call msg(p,"|c00FF0000Drug related:|r You suddenly feel pain","")
call SpellDummy(p,GetUnitX(h.u),GetUnitY(h.u),0,'Aslo',"slow",2,h.u,.5)
call UnitRemoveAbility(h.u,'Bbsk') //stimpack
endif
endif
endif
endfunction
//------------------------------------------------------------
function SpellBarrageImpact takes nothing returns nothing
local mover m=placeholdmobile
local real x=GetUnitX(m.u)
local real y=GetUnitY(m.u)
local group g=CreateGroup()
local boolexpr filter
local real factor
local unit c
local blur s
local vector a=vector.createFrom(x,y,GetZ(x,y)+GetUnitFlyHeight(m.u))
local vector b=vector.create()
set filter=Condition(function IsAll)
call GroupEnumUnitsInRange(g,x,y,250,filter)
call DestroyBoolExpr(filter)
set filter=null
call GroupRemoveUnit(g,m.u)
loop
set c=FirstOfGroup(g)
exitwhen c==null
call GroupRemoveUnit(g,c)
set b.x=GetUnitX(c)
set b.y=GetUnitY(c)
set b.z=GetZ(GetUnitX(c),GetUnitY(c))+GetUnitFlyHeight(c)
set factor=1
if GetUnitAbilityLevel(c,'AId4')>0 then
set factor=.75
endif
call UnitDamageTarget(m.u,c,DamageArea(vector.distance(a,b),300,250)*factor,false,false,ATTACK_TYPE_MAGIC,DAMAGE_TYPE_MAGIC,null)
// Blood
if not IsUnitType(c,UNIT_TYPE_MECHANICAL) then
if not IsAlive(c) then
call CreateGib(GetUnitX(c),GetUnitY(c),GetUnitFlyHeight(c),-GetUnitFacing(c),300)
call KillUnitA(c)
else
call DestroyEffect(AddSpecialEffectTarget(MODEL_BLOOD,c,"chest"))
call CreateBloodsplat(GetUnitX(c),GetUnitY(c),GetRandomReal(0.9,1.2))
endif
endif
call CreateBeep(m.u,c)
endloop
call DestroyGroup(g)
set g=null
call a.destroy()
call b.destroy()
call EnumDestructablesInCircle(x,y,250,function TreeKill)
call EnumDestructablesInCircle(x,y,500,function TreeShake)
set s=blur.Create(RAW_DUMMY,x,y,GetUnitFlyHeight(m.u)+12,GetRandomReal(0,360),0)
set s.fadeduration=20
//if GetUnitFlyHeight(s.u)>40 then
// call s.addfx(MODEL_EXPLO_AIR,"origin")
//else
//call s.addfx(MODEL_EXPLO_GROUND,"origin")
call s.addfx("Model\\EXground2.mdl","origin")
//endif
call AddSound(s.u,SOUND_EXPLO())
call AddSoundStereo(s.u,"sound\\explosion_L.mp3","sound\\explosion_R.mp3")
call addmobile(s)
call SetUnitScale(s.u,1.25,0,0)
call DestroyEffect(s.fx)
set s=blur.Create(RAW_DUMMY,x,y,GetUnitFlyHeight(m.u)+12,GetRandomReal(0,360),0)
call s.addfx(MODEL_EXPLO_FLARE,"origin")
call SetUnitScale(s.u,2.5,0,0)
call DestroyEffect(s.fx)
call KillUnitA(m.u)
set m.terminate=true
endfunction
function SpellBarrageGen takes nothing returns nothing
local missile m=placeholdmobile
local mover s
local real spread=GetRandomReal(0,500.)
local real a=GetRandomReal(0,360)
local real x=m.x+Cos(a*bj_DEGTORAD)*spread
local real y=m.y+Sin(a*bj_DEGTORAD)*spread
set s=mover.Create(CreateUnit(GetOwningPlayer(m.u),RAW_DUMMY,x,y,10))
set s.z=GetZ(s.x,s.y)+2000
call SetUnitAnimationByIndex(s.u,0)
call SetUnitScale(s.u,2,0,0)
call s.addfx(MODEL_ROCKET2,"origin")
//set s.vz=-2000.
set s.G=-300.
set s.horizontal=false
set s.funcimpact="SpellBarrageImpact"
call addmobile(s)
endfunction
function SpellBarrage takes nothing returns nothing
local location l=GetSpellTargetLoc()
local real x=GetLocationX(l)
local real y=GetLocationY(l)
local unit u=GetSpellAbilityUnit()
local Hero h=GetUnitUserData(u)
local missile m
local string s=""
call RemoveLocation(l)
set l=null
set m=missile.Create(GetOwningPlayer(u),x,y,50,0)
if IsPlayerAlly(GetLocalPlayer(),GetOwningPlayer(u)) then
set s=MODEL_AOE
call PingMinimapEx(x,y,14,255,43,178,false)
endif
call m.addfx(s,"origin")
set m.speed=0.
set m.range=0.
set m.timed=12.
set m.gen=4
set m.geno=0.5
set m.aux1=GetUnitFacing(u)
set m.funcgen="SpellBarrageGen"
call addmobile(m)
call SetUnitScale(m.u,4,0,0)
call SetUnitVertexColor(m.u,255,43,178,255)
set m.green=43
set m.blue=178
//call AddSound(m.u,"Sound\\Flyby.mp3")
//call AddSound2D(GetLocalPlayer(),"Sound\\Flyby.mp3")
if IsUnitInForce(u,player_Force[0]) then
set s=COLOR_TEAM1
else
set s=COLOR_TEAM2
endif
set s=s+GetPlayerName(GetOwningPlayer(u))+COLOR_END
call msg_timed(GetLocalPlayer(),6,s+" calls for an artillery barrage !",SOUND_MSG)
call PingIcon(GetPlayerId(GetOwningPlayer(u)),MODEL_ICON_BOMB)
set u=null
endfunction
function SpellAirStrikeImpact takes nothing returns nothing
local mover m=placeholdmobile
local real x=GetUnitX(m.u)
local real y=GetUnitY(m.u)
local group g=CreateGroup()
local boolexpr filter
local unit c
local blur s
local vector a=vector.createFrom(x,y,GetZ(x,y)+GetUnitFlyHeight(m.u))
local vector b=vector.create()
set filter=Condition(function IsAll)
call GroupEnumUnitsInRange(g,x,y,312,filter)
call DestroyBoolExpr(filter)
set filter=null
call GroupRemoveUnit(g,m.u)
loop
set c=FirstOfGroup(g)
exitwhen c==null
call GroupRemoveUnit(g,c)
set b.x=GetUnitX(c)
set b.y=GetUnitY(c)
set b.z=GetZ(GetUnitX(c),GetUnitY(c))+GetUnitFlyHeight(c)
call UnitDamageTarget(m.u,c,DamageArea(vector.distance(a,b),362,600),false,false,ATTACK_TYPE_MAGIC,DAMAGE_TYPE_MAGIC,null)
// Blood
if not IsUnitType(c,UNIT_TYPE_MECHANICAL) then
if not IsAlive(c) then
call CreateGib(GetUnitX(c),GetUnitY(c),GetUnitFlyHeight(c),-GetUnitFacing(c),300)
call KillUnitA(c)
else
call UnitBurn(m.u,c)
call DestroyEffect(AddSpecialEffectTarget(MODEL_BLOOD,c,"chest"))
call CreateBloodsplat(GetUnitX(c),GetUnitY(c),GetRandomReal(0.9,1.2))
endif
endif
call CreateBeep(m.u,c)
endloop
call DestroyGroup(g)
set g=null
call a.destroy()
call b.destroy()
call EnumDestructablesInCircle(x,y,250,function TreeKill)
call EnumDestructablesInCircle(x,y,500,function TreeShake)
set s=blur.Create(RAW_DUMMY,x,y,GetUnitFlyHeight(m.u)+12,GetRandomReal(0,360),0)
set s.fadeduration=3
//if GetUnitFlyHeight(s.u)>40 then
// call s.addfx(MODEL_EXPLO_AIR,"origin")
//else
call s.addfx(MODEL_EXPLO_GROUND,"origin")
//endif
call AddSound(s.u,SOUND_EXPLO())
call AddSoundStereo(s.u,"sound\\explosion_L.mp3","sound\\explosion_R.mp3")
call addmobile(s)
call SetUnitScale(s.u,2.5,0,0)
call DestroyEffect(s.fx)
set s=blur.Create(RAW_DUMMY,x,y,GetUnitFlyHeight(m.u)+12,GetRandomReal(0,360),0)
call s.addfx(MODEL_EXPLO_FLARE,"origin")
call SetUnitScale(s.u,3.5,0,0)
call DestroyEffect(s.fx)
call KillUnitA(m.u)
set m.terminate=true
endfunction
function SpellAirStrikeGen takes nothing returns nothing
local missile m=placeholdmobile
local mover s
local real spread=72.
local real c=((m.timed-1)/0.25)*180
local real x=m.x+Cos(m.aux1*bj_DEGTORAD)*c+GetRandomReal(-spread,spread)
local real y=m.y+Sin(m.aux1*bj_DEGTORAD)*c+GetRandomReal(-spread,spread)
set s=mover.Create(CreateUnit(GetOwningPlayer(m.u),RAW_DUMMY,x,y,10))
set s.z=GetZ(s.x,s.y)+2000
call SetUnitAnimationByIndex(s.u,0)
call SetUnitScale(s.u,2,0,0)
call s.addfx(MODEL_AIRSTRIKE,"origin")
set s.vz=-1000.
set s.G=0.
set s.horizontal=false
set s.funcimpact="SpellAirStrikeImpact"
call addmobile(s)
call AddSound(s.u,"Sound\\Whistle.mp3")
endfunction
function SpellAirStrike takes nothing returns nothing
local location l=GetSpellTargetLoc()
local real x=GetLocationX(l)
local real y=GetLocationY(l)
local unit u=GetSpellAbilityUnit()
local Hero h=GetUnitUserData(u)
local missile m
local string s=""
call RemoveLocation(l)
set l=null
set m=missile.Create(GetOwningPlayer(u),x,y,50,0)
if IsPlayerAlly(GetLocalPlayer(),GetOwningPlayer(u)) then
set s=MODEL_AOE
call PingMinimapEx(x,y,6,255,96,16,false)
endif
call m.addfx(s,"origin")
set m.speed=0.
set m.range=0.
set m.timed=5.
set m.gen=3
set m.geno=0.25
set m.aux1=GetUnitFacing(u)
set m.funcgen="SpellAirStrikeGen"
call addmobile(m)
call SetUnitScale(m.u,5.5,0,0)
call SetUnitVertexColor(m.u,255,96,16,255)
set m.green=96
set m.blue=16
//call AddSound(m.u,"Sound\\Flyby.mp3")
call AddSound2D(GetLocalPlayer(),"Sound\\Flyby.mp3")
if IsUnitInForce(u,player_Force[0]) then
set s=COLOR_TEAM1
else
set s=COLOR_TEAM2
endif
set s=s+GetPlayerName(GetOwningPlayer(u))+COLOR_END
call msg_timed(GetLocalPlayer(),6,s+" calls for an airstrike !",SOUND_MSG)
call PingIcon(GetPlayerId(GetOwningPlayer(u)),MODEL_ICON_BOMB)
set u=null
endfunction
function SpellLSDDeath takes nothing returns nothing
local missile m=placeholdmobile
local Hero h=GetUnitUserData(m.target)
local integer p=GetPlayerId(GetOwningPlayer(m.u))
if GetLocalPlayer()==GetOwningPlayer(m.u) then
call CinematicFadeWithUI(filter_red[p],filter_green[p],filter_blue[p],filter_red[p],filter_green[p],filter_blue[p],10,"ReplaceableTextures\\CameraMasks\\DreamFilter_Mask.blp",15,100)
endif
call UnitRemoveAbility(h.u,'A001')
call UnitRemoveAbility(h.u,'A00O')
//call StopSound(h.s_berserk,true,true)
//call KillSoundWhenDone(h.s_berserk)
set h.lsd_rotate=0
set h.lsd_time=0
set h.lsd=0
endfunction
function SpellLSDGen takes nothing returns nothing
local missile m=placeholdmobile
local Hero h=GetUnitUserData(m.target)
local unit c
local real spread=GetRandomReal(200,750)
local real a=GetRandomReal(0,360)
local real x=m.x+CosBJ(a)*spread
local real y=m.y+SinBJ(a)*spread
local integer i=15
local integer p=GetPlayerId(GetOwningPlayer(m.u))
local sound snd
local blur s
local wave w
local string fx
local real red=filter_red[p]
local real green=filter_green[p]
local real blue=filter_blue[p]
if not IsAlive(h.u) then
set m.terminate=true
return
endif
set m.geno=GetRandomReal(m.aux1,m.aux2)
set h.lsd_rotate=GetRandomReal(-90,270)
set h.lsd_time=m.geno+1
if m.aux3==0 then
set red=GetRandomReal(0,100)
set green=GetRandomReal(0,100)
set blue=GetRandomReal(0,100)
set m.aux3=1
set i=100
endif
if m.aux3!=0 then
set filter_red[p]=GetRandomReal(0,100)
set filter_green[p]=GetRandomReal(0,100)
set filter_blue[p]=GetRandomReal(0,100)
if GetLocalPlayer()==GetOwningPlayer(m.u) then
call CinematicFadeWithUI(red,green,blue,filter_red[p],filter_green[p],filter_blue[p],m.geno,"ReplaceableTextures\\CameraMasks\\DreamFilter_Mask.blp",i,15)
endif
endif
set i=GetRandomInt(1,6)
if i==1 then
set s=blur.Create(RAW_DUMMY,x,y,GetUnitFlyHeight(m.u)+GetRandomReal(-90,128),GetRandomReal(0,360),0)
set s.fadeduration=3
set fx=""
if GetLocalPlayer()==GetOwningPlayer(m.u) then
if GetUnitFlyHeight(s.u)>40 then
set fx=MODEL_EXPLO_AIR
else
set fx=MODEL_EXPLO_GROUND
endif
endif
call s.addfx(fx,"origin")
call spell_addmobile(s)
call SetUnitScale(s.u,2,0,0)
call DestroyEffect(s.fx)
set fx=""
if GetLocalPlayer()==GetOwningPlayer(m.u) then
set fx=MODEL_EXPLO_FLARE
endif
call s.addfx(fx,"origin")
call DestroyEffect(s.fx)
set snd=CreateSound(SOUND_EXPLO(),false,true,false,10,10,"")
call SetSoundPitch(snd,GetRandomReal(0.4,0.9))
//set i=0
//if GetLocalPlayer()==GetOwningPlayer(m.u) then
set i=128
//endif
call SetSoundVolume(snd,i)
call SetSoundDistances(snd,600,10000)
call SetSoundDistanceCutoff(snd,3000)
call AttachSoundToUnit(snd,s.u)
if GetLocalPlayer()==GetOwningPlayer(m.u) then
call StartSound(snd)
endif
call KillSoundWhenDone(snd)
set snd=null
elseif i==2 then
set snd=CreateSound(SOUND_GUN,false,true,false,10,10,"")
call SetSoundPitch(snd,GetRandomReal(0.4,1.25))
//set i=0
//if GetLocalPlayer()==GetOwningPlayer(m.u) then
set i=128
//endif
call SetSoundVolume(snd,i)
call SetSoundDistances(snd,600,10000)
call SetSoundDistanceCutoff(snd,3000)
call AttachSoundToUnit(snd,m.u)
if GetLocalPlayer()==GetOwningPlayer(m.u) then
call StartSound(snd)
endif
call KillSoundWhenDone(snd)
set snd=null
elseif i>=3 then
set red=0.4
set blue=0.9
set i=GetRandomInt(0,13)
if i==0 then
set fx=SOUND_GIBS
elseif i==1 then
set fx="Sound\\Ambient\\Ashenvale\\FreakyForest"+I2S(GetRandomInt(1,4))+".wav"
set blue=0.8
elseif i==2 then
set fx="Sound\\drug.wav"
set red=0.8
set blue=1
elseif i==3 then
set fx="Buildings\\Naga\\TempleOfTides\\TempleOfTidesWhat1.wav"
elseif i==4 then
set fx="Buildings\\Undead\\GraveYard\\GraveYardWhat1.wav"
elseif i==5 then
set fx="Buildings\\Undead\\HauntedMine\\UndeadMiningWhat1.wav"
elseif i==6 then
set fx="Buildings\\Undead\\TempleOfTheDamned\\TempleOfTheDamnedWhat.wav"
elseif i==7 then
set fx="Buildings\\Undead\\Necropolis\\NecropolisWhat.wav"
elseif i==8 then
set fx="Buildings\\Undead\\Crypt\\CryptWhat.wav"
elseif i==9 then
set fx="Buildings\\Undead\\GargoyleSpire\\GargoyleSpireWhat1.wav"
elseif i>9 then
set w=wave.Create(GetOwningPlayer(m.u),x,y,50.,0)
set c=CreateUnit(GetOwningPlayer(m.u),'hrif',x,y,GetRandomReal(0,360))
call RemoveUnit(w.u)
set w.u=c
set c=null
//set fx=""
set i=0
if GetLocalPlayer()==GetOwningPlayer(m.u) then
// set fx="Model\\Marine.mdl"
set i=255
endif
//call w.addfx(fx,"origin")
call SetUnitVertexColor(w.u,255,255,255,i)
set w.speed=0.//522.
set w.range=0.
set w.timed=GetRandomReal(2.,4.)
set w.alpha=0
//call SetUnitScale(w.u,1.4,0,0)
//set w.tx=x+Cos(GetUnitFacing(w.u)*bj_DEGTORAD)*100
//set w.ty=y+Sin(GetUnitFacing(w.u)*bj_DEGTORAD)*100
call addmobile(w)
//call SetUnitAnimationByIndex(w.u,7)
//call SetUnitAnimation(w.u,"walk")
endif
call Preload(fx) //cojavim
set snd=CreateSound(fx,false,true,false,10,10,"")
call SetSoundPitch(snd,GetRandomReal(red,blue))
//set i=0
//if GetLocalPlayer()==GetOwningPlayer(m.u) then
set i=128
//endif
call SetSoundVolume(snd,i)
call SetSoundDistances(snd,600,10000)
call SetSoundDistanceCutoff(snd,3000)
call AttachSoundToUnit(snd,m.u)
if GetLocalPlayer()==GetOwningPlayer(m.u) then
call StartSound(snd)
endif
call KillSoundWhenDone(snd)
set snd=null
endif
endfunction
function SpellLSD takes unit u, real timed, real react, real int1, real int2 returns nothing
local Hero h=GetUnitUserData(u)
local real x=GetUnitX(u)
local real y=GetUnitY(u)
local missile m
if h==0 then
call UnitAddAbility(u,'A001')
call UnitAddAbility(u,'A00O')
endif
if h.lsd!=0 then
set h.lsd.timed=h.lsd.timed+(timed*.5)
else
call UnitAddAbility(u,'A001')
call UnitAddAbility(u,'A00O')
set m=missile.Create(GetOwningPlayer(u),x,y,GetUnitFlyHeight(u)+90,0)
set m.target=u
set m.speed=1000.
set m.range=0.
set m.timed=timed
set m.conhit=BOOLEXPR_FALSE
set m.gen=react
set m.geno=GetRandomReal(int1,int2)
set m.funcgen="SpellLSDGen"
set m.funcdeath="SpellLSDDeath"
//set m.funcimpact="SpellLSDDeath"
call addmobile(m)
set m.aux1=int1
set m.aux2=int2
set m.alpha=0
set h.lsd=m
endif
//set h.s_berserk=CreateSound("Sound\\berserk.wav",true,true,false,10,10,"")
//call SetSoundPitch(h.s_berserk,1)
//call SetSoundVolume(h.s_berserk,100)
//call SetSoundDistances(h.s_berserk,600,10000)
//call SetSoundDistanceCutoff(h.s_berserk,3000)
//call AttachSoundToUnit(h.s_berserk,u)
//call StartSound(h.s_berserk)
//call KillSoundWhenDone(h.s_berserk)
endfunction
function SpellMortarDeath takes nothing returns nothing
local mover m=placeholdmobile
local real x=GetUnitX(m.u)
local real y=GetUnitY(m.u)
local group g=CreateGroup()
local boolexpr filter
local unit c
local blur s
local real d=0
local real factor
local vector a=vector.createFrom(x,y,GetZ(x,y)+GetUnitFlyHeight(m.u))
local vector b=vector.create()
set filter=Condition(function IsAll)
call GroupEnumUnitsInRange(g,x,y,400,filter)
call DestroyBoolExpr(filter)
set filter=null
call GroupRemoveUnit(g,m.u)
loop
set c=FirstOfGroup(g)
exitwhen c==null
call GroupRemoveUnit(g,c)
set b.x=GetUnitX(c)
set b.y=GetUnitY(c)
set b.z=GetZ(GetUnitX(c),GetUnitY(c))+GetUnitFlyHeight(c)
set d=DamageArea(vector.distance(a,b),300,40)+25
set factor=1
if GetUnitAbilityLevel(c,'AId4')>0 then
set factor=.75
endif
call UnitDamageTarget(m.u,c,d*factor,false,false,ATTACK_TYPE_MAGIC,DAMAGE_TYPE_MAGIC,null)
// Blood
if not IsUnitType(c,UNIT_TYPE_MECHANICAL) then
if not IsAlive(c) then
call CreateGib(GetUnitX(c),GetUnitY(c),GetUnitFlyHeight(c),-GetUnitFacing(c),400)
call KillUnitA(c)
else
//call UnitBurn(c)
call DestroyEffect(AddSpecialEffectTarget(MODEL_BLOOD,c,"chest"))
call CreateBloodsplat(GetUnitX(c),GetUnitY(c),GetRandomReal(0.9,1.2))
call SpellDummy(GetOwningPlayer(m.u),x,y,0,'Aslo',"slow",2-GetUnitAbilityLevel(c,'AId4'),c,.5) //hit recovery
endif
endif
call CreateBeep(m.u,c)
endloop
call DestroyGroup(g)
set g=null
call a.destroy()
call b.destroy()
call EnumDestructablesInCircle(x,y,200,function TreeKill)
call EnumDestructablesInCircle(x,y,600,function TreeShake)
set s=blur.Create(RAW_DUMMY,x,y,GetUnitFlyHeight(m.u)+12,GetRandomReal(0,360),0)
set s.fadeduration=3
call s.addfx("model\\rocket.mdl","origin")
call AddSound(s.u,"Sound\\explosion_blast.mp3")
call AddSoundStereo(s.u,"sound\\explosion_L.mp3","sound\\explosion_R.mp3")
call addmobile(s)
call SetUnitScale(s.u,1.5,0,0)
call DestroyEffect(s.fx)
set s=blur.Create(RAW_DUMMY,x,y,GetUnitFlyHeight(m.u)+12,GetRandomReal(0,360),0)
call s.addfx(MODEL_EXPLO_FLARE,"origin")
call SetUnitScale(s.u,4.,0,0)
call DestroyEffect(s.fx)
call KillUnitA(m.u)
set m.terminate=true
endfunction
function SpellMortarImpact takes nothing returns nothing
local mover m=placeholdmobile
set m.terminate=true
endfunction
function SpellMortarGen takes nothing returns nothing
local missile m=placeholdmobile
local real x=m.aux1
local real y=m.aux2
local real z=m.aux3
local real a=Atan2BJ(y,x)
local real aoa
local unit c
local mover s
local real array V
local real G=1600
local integer q=IMaxBJ(0,GetTerrainCliffLevel(x,y)-GetTerrainCliffLevel(m.x,m.y))
if not IsAbleToShot(m.target) then
set m.terminate=true
return
endif
set V[2]=1500+q*100 //RANGE
set V[0]=RMaxBJ(RMinBJ(900,SquareRoot(x*x+y*y)),600) //MIN RANGE
set V[1]=SquareRoot(V[2]*G)-GetRandomReal(0,100) //Max speed
set aoa=(bj_PI/2)-(Asin(((V[0]-150+q*80)*G)/(V[1]*V[1]))/0.5)
set x=m.x
set y=m.y
set c=CreateUnit(GetOwningPlayer(m.u),RAW_DUMMY,x,y,a)
set s=mover.Create(c)
call s.addfx("model\\rocket.mdl","origin")
//set a=a*bj_DEGTORAD
set s.x=x
set s.y=y
set s.z=GetZ(x,y)+spell_z+GetRandomReal(6,27)
set a=a+GetRandomReal(-10,10)
set s.vx=Cos(aoa)*CosBJ(a)*V[1] //Cos(a)*v
set s.vy=Cos(aoa)*SinBJ(a)*V[1] //Sin(a)*v
set s.vz=Sin(aoa)*V[1] //Sin(aoa)*v
set s.G=-G*period
set s.funcimpact="SpellMortarImpact"
set s.funcdeath="SpellMortarDeath"
set s.zangle=true
call SetUnitScale(s.u,1.5,0,0)
//call SetUnitTimeScale(s.u,.1)
call SetUnitAnimationByIndex(s.u,90)
//call SetUnitVertexColor(s.u,128,64,64,255)
call UnitAddAbility(s.u,RAW_ABIL_NADEGLOW)
call addmobile(s)
set s.target=null
call AddSound(s.u,"Abilities\\Spells\\Human\\FlakCannons\\FlakCannon.wav")
//call echo("mortar shell")
set c=null
endfunction
function SpellMortar takes nothing returns nothing
local unit u=GetSpellAbilityUnit()
local location l=GetSpellTargetLoc()
local Hero h=GetUnitUserData(u)
local unit c=h.target
local real x=GetUnitX(u)
local real y=GetUnitY(u)
local real z=GetLocationZ(l)-GetZ(GetUnitX(u),GetUnitY(u))
local missile m
set m=missile.Create(GetOwningPlayer(u),x,y,GetUnitFlyHeight(u)+150,0)
set m.target=u
set m.speed=1000.
set m.range=0.
set m.timed=1.06
set m.conhit=BOOLEXPR_FALSE
set m.gen=0.
set m.geno=0.2
set m.funcgen="SpellMortarGen"
call addmobile(m)
set m.aux1=GetLocationX(l)-x
set m.aux2=GetLocationY(l)-y
set m.aux3=z
call PingIcon(GetPlayerId(GetOwningPlayer(u)),MODEL_ICON_BOMB)
call RemoveLocation(l)
set l=null
set c=null
set u=null
endfunction
function SpellMorphine takes nothing returns nothing
local unit u=GetSpellAbilityUnit()
local unit c
local Hero h//=GetUnitUserData(u)
local Hero m
local integer q=0
local real x=GetUnitX(u)
local real y=GetUnitY(u)
local group g=CreateGroup()
local boolexpr filter
set conunit=u
set filter=Condition(function IsRespawnable)
call GroupEnumUnitsInRange(g,x,y,500,filter)
call GroupRemoveUnit(g,u)
call DestroyBoolExpr(filter)
set filter=null
set c=FirstOfGroup(g)//GroupPickRandomUnit(g)
call DestroyGroup(g)
set g=null
if c!=null then
//call echo("Morphine: "+GetHeroProperName(c)+" hp: "+R2S(GetWidgetLife(c)))
set m=GetUnitUserData(c)
loop
exitwhen q==FORCES
if IsPlayerInForce(GetOwningPlayer(c),player_Force[q]) then
set game_Count[q]=game_Count[q]+1
endif
set q=q+1
endloop
set h=Hero.Create(CreateUnit(GetOwningPlayer(c),GetUnitTypeId(c),GetUnitX(c),GetUnitY(c),GetUnitFacing(c)))
set player_Cam[GetPlayerId(GetOwningPlayer(c))]=null
//set player_N=player_N+1
set player_Heroes[m.nn]=h
set player_Cam[GetPlayerId(GetOwningPlayer(c))]=h.u
set player_drug[GetPlayerId(GetOwningPlayer(c))]=player_drug[GetPlayerId(GetOwningPlayer(c))]+1000
//call DrugAilments(GetOwningPlayer(c))
call RemoveItem(UnitItemInSlot(h.u,0))
call RemoveItem(UnitItemInSlot(h.u,1))
call RemoveItem(UnitItemInSlot(h.u,2))
call UnitAddItem(h.u,UnitItemInSlot(c,0))
call UnitAddItem(h.u,UnitItemInSlot(c,1))
call UnitAddItem(h.u,UnitItemInSlot(c,2))
call UnitAddItem(h.u,UnitItemInSlot(c,3))
call UnitAddItem(h.u,UnitItemInSlot(c,4))
call UnitAddItem(h.u,UnitItemInSlot(c,5))
set h.i_weapon=UnitItemInSlot(h.u,0)//m.i_weapon
set h.i_ammo=UnitItemInSlot(h.u,1)//m.i_ammo
set h.weapon=m.weapon
set h.revived=true
call SetWidgetLife(h.u,GetUnitState(h.u,UNIT_STATE_MAX_LIFE)*.33)
call m.destroy()
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Items\\AIsm\\AIsmTarget.mdl",GetUnitX(h.u),GetUnitY(h.u)))
call UnitAddAbility(h.u,'Arll')
call UnitAddAbility(h.u,RAW_ABIL_ATTACK)
call UnitRemoveAbility(h.u,'Bvul')
call UnitAddItem(h.u,CreateItem('rres',0,0))
if GetLocalPlayer()==GetOwningPlayer(h.u) then
call ClearSelection()
call SelectUnit(h.u,true)
endif
call msg(GetOwningPlayer(h.u),STRING_NOTICE+"You have been revived!",SOUND_MSG)
call AddSound(h.u,"Sound\\drug.mp3")
call ExecuteFunc("LabelRemainingExec")
else
call msg(GetOwningPlayer(u),STRING_NOTICE+"You have to be nearer to ally corpse!",SOUND_MSG)
call UnitRemoveAbility(u,'A007')
call UnitAddAbility(u,'A007')
call TriggerSleepAction(0)
call SetUnitState(u,UNIT_STATE_MANA,GetUnitState(u,UNIT_STATE_MANA)+100)
endif
set c=null
set u=null
endfunction
function SpellSmokeDeath takes nothing returns nothing
local mover m=placeholdmobile
local real x=GetUnitX(m.u)
local real y=GetUnitY(m.u)
local blur s
local destructable d1=CreateDestructable('YTlb',x+64,y+64,0,0,0)
local destructable d2=CreateDestructable('YTlb',x-64,y+64,0,0,0)
local destructable d3=CreateDestructable('YTlb',x-64,y-64,0,0,0)
local destructable d4=CreateDestructable('YTlb',x+64,y-64,0,0,0)
set s=blur.Create('u001',x,y,0,GetRandomReal(0,360),0)
set s.timed=30
set s.fadeduration=3
call AddSound(s.u,"sound\\smoke.mp3")
call addmobile(s)
call SetUnitScale(s.u,3,0,0)
call s.addfx("Model\\Smoke.mdl","origin")
call UnitAddAbility(s.u,'ANpi')
//if mod==3 then
call UnitAddAbility(s.u,'A013')
//endif
call SetUnitOwner(s.u,GetOwningPlayer(m.u),false)
call KillUnitA(m.u)
loop
exitwhen not IsAlive(s.u)
call TriggerSleepAction(0)
endloop
call RemoveDestructable(d1)
call RemoveDestructable(d2)
call RemoveDestructable(d3)
call RemoveDestructable(d4)
set d1=null
set d2=null
set d3=null
set d4=null
endfunction
function SpellSmokeImpact takes nothing returns nothing
local mover m=placeholdmobile
local vector v
local vector v1
local vector v2
local real l
local real b=.7
set v=vector.createFrom(m.vx,m.vy,m.vz)
set v1=vector.getTerrainNormal(m.x,m.y,50)
set v2=v.project(v1)
call v2.scale(-2)
call v.add(v2)
call v.scale(b)
set m.vx=v.x
set m.vy=v.y
set m.vz=v.z
call v1.destroy()
call v2.destroy()
set l=v.lengthSquare()
if l>250 then
if not IsTerrainPathable(m.x,m.y,PATHING_TYPE_FLOATABILITY) and GetUnitFlyHeight(m.u)<30 then
call DestroyEffect(AddSpecialEffect(MODEL_WATER_SPLASH,m.x,m.y))
set m.vz=0
call AddSound(m.u,"Sound\\Step\\inwater.wav")
else
call DestroyEffect(AddSpecialEffect(MODEL_DUST_SPLASH,m.x,m.y))
call AddSound(m.u,SOUND_BOUNCE)
set m.vz=m.vz+10
endif
set m.range=92.
else
//set m.z=m.z+1
//set m.vz=m.vz+4
//set m.vertical=false
endif
call v.destroy()
endfunction
function SpellSmokeHit takes nothing returns nothing
local mover m=placeholdmobile
if IsWall(placeholdunit) and IsAnotherPlayer(placeholdunit,m.u) then
set m.x=m.x-m.vx*period
set m.y=m.y-m.vy*period
set m.vx=-m.vx*.1
set m.vy=-m.vy*.1
set m.vz=m.vz*.5
endif
set placeholdunit=null
endfunction
function SpellSmoke takes nothing returns nothing
local unit u=GetSpellAbilityUnit()
local location l=GetSpellTargetLoc()
local real x=GetLocationX(l)-GetUnitX(u)
local real y=GetLocationY(l)-GetUnitY(u)
local real a=Atan2BJ(y,x)
local real aoa
local unit c
local mover s
local real array V
local real G=1800
call RemoveLocation(l)
set l=null
set V[2]=1200 //RANGE
set V[0]=RMinBJ(V[2],SquareRoot(x*x+y*y))
set V[1]=SquareRoot(V[2]*G) //Max speed
set aoa=(bj_PI/2)-(Asin((V[0]*G)/(V[1]*V[1]))/1.2)
set x=GetUnitX(u)
set y=GetUnitY(u)
set c=CreateUnit(GetOwningPlayer(u),RAW_DUMMY,x,y,a)
set s=mover.Create(c)
call s.addfx(MODEL_ALCHEMY,"origin")
set s.x=x
set s.y=y
set s.z=GetZ(x,y)+32
set s.vx=Cos(aoa)*CosBJ(a)*V[1]
set s.vy=Cos(aoa)*SinBJ(a)*V[1]
set s.vz=Sin(aoa)*V[1]
set s.G=-G*period
set s.funcimpact="SpellNadeImpact" //SpellSmokeImpact
set s.funchit="SpellSmokeHit"
set s.funcdeath="SpellSmokeDeath"
call SetUnitScale(s.u,.5,0,0)
call SetUnitTimeScale(s.u,.1)
call SetUnitAnimationByIndex(s.u,90)
call SetUnitVertexColor(s.u,0,255,255,255)
call UnitAddAbility(s.u,RAW_ABIL_NADEGLOW)
call addmobile(s)
set s.range=32.
set s.aux1=10
set s.timed=5
call PingIcon(GetPlayerId(GetOwningPlayer(u)),MODEL_ICON_SMOKE)
set c=null
set u=null
endfunction
function SpellLSDNadeDeath takes nothing returns nothing
local mover m=placeholdmobile
local real x=GetUnitX(m.u)
local real y=GetUnitY(m.u)
local group g=CreateGroup()
local boolexpr filter
local unit c
local blur s
local real d
local ray r
local integer rspawn=9
local real rx
local real ry
local real pal
set filter=Condition(function IsAll)
call GroupEnumUnitsInRange(g,x,y,600,filter)
call DestroyBoolExpr(filter)
set filter=null
call GroupRemoveUnit(g,m.u)
loop
set c=FirstOfGroup(g)
exitwhen c==null
call GroupRemoveUnit(g,c)
//if not IsUnitType(c,UNIT_TYPE_MECHANICAL) then
if IsUnitType(c,UNIT_TYPE_HERO) then
if m.target!=c then
set d=18
else
set d=20
endif
//call SpellLSD(c,d,1,0.5,2)
call SpellLSD(c,d,1,.3,.7)
set player_drug[GetPlayerId(GetOwningPlayer(c))]=player_drug[GetPlayerId(GetOwningPlayer(c))]+R2I(d*15)
//call DrugAilments(GetOwningPlayer(c))
call CreateBeep(m.u,c)
endif
endloop
call DestroyGroup(g)
set g=null
set s=blur.Create(RAW_DUMMY,x,y,GetUnitFlyHeight(m.u)+12,GetRandomReal(0,360),0)
call s.addfx(MODEL_EXPLO_FLARE,"origin")
call SetUnitScale(s.u,6,0,0)
call DestroyEffect(s.fx)
call AddSound(s.u,SOUND_EXPLO())
call AddSound(s.u,"Abilities\\Spells\\Other\\AcidBomb\\AlchemistAcidBurnMissileDeath1.wav")
call AddSoundStereo(s.u,"sound\\explosion_L.mp3","sound\\explosion_R.mp3")
call addmobile(s)
loop
exitwhen rspawn<=0
set rx=x+GetRandomReal(-400,400)
set ry=y+GetRandomReal(-400,400)
set r=ray.Create("SPLK",x,y,m.z,rx,ry,GetZ(rx,ry)+GetRandomReal(0,300)) //"CLPB"
set r.timed=0.3
set r.fadeduration=0.25
set r.random2=175
call addmobile(r)
set pal=2.
set r.r=GetRandomReal(0,1)
set pal=pal-r.r
set r.g=GetRandomReal(0,1)
set pal=pal-r.g
set r.b=pal
call SetLightningColor(r.lx,r.r,r.g,r.b,r.a)
set rspawn=rspawn-1
endloop
call KillUnitA(m.u)
endfunction
function SpellLSDNade takes nothing returns nothing
local unit u=GetSpellAbilityUnit()
local location l=GetSpellTargetLoc()
local real x=GetLocationX(l)-GetUnitX(u)
local real y=GetLocationY(l)-GetUnitY(u)
local real a=Atan2BJ(y,x)
local real aoa
local unit c
local mover s
local real array V
local real G=1800
call RemoveLocation(l)
set l=null
set V[2]=1200 //RANGE
set V[0]=RMinBJ(V[2],SquareRoot(x*x+y*y))
set V[1]=SquareRoot(V[2]*G) //Max speed
set aoa=(bj_PI/2)-(Asin((V[0]*G)/(V[1]*V[1]))/1.2)
set x=GetUnitX(u)
set y=GetUnitY(u)
set c=CreateUnit(GetOwningPlayer(u),RAW_DUMMY,x,y,a)
set s=mover.Create(c)
call s.addfx(MODEL_ALCHEMY,"origin")
set s.x=x
set s.y=y
set s.z=GetZ(x,y)+32
set s.vx=Cos(aoa)*CosBJ(a)*V[1]
set s.vy=Cos(aoa)*SinBJ(a)*V[1]
set s.vz=Sin(aoa)*V[1]
set s.G=-G*period
set s.funcimpact="SpellNadeImpact"
set s.funchit="SpellNadeHit"
set s.funcdeath="SpellLSDNadeDeath"
call SetUnitScale(s.u,.5,0,0)
call SetUnitTimeScale(s.u,.1)
call SetUnitAnimationByIndex(s.u,90)
call SetUnitVertexColor(s.u,200,225,0,255)
call UnitAddAbility(s.u,RAW_ABIL_NADEGLOW)
call addmobile(s)
set s.range=48.
set s.aux1=10
set s.timed=3.5
set s.target=null
call PingIcon(GetPlayerId(GetOwningPlayer(u)),MODEL_ICON_LSD)
set c=null
set u=null
endfunction
function SpellNadeDeath takes nothing returns nothing
local mover m=placeholdmobile
local real x=GetUnitX(m.u)
local real y=GetUnitY(m.u)
local group g=CreateGroup()
local boolexpr filter
local unit c
local blur s
local real d=0
local vector a=vector.createFrom(x,y,GetZ(x,y)+GetUnitFlyHeight(m.u))
local vector b=vector.create()
local real factor=1
//set conunit=m.u
set filter=Condition(function IsAll)
call GroupEnumUnitsInRange(g,x,y,500,filter)
call DestroyBoolExpr(filter)
set filter=null
call GroupRemoveUnit(g,m.u)
loop
set c=FirstOfGroup(g)
exitwhen c==null
call GroupRemoveUnit(g,c)
set b.x=GetUnitX(c)
set b.y=GetUnitY(c)
set b.z=GetZ(GetUnitX(c),GetUnitY(c))+GetUnitFlyHeight(c)
if m.target!=c then
set d=DamageArea(vector.distance(a,b),500,260)
else
set d=260
endif
if GetUnitAbilityLevel(c,'AId4')>0 then
set factor=.6 //156
endif
call UnitDamageTarget(m.u,c,10+d*factor,false,false,ATTACK_TYPE_MAGIC,DAMAGE_TYPE_MAGIC,null)
// Blood
if not IsUnitType(c,UNIT_TYPE_MECHANICAL) then
if not IsAlive(c) then
call CreateGib(GetUnitX(c),GetUnitY(c),GetUnitFlyHeight(c),-GetUnitFacing(c),600)
call KillUnitA(c)
else
//call UnitBurn(c)
call DestroyEffect(AddSpecialEffectTarget(MODEL_BLOOD,c,"chest"))
call CreateBloodsplat(GetUnitX(c),GetUnitY(c),GetRandomReal(0.9,1.2))
endif
endif
call CreateBeep(m.u,c)
endloop
call DestroyGroup(g)
set g=null
call a.destroy()
call b.destroy()
call EnumDestructablesInCircle(x,y,300,function TreeKill)
call EnumDestructablesInCircle(x,y,500,function TreeShake)
set s=blur.Create(RAW_DUMMY,x,y,GetUnitFlyHeight(m.u)+12,GetRandomReal(0,360),0)
set s.fadeduration=3
if GetUnitFlyHeight(s.u)>40 then
call s.addfx(MODEL_EXPLO_AIR,"origin")
else
call s.addfx(MODEL_EXPLO_GROUND,"origin")
endif
call AddSound(s.u,SOUND_EXPLO())
call AddSoundStereo(s.u,"sound\\explosion_L.mp3","sound\\explosion_R.mp3")
//call AddSoundFogStereo(s.u,"sound\\explosion_L.mp3",true)
//call AddSoundFogStereo(s.u,"sound\\explosion_R.mp3",false)
call addmobile(s)
call SetUnitScale(s.u,2,0,0)
call DestroyEffect(s.fx)
set s=blur.Create(RAW_DUMMY,x,y,GetUnitFlyHeight(m.u)+12,GetRandomReal(0,360),0)
call s.addfx(MODEL_EXPLO_FLARE,"origin")
call SetUnitScale(s.u,5,0,0)
call DestroyEffect(s.fx)
call KillUnitA(m.u)
endfunction
function SpellNadeHit takes nothing returns nothing
local mover m=placeholdmobile
if IsWall(placeholdunit) and IsAnotherPlayer(placeholdunit,m.u) then
set m.x=m.x-m.vx*period
set m.y=m.y-m.vy*period
set m.vx=-m.vx*.1
set m.vy=-m.vy*.1
set m.vz=m.vz*.5
elseif IsUnitEnemy(placeholdunit,GetOwningPlayer(m.u)) and IsAlive(placeholdunit) then
set m.target=placeholdunit
set m.terminate=true
endif
set placeholdunit=null
endfunction
function SpellNadeImpact takes nothing returns nothing
local mover m=placeholdmobile
local vector v
local vector v1
local vector v2
local real l
local real b=.6
set v=vector.createFrom(m.vx,m.vy,m.vz)
set v1=vector.getTerrainNormal(m.x,m.y,50)
set v2=v.project(v1)
call v2.scale(-2)
call v.add(v2)
call v.scale(b)
set m.vx=v.x
set m.vy=v.y
set m.vz=v.z
//set m.x=m.x+v2.x*period*3
//set m.y=m.y+v2.y*period*3
//set m.z=m.z+v2.z*period*3
call v1.destroy()
call v2.destroy()
if m.aux1>0. then
set l=v.lengthSquare()
if l>128 then
if not IsTerrainPathable(m.x,m.y,PATHING_TYPE_FLOATABILITY) and GetUnitFlyHeight(m.u)<30 then
call DestroyEffect(AddSpecialEffect(MODEL_WATER_SPLASH,m.x,m.y))
set m.vz=0
call AddSound(m.u,"Sound\\Step\\inwater.wav")
else
call DestroyEffect(AddSpecialEffect(MODEL_DUST_SPLASH,m.x,m.y))
call AddSound(m.u,SOUND_BOUNCE)
set m.vz=m.vz+m.vz*.15
set m.z=m.z+2
endif
set m.range=92.
else
set m.vertical=false
endif
else
//set m.vx=m.vx*.8
//set m.vy=m.vy*.8
set m.vertical=false
if m.aux2>0. then
set m.horizontal=false
set m.range=m.aux2
endif
call SetUnitX(m.u,m.x)
call SetUnitY(m.u,m.y)
endif
set m.aux1=m.aux1-1
call v.destroy()
endfunction
function SpellNade takes nothing returns nothing
local unit u=GetSpellAbilityUnit()
//local integer p=GetPlayerId(GetOwningPlayer(h))
local location l=GetSpellTargetLoc()
local real x=GetLocationX(l)-GetUnitX(u)
local real y=GetLocationY(l)-GetUnitY(u)
local real a=Atan2BJ(y,x)
local real aoa
local unit c//=CreateProjectile(GetOwningPlayer(h),"Nade.mdl",GetUnitX(h),GetUnitY(h),a)
local mover s
local real array V
local real G=1800
call RemoveLocation(l)
set l=null
set V[2]=1200 //RANGE
set V[0]=RMinBJ(V[2],SquareRoot(x*x+y*y))
set V[1]=SquareRoot(V[2]*G) //Max speed
set aoa=(bj_PI/2)-(Asin((V[0]*G)/(V[1]*V[1]))/1.2)
set x=GetUnitX(u)
set y=GetUnitY(u)
set c=CreateUnit(GetOwningPlayer(u),RAW_DUMMY,x,y,a)
set s=mover.Create(c)
call s.addfx(MODEL_ALCHEMY,"origin")
//set a=a*bj_DEGTORAD
set s.x=x
set s.y=y
set s.z=GetZ(x,y)+32
set s.vx=Cos(aoa)*CosBJ(a)*V[1] //Cos(a)*v
set s.vy=Cos(aoa)*SinBJ(a)*V[1] //Sin(a)*v
set s.vz=Sin(aoa)*V[1] //Sin(aoa)*v
set s.G=-G*period
set s.funcimpact="SpellNadeImpact"
set s.funchit="SpellNadeHit"
//set s.conhit=Condition(function IsEnemy)
set s.funcdeath="SpellNadeDeath"
call SetUnitScale(s.u,.5,0,0)
call SetUnitTimeScale(s.u,.1)
call SetUnitAnimationByIndex(s.u,90)
call SetUnitVertexColor(s.u,255,64,64,255)
call UnitAddAbility(s.u,RAW_ABIL_NADEGLOW)
call addmobile(s)
set s.range=32.
set s.aux1=12
set s.timed=4
set s.target=null
call PingIcon(GetPlayerId(GetOwningPlayer(u)),MODEL_ICON_NADE)
set c=null
set u=null
endfunction
function SpellStickyDeath takes nothing returns nothing
local mover m=placeholdmobile
local real x=GetUnitX(m.u)
local real y=GetUnitY(m.u)
local group g=CreateGroup()
local boolexpr filter
local unit c
local blur s
local real d=0
local vector a=vector.createFrom(x,y,GetZ(x,y)+GetUnitFlyHeight(m.u))
local vector b=vector.create()
local real factor=1
local missile n
local integer i=20
set filter=Condition(function IsAll)
call GroupEnumUnitsInRange(g,x,y,300,filter)
call DestroyBoolExpr(filter)
set filter=null
call GroupRemoveUnit(g,m.u)
loop
set c=FirstOfGroup(g)
exitwhen c==null
call GroupRemoveUnit(g,c)
set b.x=GetUnitX(c)
set b.y=GetUnitY(c)
set b.z=GetZ(GetUnitX(c),GetUnitY(c))+GetUnitFlyHeight(c)
if m.target!=c then
set d=DamageArea(vector.distance(a,b),300,80)
else
set d=150
endif
if GetUnitAbilityLevel(c,'AId4')>0 then
set factor=.6 //48
endif
call UnitDamageTarget(m.u,c,d*factor,false,false,ATTACK_TYPE_MAGIC,DAMAGE_TYPE_MAGIC,null)
// Blood
if not IsUnitType(c,UNIT_TYPE_MECHANICAL) then
if not IsAlive(c) then
call CreateGib(GetUnitX(c),GetUnitY(c),GetUnitFlyHeight(c),-GetUnitFacing(c),d*4)
call KillUnitA(c)
else
call DestroyEffect(AddSpecialEffectTarget(MODEL_BLOOD,c,"chest"))
call CreateBloodsplat(GetUnitX(c),GetUnitY(c),GetRandomReal(0.9,1.2))
endif
endif
call CreateBeep(m.u,c)
endloop
call DestroyGroup(g)
set g=null
call a.destroy()
call b.destroy()
call EnumDestructablesInCircle(x,y,64,function TreeKill)
call EnumDestructablesInCircle(x,y,350,function TreeShake)
set s=blur.Create(RAW_DUMMY,x,y,GetUnitFlyHeight(m.u)+12,GetRandomReal(0,360),0)
set s.fadeduration=3
if GetUnitFlyHeight(s.u)>40 then
call s.addfx(MODEL_EXPLO_AIR,"origin")
else
call s.addfx(MODEL_EXPLO_GROUND,"origin")
endif
call AddSound(s.u,SOUND_EXPLO())
call AddSoundStereo(s.u,"sound\\explosion_L.mp3","sound\\explosion_R.mp3")
//call AddSoundFogStereo(s.u,"sound\\explosion_L.mp3",true)
//call AddSoundFogStereo(s.u,"sound\\explosion_R.mp3",false)
call addmobile(s)
call SetUnitScale(s.u,1,0,0)
call DestroyEffect(s.fx)
set s=blur.Create(RAW_DUMMY,x,y,GetUnitFlyHeight(m.u)+12,GetRandomReal(0,360),0)
call s.addfx(MODEL_EXPLO_FLARE,"origin")
call SetUnitScale(s.u,3,0,0)
call DestroyEffect(s.fx)
set d=i
loop
exitwhen i<=0
set factor=(360/d)*i
set n=missile.Create(GetOwningPlayer(m.u),x,y,GetUnitFlyHeight(m.u)+spell_z,factor)
set n.speed=1800.
set n.range=92.
set n.timed=.6
set n.G=GetRandomReal(.01,.05)
//set n.conhit=Condition(function IsAll)
set n.funchit="SpellGunnerHit"
set n.funcimpact="SpellRifleImpact"
call addmobile(n)
set n.aux1=150
if mod==3 then
set n.aux1=200
endif
set n.aux4=0
set n.aux2=1
set n.aux3=1
call SetUnitScale(n.u,.5,0,0)
call n.addfx(MODEL_BULLET,"origin")
call GroupAddUnit(n.g,m.target)
set i=i-1
endloop
call KillUnitA(m.u)
endfunction
function SpellStickyHit takes nothing returns nothing
local mover m=placeholdmobile
local boolean b=IsUnitEnemy(placeholdunit,GetOwningPlayer(m.u)) and GetOwningPlayer(placeholdunit)!=Player(11)
local boolean b2=GetUnitTypeId(placeholdunit)!='h004'
if b2 and ((IsAlive(placeholdunit) and b) or (IsAlive(placeholdunit) and m.aux3==0 and m.timed<8.5 and not b)) then
set m.target=placeholdunit
call GroupAddUnit(m.g,m.target)
if m.aux3==0. then
set m.range=200.
set m.timed=8.
set m.gen=0.
set m.geno=period*2
set m.vx=0
set m.vy=0
set m.vz=0
set m.horizontal=false
set m.vertical=false
//set m.funcimpact="DoNothing"
call SetUnitScale(m.u,4.,0,0)
//call UnitRemoveAbility(m.u,RAW_ABIL_NADEGLOW)
set m.aux3=1.
endif
if b then
set m.range=0.
set m.funchit="DoNothing"
endif
call AddSound(m.u,"sound\\sticky.mp3")
endif
set placeholdunit=null
endfunction
function SpellStickyGen takes nothing returns nothing
local mover m=placeholdmobile
local unit u=m.target
call SetUnitX(m.u,GetUnitX(u))
call SetUnitY(m.u,GetUnitY(u))
call SetUnitFlyHeight(m.u,40+GetUnitFlyHeight(u),0)
if m.timed<3 then
if m.aux3==1. then
call SetUnitVertexColor(m.u,64,64,255,255)
set m.aux3=2.
else
call SetUnitVertexColor(m.u,255,0,0,255)
set m.aux3=1.
endif
endif
set u=null
endfunction
function SpellSticky takes nothing returns nothing
local unit u=GetSpellAbilityUnit()
local location l=GetSpellTargetLoc()
local real x=GetLocationX(l)-GetUnitX(u)
local real y=GetLocationY(l)-GetUnitY(u)
local real a=Atan2BJ(y,x)
local real aoa
local unit c
local mover s
local real array V
local real G=2000
call RemoveLocation(l)
set l=null
set V[2]=1250 //RANGE
set V[0]=RMinBJ(V[2],SquareRoot(x*x+y*y))
set V[1]=SquareRoot(V[2]*G) //Max speed
set aoa=(bj_PI/2)-(Asin((V[0]*G)/(V[1]*V[1]))/1.2)
set x=GetUnitX(u)
set y=GetUnitY(u)
set c=CreateUnit(GetOwningPlayer(u),RAW_DUMMY,x,y,a)
set s=mover.Create(c)
call s.addfx("Abilities\\Weapons\\MakuraMissile\\MakuraMissile.mdl","origin")
set s.x=x
set s.y=y
set s.z=GetZ(x,y)+32
set s.vx=Cos(aoa)*CosBJ(a)*V[1] //Cos(a)*v
set s.vy=Cos(aoa)*SinBJ(a)*V[1] //Sin(a)*v
set s.vz=Sin(aoa)*V[1] //Sin(aoa)*v
set s.G=-G*period
set s.funcimpact="SpellNadeImpact"
set s.funchit="SpellStickyHit"
set s.funcdeath="SpellStickyDeath"
set s.funcgen="SpellStickyGen"
call SetUnitScale(s.u,2,0,0)
call SetUnitTimeScale(s.u,.1)
call SetUnitAnimationByIndex(s.u,90)
call SetUnitVertexColor(s.u,64,64,255,255)
call UnitAddAbility(s.u,RAW_ABIL_NADEGLOW)
call addmobile(s)
set s.range=32.
set s.aux2=164. //range after landing
set s.aux1=0.
set s.aux3=0.
set s.timed=10
set s.target=null
call PingIcon(GetPlayerId(GetOwningPlayer(u)),MODEL_ICON_STICKY)
set c=null
set u=null
endfunction
function SpellFindAmmo takes unit u returns boolean
local integer i=0
local integer id=0
local integer lvl=GetItemLevel(UnitItemInSlot(u,0))
loop
set id=GetItemTypeId(UnitItemInSlot(u,i))
if id=='I004' or id=='I005' or id=='I009' or id=='I00A' or id=='I00B' then
if GetItemLevel(UnitItemInSlot(u,i))==lvl then
call UnitUseItem(u,UnitItemInSlot(u,i))
set i=6
endif
endif
set i=i+1
exitwhen i>5
endloop
return i==7
endfunction
function SpellSniperHit takes nothing returns nothing
local missile m=placeholdmobile
local unit picked=placeholdunit
local real dmg=0
local real factor=1.
local blur s
if IsUnitEnemy(picked,GetOwningPlayer(m.u)) and IsAlive(picked) then
call GroupAddUnit(m.g,picked)
//if IsAnotherPlayer(m.u,picked) then
if GetUnitAbilityLevel(picked,'AId4')>0 then
set s=blur.Create(RAW_DUMMY,m.x,m.y,GetUnitFlyHeight(m.u)+GetRandomReal(0,30),GetRandomReal(0,360),0)
call s.addfx(MODEL_HIT,"origin")
call DestroyEffect(s.fx)
call addmobile(s)
call AddSound(picked,SOUND_METAL_IMPACT())
endif
if(IsUnitType(picked,UNIT_TYPE_MECHANICAL) or mod==3)then
set dmg=400
else
set dmg=GetUnitState(picked,UNIT_STATE_MAX_LIFE)*m.aux3
endif
if GetUnitAbilityLevel(picked,'AId4')>0 then
set factor=.5
endif
call UnitDamageTarget(m.u,picked,dmg*factor*m.aux1,false,false,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_NORMAL,null)
set m.aux1=.5
// Blood
if not IsUnitType(picked,UNIT_TYPE_MECHANICAL) then
if not IsAlive(picked) then
call CreateBloodsplat(GetUnitX(picked),GetUnitY(picked),GetRandomReal(1.4,1.7))
else
call DestroyEffect(AddSpecialEffectTarget(MODEL_BLOOD,picked,"chest"))
call CreateBloodsplat(GetUnitX(picked)+GetRandomReal(-25,25),GetUnitY(picked)+GetRandomReal(-25,25),GetRandomReal(.5,1))
call AddSound(picked,SOUND_HIT_FLESH)
call SpellDummy(GetOwningPlayer(m.u),m.x,m.y,0,'Aslo',"slow",1,picked,.5) //hit recovery
endif
else
if m.aux2==1 then
set s=blur.Create(RAW_DUMMY,m.x,m.y,GetUnitFlyHeight(m.u)+GetRandomReal(0,30),GetRandomReal(0,360),0)
if GetUnitTypeId(picked)==RAW_WALL_WOODEN then
call s.addfx(MODEL_HITW,"origin")
else
call s.addfx(MODEL_HIT,"origin")
endif
call DestroyEffect(s.fx)
call addmobile(s)
set m.aux2=0
endif
if GetUnitTypeId(picked)==RAW_WALL_WOODEN then
call AddSound(picked,SOUND_HIT_WOOD)
else
call AddSound(picked,SOUND_METAL_IMPACT())
endif
endif
call IsShield(m.u,picked)
call CreateBeep(m.u,picked)
//endif
//set m.alpha=0
//set m.terminate=true
endif
set picked=null
set placeholdunit=null
//set placeholdmobile=0
endfunction
function SpellSniperGen takes nothing returns nothing
local missile m=placeholdmobile
set m.aux3=.8
set m.funcgen="DoNothing"
set m.gen=-1.
set m.geno=-1.
//call echo("sniper bullet stronger now")
endfunction
function SpellSniper takes nothing returns nothing
local unit u=GetSpellAbilityUnit()
local location l=GetSpellTargetLoc()
local Hero h=GetUnitUserData(u)
local real x=GetLocationX(l)-GetUnitX(u)
local real y=GetLocationY(l)-GetUnitY(u)
local real z=GetLocationZ(l)-GetZ(GetUnitX(u),GetUnitY(u))
local missile s
local real a=Atan2BJ(y,x)// + GetRandomReal(-5,5)
local real aoa=Atan2(z,SquareRoot(x*x+y*y)) +.05 // + GetRandomReal(-.02,.05)
if GetItemTypeId(h.i_ammo)=='I009' then
set s=missile.Create(GetOwningPlayer(u),GetUnitX(u),GetUnitY(u),GetUnitFlyHeight(u)+spell_z+2,a)
call s.addfx(MODEL_BULLET,"origin")
set s.speed=1500.
set s.range=90.
set s.timed=1.8
set s.G=aoa
set s.funchit="SpellSniperHit"
set s.funcimpact="SpellRifleImpact"
set s.gen=.4
set s.funcgen="SpellSniperGen"
call addmobile(s)
call SetUnitScale(s.u,.5,0,0)
set s.aux1=1.
set s.aux2=1.0
set s.aux3=.33
//set s.aux4=GetItemTypeId(h.i_ammo)
call SetItemCharges(h.i_ammo,GetItemCharges(h.i_ammo)-1)
if GetItemCharges(h.i_ammo)==0 then
call RemoveItem(h.i_ammo)
endif
//if s.aux4=='I005' then
// call SetUnitVertexColor(s.u,255,32,0,255)
//endif
call DestroyEffect(AddSpecialEffectTarget("Model\\MuzzleFlash.mdl",u,"weapon")) //"hand left"
call AddSound(s.u,SOUND_GUN)
call AddSoundFog(s.u,SOUND_GUN)
endif
call RemoveLocation(l)
set l=null
set u=null
endfunction
function SpellPistol takes nothing returns nothing
local unit u=GetSpellAbilityUnit()
local location l=GetSpellTargetLoc()
local Hero h=GetUnitUserData(u)
local real x=GetLocationX(l)-GetUnitX(u)
local real y=GetLocationY(l)-GetUnitY(u)
local real z=GetLocationZ(l)-GetZ(GetUnitX(u),GetUnitY(u))
local missile s
local real a=Atan2BJ(y,x) + GetRandomInt(-1,1)*3.
local real aoa=Atan2(z,SquareRoot(x*x+y*y)) +.05 // + GetRandomReal(-.02,.05)
if GetItemTypeId(h.i_ammo)=='I009' then
set s=missile.Create(GetOwningPlayer(u),GetUnitX(u),GetUnitY(u),GetUnitFlyHeight(u)+spell_z+2,a)
call s.addfx(MODEL_BULLET,"origin")
set s.speed=1250.
set s.range=64.
set s.timed=1.2
set s.G=aoa
set s.funchit="SpellRifleHit"
set s.funcimpact="SpellRifleImpact"
call addmobile(s)
call SetUnitScale(s.u,.3,0,0)
set s.aux1=115
call SetItemCharges(h.i_ammo,GetItemCharges(h.i_ammo)-1)
if GetItemCharges(h.i_ammo)==0 then
call RemoveItem(h.i_ammo)
endif
//call DestroyEffect(AddSpecialEffectTarget("Model\\MuzzleFlash.mdl",u,"weapon")) //"hand left"
call AddSound(s.u,"sound\\silencer.mp3")
//call AddSoundFog(s.u,SOUND_GUN)
endif
call RemoveLocation(l)
set l=null
set u=null
endfunction
//=================================================================================================
//##Weapon Assault Rifle##
//=================================================================================================
//function WeaponReloadTimed takes nothing returns nothing
//GetExpiredTimer()
// local Hero h
//endfunction
//function WeaponReload takes integer h, real timed returns nothing
// call TimerStart(h.reload,timed,false,function WeaponReloadTimed)
//endfunction
function SpellRifleImpact takes nothing returns nothing
local missile m=placeholdmobile
local boolean b=true
local blur s
if not IsTerrainPathable(m.x,m.y,PATHING_TYPE_FLOATABILITY) then
if m.z<=GetZ(m.x,m.y) then
call DestroyEffect(AddSpecialEffect(MODEL_WATER_SPLASH,m.x,m.y))
set b=false
call AddSound(m.u,"Sound\\Step\\inwater.wav")
endif
endif
if b then
call AddSound(m.u,SOUND_IMPACT())
// Phosphorous
if m.aux2==9 then
set s=blur.Create(RAW_DUMMY,m.x+GetRandomReal(-30,30),m.y+GetRandomReal(-30,30),GetUnitFlyHeight(m.u)+GetRandomReal(0,30),GetRandomReal(0,360),0)
set s.fadeduration=2
call s.addfx("Abilities\\Weapons\\FireBallMissile\\FireBallMissile.mdl","origin")
call DestroyEffect(s.fx)
call addmobile(s)
call SetUnitScale(s.u,.5,0,0)
else
call DestroyEffect(AddSpecialEffect(MODEL_DUST_IMPACT,m.x,m.y))
endif
endif
set m.target=null
set m.alpha=0
set m.terminate=true
endfunction
function SpellRifleHit takes nothing returns nothing
local missile m=placeholdmobile
local unit picked=placeholdunit
local real factor=1.
local blur s
if IsUnitEnemy(picked,GetOwningPlayer(m.u)) and IsAlive(picked) then
call GroupAddUnit(m.g,picked)
//if IsAnotherPlayer(m.u,picked) then
if GetUnitAbilityLevel(picked,'AId4')>0 then
set s=blur.Create(RAW_DUMMY,m.x,m.y,GetUnitFlyHeight(m.u)+GetRandomReal(0,30),GetRandomReal(0,360),0)
if m.aux4=='I005' then
call s.addfx(MODEL_HIT2,"origin")
else
call s.addfx(MODEL_HIT,"origin")
endif
call DestroyEffect(s.fx)
call addmobile(s)
call AddSound(picked,SOUND_METAL_IMPACT())
endif
if GetUnitAbilityLevel(picked,'AId4')>0 and m.aux4!='I005' then
set factor=.5
endif
if GetUnitAbilityLevel(picked,'AId4')==0 and m.aux4=='I005' and not IsUnitType(picked,UNIT_TYPE_MECHANICAL) then
set factor=.5
endif
// Phosphorous
if m.aux2==9 then
call UnitBurn(m.u,picked)
set factor=1.5
set s=blur.Create(RAW_DUMMY,m.x+GetRandomReal(-30,30),m.y+GetRandomReal(-30,30),GetUnitFlyHeight(m.u)+GetRandomReal(0,30),GetRandomReal(0,360),0)
set s.fadeduration=2
call s.addfx("Abilities\\Weapons\\FireBallMissile\\FireBallMissile.mdl","origin")
call DestroyEffect(s.fx)
call addmobile(s)
call SetUnitScale(s.u,.3,0,0)
if GetUnitTypeId(picked)=='hwtw' then
set factor=30
endif
//call EnumDestructablesInCircle(x,y,300,function TreeKill)
call EnumDestructablesInCircle(m.x,m.y,128,function TreeShake)
endif
call UnitDamageTarget(m.u,picked,m.aux1*factor,false,false,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_NORMAL,null)
// Blood
if not IsUnitType(picked,UNIT_TYPE_MECHANICAL) then
if not IsAlive(picked) then
call CreateBloodsplat(GetUnitX(picked),GetUnitY(picked),GetRandomReal(1.2,1.5))
else
call DestroyEffect(AddSpecialEffectTarget(MODEL_BLOOD,picked,"chest"))
call CreateBloodsplat(GetUnitX(picked)+GetRandomReal(-25,25),GetUnitY(picked)+GetRandomReal(-25,25),GetRandomReal(.5,1))
call AddSound(picked,SOUND_HIT_FLESH)
call SpellDummy(GetOwningPlayer(m.u),m.x,m.y,0,'Aslo',"slow",1,picked,.5) //hit recovery
endif
else
set s=blur.Create(RAW_DUMMY,m.x,m.y,GetUnitFlyHeight(m.u)+GetRandomReal(0,30),GetRandomReal(0,360),0)
if GetUnitTypeId(picked)==RAW_WALL_WOODEN then
call AddSound(picked,SOUND_HIT_WOOD)
call s.addfx(MODEL_HITW,"origin")
else
call AddSound(picked,SOUND_METAL_IMPACT())
if m.aux4=='I005' then
call s.addfx(MODEL_HIT2,"origin")
else
call s.addfx(MODEL_HIT,"origin")
endif
endif
call DestroyEffect(s.fx)
call addmobile(s)
endif
if not IsShield(m.u,picked) then
set m.alpha=0
set m.terminate=true
endif
call CreateBeep(m.u,picked)
endif
set picked=null
set placeholdunit=null
//set placeholdmobile=0
endfunction
function SpellRifleGen takes nothing returns nothing
local missile m=placeholdmobile
local missile s
local real x=m.aux1
local real y=m.aux2
local real z=m.aux3
local real a=Atan2BJ(y,x) + GetRandomReal(-5,5)
local real aoa=Atan2(z,SquareRoot(x*x+y*y)) + GetRandomReal(.01,.06)
if not IsAbleToShot(m.target) then
set m.terminate=true
return
endif
set s=missile.Create(GetOwningPlayer(m.u),m.x,m.y,GetUnitFlyHeight(m.u)+spell_z,a)
set s.speed=1250.
set s.range=64.
set s.timed=2.
set s.G=aoa
set s.conhit=Condition(function IsEnemy)
set s.funchit="SpellRifleHit"
set s.funcimpact="SpellRifleImpact"
call addmobile(s)
set s.aux1=75
set s.aux4=m.aux4
if GetUnitAbilityLevel(m.u,'A00S')>0 then
call SetUnitScale(s.u,.5,0,0)
set s.aux2=9
call s.addfx("Abilities\\Weapons\\LavaSpawnMissile\\LavaSpawnMissile.mdl","origin")
else
call SetUnitScale(s.u,.3,0,0)
set s.aux2=0
if m.aux4=='I005' then
call s.addfx(MODEL_BULLET2,"origin")
//call SetUnitVertexColor(s.u,255,32,0,255)
else
call s.addfx(MODEL_BULLET,"origin")
endif
endif
call DestroyEffect(AddSpecialEffectTarget("Model\\MuzzleFlash.mdl",m.target,"weapon"))
call AddSound(s.u,"Sound\\machinegun.wav")
call AddSoundFog(s.u,"Sound\\machinegun_.mp3")
endfunction
function SpellRifle takes nothing returns nothing
local unit u=GetSpellAbilityUnit()
local location l=GetSpellTargetLoc()
local Hero h=GetUnitUserData(u)
local unit c=h.target
local real x=GetUnitX(u)
local real y=GetUnitY(u)
local real z=GetLocationZ(l)-GetZ(GetUnitX(u),GetUnitY(u))
local missile m
if GetItemTypeId(h.i_ammo)=='I004' or GetItemTypeId(h.i_ammo)=='I005' then
set m=missile.Create(GetOwningPlayer(u),x,y,GetUnitFlyHeight(u),0)
set m.target=u
set m.speed=1000.
set m.range=0.
set m.timed=0.6
set m.conhit=BOOLEXPR_FALSE
set m.gen=0.
set m.geno=0.1
set m.funcgen="SpellRifleGen"
call addmobile(m)
set m.aux1=GetLocationX(l)-x
set m.aux2=GetLocationY(l)-y
set m.aux3=z
if GetUnitAbilityLevel(u,'A00S')>0 then
call UnitAddAbility(m.u,'A00S')
call UnitRemoveAbility(u,'A00S') //ability
call UnitRemoveAbility(u,'B001') //buff
endif
set m.aux4=GetItemTypeId(h.i_ammo)
call SetItemCharges(h.i_ammo,GetItemCharges(h.i_ammo)-1)
if GetItemCharges(h.i_ammo)==0 then
call RemoveItem(h.i_ammo)
endif
endif
call RemoveLocation(l)
set l=null
set c=null
set u=null
endfunction
function SpellSMGGen takes nothing returns nothing
local missile m=placeholdmobile
local missile s
local real x=m.aux1
local real y=m.aux2
local real z=m.aux3
local real a=Atan2BJ(y,x) + GetRandomReal(-9,9)
local real aoa=Atan2(z,SquareRoot(x*x+y*y)) + GetRandomReal(.02,.07)
if not IsAbleToShot(m.target) then
set m.terminate=true
return
endif
set s=missile.Create(GetOwningPlayer(m.u),m.x,m.y,GetUnitFlyHeight(m.u)+spell_z,a)
set s.speed=1250.
set s.range=65.
set s.timed=1.33
set s.G=aoa
set s.conhit=Condition(function IsEnemy)
set s.funchit="SpellRifleHit"
set s.funcimpact="SpellRifleImpact"
call addmobile(s)
call SetUnitScale(s.u,.3,0,0)
set s.aux1=48
//set s.aux2=0
set s.aux4=m.aux4
if m.aux4=='I005' then
call s.addfx(MODEL_BULLET2,"origin")
else
call s.addfx(MODEL_BULLET,"origin")
endif
call DestroyEffect(AddSpecialEffectTarget("Model\\MuzzleFlash.mdl",m.target,"weapon"))
call AddSound(s.u,"Sound\\machinegun.wav")
call AddSoundFog(s.u,"Sound\\machinegun_.mp3")
endfunction
function SpellSMG takes nothing returns nothing
local unit u=GetSpellAbilityUnit()
local location l=GetSpellTargetLoc()
local Hero h=GetUnitUserData(u)
local unit c=h.target
local real x=GetUnitX(u)
local real y=GetUnitY(u)
local real z=GetLocationZ(l)-GetZ(GetUnitX(u),GetUnitY(u))
local missile m
if GetItemTypeId(h.i_ammo)=='I004' or GetItemTypeId(h.i_ammo)=='I005' then
set m=missile.Create(GetOwningPlayer(u),x,y,GetUnitFlyHeight(u),0)
set m.target=u
set m.speed=1000.
set m.range=0.
set m.timed=0.45
set m.conhit=BOOLEXPR_FALSE
set m.gen=0.
set m.geno=0.05
set m.funcgen="SpellSMGGen"
call addmobile(m)
set m.aux1=GetLocationX(l)-x
set m.aux2=GetLocationY(l)-y
set m.aux3=z
set m.aux4=GetItemTypeId(h.i_ammo)
call SetItemCharges(h.i_ammo,GetItemCharges(h.i_ammo)-1)
if GetItemCharges(h.i_ammo)==0 then
call RemoveItem(h.i_ammo)
endif
endif
call RemoveLocation(l)
set l=null
set c=null
set u=null
endfunction
function SpellGunnerHit takes nothing returns nothing
local missile m=placeholdmobile
local unit picked=placeholdunit
local real factor=1.
local blur s
local boolean b
if m.aux3==1 then
set b=true
else
set b=IsUnitEnemy(picked,GetOwningPlayer(m.u))
endif
if b and IsAlive(picked) then
call GroupAddUnit(m.g,picked)
//if IsAnotherPlayer(m.u,picked) then
if GetUnitAbilityLevel(picked,'AId4')>0 then
set s=blur.Create(RAW_DUMMY,m.x,m.y,GetUnitFlyHeight(m.u)+GetRandomReal(0,30),GetRandomReal(0,360),0)
if m.aux4=='I005' then
call s.addfx(MODEL_HIT2,"origin")
else
call s.addfx(MODEL_HIT,"origin")
endif
call DestroyEffect(s.fx)
call addmobile(s)
call AddSound(picked,SOUND_METAL_IMPACT())
endif
if GetUnitAbilityLevel(picked,'AId4')>0 and m.aux4!='I005' then
set factor=.5
endif
if GetUnitAbilityLevel(picked,'AId4')==0 and m.aux4=='I005' and not IsUnitType(picked,UNIT_TYPE_MECHANICAL) then
set factor=.5
endif
call UnitDamageTarget(m.u,picked,m.aux1*factor,false,false,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_NORMAL,null)
set m.aux1=25
// Blood
if not IsUnitType(picked,UNIT_TYPE_MECHANICAL) then
if not IsAlive(picked) then
call CreateBloodsplat(GetUnitX(picked),GetUnitY(picked),GetRandomReal(1.2,1.5))
else
call DestroyEffect(AddSpecialEffectTarget(MODEL_BLOOD,picked,"chest"))
call CreateBloodsplat(GetUnitX(picked)+GetRandomReal(-25,25),GetUnitY(picked)+GetRandomReal(-25,25),GetRandomReal(.5,1))
call AddSound(picked,SOUND_HIT_FLESH)
call SpellDummy(GetOwningPlayer(m.u),m.x,m.y,0,'Aslo',"slow",1,picked,.5) //hit recovery
endif
else
if m.aux2==1 then
set s=blur.Create(RAW_DUMMY,m.x,m.y,GetUnitFlyHeight(m.u)+GetRandomReal(0,30),GetRandomReal(0,360),0)
if GetUnitTypeId(picked)==RAW_WALL_WOODEN then
call s.addfx(MODEL_HITW,"origin")
else
if m.aux4=='I005' then
call s.addfx(MODEL_HIT2,"origin")
else
call s.addfx(MODEL_HIT,"origin")
endif
endif
call DestroyEffect(s.fx)
call addmobile(s)
set m.aux2=0
endif
if GetUnitTypeId(picked)==RAW_WALL_WOODEN then
call AddSound(picked,SOUND_HIT_WOOD)
else
call AddSound(picked,SOUND_METAL_IMPACT())
endif
endif
call IsShield(m.u,picked)
call CreateBeep(m.u,picked)
//endif
//set m.alpha=0
//set m.terminate=true
endif
set picked=null
set placeholdunit=null
//set placeholdmobile=0
endfunction
function SpellGunnerGen takes nothing returns nothing
local missile m=placeholdmobile
local missile s
local real x=m.aux1
local real y=m.aux2
local real z=m.aux3
local real a=Atan2BJ(y,x) + GetRandomReal(-9,9)
local real aoa=Atan2(z,SquareRoot(x*x+y*y)) + GetRandomReal(-.01,.06)
if not IsAbleToShot(m.target) then
set m.terminate=true
return
endif
set s=missile.Create(GetOwningPlayer(m.u),m.x,m.y,GetUnitFlyHeight(m.u)+spell_z,a)
set s.speed=1250.
set s.range=64.
set s.timed=2.2
set s.G=aoa
set s.conhit=Condition(function IsEnemy)
set s.funchit="SpellGunnerHit"
set s.funcimpact="SpellRifleImpact"
call addmobile(s)
set s.aux1=30
set s.aux2=1
call SetUnitScale(s.u,.3,0,0)
set s.aux4=m.aux4
if m.aux4=='I005' then
call s.addfx(MODEL_BULLET2,"origin")
else
call s.addfx(MODEL_BULLET,"origin")
endif
call DestroyEffect(AddSpecialEffectTarget("Model\\MuzzleFlash.mdl",m.target,"weapon"))
call AddSound(s.u,"Sound\\turret.mp3")
call AddSoundFog(s.u,"Sound\\machinegun_.mp3")
endfunction
function SpellGunner takes nothing returns nothing
local unit u=GetSpellAbilityUnit()
local location l=GetSpellTargetLoc()
local Hero h=GetUnitUserData(u)
//local unit c=h.target
local real x=GetUnitX(u)
local real y=GetUnitY(u)
local real z=GetLocationZ(l)-GetZ(GetUnitX(u),GetUnitY(u))
local missile m
if GetItemTypeId(h.i_ammo)=='I004' or GetItemTypeId(h.i_ammo)=='I005' then
set m=missile.Create(GetOwningPlayer(u),x,y,GetUnitFlyHeight(u),0)
set m.target=u
set m.speed=1000.
set m.range=0.
set m.timed=2
set m.conhit=BOOLEXPR_FALSE
set m.gen=0.
set m.geno=0.1
set m.funcgen="SpellGunnerGen"
call addmobile(m)
set m.aux1=GetLocationX(l)-x
set m.aux2=GetLocationY(l)-y
set m.aux3=z
set m.aux4=GetItemTypeId(h.i_ammo)
call SetItemCharges(h.i_ammo,GetItemCharges(h.i_ammo)-1)
if GetItemCharges(h.i_ammo)==0 then
call RemoveItem(h.i_ammo)
endif
endif
call RemoveLocation(l)
set l=null
//set c=null
set u=null
endfunction
function SpellTurretHit takes nothing returns nothing
local missile m=placeholdmobile
local unit picked=placeholdunit
local real factor=1.
local blur s
if IsUnitEnemy(picked,GetOwningPlayer(m.u)) and IsAlive(picked) then
call GroupAddUnit(m.g,picked)
//if IsAnotherPlayer(m.u,picked) then
if GetUnitAbilityLevel(picked,'AId4')>0 then
set s=blur.Create(RAW_DUMMY,m.x,m.y,GetUnitFlyHeight(m.u)+GetRandomReal(0,30),GetRandomReal(0,360),0)
call s.addfx(MODEL_HIT,"origin")
call DestroyEffect(s.fx)
call addmobile(s)
call AddSound(picked,SOUND_METAL_IMPACT())
endif
if GetUnitAbilityLevel(picked,'AId4')>0 then
set factor=.5
endif
call UnitDamageTarget(m.u,picked,m.aux1*factor,false,false,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_NORMAL,null)
if m.aux1>10 then
set m.aux1=m.aux1-10
endif
// Blood
if not IsUnitType(picked,UNIT_TYPE_MECHANICAL) then
if not IsAlive(picked) then
call CreateBloodsplat(GetUnitX(picked),GetUnitY(picked),GetRandomReal(1.2,1.5))
else
call DestroyEffect(AddSpecialEffectTarget(MODEL_BLOOD,picked,"chest"))
call CreateBloodsplat(GetUnitX(picked)+GetRandomReal(-25,25),GetUnitY(picked)+GetRandomReal(-25,25),GetRandomReal(.5,1))
call AddSound(picked,SOUND_HIT_FLESH)
call SpellDummy(GetOwningPlayer(m.u),m.x,m.y,0,'Aslo',"slow",1,picked,.5) //hit recovery
if GetWidgetLife(picked)<100. then
call UnitResetCooldown(m.target2)
call IssueTargetOrder(m.target2,"faeriefire",picked) //because blizz bugged this
endif
endif
else
if m.aux2==1 then
set s=blur.Create(RAW_DUMMY,m.x,m.y,GetUnitFlyHeight(m.u)+GetRandomReal(0,30),GetRandomReal(0,360),0)
if GetUnitTypeId(picked)==RAW_WALL_WOODEN then
call s.addfx(MODEL_HITW,"origin")
else
call s.addfx(MODEL_HIT,"origin")
endif
call DestroyEffect(s.fx)
call addmobile(s)
set m.aux2=0
endif
if GetUnitTypeId(picked)==RAW_WALL_WOODEN then
call AddSound(picked,SOUND_HIT_WOOD)
else
call AddSound(picked,SOUND_METAL_IMPACT())
endif
endif
//endif
//set m.alpha=0
//set m.terminate=true
call IsShield(m.u,picked)
endif
//if GetUnitTypeId(picked)=='h004' then
//U_Odraz = 2*(U_Ciel + premenna + 90 ) - U_Strelec
//call SetUnitFacing(m.u,2*(GetUnitFacing(picked)+180)-GetUnitFacing(m.u))
//set m.a=2*(GetUnitFacing(picked)+90)-GetUnitFacing(m.u)
//set m.speed=m.speed*.1
//set m.timed=m.timed*10
//set m.speed=-m.speed
//endif
set picked=null
set placeholdunit=null
//set placeholdmobile=0
endfunction
function SpellTurretCalc takes unit u returns real
local Hero h=GetUnitUserData(u)
local real z=GetRandomReal(.05,.2)
if h>0 then
if h.foot.moving then
set turret_x=GetUnitMoveSpeed(u)*z*CosBJ(GetUnitFacing(u))
set turret_y=GetUnitMoveSpeed(u)*z*SinBJ(GetUnitFacing(u))
endif
endif
return .0
endfunction
function SpellTurretGen takes nothing returns nothing
local missile m=placeholdmobile
local missile s
local real x=SpellTurretCalc(m.target2)+(turret_x+GetUnitX(m.target2))-m.x
local real y=(turret_y+GetUnitY(m.target2))-m.y
local real z=GetZ(GetUnitX(m.target2),GetUnitY(m.target2))-GetZ(m.x,m.y)
local real a=Atan2BJ(y,x) + GetRandomReal(-11,11)
local real aoa=Atan2(z,SquareRoot(x*x+y*y)) + GetRandomReal(-.01,.02)
if not IsAbleToShot(m.target) then
set m.terminate=true
return
endif
set s=missile.Create(GetOwningPlayer(m.u),m.x+CosBJ(a)*64,m.y+SinBJ(a)*64,GetUnitFlyHeight(m.u)+25,a)
set s.speed=1250.
set s.range=72.
set s.timed=1.6
set s.G=aoa
set s.conhit=Condition(function IsEnemy)
set s.funchit="SpellTurretHit"
set s.funcimpact="SpellRifleImpact"
call addmobile(s)
set s.aux1=40
set s.aux2=1.0
call SetUnitScale(s.u,.3,0,0)
set s.target2=m.u
call s.addfx(MODEL_BULLET,"origin")
call AddSound(s.u,"Sound\\turret.mp3")
call AddSoundFog(s.u,"Sound\\machinegun_.mp3")
call SetUnitAnimation(m.target,"attack")
call DestroyEffect(AddSpecialEffectTarget("Model\\MuzzleFlash.mdl",s.u,"origin"))
endfunction
function SpellTurret takes nothing returns nothing
local unit u=GetSpellAbilityUnit()
//local real x=GetUnitX(GetSpellTargetUnit())
//local real y=GetUnitY(GetSpellTargetUnit())
//local real z=GetZ(x,y)-GetZ(GetUnitX(u),GetUnitY(u))
local missile m
set m=missile.Create(GetOwningPlayer(u),GetUnitX(u),GetUnitY(u),GetUnitFlyHeight(u),0)
set m.target=u
set m.target2=GetSpellTargetUnit()
set m.speed=1000.
set m.range=0.
set m.timed=2.4
set m.conhit=BOOLEXPR_FALSE
set m.gen=1.5
set m.geno=0.15
set m.funcgen="SpellTurretGen"
call addmobile(m)
//call AddSound2D(GetOwningPlayer(GetSpellTargetUnit()),"Abilities\\Spells\\Human\\Slow\\SlowTarget.wav")
if not IsUnitType(GetSpellTargetUnit(),UNIT_TYPE_MECHANICAL) then
call AddSound2D(GetOwningPlayer(GetSpellTargetUnit()),"Sound\\alarm.mp3")
endif
call SetUnitLookAt(u,"bone_turret",GetSpellTargetUnit(),0,0,0)
set u=null
endfunction
function SpellTrap takes nothing returns nothing
local unit u=GetDyingUnit()
local unit c
local real x=GetUnitX(u)
local real y=GetUnitY(u)
local group g=CreateGroup()
local boolexpr filter
set filter=Condition(function IsAll)
call GroupEnumUnitsInRange(g,x,y,180,filter)
call DestroyBoolExpr(filter)
set filter=null
call GroupRemoveUnit(g,u)
set c=FirstOfGroup(g)
call DestroyGroup(g)
set g=null
call SetUnitPosition(c,x,y)
call SpellDummy(GetOwningPlayer(u),x,y,0,'Aenr',"entanglingroots",1,c,.5)
//call KillUnit(u)
set u=null
set c=null
endfunction
function SpellShotgunHit takes nothing returns nothing
local missile m=placeholdmobile
local unit picked=placeholdunit
local real factor=1.
local blur s
if IsUnitEnemy(picked,GetOwningPlayer(m.u)) and IsAlive(picked) then
call GroupAddUnit(m.g,picked)
//if IsAnotherPlayer(m.u,picked) then
if m.aux4=='I00B' then
set factor=.5
endif
if GetUnitAbilityLevel(picked,'AId4')>0 then
set s=blur.Create(RAW_DUMMY,m.x,m.y,GetUnitFlyHeight(m.u)+GetRandomReal(0,30),GetRandomReal(0,360),0)
if m.aux4=='I00B' then
call s.addfx(MODEL_HIT2,"origin")
else
call s.addfx(MODEL_HIT,"origin")
endif
call DestroyEffect(s.fx)
call addmobile(s)
call AddSound(picked,SOUND_METAL_IMPACT())
set factor=factor*.8
endif
call UnitDamageTarget(m.u,picked,(70+40*m.timed)*factor,false,false,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_NORMAL,null)
// Blood
if not IsUnitType(picked,UNIT_TYPE_MECHANICAL) then
if not IsAlive(picked) then
call CreateBloodsplat(GetUnitX(picked),GetUnitY(picked),GetRandomReal(1.2,1.5))
else
call DestroyEffect(AddSpecialEffectTarget(MODEL_BLOOD,picked,"chest"))
call CreateBloodsplat(GetUnitX(picked)+GetRandomReal(-40,40),GetUnitY(picked)+GetRandomReal(-40,40),GetRandomReal(.5,.8))
call AddSound(picked,SOUND_HIT_FLESH)
if m.aux4=='I00B' then//and GetUnitAbilityLevel(picked,'B004')==0 then
call SpellDummy(GetOwningPlayer(m.u),m.x,m.y,0,'ACtb',"creepthunderbolt",1,picked,.5) //stun
else
call SpellDummy(GetOwningPlayer(m.u),m.x,m.y,0,'Aslo',"slow",1,picked,.5) //hit recovery
endif
endif
else
set s=blur.Create(RAW_DUMMY,m.x,m.y,GetUnitFlyHeight(m.u)+GetRandomReal(0,30),GetRandomReal(0,360),0)
if GetUnitTypeId(picked)==RAW_WALL_WOODEN then
call AddSound(picked,SOUND_HIT_WOOD)
call s.addfx(MODEL_HITW,"origin")
else
call AddSound(picked,SOUND_METAL_IMPACT())
if m.aux4=='I00B' then
call s.addfx(MODEL_HIT2,"origin")
else
call s.addfx(MODEL_HIT,"origin")
endif
endif
call DestroyEffect(s.fx)
call addmobile(s)
endif
//endif
if not IsShield(m.u,picked) then
set m.alpha=0
set m.terminate=true
endif
call CreateBeep(m.u,picked)
endif
set picked=null
set placeholdunit=null
//set placeholdmobile=0
endfunction
function SpellShotgunGen takes nothing returns nothing
local missile m=placeholdmobile
local missile s
local real x=m.aux1
local real y=m.aux2
local real z=m.aux3
local real a=Atan2BJ(y,x) + GetRandomReal(-18,18)
local real aoa=Atan2(z,SquareRoot(x*x+y*y)) + GetRandomReal(.01,.04)
set s=missile.Create(GetOwningPlayer(m.u),m.x,m.y,GetUnitFlyHeight(m.u)+spell_z+4,a)
//call s.addfx(MODEL_BULLET,"origin")
set s.speed=1250.
set s.range=64.
set s.timed=0.5+GetRandomInt(0,5)*0.02
set s.G=aoa
//set s.conhit=Condition(function IsEnemy)
set s.funchit="SpellShotgunHit"
set s.funcimpact="SpellRifleImpact"
call addmobile(s)
call SetUnitScale(s.u,.3,0,0)
set s.aux4=m.aux4
if m.aux4=='I00B' then
call s.addfx(MODEL_BULLET2,"origin")
//call SetUnitVertexColor(s.u,128,255,128,255)
else
call s.addfx(MODEL_BULLET,"origin")
set s.timed=s.timed+0.2
endif
endfunction
function SpellShotgun takes nothing returns nothing
local unit u=GetSpellAbilityUnit()
local location l=GetSpellTargetLoc()
local Hero h=GetUnitUserData(u)
local unit c=h.target
local real x=GetUnitX(u)
local real y=GetUnitY(u)
local real z=GetLocationZ(l)-GetZ(GetUnitX(u),GetUnitY(u))
local missile m
if GetItemTypeId(h.i_ammo)=='I00A' or GetItemTypeId(h.i_ammo)=='I00B' then
call SetUnitAnimation(u,"attack")
call AddSound(u,"Sound\\shotgun.wav")
call AddSoundFog(u,"Sound\\shotgun.wav")
set m=missile.Create(GetOwningPlayer(u),x,y,GetUnitFlyHeight(u),0)
set m.target=u
set m.speed=1000.
set m.range=0.
set m.timed=0.18
set m.conhit=BOOLEXPR_FALSE
set m.gen=0.
set m.geno=0.
set m.funcgen="SpellShotgunGen"
call addmobile(m)
set m.aux1=GetLocationX(l)-x
set m.aux2=GetLocationY(l)-y
set m.aux3=z
set m.aux4=GetItemTypeId(h.i_ammo)
call SetItemCharges(h.i_ammo,GetItemCharges(h.i_ammo)-1)
if GetItemCharges(h.i_ammo)==0 then
call RemoveItem(h.i_ammo)
endif
call DestroyEffect(AddSpecialEffectTarget("Model\\MuzzleFlash.mdl",u,"weapon"))
endif
call RemoveLocation(l)
set l=null
set c=null
set u=null
endfunction
function SpellKnife takes nothing returns nothing
local unit u=GetSpellAbilityUnit()
local Hero h=GetUnitUserData(u)
local real x=GetUnitX(u)
local real y=GetUnitY(u)
local group g=CreateGroup()
local boolexpr filter
local unit c
local blur s
local integer i=GetUnitAbilityLevel(u,'A008')
local real d
local real factor=1.
local boolean hit=false
//set conunit=m.u
set filter=Condition(function IsEnemy)
call GroupEnumUnitsInRange(g,x,y,256,filter)
call DestroyBoolExpr(filter)
set filter=null
call GroupRemoveUnit(g,u)
if i==1 then
set d=200
elseif i==2 then
set d=100
elseif i==3 then
set d=300
elseif i==0 then
set d=250
call EnumDestructablesInCircle(x,y,256,function TreeShake)
endif
loop
set c=FirstOfGroup(g)
exitwhen c==null
call GroupRemoveUnit(g,c)
if GetUnitTypeId(c)=='n001' then
call SetTextTagVisibility(mission_label.t,true)
if GetWidgetLife(c)-10<=.5 then
set mission_unit[5]=u
endif
call SetWidgetLife(c,GetWidgetLife(c)-10)
else
if i==0 then
if GetUnitAbilityLevel(c,'AId4')>0 then
set factor=.5
endif
endif
call UnitDamageTarget(u,c,d*factor,false,false,ATTACK_TYPE_MAGIC,DAMAGE_TYPE_ENHANCED,null)
set factor=1.
endif
set hit=true
// Blood
if GetUnitAbilityLevel(c,'AId4')>0 then
set s=blur.Create(RAW_DUMMY,GetUnitX(c),GetUnitY(c),GetUnitFlyHeight(c)+GetRandomReal(0,30),GetRandomReal(0,360),0)
call s.addfx(MODEL_HIT,"origin")
call DestroyEffect(s.fx)
call addmobile(s)
call AddSound(c,SOUND_METAL_IMPACT())
endif
if not IsUnitType(c,UNIT_TYPE_MECHANICAL) then
if not IsAlive(c) then
call CreateBloodsplat(GetUnitX(c),GetUnitY(c),GetRandomReal(1.2,1.5))
else
call DestroyEffect(AddSpecialEffectTarget(MODEL_BLOOD,c,"chest"))
call CreateBloodsplat(GetUnitX(c)+GetRandomReal(-40,40),GetUnitY(c)+GetRandomReal(-40,40),GetRandomReal(.5,.8))
endif
else
//---zbytocny bordel?
//set s=blur.Create(RAW_DUMMY,GetUnitX(c),GetUnitY(c),GetUnitFlyHeight(c)+GetRandomReal(0,30),GetRandomReal(0,360),0)
//call s.addfx(MODEL_HIT,"origin")
//call DestroyEffect(s.fx)
//call addmobile(s)
if GetUnitTypeId(c)==RAW_WALL_WOODEN then
call AddSound(c,SOUND_HIT_WOOD)
if i==0 then
call UnitDamageTarget(u,c,d,false,false,ATTACK_TYPE_MAGIC,DAMAGE_TYPE_MAGIC,null)
endif
else
call AddSound(c,SOUND_METAL_IMPACT())
endif
endif
endloop
call DestroyGroup(g)
set g=null
set s=blur.Create(RAW_DUMMY,x,y,GetUnitFlyHeight(u)+12,GetRandomReal(0,360),0)
call s.addfx(MODEL_EXPLO_FLARE2,"origin")
call SetUnitScale(s.u,2.5,0,0)
call DestroyEffect(s.fx)
if hit then
call AddSound(u,"Sound\\knife.mp3")
else
call AddSound(u,"Units\\Orc\\HeroBladeMaster\\HeroBladeMasterAttack1.wav")
endif
set u=null
endfunction
function SpellC4 takes nothing returns nothing
local unit u=GetEnumUnit()
local real x=GetUnitX(u)
local real y=GetUnitY(u)
local group g
local boolexpr filter
local unit c
local blur s
local real b=0
if not IsAlive(u) then
return
endif
set filter=Condition(function IsAll)
set g=CreateGroup()
call GroupEnumUnitsInRange(g,x,y,600,filter)
call DestroyBoolExpr(filter)
set filter=null
call GroupRemoveUnit(g,u)
loop
set c=FirstOfGroup(g)
exitwhen c==null
call GroupRemoveUnit(g,c)
set b=200
if GetUnitTypeId(c)==RAW_MISSION then
set b=2000
elseif GetUnitTypeId(c)=='n000' then
set b=0
endif
call UnitDamageTarget(u,c,b,false,false,ATTACK_TYPE_MAGIC,DAMAGE_TYPE_MAGIC,null)
// Blood
if not IsUnitType(c,UNIT_TYPE_MECHANICAL) then
if not IsAlive(c) then
call CreateGib(GetUnitX(c),GetUnitY(c),GetUnitFlyHeight(c),-GetUnitFacing(c),500)
call KillUnitA(c)
else
call DestroyEffect(AddSpecialEffectTarget(MODEL_BLOOD,c,"chest"))
call CreateBloodsplat(GetUnitX(c),GetUnitY(c),GetRandomReal(0.9,1.2))
endif
endif
call CreateBeep(u,c)
endloop
call DestroyGroup(g)
set g=null
call EnumDestructablesInCircle(x,y,300,function TreeKill)
call EnumDestructablesInCircle(x,y,600,function TreeShake)
set s=blur.Create(RAW_DUMMY,x,y,GetUnitFlyHeight(u)+12,GetRandomReal(0,360),0)
set s.fadeduration=4
if GetUnitFlyHeight(s.u)>40 then
call s.addfx(MODEL_EXPLO_AIR,"origin")
else
call s.addfx("Model\\EXground.mdl","origin")
endif
call AddSound(s.u,SOUND_EXPLO())
call AddSoundStereo(s.u,"sound\\explosion_L.mp3","sound\\explosion_R.mp3")
call spell_addmobile(s)
call SetUnitScale(s.u,3,0,0)
call DestroyEffect(s.fx)
set s=blur.Create(RAW_DUMMY,x,y,GetUnitFlyHeight(u)+12,GetRandomReal(0,360),0)
call s.addfx(MODEL_EXPLO_FLARE,"origin")
call SetUnitScale(s.u,6,0,0)
call DestroyEffect(s.fx)
call KillUnitA(u)
set c=null
set u=null
endfunction
function SpellBombExtra takes nothing returns nothing
local blur s
local real x=GetUnitX(mission_unit[4])
local real y=GetUnitY(mission_unit[4])
local integer c=9
loop
exitwhen c<=0
call TriggerSleepAction(0)
set s=blur.Create(RAW_DUMMY,x+GetRandomInt(-25,25)*25,y+GetRandomInt(-25,25)*25,15,GetRandomReal(0,360),0)
set s.fadeduration=4
call s.addfx("Model\\EXground.mdl","origin")
call spell_addmobile(s)
call SetUnitScale(s.u,2.5,0,0)
call DestroyEffect(s.fx)
call AddSound(s.u,SOUND_EXPLO())
call AddSoundStereo(s.u,"sound\\explosion_L.mp3","sound\\explosion_R.mp3")
set c=c-1
endloop
endfunction
function SpellBomb takes nothing returns nothing
local unit u=mission_unit[4]
local real x=GetUnitX(u)
local real y=GetUnitY(u)
local group g
local boolexpr filter
local unit c
local blur s
local vector a
local vector b
if not IsAlive(u) then
return
endif
call DestroyTimerDialog(game_td_round)
call PauseTimer(game_timer_round)
set a=vector.createFrom(x,y,GetZ(x,y))
set b=vector.create()
set filter=Condition(function IsAll)
set g=CreateGroup()
call GroupEnumUnitsInRange(g,x,y,1500,filter)
call DestroyBoolExpr(filter)
set filter=null
call GroupRemoveUnit(g,u)
loop
set c=FirstOfGroup(g)
exitwhen c==null
call GroupRemoveUnit(g,c)
set b.x=GetUnitX(c)
set b.y=GetUnitY(c)
set b.z=GetZ(GetUnitX(c),GetUnitY(c))+GetUnitFlyHeight(c)
call UnitDamageTarget(u,c,DamageArea(vector.distance(a,b),1500,800),false,false,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_MAGIC,null)
// Blood
if not IsUnitType(c,UNIT_TYPE_MECHANICAL) then
if not IsAlive(c) then
call CreateGib(GetUnitX(c),GetUnitY(c),GetUnitFlyHeight(c),-GetUnitFacing(c),700)
call KillUnitA(c)
else
call DestroyEffect(AddSpecialEffectTarget(MODEL_BLOOD,c,"chest"))
call CreateBloodsplat(GetUnitX(c),GetUnitY(c),GetRandomReal(0.9,1.2))
endif
endif
endloop
call DestroyGroup(g)
set g=null
call a.destroy()
call b.destroy()
call EnumDestructablesInCircle(x,y,1000,function TreeKill)
call EnumDestructablesInCircle(x,y,3000,function TreeShake)
set s=blur.Create(RAW_DUMMY,x,y,GetUnitFlyHeight(u)+12,GetRandomReal(0,360),0)
set s.fadeduration=4
call s.addfx("Model\\EXground.mdl","origin")
call AddSound(s.u,SOUND_EXPLO())
call AddSoundStereo(s.u,"sound\\explosion_L.mp3","sound\\explosion_R.mp3")
call spell_addmobile(s)
call SetUnitScale(s.u,4,0,0)
call DestroyEffect(s.fx)
set s=blur.Create(RAW_DUMMY,x,y,GetUnitFlyHeight(u)+12,GetRandomReal(0,360),0)
call s.addfx(MODEL_EXPLO_FLARE,"origin")
call SetUnitScale(s.u,15,0,0)
call DestroyEffect(s.fx)
call ExecuteFunc("SpellBombExtra")
call KillUnitA(u)
set c=null
set u=null
call PingMinimapEx(x,y,5,255,0,0,false)
endfunction
//=================================================================================================
function end takes nothing returns nothing
if ta!=null then
call ReleaseTimer(ta)
set ta=null
call BJDebugMsg("Clicks per second: "+I2S(strike))
set strike=0
endif
endfunction
function Spell takes nothing returns nothing
local unit u=GetSpellAbilityUnit()
local Hero h=GetUnitUserData(u)
local integer id=GetSpellAbilityId()
local location l=GetSpellTargetLoc()
local group g
local boolean b
local string s=""
set conunit=u
//call PingIcon(GetPlayerId(GetOwningPlayer(u)),MODEL_ICON_NADE)
if id==RAW_ABIL_NADE or id=='A003' or id=='A00B' or id=='A00X' then
if GetItemCharges(UnitItemInSlot(u,2))>0 then
if id==RAW_ABIL_NADE then
call ExecuteFunc("SpellNade")
elseif id=='A003' then
call ExecuteFunc("SpellSmoke")
elseif id=='A00B' then
call ExecuteFunc("SpellLSDNade")
elseif id=='A00X' then
call ExecuteFunc("SpellSticky")
endif
call SetItemCharges(UnitItemInSlot(u,2),GetItemCharges(UnitItemInSlot(u,2))-1)
else
call msg(GetOwningPlayer(u),STRING_NOTICE+"Out of grenades!",SOUND_MSG)
call UnitRemoveAbility(u,id)
call UnitAddAbility(u,id)
if id=='A00B' or id=='A00X' then
call TriggerSleepAction(0)
call SetUnitState(u,UNIT_STATE_MANA,GetUnitState(u,UNIT_STATE_MANA)+150)
endif
//call RemoveItem(UnitItemInSlot(u,2))
endif
//elseif id=='A003' then
//call ExecuteFunc("SpellSmoke")
elseif id=='A008' or id=='A012' then
call ExecuteFunc("SpellKnife")
elseif id=='A006' then // medikit
set player_drug[GetPlayerId(GetOwningPlayer(GetSpellTargetUnit()))]=player_drug[GetPlayerId(GetOwningPlayer(GetSpellTargetUnit()))]-200
if GetSpellTargetUnit()==u then //when medic heals himself
call TriggerSleepAction(0)
//call UnitRemoveAbility(u,'BIrg')
call UnitRemoveAbility(u,'BIrl')
//call UnitRemoveAbility(u,'BIrm')
call UnitAddItem(u,CreateItem('rhe2',0,0))
endif
elseif id=='A007' then
call ExecuteFunc("SpellMorphine")
//elseif id=='A00B' then
//call ExecuteFunc("SpellLSDNade")
elseif id=='A00D' then
call ExecuteFunc("SpellAirStrike")
call UnitRemoveAbility(u,'A00D')
elseif id=='A00F' then // scope mode
call UnitRemoveAbility(u,'A00F')
call UnitAddAbility(u,'A00G')
set h.zbonus=1150
call UnitAddAbility(u,'Aasl') //slow aura
elseif id=='A00G' then // normal mode
call UnitRemoveAbility(u,'A00G')
call UnitAddAbility(u,'A00F')
set h.zbonus=200
call UnitRemoveAbility(u,'Aasl') //slow aura
call UnitRemoveAbility(u,'Basl') //slow aura buff
elseif id=='A00W' then // painkiller
set id=0
if GetWidgetLife(u)<250. then
set id=R2I((250-GetWidgetLife(u))*.33+.5)
call SetWidgetLife(u,GetWidgetLife(u)+id)
endif
set player_drug[GetPlayerId(GetOwningPlayer(u))]=player_drug[GetPlayerId(GetOwningPlayer(u))]+320+id*3
//call DrugAilments(GetOwningPlayer(u))
call AddSound(u,"Sound\\pills.mp3")
call PolledWait(1.3)
call UnitAddAbility(u,'AIlf')
call PolledWait(8)
call UnitRemoveAbility(u,'AIlf')
elseif id=='Astn' then
call SetUnitVertexColor(u,72,255,64,64)
elseif id=='A00J' then
call ExecuteFunc("SpellMortar")
elseif id=='A00R' then
call ExecuteFunc("SpellBarrage")
elseif id=='A00A' then // binoculars
set id=20
set bj_lastCreatedUnit=CreateUnitAtLoc(GetOwningPlayer(u),'hphx',l,0)
call UnitApplyTimedLife(bj_lastCreatedUnit,0,id)
set bj_lastCreatedUnit=CreateUnitAtLoc(GetOwningPlayer(u),RAW_DUMMY,l,0)
call UnitAddAbility(bj_lastCreatedUnit,'A00Q')
call UnitAddAbility(bj_lastCreatedUnit,'Agyv')
call UnitApplyTimedLife(bj_lastCreatedUnit,0,id)
elseif id==RAW_ABIL_ATTACK then
if GetItemCharges(h.i_ammo)>0 then
call ExecuteFunc(h.weapon)
else
call TriggerSleepAction(0)
set b=SpellFindAmmo(u)
if not(b)then
call msg(GetOwningPlayer(u),STRING_NOTICE+"Out of ammunition!",SOUND_MSG)
endif
call UnitRemoveAbility(u,RAW_ABIL_ATTACK)
call UnitAddAbility(u,RAW_ABIL_ATTACK)
endif
elseif id=='A004' then // C4
set bj_lastCreatedUnit=CreateUnit(GetOwningPlayer(u),'n000',GetLocationX(l),GetLocationY(l),GetRandomReal(0,360))
call UnitAddAbility(u,'A00H')
call UnitMakeAbilityPermanent(u,true,'A00H')
//set bj_lastCreatedItem=CreateItem('I007',0,0)
//call SetItemUserData(bj_lastCreatedItem,H2I(bj_lastCreatedUnit))
//call UnitAddItem(u,bj_lastCreatedItem)
elseif id=='A00T' then // Fire Bullets
if GetItemCharges(h.i_ammo)>4 and GetUnitAbilityLevel(u,'A00S')==0 then
call SetItemCharges(h.i_ammo,GetItemCharges(h.i_ammo)-4)
call UnitAddAbility(u,'A00S')
//call UnitRemoveAbility(u,'Avul')
else
call msg(GetOwningPlayer(u),STRING_NOTICE+"Need at least 5 bullets!",SOUND_MSG)
call UnitRemoveAbility(u,'A00T')
call UnitAddAbility(u,'A00T')
call TriggerSleepAction(0)
call SetUnitState(u,UNIT_STATE_MANA,GetUnitState(u,UNIT_STATE_MANA)+100)
endif
elseif id=='A00H' then // C4 Detonator
set g=GetUnitsOfPlayerAndTypeId(GetOwningPlayer(u),'n000')
call ForGroup(g,function SpellC4)
call DestroyGroup(g)
set g=null
call UnitRemoveAbility(u,'A00H')
elseif id=='A00V' then // C4 Detonator (single)
set g=GetUnitsOfPlayerAndTypeId(GetOwningPlayer(u),'n000')
if CountUnitsInGroup(g)<=1 then
call UnitRemoveAbility(player_PlayerHero[GetPlayerId(GetOwningPlayer(u))].u,'A00H')
endif
call DestroyGroup(g)
set g=CreateGroup()
call GroupAddUnit(g,u)
call ForGroup(g,function SpellC4)
call DestroyGroup(g)
set g=null
elseif id=='A00U' then // bear trap
set bj_lastCreatedUnit=CreateUnit(GetOwningPlayer(u),'n002',GetUnitX(u),GetUnitY(u),GetRandomReal(0,360))
call SetUnitAnimation(bj_lastCreatedUnit,"birth")
//call UnitApplyTimedLife(bj_lastCreatedUnit,'BFig',200)
elseif id=='A005' then // explosive barrel
set bj_lastCreatedUnit=CreateUnit(Player(15),'ncg3',GetLocationX(l),GetLocationY(l),GetRandomReal(0,360))
elseif id=='A00E' then // sentry turret
set bj_lastCreatedUnit=CreateUnit(GetOwningPlayer(u),'hgtw',GetLocationX(l),GetLocationY(l),GetRandomReal(0,360))
if IsUnitInForce(u,player_Force[0]) then
call SetUnitColor(bj_lastCreatedUnit,PLAYER_COLOR_RED)
elseif IsUnitInForce(u,player_Force[1]) then
call SetUnitColor(bj_lastCreatedUnit,PLAYER_COLOR_BLUE)
endif
call DestroyEffect(AddSpecialEffect(MODEL_HIT,GetUnitX(bj_lastCreatedUnit),GetUnitY(bj_lastCreatedUnit)))
call AddSound(bj_lastCreatedUnit,"sound\\buildings\\shared\\BuildingPlacement.wav")
elseif id=='A00I' then // barricade
set bj_lastCreatedUnit=CreateUnit(GetOwningPlayer(u),'hwtw',GetLocationX(l),GetLocationY(l),90+GetRandomInt(0,4)*90)
call DestroyEffect(AddSpecialEffect(MODEL_HIT,GetUnitX(bj_lastCreatedUnit),GetUnitY(bj_lastCreatedUnit)))
call AddSound(bj_lastCreatedUnit,"sound\\buildings\\shared\\BuildingPlacement.wav")
elseif id=='A00C' then // satellite
call AddSound(h.u,"Sound\\satellite.mp3")
call UnitAddType(u,UNIT_TYPE_ANCIENT)
set h.satellite=true
//call CameraSetupApplyForPlayer(true,gg_cam_Satellite,GetOwningPlayer(u),1)
call msg_timed(GetOwningPlayer(u),10,STRING_NOTICE+"You can now freely move camera!",SOUND_MSG)
if GetLocalPlayer()==GetOwningPlayer(u) then
call FogEnable(false)
//call SetTerrainFogEx(0,8000,9000,0,0,0,0)
endif
call PolledWait(10)
set h.satellite=false
call UnitRemoveType(u,UNIT_TYPE_ANCIENT)
if GetLocalPlayer()==GetOwningPlayer(u) then
call FogEnable(true)
//call SetTerrainFogEx(0,1000,6000,0,0,0,0)
endif
elseif id=='A00P' then // bomb
if GetUnitAbilityLevel(u,'B000')==1 then
//call ExecuteFunc("SpellBomb")
call RemoveItem(mission_item[0])
call DestroyTimerDialog(game_td_round)
call PauseTimer(game_timer_round)
call TimerStart(game_timer_round,bombtime,false,function SpellBomb)
set game_td_round=CreateTimerDialog(game_timer_round)
call TimerDialogSetTitle(game_td_round,"Bomb explodes in")
call TimerDialogDisplay(game_td_round,true)
//GetOwningPlayer(u)
if IsPlayerAlly(GetLocalPlayer(),GetOwningPlayer(u)) then
call PingMinimapEx(GetUnitX(u),GetUnitY(u),10,200,200,200,false)
else
set s=" |c00808080(You can defuse bomb with Knife)"
endif
set mission_unit[4]=CreateUnit(GetOwningPlayer(u),RAW_BOMB,GetUnitX(u),GetUnitY(u),GetUnitFacing(u))
//set mission_unit[4]=CreateUnit(Player(9),RAW_BOMB,GetUnitX(u),GetUnitY(u),GetUnitFacing(u))
set mission_label=label.Create(GetOwningPlayer(u),12,-80,130,"",5,255,255,255)
set mission_label.u=mission_unit[4]
set mission_label.ui=true
call SetTextTagPermanent(mission_label.t,true)
call SetTextTagVisibility(mission_label.t,IsUnitAlly(mission_label.u,GetLocalPlayer()))
call Label_addlabel(mission_label)
call msg_timed(GetLocalPlayer(),10,STRING_GAME+"Bomb has been planted!"+s,SOUND_MSG)
call AddSound2D(GetLocalPlayer(),"Sound\\UI\\bombplant.mp3")
// --- prevention of bug ---
call TriggerSleepAction(0)
set mission_label.u=mission_unit[4]
else
call msg_timed(GetOwningPlayer(u),5,STRING_NOTICE+"You can plant bomb only in the bomb site!",SOUND_MSG)
endif
elseif id=='A00K' then
if map+1>max_map then
set map=min_map
else
set map=map+1
endif
call ExecuteFunc("MAP_"+I2S(map))
elseif id=='A00L' then
if map-1<min_map then
set map=max_map
else
set map=map-1
endif
call ExecuteFunc("MAP_"+I2S(map))
elseif id=='A00M' then
call ExecuteFunc("GameStart")
elseif id=='A00N' then
set map=GetRandomInt(min_map,max_map)
call ExecuteFunc("MAP_"+I2S(map))
call UnitRemoveAbility(u,'A00M')
call UnitRemoveAbility(u,'A00N')
call TriggerSleepAction(2)
call ExecuteFunc("GameStart")
endif
//set strike=strike+1
//if ta==null then
// set ta=NewTimer()
// call TimerStart(ta,1,false,function end)
//endif
call RemoveLocation(l)
set l=null
set u=null
endfunction
function SpellDeath takes nothing returns nothing
local unit u=GetTriggerUnit()
//local boolean b=GetOwningPlayer(u)!=GetOwningPlayer(GetKillingUnit())
//if GetUnitTypeId(u)!=RAW_DUMMY then
//call echo("b")
//call SetWidgetLife(u,1)
if GetUnitAbilityLevel(u,'BNbf')>0 then
//if GetUnitAbilityLevel(u,'A001')>0 then
//call echo("burn")
call UnitBurn(u,u)
endif
//endif
set u=null
endfunction
//######################################################################
//#
//# Init
//#
//######################################################################
private function Init takes nothing returns nothing
call TimerStart(CreateTimer(),period,true,function movemobiles)
endfunction
endlibrary
//TESH.scrollpos=34
//TESH.alwaysfold=0
function InitTrig_item takes nothing returns nothing
endfunction
//===========================================================================
library item initializer Init requires Safety, spell, Label
globals
private constant real period=0.25
private Item array mobs
private integer N=0
private boolexpr conitem
endglobals
struct Item
string name
unit u
real x
real y
integer red=255
integer green=255
integer blue=255
integer alpha=255
real respawno=1
real respawn=0
string func="DoNothing"
static method Create takes integer id, real x, real y returns Item
local Item s=Item.create()
set s.u=CreateUnit(Player(15),id,x,y,0)
call SetUnitX(s.u,x)
call SetUnitY(s.u,y)
set s.x=x
set s.y=y
return s
endmethod
private method collision takes nothing returns boolean
local boolean r=false
local unit picked
local group g=CreateGroup()
local blur m
local label a
call GroupEnumUnitsInRange(g,.x,.y,ITEM_RANGE,conitem)
call GroupRemoveUnit(g,.u)
loop
set picked=FirstOfGroup(g)
exitwhen picked==null or r
set r=true
set placeholdunit=picked
call ExecuteFunc(.func)
call ShowUnit(.u,false)
set this.respawn=.respawno
call DestroyEffect(AddSpecialEffectTarget(MODEL_ITEM,picked,"origin"))
set m=blur.Create(GetUnitTypeId(.u),.x,.y,0,0,0)
set m.red=this.red
set m.green=this.green
set m.blue=this.blue
set m.alpha=this.alpha
call SetUnitVertexColor(m.u,m.red,m.green,m.blue,m.alpha)
call SetUnitX(m.u,.x)
call SetUnitY(m.u,.y)
call spell_addmobile(m)
set a=label.Create(GetOwningPlayer(picked),4,-300,200, "You Picked Up "+.name ,20,128,255,0)
call a.timed(0,4)
call Label_addlabel(a)
call AddSound(picked,SOUND_PICKUP)
endloop
call DestroyGroup(g)
set g=null
set picked=null
return r
endmethod
method anim takes nothing returns boolean
set placeholdmobile=this
if IsUnitHidden(this.u) then
set .respawn=.respawn-period
if .respawn<=0 then
call UnitRemoveAbility(.u,'Aloc')
call ShowUnit(.u,true)
call UnitAddAbility(.u,'Aloc')
endif
else
call .collision()
endif
return false
endmethod
method onDestroy takes nothing returns nothing
call KillUnitA(.u)
endmethod
endstruct
private function moveitems takes nothing returns nothing
local integer i=0
loop
exitwhen i==N
call mobs[i].anim()
set i=i+1
endloop
endfunction
public function respawnitems takes nothing returns nothing
local integer i=0
loop
exitwhen i==N
//call ShowUnit(mobs[i].u,false)
set mobs[i].respawn=0
set i=i+1
endloop
endfunction
public function additem takes Item m returns nothing
set mobs[N]=m
set N=N+1
endfunction
public function count takes nothing returns integer
return N
endfunction
private function con takes nothing returns boolean
local Item m=placeholditem
return (not IsUnitHidden(m.u) and IsHeroUnitId(GetUnitTypeId(GetFilterUnit())) and IsAlive(GetFilterUnit()))
endfunction
function ItemArmor takes nothing returns nothing
local unit p=placeholdunit
call SpellDummy(GetOwningPlayer(p),GetUnitX(p),GetUnitY(p),0,'ACrj',"rejuvination",1,p,0)
set p=null
endfunction
function ItemHaste takes nothing returns nothing
local unit p=placeholdunit
//call SpellDummy(GetOwningPlayer(p),GetUnitX(p),GetUnitY(p),0,'Ablo',"bloodlust",1,p,0)
call SpellLSD(p,60,1,0.5,10)
set p=null
endfunction
function ItemCreateArmor takes nothing returns nothing
local Item m
set m=Item.Create('osp1',GetUnitX(GetEnumUnit()),GetUnitY(GetEnumUnit()))
set m.respawno=20
set m.func="ItemArmor"
set m.red=0
set m.blue=0
set m.green=255
call SetUnitVertexColor(m.u,m.red,m.green,m.blue,m.alpha)
call additem(m)
set m.name="Rune of Heal"
endfunction
function ItemCreateHaste takes nothing returns nothing
local Item m
set m=Item.Create('osp1',GetUnitX(GetEnumUnit()),GetUnitY(GetEnumUnit()))
set m.respawno=32
set m.func="ItemHaste"
set m.green=128
set m.blue=0
call SetUnitVertexColor(m.u,m.red,m.green,m.blue,m.alpha)
call additem(m)
set m.name="Rune of LSD"
endfunction
//######################################################################
//#
//# Init
//#
//######################################################################
private function Init takes nothing returns nothing
//local Item m
//set conitem=Condition(function con)
//call TimerStart(CreateTimer(),period,true,function moveitems)
//call ForGroup(GetUnitsOfTypeIdAll('ncop'),function ItemCreateArmor)
//call ForGroup(GetUnitsOfTypeIdAll('ncp2'),function ItemCreateHaste)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
function InitTrig_creep takes nothing returns nothing
endfunction
//===========================================================================
library Creep requires spell
globals
private real Creep_X=0
private real Creep_Y=0
private integer Creep_ID
private integer Creep_C
endglobals
function Creep_Find_Place takes nothing returns nothing
local real x=GetRandomReal(GetRectMinX(rect_map),GetRectMaxX(rect_map))
local real y=GetRandomReal(GetRectMinY(rect_map),GetRectMaxY(rect_map))
local real x2
local real y2
local integer n=player_N
local boolean b=false
if GetTerrainCliffLevel(x,y)==main_cliff then
set Creep_X=x
set Creep_Y=y
loop
exitwhen n==0
if player_Heroes[n]!=0 then
if IsAlive(player_Heroes[n].u) then
set x2=GetUnitX(player_Heroes[n].u)
set y2=GetUnitY(player_Heroes[n].u)
if (x-x2)*(x-x2)+(y-y2)*(y-y2)<1000000 and not IsFoggedToPlayer(x,y,GetOwningPlayer(player_Heroes[n].u)) then
set n=1
set b=true
endif
endif
endif
set n=n-1
endloop
else
set b=true
endif
if b then
call ExecuteFunc("Creep_Find_Place")
endif
endfunction
function Creep_CreateExec takes nothing returns nothing
local integer id=Creep_ID
local integer c=Creep_C
local real x=GetRectCenterX(rect_map)
local real y=GetRectCenterY(rect_map)
call Creep_Find_Place()
loop
exitwhen c<=0
set bj_lastCreatedUnit=CreateUnit(Player(10),id,Creep_X,Creep_Y,GetRandomInt(0,360))
call RemoveGuardPosition(bj_lastCreatedUnit)
call IssuePointOrder(bj_lastCreatedUnit,"attack",x,y)
set game_Count[1]=game_Count[1]+1
set c=c-1
call TriggerSleepAction(0)
call ExecuteFunc("LabelRemainingExec")
endloop
//call ExecuteFunc("LabelRemainingExec")
endfunction
public function Create takes integer id, integer c returns nothing
set Creep_ID=id
set Creep_C=c
call ExecuteFunc("Creep_CreateExec")
endfunction
public function Wave takes integer w, integer t returns nothing
if w==1 then
call Creep_Create(RAW_MINION,2+t/5)
call Creep_Create(RAW_MINION,2+t/5)
elseif w==2 then
call Creep_Create('ogru',3+t/5)
call Creep_Create('ogru',3+t/5)
elseif w==6 or wave==8 then
call Creep_Create('otau',2+t/5)
call Creep_Create('otau',2+t/5)
call Creep_Create('otau',3+t/5)
call Creep_Create('otau',3+t/5)
elseif w<10 then
call Creep_Create('ogru',4+t/5)
call Creep_Create('ogru',4+t/5)
call Creep_Create('otau',5+t/5)
elseif w<15 then
call Creep_Create(RAW_MINION,3+t/5)
call Creep_Create(RAW_MINION,3+t/5)
call Creep_Create(RAW_MINION,2+t/5)
call Creep_Create('otau',5+t/5)
else
call Creep_Create('ogru',2+t/5)
call Creep_Create('ogru',2+t/5)
call Creep_Create('otau',10+t/5)
call Creep_Create(RAW_MINION,2+t/5)
call Creep_Create('orai',1)
endif
endfunction
endlibrary
//TESH.scrollpos=102
//TESH.alwaysfold=0
function InitTrig_player takes nothing returns nothing
endfunction
//===========================================================================
library player initializer Init requires spell, Label, Creep
function GetPlayerPlaying takes player p returns boolean
return GetPlayerSlotState(p)==PLAYER_SLOT_STATE_PLAYING// and GetPlayerSlotState(p)!=PLAYER_SLOT_STATE_LEFT
endfunction
function GetPlayerCompPlaying takes player p returns boolean
return GetPlayerController(p)==MAP_CONTROL_COMPUTER
endfunction
globals
public force array Force
public Hero array Heroes
public Hero array PlayerHero
public unit array Cam
public real array SpawnX
public real array SpawnY
public camerasetup array ObsCam
public integer actual_ObsCam
public integer max_ObsCam
public integer N=0
public integer array Force_rotate
public integer array drug
public integer array stats_fb
public integer array stats_kill
public integer array stats_death
public boolean array survived
endglobals
struct Hero
unit u
unit target
foot foot
ping ping
integer nn=0
integer id
item i_weapon
string weapon
item i_ammo
//integer backstab=0
//integer bonusdmg=0
//integer mover=0
real lsd_rotate=0
real lsd_time=0 //smooth for lsd camera
missile lsd=0 //for stacking
//sound s_berserk
//private effect hpointer
label namepointer=0
label hppointer=0
boolean satellite=false
boolean revived=false
boolean selected=true
real zbonus=0
static method Create takes unit u returns Hero
local player p=GetOwningPlayer(u)
local Hero h=Hero.create()
local foot s
local ping x
local unit vision
local integer id=GetUnitTypeId(u)
local string t
local integer f
set PlayerHero[GetPlayerId(p)]=h
set h.id=GetUnitTypeId(u)
set h.u=u
call SetUnitUserData(u,h)
set h.selected=true
call UnitAddAbility(u,RAW_ABIL_ATTACK)
call UnitAddAbility(u,RAW_ABIL_NADE)
call UnitAddAbility(u,'A008')
call UnitMakeAbilityPermanent(u,true,RAW_ABIL_ATTACK)
call UnitMakeAbilityPermanent(u,true,RAW_ABIL_NADE)
call UnitMakeAbilityPermanent(u,true,'A008')
if id==RAW_MARINE then
set h.i_weapon=CreateItem('I001',0,0)
set h.i_ammo=CreateItem('I004',0,0)
set h.weapon="SpellRifle"
call UnitAddAbility(u,'A003')
call UnitAddAbility(u,'A00T') // Phosphorous Bullets
set STATS_CLASSES_USED[1]=STATS_CLASSES_USED[1]+1
elseif id==RAW_MEDIC then
set h.i_weapon=CreateItem('I00I',0,0)
set h.i_ammo=CreateItem('I004',0,0)
set h.weapon="SpellSMG"
call UnitAddAbility(u,'A006') // medikit
call UnitAddAbility(u,'A007')
call UnitAddAbility(u,'A00B')
set STATS_CLASSES_USED[2]=STATS_CLASSES_USED[2]+1
elseif id==RAW_SCOUT then
set h.i_weapon=CreateItem('I002',0,0)
set h.i_ammo=CreateItem('I00A',0,0)
set h.weapon="SpellShotgun"
call SetUnitAbilityLevel(u,RAW_ABIL_ATTACK,2)
call SetUnitAbilityLevel(u,'A008',2)
call UnitAddAbility(u,'A00A')
call UnitAddAbility(u,'A00W') // painkiller
set STATS_CLASSES_USED[3]=STATS_CLASSES_USED[3]+1
elseif id==RAW_SNIPER then
set h.i_weapon=CreateItem('I008',0,0)
set h.i_ammo=CreateItem('I009',0,0)
set h.weapon="SpellSniper"
call SetUnitAbilityLevel(u,RAW_ABIL_ATTACK,3)
call UnitAddAbility(u,'A003')
call UnitAddAbility(u,'A00F')
call UnitAddAbility(u,'A00X')
set h.zbonus=200
set STATS_CLASSES_USED[4]=STATS_CLASSES_USED[4]+1
elseif id==RAW_OPERATOR then
set h.i_weapon=CreateItem('I001',0,0)
set h.i_ammo=CreateItem('I004',0,0)
set h.weapon="SpellRifle"
call UnitAddAbility(u,'A00R') // artillery barrage
call UnitAddAbility(u,'Aeye') // sentinel
//call UnitAddAbility(u,'ACua')
call UnitAddAbility(u,'A00D') // airstrike
set STATS_CLASSES_USED[5]=STATS_CLASSES_USED[5]+1
elseif id==RAW_GUNNER then
set h.i_weapon=CreateItem('I00F',0,0)
set h.i_ammo=CreateItem('I004',0,0)
set h.weapon="SpellGunner"
call SetUnitAbilityLevel(u,RAW_ABIL_ATTACK,4)
call UnitAddAbility(u,'A00J')
set STATS_CLASSES_USED[6]=STATS_CLASSES_USED[6]+1
elseif id==RAW_STALKER then
set h.i_weapon=CreateItem('I00N',0,0)
set h.i_ammo=CreateItem('I009',0,0)
set h.weapon="SpellPistol"
call SetUnitAbilityLevel(u,RAW_ABIL_ATTACK,5)
call SetUnitAbilityLevel(u,'A008',3)
call UnitAddAbility(u,'A003')
call UnitMakeAbilityPermanent(u,true,'A003')
call UnitAddAbility(u,'A00U') // bear trap
call UnitMakeAbilityPermanent(u,true,'A00U')
set STATS_CLASSES_USED[7]=STATS_CLASSES_USED[7]+1
endif
call UnitAddItemToSlotById(u,'I00C',2)
//call UnitAddItem(u,CreateItem('I00C',0,0))
//call I(UnitItemInSlot(h.u,0),2)
call UnitAddItem(u,h.i_weapon)
call UnitAddItem(u,h.i_ammo)
call UnitAddItem(u,CreateItem('rsps',0,0))
if mod==3 and survived[GetPlayerId(p)] then
call UnitAddItem(u,CreateItem('I00K',0,0))
endif
call SetItemCharges(UnitItemInSlot(h.u,2),max_grenades)
set h.target=null
set s=foot.Create(u)
set h.foot=s
call spell_addmobile(s)
//set h.hpointer=AddSpecialEffectTarget("height.mdl",u,"origin")
// NAME
if IsUnitInForce(u,player_Force[0]) then
set t=COLOR_TEAM1
set f=0
else
set t=COLOR_TEAM2
set f=1
endif
//10+GetPlayerId(p)
set h.namepointer=label.Create(p,10,-StringLength(GetPlayerName(p))*9,-80,t+GetPlayerName(p)+COLOR_END+"
|c00808080("+GetHeroProperName(u)+")",7,255,255,255)
set h.namepointer.u=h.u
call SetTextTagPermanent(h.namepointer.t,true)
set h.hppointer=label.Create(p,11,-80,130,"",5,255,255,255)
set h.hppointer.u=h.u
set h.hppointer.ui=true
call SetTextTagPermanent(h.hppointer.t,true)
if replay_game then
call SetTextTagVisibility(h.namepointer.t,IsPlayerInForce(GetLocalPlayer(),Force[f]))
call SetTextTagVisibility(h.hppointer.t,IsPlayerInForce(GetLocalPlayer(),Force[f]))
else
call SetTextTagVisibility(h.namepointer.t,true)
call SetTextTagVisibility(h.hppointer.t,true)
endif
call Label_addlabel(h.namepointer)
call Label_addlabel(h.hppointer)
if mod!=3 then
set x=ping.Create(u)
call spell_addmobile(x)
set h.ping=x
endif
set p=null
//call SetTextTagVisibility(h.namepointer.t,IsUnitAlly(u,GetLocalPlayer())) //bulletproof?
//call SetTextTagVisibility(h.hppointer.t,IsUnitAlly(u,GetLocalPlayer())) //bulletproof?
return h
endmethod
method Replace takes integer id returns nothing
local unit u
local real x=GetUnitX(.u)
local real y=GetUnitY(.u)
local Hero h=GetUnitUserData(.u)
call RemoveItem(h.i_weapon)
call RemoveUnit(.u)
set u=CreateUnit(GetOwningPlayer(.u),id,x,y,GetUnitFacing(.u))
set .id=id
set .u=u
call SetUnitUserData(u,h)
call SetUnitX(u,x)
call SetUnitY(u,y)
set .hppointer.u=u
set .namepointer.u=u
set .namepointer.text=COLOR_TEAM2+GetPlayerName(GetOwningPlayer(u))+COLOR_END+"
|c00808080("+GetHeroProperName(u)+")"
call SetTextTagText(.namepointer.t,.namepointer.text,TextTagSize2Height(.namepointer.size))
//if replay_game then
// call SetTextTagVisibility(.namepointer.t,IsPlayerInForce(GetLocalPlayer(),Force[1]))
// call SetTextTagVisibility(.hppointer.t,IsPlayerInForce(GetLocalPlayer(),Force[1]))
//else
// call SetTextTagVisibility(.namepointer.t,true)
// call SetTextTagVisibility(.hppointer.t,true)
//endif
set .foot.u=u
set u=null
endmethod
method onDestroy takes nothing returns nothing
//call DestroyEffect(.hpointer)
set .namepointer.dur=0
set .hppointer.dur=0
call RemoveUnit(.u)
endmethod
endstruct
function Class takes nothing returns nothing
local unit u=GetSoldUnit()
local unit c=GetSellingUnit()
if GetLocalPlayer()==GetOwningPlayer(u) then
call ClearSelection()
call SelectUnit(u,true)
endif
call SetUnitX(u,GetUnitX(c))
call SetUnitY(u,GetUnitY(c))
call KillUnitA(c)
set Cam[GetPlayerId(GetOwningPlayer(u))]=null
set N=N+1
set Heroes[N]=Hero.Create(u)
set Heroes[N].nn=N
set c=null
set u=null
endfunction
function Force5V5Start takes nothing returns nothing
local integer n=MAXPLAYERS/2
local integer i=0
loop
exitwhen i==n
//if IsPlayerInForce(Player(i),Force[1]) then
call ForceRemovePlayer(Force[1],Player(i))
call ForceAddPlayer(Force[0],Player(i))
call ForceRemovePlayer(Force[0],Player(i+5))
call ForceAddPlayer(Force[1],Player(i+5))
call SetPlayerColor(Player(i),PLAYER_COLOR_RED)
call SetPlayerColor(Player(i+5),PLAYER_COLOR_BLUE)
//endif
set i=i+1
endloop
call SetForceAllianceStateBJ(Force[0],Force[0],bj_ALLIANCE_UNALLIED)
call SetForceAllianceStateBJ(Force[1],Force[1],bj_ALLIANCE_UNALLIED)
call SetForceAllianceStateBJ(Force[0],Force[1],bj_ALLIANCE_UNALLIED)
call SetForceAllianceStateBJ(Force[1],Force[0],bj_ALLIANCE_UNALLIED)
call SetForceAllianceStateBJ(Force[0],Force[0],bj_ALLIANCE_ALLIED_VISION)
call SetForceAllianceStateBJ(Force[1],Force[1],bj_ALLIANCE_ALLIED_VISION)
endfunction
function ForceZombieStart takes nothing returns nothing
local integer n=MAXPLAYERS
local integer i=0
loop
exitwhen i==n
if IsPlayerInForce(Player(i),Force[1]) then
call ForceRemovePlayer(Force[1],Player(i))
call ForceAddPlayer(Force[0],Player(i))
call SetPlayerColor(Player(i),PLAYER_COLOR_RED)
endif
set i=i+1
endloop
call SetForceAllianceStateBJ(Force[0],Force[0],bj_ALLIANCE_UNALLIED)
call SetForceAllianceStateBJ(Force[1],Force[1],bj_ALLIANCE_UNALLIED)
call SetForceAllianceStateBJ(Force[0],Force[1],bj_ALLIANCE_UNALLIED)
call SetForceAllianceStateBJ(Force[1],Force[0],bj_ALLIANCE_UNALLIED)
call SetForceAllianceStateBJ(Force[0],Force[0],bj_ALLIANCE_ALLIED_VISION)
call SetForceAllianceStateBJ(Force[1],Force[1],bj_ALLIANCE_ALLIED_VISION)
endfunction
function ForceZombieAdd takes player p returns nothing
local integer n=MAXPLAYERS
local integer i=0
call ForceRemovePlayer(Force[0],p)
call ForceAddPlayer(Force[1],p)
call SetPlayerColor(p,PLAYER_COLOR_BLUE)
set AI_Role[GetPlayerId(p)]=2
loop
exitwhen i==n
if IsPlayerInForce(Player(i),Force[1]) then
if replay_game then
call SetTextTagVisibility(PlayerHero[i].namepointer.t,IsPlayerInForce(GetLocalPlayer(),Force[1]))
call SetTextTagVisibility(PlayerHero[i].hppointer.t,IsPlayerInForce(GetLocalPlayer(),Force[1]))
else
call SetTextTagVisibility(PlayerHero[i].namepointer.t,true)
call SetTextTagVisibility(PlayerHero[i].hppointer.t,true)
endif
endif
set i=i+1
endloop
call SetForceAllianceStateBJ(Force[0],Force[0],bj_ALLIANCE_UNALLIED)
call SetForceAllianceStateBJ(Force[1],Force[1],bj_ALLIANCE_UNALLIED)
call SetForceAllianceStateBJ(Force[0],Force[1],bj_ALLIANCE_UNALLIED)
call SetForceAllianceStateBJ(Force[1],Force[0],bj_ALLIANCE_UNALLIED)
call SetForceAllianceStateBJ(Force[0],Force[0],bj_ALLIANCE_ALLIED_VISION)
call SetForceAllianceStateBJ(Force[1],Force[1],bj_ALLIANCE_ALLIED_VISION)
endfunction
function ClassZombie takes nothing returns nothing
local integer q=mission_player
local Hero h=PlayerHero[q]
call ExecuteFunc("RoundClearBuildingsExec")
call CreateGib(GetUnitX(h.u),GetUnitY(h.u),GetUnitFlyHeight(h.u),-GetUnitFacing(h.u),500)
call ForceZombieAdd(Player(q))
call PlayerHero[q].Replace(RAW_ZOMBIE)
if h.lsd!=0 then
set h.lsd.timed=.5
endif
if GetLocalPlayer()==Player(q) then
call ClearSelection()
call SelectUnit(h.u,true)
endif
call UnitAddAbility(h.u,'AIlz')
call UnitAddAbility(h.u,'A015') //minion generator
call UnitAddItem(h.u,CreateItem('rsps',0,0))
call msg_timed(GetLocalPlayer(),10,STRING_GAME+COLOR_TEAM2+GetPlayerName(Player(q))+COLOR_END+" is zombie!",SOUND_MSG)
call DestroyTimerDialog(game_td_class)
call ExecuteFunc("RoundTimer")
call ExecuteFunc("LabelRemainingExec")
endfunction
function SpawnCreep takes nothing returns nothing
if TimerGetRemaining(game_timer_round)<wave_spawn+1 then
call PauseTimer(game_timer_class)
call TimerDialogDisplay(game_td_class,false)
else
call Creep_Wave(wave,wave_t)
endif
endfunction
function ClassPenalty takes nothing returns nothing
local unit u
local integer n=MAXPLAYERS
local real x=0
local real y=0
loop
set n=n-1
exitwhen n<0
if(Cam[n]!=null)and(GetPlayerPlaying(Player(n))or(AI_active[n]))then
set x=GetUnitX(Cam[n])
set y=GetUnitY(Cam[n])
call KillUnitA(Cam[n])
set u=CreateUnit(Player(n),RAW_MARINE,x,y,0)
if GetLocalPlayer()==GetOwningPlayer(u) then
call ClearSelection()
call SelectUnit(u,true)
endif
set Cam[GetPlayerId(GetOwningPlayer(u))]=null
set N=N+1
set Heroes[N]=Hero.Create(u)
set Heroes[N].nn=N
endif
endloop
if mod==3 then
call ExecuteFunc("ChoosePlayer")
call TimerStart(game_timer_class,ROUND_ZOMBIE,false,function ClassZombie)
call DestroyTimerDialog(game_td_class)
set game_td_class=CreateTimerDialog(game_timer_class)
call TimerDialogSetTitle(game_td_class,"Zombie come in")
call TimerDialogDisplay(game_td_class,true)
elseif mod==4 then
call ExecuteFunc("RoundTimer")
call TimerStart(game_timer_class,wave_spawn,true,function SpawnCreep)
call DestroyTimerDialog(game_td_class)
set game_td_class=CreateTimerDialog(game_timer_class)
call TimerDialogSetTitle(game_td_class,"Spawn in")
call TimerDialogDisplay(game_td_class,true)
call ExecuteFunc("LabelRemainingExec")
else
call DestroyTimerDialog(game_td_class)
call ExecuteFunc("RoundTimer")
call ExecuteFunc("LabelRemainingExec")
endif
set u=null
endfunction
function DrugAll takes integer c returns nothing
local integer n=MAXPLAYERS
local integer i=0
local integer o
loop
exitwhen i==n
set drug[i]=drug[i]+c
if drug[i]<0 then
set drug[i]=0
endif
if drug[i]>1000 then
set o=GetRandomInt(1,100+R2I((drug[i]/500)-.5))
if o>99 then
call DrugAilments(Player(i))
endif
endif
set i=i+1
endloop
endfunction
function Camera takes nothing returns nothing
local integer n=N
local Hero h
local real x
local real y
local real z
local real q=CAMERA_ZOFFSET*.7
local real aoa=300.
local real fov=120.
local integer f
//call DrugAll(-3)
if(not loaded or FILE==-1)then
call CameraSetupApplyForceDuration(gg_cam_BLACK,true,0)
call CameraSetupApplyForceDuration(gg_cam_BLACK,true,10)
return
endif
if not replay_game then
call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE,CAMERA_ZOFFSET,CAMERA_DELAY)
call SetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK,aoa,CAMERA_DELAY)
call SetCameraField(CAMERA_FIELD_FIELD_OF_VIEW,fov,CAMERA_DELAY)
call SetCameraField(CAMERA_FIELD_ROTATION,90,CAMERA_DELAY)
return
endif
loop
exitwhen n==0
if Heroes[n]!=0 then
set h=Heroes[n]
if IsUnitInForce(h.u,player_Force[0]) then
set f=0
else
set f=1
endif
if GetLocalPlayer()==GetOwningPlayer(h.u) and IsAlive(h.u) and not h.satellite then
set z=GetUnitFlyHeight(h.u)+h.zbonus
set x=GetUnitX(h.u)
set y=GetUnitY(h.u)//-q//-z*.59
//if player_drug[GetPlayerId(GetOwningPlayer(h.u))]>250 then
// set z=(player_drug[GetPlayerId(GetOwningPlayer(h.u))]-250)*.03
// set x=x+GetRandomReal(-(5+z),5+z)
// set y=y+GetRandomReal(-(5+z),5+z)
//endif
call PanCameraToTimed(x,y,CAMERA_DELAY)
if h.zbonus>200 then
set aoa=270.
endif
call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE,z+CAMERA_ZOFFSET,CAMERA_DELAY)
call SetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK,aoa,CAMERA_DELAY*1.5)
set z=h.lsd_time
if z==0 then
set z=CAMERA_DELAY*10
endif
call SetCameraField(CAMERA_FIELD_ROTATION,90+Force_rotate[f]+h.lsd_rotate,z)
call SetCameraField(CAMERA_FIELD_FIELD_OF_VIEW,fov,CAMERA_DELAY)
if h.lsd_time>0 then
call CameraSetSourceNoiseEx(500,500,false)
else
//set z=(player_drug[GetPlayerId(GetOwningPlayer(h.u))]*.1)
call CameraSetSourceNoiseEx(2,5,true)
endif
endif
//if h.satellite then
// call CameraSetupApplyForPlayer(true,gg_cam_Satellite,GetOwningPlayer(h.u),0.1)
//endif
endif
set n=n-1
endloop
set n=MAXPLAYERS
loop
set n=n-1
exitwhen n<0
set h=PlayerHero[n]
if IsPlayerInForce(Player(n),player_Force[0]) then
set f=0
else
set f=1
endif
if Cam[n]!=null then
if GetLocalPlayer()==Player(n) and IsAlive(Cam[n]) then
set z=GetUnitFlyHeight(Cam[n])
set x=GetUnitX(Cam[n])
set y=GetUnitY(Cam[n])
call PanCameraToTimed(x,y,CAMERA_DELAY)
call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE,z+CAMERA_ZOFFSET,CAMERA_DELAY)
call SetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK,aoa,CAMERA_DELAY*1.5)
call SetCameraField(CAMERA_FIELD_FIELD_OF_VIEW,fov,CAMERA_DELAY)
call SetCameraField(CAMERA_FIELD_ROTATION,90+Force_rotate[f],CAMERA_DELAY)
endif
// --- pri vyberani operation
elseif mission_unit[100]!=null then
call CameraSetupApplyForPlayer(true,ObsCam[actual_ObsCam],Player(n),0)
call CameraSetupApplyForPlayer(true,ObsCam[actual_ObsCam],Player(n),10)
// --- camera po smrti
elseif not IsAlive(h.u) or h.u==null or h.satellite then
if GetLocalPlayer()==Player(n) then
call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE,CAMERA_ZOFFSET,CAMERA_DELAY)
call SetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK,aoa,CAMERA_DELAY*1.5)
call SetCameraField(CAMERA_FIELD_FIELD_OF_VIEW,fov,CAMERA_DELAY)
call SetCameraField(CAMERA_FIELD_ROTATION,90+Force_rotate[f],CAMERA_DELAY)
endif
endif
endloop
endfunction
function ForceCond takes integer p, boolean inv returns integer
if IsPlayerInForce(Player(p),Force[0]) then
if inv then
return 1
else
return 0
endif
else
if inv then
return 0
else
return 1
endif
endif
return 0
endfunction
function ForceSwap takes nothing returns nothing
local integer n=MAXPLAYERS/2
local integer i=0
local integer f1
local integer f2
loop
exitwhen i==n
set f1=ForceCond(i,false)
set f2=ForceCond(i,true)
call ForceRemovePlayer(Force[f1],Player(i))
call ForceAddPlayer(Force[f2],Player(i))
call SetPlayerColor(Player(i),PLAYER_COLOR_BLUE)
set f1=ForceCond(i+5,false)
set f2=ForceCond(i+5,true)
call ForceRemovePlayer(Force[f1],Player(i+5))
call ForceAddPlayer(Force[f2],Player(i+5))
call SetPlayerColor(Player(i+5),PLAYER_COLOR_RED)
set i=i+1
endloop
endfunction
//######################################################################
//#
//# Init
//#
//######################################################################
private function Init takes nothing returns nothing
local integer n=MAXPLAYERS/2
local integer i=0
set Force[0]=CreateForce()
set Force[1]=CreateForce()
call Force5V5Start()
loop
exitwhen i==n
set Heroes[i]=0
set Heroes[i+5]=0
set PlayerHero[i]=0
set PlayerHero[i+5]=0
set drug[i]=0
set drug[i+5]=0
//call ForceAddPlayer(Force[0],Player(i))
//call ForceAddPlayer(Force[1],Player(i+5))
//call SetPlayerColor(Player(i),PLAYER_COLOR_RED)
//call SetPlayerColor(Player(i+5),PLAYER_COLOR_BLUE)
set i=i+1
endloop
call SetPlayerColor(Player(10),PLAYER_COLOR_BLUE)
call SetPlayerState(Player(10),PLAYER_STATE_GIVES_BOUNTY,1)
call StartCampaignAI(Player(10),"map.ai")
call TimerStart(CreateTimer(),CAMERA_DELAY,true,function Camera)
endfunction
endlibrary
//TESH.scrollpos=932
//TESH.alwaysfold=0
function InitTrig_game takes nothing returns nothing
endfunction
//===========================================================================
library game initializer Init requires Safety, player, spell, item, Label
globals
public timer timer_round=null
public timer timer_class=null
public timer timer_map=null
public timerdialog td_round=null
public timerdialog td_class=null
public timerdialog td_map=null
public boolean About2End=false
private boolean leaving=false
private boolean defused=false
public integer array Count
integer array Score
integer mod=0
integer rounds=0
integer wave
integer wave_t=0
integer wave_dur=0
integer wave_spawn=20
boolean disabled_win=false
boolean possible_rr=true
// commands
boolean cmd_swap=false
// win conditions
private integer gap=4 //default:2 ;+1 ;difference to win
private integer maxwins=10 //default:16
unit array mission_unit
item array mission_item
label mission_label=0
integer mission_player
// misc
private integer dead=0
private integer shrooms=1
integer max_grenades=5
real bombtime=50
//integer max_areas=1
// debug
player autor=null
//private label dbg=0
private integer dbgp=0
endglobals
function Cond_Playing takes nothing returns boolean
return GetPlayerSlotState(GetFilterPlayer())==PLAYER_SLOT_STATE_PLAYING or AI_active[GetPlayerId(GetFilterPlayer())]
endfunction
function Cond_PlayingF0 takes nothing returns boolean
return GetPlayerSlotState(GetFilterPlayer())==PLAYER_SLOT_STATE_PLAYING and IsPlayerInForce(GetFilterPlayer(),player_Force[0])
endfunction
function Cond_PlayingF1 takes nothing returns boolean
return GetPlayerSlotState(GetFilterPlayer())==PLAYER_SLOT_STATE_PLAYING and IsPlayerInForce(GetFilterPlayer(),player_Force[1])
endfunction
function GetPlayingPlayers takes nothing returns integer
return CountPlayersInForceBJ(GetPlayersMatching(Condition(function Cond_Playing)))
endfunction
function GetPlayingPlayersF0 takes nothing returns integer
return CountPlayersInForceBJ(GetPlayersMatching(Condition(function Cond_PlayingF0)))
endfunction
function GetPlayingPlayersF1 takes nothing returns integer
return CountPlayersInForceBJ(GetPlayersMatching(Condition(function Cond_PlayingF1)))
endfunction
function GameNull takes nothing returns nothing
set Score[0]=0
set Score[1]=0
call LeaderboardSetPlayerItemValueBJ(Player(0),GetLastCreatedLeaderboard(),Score[0])
call LeaderboardSetPlayerItemValueBJ(Player(1),GetLastCreatedLeaderboard(),Score[1])
call DrugAll(-9999)
endfunction
function ChoosePlayer takes nothing returns nothing
local integer q=mission_player
local string s="healthy"
set mission_player=-1
loop
exitwhen mission_player!=-1
set mission_player=GetRandomInt(0,9)
if mission_player==q or not IsAlive(player_PlayerHero[mission_player].u) then
set mission_player=-1
endif
endloop
if mission_player==-1 then
set mission_player=0
endif
if GetLocalPlayer()==Player(mission_player) then
set s="|c00FF0000infected|r"
endif
call msg_timed(GetLocalPlayer(),15,"|c0080FF00Your status:|r "+s,SOUND_MSG)
endfunction
function RoundWaveMsg takes nothing returns nothing
call TimerDialogSetTitle(td_round,"Wave: "+I2S(wave)+" Next in")
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,10,STRING_GAME+"Wave: "+I2S(wave))
endfunction
function RoundWave takes nothing returns nothing
call PauseTimer(timer_round)
call PauseTimer(timer_class)
call TimerDialogDisplay(game_td_class,false)
loop
exitwhen Count[1]<=0
call TriggerSleepAction(0)
endloop
if Count[0]>0 then
set wave=wave+1
call RoundWaveMsg()
//call ResumeTimer(timer_round)
call TimerDialogDisplay(game_td_round,false)
call ExecuteFunc("SetWaveTimer")
call TimerStart(timer_class,wave_spawn,true,function SpawnCreep)
call TimerDialogDisplay(game_td_class,true)
//call ResumeTimer(timer_class)
endif
endfunction
function RoundWaveExec takes nothing returns nothing
if Count[0]>0 then
call ExecuteFunc("RoundWave")
else
call PauseTimer(timer_round)
endif
endfunction
function SetWaveTimer takes nothing returns nothing
local real t
if not IsTimerDialogDisplayed(td_round) then
call TimerDialogDisplay(game_td_round,true)
call TimerStart(timer_round,wave_dur,true,function RoundWaveExec)
else
//set t=TimerGetRemaining(timer_round)
//if t>(10-wave_t)*10 then
// call PauseTimer(timer_round)
// call TimerStart(timer_round,t-((10-wave_t)*10),true,function RoundWaveExec)
//endif
endif
endfunction
function SetWaveDuration takes nothing returns nothing
set wave_t=GetPlayingPlayers()
set wave_dur=61+wave_t*10
call SetWaveTimer()
endfunction
//######################################################################
//#
//# resources
//#
//######################################################################
function ResourceStart takes nothing returns nothing
//call AdjustPlayerStateBJ(100,GetEnumPlayer(),PLAYER_STATE_RESOURCE_GOLD)
//call AdjustPlayerStateBJ(1,GetEnumPlayer(),PLAYER_STATE_RESOURCE_FOOD_CAP)
call SetPlayerState(GetEnumPlayer(),PLAYER_STATE_RESOURCE_GOLD,100)
call SetPlayerState(GetEnumPlayer(),PLAYER_STATE_RESOURCE_FOOD_CAP,1)
endfunction
function ResourceWin takes nothing returns nothing
local integer c0=GetPlayingPlayersF0()
local integer c1=GetPlayingPlayersF1()
local integer d=IAbsBJ(c1-c0)
if GetEnumPlayer()==autor then
call echo(I2S(c0)+":"+I2S(c1))
endif
if c0<c1 then
if IsPlayerInForce(GetEnumPlayer(),player_Force[0]) then
set d=d*25
else
set d=0
endif
endif
if c1<c0 then
if IsPlayerInForce(GetEnumPlayer(),player_Force[1]) then
set d=d*25
else
set d=0
endif
endif
if mod==3 then
set d=d+100
endif
call AdjustPlayerStateBJ(100+d,GetEnumPlayer(),PLAYER_STATE_RESOURCE_GOLD)
endfunction
function ResourceLose takes nothing returns nothing
local integer c0=GetPlayingPlayersF0()
local integer c1=GetPlayingPlayersF1()
local integer d=IAbsBJ(c1-c0)
if GetEnumPlayer()==autor then
call echo(I2S(c0)+":"+I2S(c1))
endif
if c0<c1 then
if IsPlayerInForce(GetEnumPlayer(),player_Force[0]) then
set d=d*50
else
set d=0
endif
endif
if c1<c0 then
if IsPlayerInForce(GetEnumPlayer(),player_Force[1]) then
set d=d*50
else
set d=0
endif
endif
if mod==3 then
set d=d+100
endif
call AdjustPlayerStateBJ(200+d,GetEnumPlayer(),PLAYER_STATE_RESOURCE_GOLD)
endfunction
function LabelRemaining takes boolean vis returns nothing
local label a
if vis then
set a=label.Create(Player(11),2,400,-600, "Remaining: "+COLOR_TEAM1+I2S(Count[0])+COLOR_END+" vs "+COLOR_TEAM2+I2S(Count[1])+COLOR_END ,15,255,255,0)
call a.timed(30,60)
call a.anim()
else
set a=label.Create(Player(11),2,400,-600, "" ,15,255,255,0)
call a.timed(0.01,0.02)
endif
call Label_addlabel(a)
endfunction
function LabelRemainingExec takes nothing returns nothing
call LabelRemaining(true)
endfunction
function RoundEndGame takes nothing returns nothing
local trigger t=CreateTrigger()
local dialog dwin=DialogCreate()
local dialog dlose=DialogCreate()
local integer n=MAXPLAYERS
call ReleaseTimer(GetExpiredTimer())
call DestroyTimerDialog(td_round)
call echo("game ends")
call DialogSetMessage(dwin,"You have achieved victory")
call DialogSetMessage(dlose,"You have been defeated")
call EnableUserControl(true)
call EnableUserUI(false)
set bj_changeLevelShowScores=true
call TriggerRegisterDialogButtonEvent(t,DialogAddButton(dwin,"Exit",0))
call TriggerRegisterDialogButtonEvent(t,DialogAddButton(dlose,"Exit",0))
call TriggerAddAction(t,function CustomVictoryOkBJ)
loop
set n=n-1
exitwhen n<0
if IsPlayerInForce(Player(n),player_Force[Score[100]]) then
call RemovePlayer(Player(n),PLAYER_GAME_RESULT_VICTORY)
call DialogDisplay(Player(n),dwin,true)
else
call RemovePlayer(Player(n),PLAYER_GAME_RESULT_DEFEAT)
call DialogDisplay(Player(n),dlose,true)
endif
endloop
set t=null
set dwin=null
set dlose=null
endfunction
function RoundClearItems takes nothing returns nothing
call RemoveItem(GetEnumItem())
endfunction
function RoundClearUnits takes nothing returns nothing
call KillUnitA(GetEnumUnit())
endfunction
function RoundClearBuildings takes player p returns nothing
local group g
set g=GetUnitsOfPlayerAndTypeId(p,'hgtw')
call ForGroup(g,function RoundClearUnits)
call DestroyGroup(g)
set g=GetUnitsOfPlayerAndTypeId(p,'hwtw')
call ForGroup(g,function RoundClearUnits)
call DestroyGroup(g)
set g=GetUnitsOfPlayerAndTypeId(p,'n002')
call ForGroup(g,function RoundClearUnits)
call DestroyGroup(g)
set g=null
endfunction
function RoundClearZombies takes nothing returns nothing
local group g
set g=GetUnitsOfTypeIdAll(RAW_MINION)
call ForGroup(g,function RoundClearUnits)
call DestroyGroup(g)
set g=GetUnitsOfTypeIdAll('nfac')
call ForGroup(g,function RoundClearUnits)
call DestroyGroup(g)
set g=null
endfunction
function RoundClearCreep takes nothing returns nothing
local group g
set g=GetUnitsOfPlayerMatching(Player(10),null)
call ForGroup(g,function RoundClearUnits)
call DestroyGroup(g)
set g=null
endfunction
function RoundClearBuildingsExec takes nothing returns nothing
call RoundClearBuildings(Player(mission_player))
endfunction
function RoundClear takes nothing returns nothing
local blur m
local integer n=player_N
local integer p
local group g
call FogEnable(false)
loop
exitwhen n==0
if player_Heroes[n]!=0 then
if IsAlive(player_Heroes[n].u) then
set m=blur.Create(RAW_DUMMY,GetUnitX(player_Heroes[n].u),GetUnitY(player_Heroes[n].u),GetUnitFlyHeight(player_Heroes[n].u),GetUnitFacing(player_Heroes[n].u),0)
call m.addfx(MODEL_WINNER,"origin")
call spell_addmobile(m)
call AdjustPlayerStateBJ(15,GetOwningPlayer(player_Heroes[n].u),PLAYER_STATE_RESOURCE_GOLD)
if GetUnitTypeId(player_Heroes[n].u)!=RAW_ZOMBIE then
set player_survived[GetPlayerId(GetOwningPlayer(player_Heroes[n].u))]=true
else
set player_survived[GetPlayerId(GetOwningPlayer(player_Heroes[n].u))]=false
endif
//LSD cam fix
if GetLocalPlayer()==GetOwningPlayer(player_Heroes[n].u) then
call CameraSetSourceNoiseEx(2,5,true)
call ResetToGameCamera(2)
endif
endif
set p=GetPlayerId(GetOwningPlayer(player_Heroes[n].u))
call player_Heroes[n].destroy()
//wtf?
set player_PlayerHero[p].u=null
set player_PlayerHero[p]=0
endif
set n=n-1
endloop
call EnumItemsInRect(bj_mapInitialPlayableArea,null,function RoundClearItems)
set g=GetUnitsOfTypeIdAll(RAW_CLASS)
call ForGroup(g,function RoundClearUnits)
call DestroyGroup(g)
set g=GetUnitsOfTypeIdAll('hgtw')
call ForGroup(g,function RoundClearUnits)
call DestroyGroup(g)
set g=GetUnitsOfTypeIdAll('n002')
call ForGroup(g,function RoundClearUnits)
call DestroyGroup(g)
if mod==3 then
call RoundClearZombies()
set g=GetUnitsOfTypeIdAll('hwtw')
call ForGroup(g,function RoundClearUnits)
call DestroyGroup(g)
elseif mod==4 then
call RoundClearCreep()
endif
set g=null
call RemoveUnit(mission_unit[0])
call RemoveUnit(mission_unit[1])
call RemoveUnit(mission_unit[4])
set mission_label.dur=0
call spell_respawnmobiles()
set player_N=0
set Count[0]=0
set Count[1]=0
set defused=false
//call DrugAll(-500)
endfunction
function RoundUp takes nothing returns nothing
local integer q=0
local integer n=MAXPLAYERS
local label a
local unit u
local integer alpha
local real t=ROUND_CLASS
call ReleaseTimer(GetExpiredTimer())
call echo("Round: Spawn")
set possible_rr=true
set rounds=rounds+1
set dead=0
if cmd_swap then
set q=Score[0]
set Score[0]=Score[1]
set Score[1]=q
call ForceSwap()
set cmd_swap=false
set q=0
call LeaderboardSetPlayerItemValueBJ(Player(0),GetLastCreatedLeaderboard(),Score[0])
call LeaderboardSetPlayerItemValueBJ(Player(1),GetLastCreatedLeaderboard(),Score[1])
endif
if mod==1 then
// MISSION
//if IsPlayerInForce(Player(0),player_Force[0]) then
call SetSpawn(Player(0))
//else
// call SetSpawn(Player(5))
//endif
call MoveLocation(Z_HACK,SPAWN_X-128,SPAWN_Y+128)
set mission_unit[0]=CreateUnitAtLoc(Player(0),RAW_MISSION,Z_HACK,235)
call SetUnitColor(mission_unit[0],PLAYER_COLOR_RED)
//if IsPlayerInForce(Player(0),player_Force[0]) then
call SetSpawn(Player(5))
//else
// call SetSpawn(Player(0))
//endif
call MoveLocation(Z_HACK,SPAWN_X+128,SPAWN_Y-128)
set mission_unit[1]=CreateUnitAtLoc(Player(5),RAW_MISSION,Z_HACK,235)
call SetUnitColor(mission_unit[1],PLAYER_COLOR_BLUE)
if IsPlayerInForce(Player(0),player_Force[1]) then
set mission_unit[3]=mission_unit[0]
set mission_unit[0]=mission_unit[1]
set mission_unit[1]=mission_unit[3]
endif
elseif mod==2 then
// BOMB/DEFUSE
//set n=4
//loop
// set n=n+1
// exitwhen n>4+max_areas
// set mission[n]=
//endloop
//set n=GetPlayerId(ForcePickRandomPlayer(player_Force[0]))
//set mission_unit[4]=player_PlayerHero[n].u
set mission_unit[4]=null
set mission_unit[5]=null
if IsPlayerInForce(Player(0),player_Force[0]) then
call SetSpawn(Player(0))
else
call SetSpawn(Player(5))
endif
set mission_item[0]=CreateItem('I00L',SPAWN_X+256,SPAWN_Y-256)
//call UnitAddItem(mission_unit[4],mission_item[0])
elseif mod==3 then
// ZOMBIE MODE
call ForceZombieStart()
set Count[0]=-1
set Count[1]=1
elseif mod==4 then
// COOP MODE
call ForceZombieStart()
call SetWaveDuration()
endif
loop
exitwhen n==0
if(GetPlayerPlaying(Player(n-1))or(AI_active[n-1]))then //(bj_isSinglePlayer))then
call SetSpawn(Player(n-1))
call MoveLocation(Z_HACK,SPAWN_X,SPAWN_Y)
set u=CreateUnitAtLoc(Player(n-1),RAW_CLASS,Z_HACK,270)
call SetUnitPositionLoc(u,Z_HACK)
set alpha=0
if GetLocalPlayer()==Player(n-1) and replay_game then
call PanCameraTo(GetUnitX(u),GetUnitY(u))
call ClearSelection()
call SelectUnit(u,true)
set alpha=255
endif
call SetUnitVertexColor(u,255,255,255,alpha)
set player_Cam[n-1]=u
loop
exitwhen q==FORCES
if IsPlayerInForce(Player(n-1),player_Force[q]) then
set Count[q]=Count[q]+1
endif
set q=q+1
endloop
set q=0
else
call echo("Spawn: Player("+I2S(n)+") not created")
endif
set n=n-1
endloop
set n=shrooms
loop
exitwhen n==0
call CreateItem('I00D',5600+GetRandomReal(-100,100),140+GetRandomReal(-150,150)) //shrooms
call CreateItem('I00D',12414+GetRandomReal(-200,200),GetRandomReal(-230,50)) //shrooms
//call CreateItem('I00J',GetRandomReal(-600,600),GetRandomReal(-600,600)) //weed
//call CreateItem('I00K',GetRandomReal(-600,600),GetRandomReal(-600,600)) //stimpack
set n=n-1
endloop
call AddItemToAllStock('rde1',1,1) //riot shield
call TriggerExecute( gg_trg_remove_blood )
call TreeRespawn()
call item_respawnitems()
set a=label.Create(Player(11),0,-200,0, "NEW ROUND" ,15,255,255,255)
call a.timed(1,3)
call Label_addlabel(a)
if leaving then
if GetPlayingPlayers()==1 then
set a=label.Create(Player(11),0,-200,0, "ARE YOU STILL HERE?" ,15,255,64,64)
call a.timed(55,60)
call Label_addlabel(a)
endif
endif
if rounds==1 then
set t=0.
endif
call TimerStart(timer_class,t,false,function ClassPenalty)
set td_class=CreateTimerDialog(timer_class)
call TimerDialogSetTitle(td_class,"Select Class")
call TimerDialogDisplay(td_class,true)
set u=null
call FogEnable(true)
call CinematicFadeWithUI2(0,0,0,3,"ReplaceableTextures\\CameraMasks\\Black_mask.blp",0,255)
call LabelRemaining(false)
call ExecuteFunc("AI_Round")
endfunction
function RoundSetup takes nothing returns nothing
set possible_rr=false
call echo("Round: New")
call RoundClear()
call TimerStart(NewTimer(),ROUND_SETUP_DELAY,false,function RoundUp)
endfunction
function RoundEnd takes integer f returns nothing
local string s
call echo("Round: end")
call RoundClear()
set Score[100]=f
if f==0 then
set s=COLOR_TEAM1+"Red team"+COLOR_END
else
set s=COLOR_TEAM2+"Blue team"+COLOR_END
endif
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60,s+" won the game")
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60,"
Don't forget visit us at |c00FFFF00www.hoskmap.com|r !!")
call TimerStart(timer_round,GAME_END_WAIT,false,function RoundEndGame)
set td_round=CreateTimerDialog(timer_round)
call TimerDialogSetTitle(td_round,"Time to End")
call TimerDialogDisplay(td_round,true)
call AddSound2D(GetLocalPlayer(),"Sound\\Interface\\ArrangedTeamInvitation.wav")
call statistics()
//set Score[100]=1
call LabelRemaining(false)
set About2End=false
set possible_rr=true
endfunction
function RoundEndCheck takes nothing returns nothing
local label a
call DestroyTimerDialog(td_round)
call DestroyTimerDialog(td_class) //fixing bug?
call PauseTimer(timer_round)
call PauseTimer(timer_class)
call echo("Round: end check")
if disabled_win then
set About2End=false
call RoundSetup()
else
if Score[0]>Score[1]+gap or Score[0]>=maxwins then
//call echo("NT: wins")
call RoundEnd(0)
elseif Score[1]>Score[0]+gap or Score[1]>=maxwins then
//call echo("ST: wins")
call RoundEnd(1)
else
set About2End=false
call RoundSetup()
endif
endif
set a=label.Create(Player(11),3,400,400, "Score: "+I2S(Score[0])+" : "+I2S(Score[1]) ,15,255,255,0)
call a.timed(6,12)
call Label_addlabel(a)
call LeaderboardSetPlayerItemValueBJ(Player(0),GetLastCreatedLeaderboard(),Score[0])
call LeaderboardSetPlayerItemValueBJ(Player(1),GetLastCreatedLeaderboard(),Score[1])
endfunction
//*****************
//* Sets the score
//*****************
function RoundEndScore takes integer f returns nothing
local label a
local string s
local string ui
set possible_rr=false
if f==0 then
set s=COLOR_TEAM1+"RED TEAM"+COLOR_END+" WINS"
call ForForce(player_Force[1],function ResourceLose)
call ForForce(player_Force[0],function ResourceWin)
//call AddSound2DForce(0,"Sound\\Interface\\QuestCompleted.wav")
//call AddSound2DForce(1,"Sound\\Interface\\QuestFailed.wav")
set Score[0]=Score[0]+1
set ui="Sound\\UI\\redteamwins.mp3"
elseif f==1 then
set s=COLOR_TEAM2+"BLUE TEAM"+COLOR_END+" WINS"
call ForForce(player_Force[1],function ResourceWin)
call ForForce(player_Force[0],function ResourceLose)
//call AddSound2DForce(1,"Sound\\Interface\\QuestCompleted.wav")
//call AddSound2DForce(0,"Sound\\Interface\\QuestFailed.wav")
set Score[1]=Score[1]+1
set ui="Sound\\UI\\blueteamwins.mp3"
else
set s=COLOR_TEAM3+"NEITHER TEAM"+COLOR_END+" WINS"
call ForForce(player_Force[0],function ResourceLose)
call ForForce(player_Force[1],function ResourceLose)
//call AddSound2D(GetLocalPlayer(),"Sound\\Interface\\QuestNew.wav")
set ui="Sound\\UI\\neitherteamwins.mp3"
endif
call AddSound2D(GetLocalPlayer(),ui)
set a=label.Create(Player(11),0,-200,0,s,15,255,255,255)
call a.timed(2,ROUND_SETUP_DELAY)
call Label_addlabel(a)
if f==0 then
set s=COLOR_TEAM1+"Red team"+COLOR_END
elseif f==1 then
set s=COLOR_TEAM2+"Blue team"+COLOR_END
else
set s=COLOR_TEAM3+"Neither team"+COLOR_END
endif
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,10,STRING_GAME+s+" wins")
endfunction
function RoundEndTime takes nothing returns nothing
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,10,STRING_GAME+"Round time expired")
if mod==2 then
call RoundEndScore(1)
elseif mod==3 then
call RoundEndScore(0)
else
if Count[0]==Count[1] then
call RoundEndScore(2)
elseif Count[1]>Count[0] then
call RoundEndScore(1)
elseif Count[0]>Count[1] then
call RoundEndScore(0)
endif
endif
call RoundEndCheck()
endfunction
function RoundTimer takes nothing returns nothing
local real t=ROUND_MAX
if rounds!=1 then
set t=t-ROUND_CLASS
endif
if mod==4 then
call SetWaveTimer()
//call TimerStart(timer_round,wave_dur,true,function RoundWave)
set td_round=CreateTimerDialog(timer_round)
call RoundWaveMsg()
call TimerDialogDisplay(td_round,true)
else
call TimerStart(timer_round,t,false,function RoundEndTime)
set td_round=CreateTimerDialog(timer_round)
call TimerDialogSetTitle(td_round,"Round Time")
call TimerDialogDisplay(td_round,true)
endif
endfunction
function RoundRestart takes nothing returns nothing
if timer_class==null or not possible_rr or About2End then
return
endif
if Score[100]>-1 then
call GameNull()
set Score[100]=-1
endif
set possible_rr=false
call PauseTimer(timer_round)
call PauseTimer(timer_class)
call DestroyTimerDialog(td_round)
call DestroyTimerDialog(td_class)
call ClassPenalty()
call RoundEndScore(2)
call RoundEndCheck()
call msg_timed(GetLocalPlayer(),10,STRING_GAME+"Restart round",SOUND_MSG)
endfunction
function RoundStatus takes nothing returns nothing
call ReleaseTimer(GetExpiredTimer())
call echo("Round: status")
if mod==1 then
if (Count[0]<=0 and Count[1]<=0)or(not IsAlive(mission_unit[0]) and not IsAlive(mission_unit[1])) then
call RoundEndScore(2)
elseif Count[0]<=0 or not IsAlive(mission_unit[0]) then
call RoundEndScore(1)
elseif Count[1]<=0 or not IsAlive(mission_unit[1]) then
call RoundEndScore(0)
endif
elseif mod==2 then
//Count[0]<=0 or mission_unit[5]!=null
if (Count[0]<=0 and mission_unit[4]==null) or defused then
call RoundEndScore(1)
elseif mission_unit[4]!=null or Count[1]<=0 then
call RoundEndScore(0)
endif
else
if (Count[0]<=0 and Count[1]<=0) then
call RoundEndScore(2)
elseif Count[0]<=0 then
call RoundEndScore(1)
elseif Count[1]<=0 then
call RoundEndScore(0)
endif
endif
call RoundEndCheck()
endfunction
function GameDeath takes nothing returns nothing
local unit u=GetTriggerUnit()
local Hero h
local integer q=0
local integer z=0
local label a
local boolean b=GetOwningPlayer(u)!=GetOwningPlayer(GetKillingUnit())
local string p1
local string p2
local string extra=""
if GetUnitTypeId(u)=='h002' then
call echo("icon removed")
call UnitSetUsesAltIcon(u,false)
set u=null
return
endif
//********
//* TANK
//********
if GetUnitTypeId(u)==RAW_MISSION then
// normal gametext
if IsUnitInForce(GetKillingUnit(),player_Force[0]) then
set p1=COLOR_TEAM1
else
set p1=COLOR_TEAM2
endif
set p1=p1+GetPlayerName(GetOwningPlayer(GetKillingUnit()))+COLOR_END
if IsUnitInForce(u,player_Force[0]) then
set p2=COLOR_TEAM1
else
set p2=COLOR_TEAM2
endif
set p2=p2+GetUnitName(u)+COLOR_END
call msg_timed(GetLocalPlayer(),ROUND_END_DELAY,p1+" destroyed "+p2,SOUND_MSG)
if p1!=p2 then
call AdjustPlayerStateBJ(75,GetOwningPlayer(GetKillingUnit()),PLAYER_STATE_RESOURCE_GOLD)
endif
if not About2End then
set About2End=true
call TimerStart(NewTimer(),ROUND_END_DELAY,false,function RoundStatus)
call PauseTimer(game_timer_round)
endif
//call KillUnitA(u)
set u=null
return
endif
//********
//* BOMB
//********
if GetUnitTypeId(u)==RAW_BOMB then
if IsUnitInForce(u,player_Force[0]) then
set p2=COLOR_TEAM1
else
set p2=COLOR_TEAM2
endif
set p2=p2+GetUnitName(u)+COLOR_END
if mission_unit[5]!=null then
if IsUnitInForce(mission_unit[5],player_Force[0]) then
set p1=COLOR_TEAM1
else
set p1=COLOR_TEAM2
endif
set p1=p1+GetPlayerName(GetOwningPlayer(mission_unit[5]))+COLOR_END
call msg_timed(GetLocalPlayer(),ROUND_END_DELAY,STRING_GAME+p1+" defused "+p2,SOUND_MSG)
call AdjustPlayerStateBJ(25,GetOwningPlayer(mission_unit[5]),PLAYER_STATE_RESOURCE_GOLD)
set defused=true
call AddSound2D(GetLocalPlayer(),"Sound\\UI\\bombdefuse.mp3")
//call PauseTimer(game_timer_round)
else
call msg_timed(GetLocalPlayer(),ROUND_END_DELAY,STRING_GAME+p2+" succesfully bombed",SOUND_MSG)
call AdjustPlayerStateBJ(25,GetOwningPlayer(u),PLAYER_STATE_RESOURCE_GOLD)
//call PauseTimer(game_timer_round)
endif
if not About2End then
set About2End=true
call TimerStart(NewTimer(),ROUND_END_DELAY,false,function RoundStatus)
call PauseTimer(game_timer_round)
endif
//set mission_unit[4]=null
set mission_label.dur=0
call KillUnitA(u)
set u=null
return
endif
if GetOwningPlayer(u)==Player(10) and IsUnitType(u,UNIT_TYPE_GIANT) then
set Count[1]=Count[1]-1
call LabelRemaining(true)
endif
if IsUnitType(u,UNIT_TYPE_HERO) and GetUnitUserData(u)>0 then //(GetPlayerPlaying(GetOwningPlayer(u))or(bj_isSinglePlayer)) then
set h=GetUnitUserData(u)
loop
exitwhen q==FORCES
if IsPlayerInForce(GetOwningPlayer(u),player_Force[q]) then
set Count[q]=Count[q]-1
set z=Count[q]
endif
set q=q+1
endloop
if((GetPlayerPlaying(GetOwningPlayer(u)))or(AI_active[GetPlayerId(GetOwningPlayer(u))]))then //(bj_isSinglePlayer))
set player_stats_kill[GetPlayerId(GetOwningPlayer(GetKillingUnit()))] = player_stats_kill[GetPlayerId(GetOwningPlayer(GetKillingUnit()))]+1
set player_stats_death[GetPlayerId(GetOwningPlayer(u))] = player_stats_death[GetPlayerId(GetOwningPlayer(u))]+1
if IsUnitAlly(GetKillingUnit(),GetOwningPlayer(u)) and b then
set a=label.Create(GetOwningPlayer(GetKillingUnit()),1,-300,-400, "You Team-Killed "+GetPlayerName(GetOwningPlayer(u)) ,25,255,0,0)
//call AdjustPlayerStateBJ(-50,GetOwningPlayer(GetKillingUnit()),PLAYER_STATE_RESOURCE_GOLD)
elseif b then
set a=label.Create(GetOwningPlayer(GetKillingUnit()),1,-300,-400, "You Killed "+GetPlayerName(GetOwningPlayer(u)) ,25,255,0,0)
call AdjustPlayerStateBJ(50,GetOwningPlayer(GetKillingUnit()),PLAYER_STATE_RESOURCE_GOLD)
else
set a=label.Create(GetOwningPlayer(GetKillingUnit()),1,-300,-400, "You were Killed by Yourself" ,25,255,0,0)
endif
call a.timed(0,5)
call Label_addlabel(a)
if b then
set a=label.Create(GetOwningPlayer(u),1,-300,-400, "You were Killed by "+GetPlayerName(GetOwningPlayer(GetKillingUnit())) ,25,255,0,0)
call a.timed(0,5)
call Label_addlabel(a)
endif
if(dead==0 and not IsUnitAlly(GetKillingUnit(),GetOwningPlayer(u)) and mod!=4)then
set a=label.Create(GetOwningPlayer(GetKillingUnit()),3,-300,-100, "FIRSTBLOOD" ,25,255,0,0)
call a.timed(3,5)
call Label_addlabel(a)
call SetTextTagVelocity(a.t,0,0.012)
call AdjustPlayerStateBJ(25,GetOwningPlayer(GetKillingUnit()),PLAYER_STATE_RESOURCE_GOLD)
set dead=1
set player_stats_fb[GetPlayerId(GetOwningPlayer(GetKillingUnit()))] = player_stats_fb[GetPlayerId(GetOwningPlayer(GetKillingUnit()))]+1
call AddSound2D(GetLocalPlayer(),"Sound\\UI\\firstblood.mp3")
set extra=" - FIRSTBLOOD"
else
set dead=dead+1
endif
// normal gametext
if IsUnitInForce(GetKillingUnit(),player_Force[0]) then
set p1=COLOR_TEAM1
else
set p1=COLOR_TEAM2
endif
set p1=p1+GetPlayerName(GetOwningPlayer(GetKillingUnit()))+COLOR_END
if IsUnitInForce(u,player_Force[0]) then
set p2=COLOR_TEAM1
else
set p2=COLOR_TEAM2
endif
set p2=p2+GetPlayerName(GetOwningPlayer(u))+COLOR_END
call msg_timed(GetLocalPlayer(),6,p1+" killed "+p2+extra,SOUND_MSG)
endif
if Count[1]<=0 and mod==3 then
call RoundClearZombies()
endif
if mod==4 and Count[0]<=0 then
if not About2End then
set About2End=true
call TimerStart(NewTimer(),ROUND_END_DELAY,false,function RoundStatus)
call PauseTimer(game_timer_round)
endif
endif
if mod!=2 and mod!=4 and (Count[0]<=0 or Count[1]<=0) then
if not About2End then
set About2End=true
call TimerStart(NewTimer(),ROUND_END_DELAY,false,function RoundStatus)
call PauseTimer(game_timer_round)
endif
endif
if mod==2 and ((Count[0]<=0 and mission_unit[4]==null) or Count[1]<=0) then
if not About2End then
set About2End=true
call TimerStart(NewTimer(),ROUND_END_DELAY,false,function RoundStatus)
call PauseTimer(game_timer_round)
endif
endif
//********
//* ZOMBIE
//********
if(not IsUnitAlly(GetKillingUnit(),GetOwningPlayer(u)))and(GetUnitTypeId(GetKillingUnit())==RAW_ZOMBIE or GetUnitTypeId(GetKillingUnit())==RAW_MINION)and(mod==3)then
call RoundClearBuildings(GetOwningPlayer(u))
call CreateGib(GetUnitX(u),GetUnitY(u),GetUnitFlyHeight(u),-GetUnitFacing(u),500)
call ForceZombieAdd(GetOwningPlayer(u))
call player_PlayerHero[GetPlayerId(GetOwningPlayer(u))].Replace(RAW_ZOMBIE)
set u=player_PlayerHero[GetPlayerId(GetOwningPlayer(u))].u
if h.lsd!=0 then
set h.lsd.timed=.5
endif
if GetLocalPlayer()==GetOwningPlayer(u) then
call ClearSelection()
call SelectUnit(u,true)
endif
//call UnitAddItem(u,CreateItem('rsps',0,0))
//set Count[0]=Count[0]-1
set Count[1]=Count[1]+1
call LabelRemaining(true)
else
if mod==3 and GetPlayerId(GetOwningPlayer(u))==mission_player and GetUnitTypeId(u)!=RAW_ZOMBIE then
call ChoosePlayer()
endif
call LabelRemaining(true)
if h.revived then
call CreateGib(GetUnitX(u),GetUnitY(u),GetUnitFlyHeight(u),-GetUnitFacing(u),500)
set h.revived=false
call KillUnitA(u)
endif
// BLOOOOOOD :>
call CreateBloodsplat(GetUnitX(u),GetUnitY(u),GetRandomReal(1,2))
call CreateBloodsplat(GetUnitX(u)+GetRandomReal(-100,100),GetUnitY(u)+GetRandomReal(-100,100),GetRandomReal(1,2))
call CreateBloodsplat(GetUnitX(u)+GetRandomReal(-100,100),GetUnitY(u)+GetRandomReal(-100,100),GetRandomReal(1,2))
call SetTextTagVisibility(h.namepointer.t,true)
call SetTextTagVisibility(h.hppointer.t,false)
//set h.hppointer.dur=0
//LSD cam fix
if GetLocalPlayer()==GetOwningPlayer(u) then
call CameraSetSourceNoiseEx(2,5,true)
call ResetToGameCamera(2)
endif
//call TriggerSleepAction(1)
//if not IsAlive(u) then
// call SetTextTagVisibility(h.namepointer.t,true)
// call SetTextTagVisibility(h.hppointer.t,false)
//endif
if z>0 then
call msg_timed(GetOwningPlayer(u),10,STRING_NOTICE+"You are dead now! You must wait for new round - don't leave!",SOUND_MSG)
endif
if not IsGibbed(u) then
set q=MAXPLAYERS
loop
set q=q-1
if IsUnitAlly(player_PlayerHero[q].u,GetOwningPlayer(u)) and IsAlive(player_PlayerHero[q].u) and GetUnitTypeId(player_PlayerHero[q].u)==RAW_MEDIC then
call msg_timed(Player(q),10,STRING_NOTICE+"You should use Morphine to help reviving your fallen ally!",SOUND_MSG)
if GetLocalPlayer()==Player(q) then
call PingMinimap(GetUnitX(u),GetUnitY(u),10)
endif
endif
exitwhen q==0
endloop
call PingIcon(GetPlayerId(GetOwningPlayer(u)),MODEL_ICON_DEATH)
endif
endif
endif
set u=null
endfunction
function GameLeaveAction takes player p returns nothing
local integer n=GetPlayerId(p)
local string p1
local integer f
if IsPlayerInForce(p,player_Force[0]) then
set p1=COLOR_TEAM1
set f=0
else
set p1=COLOR_TEAM2
set f=1
endif
set p1=p1+GetPlayerName(p)+COLOR_END
call msg_timed(GetLocalPlayer(),10,p1+" left the game",SOUND_LEAVER)
set leaving=true
//if mod==3 and n==mission_player and GetUnitTypeId(player_PlayerHero[n].u)!=RAW_ZOMBIE then
// call ChoosePlayer()
//endif
if AI_takeover then
//set AI_active[n]=true
call AI_add(n)
else
set AI_active[n]=false
if player_PlayerHero[n]!=0 then
set player_PlayerHero[n].revived=true
call UnitRemoveBuffs(player_PlayerHero[n].u,true,true)
call UnitDamageTarget(player_PlayerHero[n].u,player_PlayerHero[n].u,9999,false,false,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_UNIVERSAL,null)
call KillUnitA(player_PlayerHero[n].u)
endif
if GetUnitTypeId(player_Cam[n])==RAW_CLASS then
call RemoveUnit(player_Cam[n])
set Count[f]=Count[f]-1
endif
call RemovePlayer(p,null)
call SetWaveDuration()
endif
endfunction
function GameLeave takes nothing returns nothing
call GameLeaveAction(GetTriggerPlayer())
endfunction
function GameStart takes nothing returns nothing
call KillUnitA(mission_unit[100])
set mission_unit[100]=null
call PauseTimer(game_timer_map)
call DestroyTimerDialog(game_td_map)
set rounds=0
call RoundSetup()
call CreateLeaderboardBJ(GetPlayersAll(),"Score:")
call LeaderboardAddItemBJ(Player(0),bj_lastCreatedLeaderboard,"Red Team",0)
call LeaderboardAddItemBJ(Player(1),bj_lastCreatedLeaderboard,"Blue Team",0)
call LeaderboardSetItemLabelColor(bj_lastCreatedLeaderboard,LeaderboardGetPlayerIndex(bj_lastCreatedLeaderboard,Player(0)),255,64,64,255)
call LeaderboardSetItemLabelColor(bj_lastCreatedLeaderboard,LeaderboardGetPlayerIndex(bj_lastCreatedLeaderboard,Player(1)),0,128,255,255)
call LeaderboardSetItemValueColor(bj_lastCreatedLeaderboard,LeaderboardGetPlayerIndex(bj_lastCreatedLeaderboard,Player(0)),255,255,255,255)
call LeaderboardSetItemValueColor(bj_lastCreatedLeaderboard,LeaderboardGetPlayerIndex(bj_lastCreatedLeaderboard,Player(1)),255,255,255,255)
call FogEnable(true)
call CinematicFadeWithUI2(0,0,0,0,"ReplaceableTextures\\CameraMasks\\Black_mask.blp",0,0)
call ResetToGameCamera(0)
call SetCameraBoundsToRect(rect_map)
call EnableWorldFogBoundary(true)
call ForForce(player_Force[0],function ResourceStart)
call ForForce(player_Force[1],function ResourceStart)
endfunction
//######################################################################
//#
//# debuger
//#
//######################################################################
function debuger takes nothing returns nothing
//set dbg.dur=1
//call SetTextTagText(dbg.t,"Labels: " + I2S(Label_count()) + "|n" + "Mobiles: " + I2S(spell_count()) + "|n" + "I: " + I2S(item_count()) ,TextTagSize2Height(8))
endfunction
function debuger_start takes nothing returns nothing
local string s
local integer n=0
loop
exitwhen n>=MAXPLAYERS
set s=StringCase(GetPlayerName(Player(n)),false)
if s=="anaconda.svk" or s=="worldedit" then
set autor=Player(n)
set dbgp=n
set n=99
endif
set n=n+1
endloop
//if n==100 then
// call TimerStart(NewTimer(),.3,true,function debuger)
// set dbg=label.Create(Player(dbgp),-1,-400,-600,"",10,255,255,64)
// call SetTextTagPermanent(dbg.t,true)
// call Label_addlabel(dbg)
// call echo("|c0080FF00debug: author found")
//endif
endfunction
//######################################################################
//#
//# Init
//#
//######################################################################
function TICK takes nothing returns nothing
local real t
local timerdialog td
loop
exitwhen 0==1
call TriggerSleepAction(0)
if IsTimerDialogDisplayed(td_round) then
set t=TimerGetRemaining(timer_round)
set td=td_round
elseif IsTimerDialogDisplayed(td_class) then
set t=TimerGetRemaining(timer_class)
set td=td_class
elseif IsTimerDialogDisplayed(td_map) then
set t=TimerGetRemaining(timer_map)
set td=td_map
else
set t=11
set td=null
endif
if t<10. then
call TimerDialogSetTimeColor(td,255,0,0,255)
call TriggerSleepAction(0)
call TimerDialogSetTimeColor(td,255,204,0,255)
endif
endloop
set td=null
endfunction
private function Init takes nothing returns nothing
local trigger t
call debuger_start()
set timer_class=CreateTimer()
set timer_round=CreateTimer()
set timer_map=CreateTimer()
call ExecuteFunc("TICK")
set t=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_DEATH)
call TriggerAddAction(t,function GameDeath)
set t=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction(t,function Spell)
set t=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SELL)
call TriggerAddAction(t,function Class)
set t=CreateTrigger()
call TriggerRegisterPlayerEventLeave(t,Player(0))
call TriggerRegisterPlayerEventLeave(t,Player(1))
call TriggerRegisterPlayerEventLeave(t,Player(2))
call TriggerRegisterPlayerEventLeave(t,Player(3))
call TriggerRegisterPlayerEventLeave(t,Player(4))
call TriggerRegisterPlayerEventLeave(t,Player(5))
call TriggerRegisterPlayerEventLeave(t,Player(6))
call TriggerRegisterPlayerEventLeave(t,Player(7))
call TriggerRegisterPlayerEventLeave(t,Player(8))
call TriggerRegisterPlayerEventLeave(t,Player(9))
call TriggerAddAction(t,function GameLeave)
//call CinematicFadeWithUI2(0,0,0,0,"ReplaceableTextures\\CameraMasks\\Black_mask.blp",0,0)
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,20,"|c0080FF00More info:|r press |cffffcc00F9|r
|c0080FF00Hotkeys:|r
|cffffcc00Q|r - Attack
|cffffcc00W|r - Grenade
|cffffcc00E|r - Knife
|cffffcc00Z|r,|cffffcc00X|r,|cffffcc00C|r - Class specific abilities
|c00808080Type -help to see them again|r
")
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,20,"|c0080FF00Loading...|r")
loop
call TriggerSleepAction(0)
exitwhen(loaded)
endloop
//call TriggerSleepAction(0)
//call TriggerSleepAction(0)
//call TriggerSleepAction(0)
//call TriggerSleepAction(0)
//call TriggerSleepAction(0)
//call ClearTextMessages()
call TriggerSleepAction(1)
call CinematicFadeWithUI2(0,0,0,2,"ReplaceableTextures\\CameraMasks\\Black_mask.blp",100,0)
call TriggerSleepAction(3)
set FILE=0
call MAP_Init()
call PolledWait(3)
call FlashQuestDialogButton()
set t=null
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
function InitTrig_AI takes nothing returns nothing
endfunction
//======================================================================
library AI initializer Init requires config, spell, player
globals
private constant real period=.33
private integer N
public boolean takeover=true
public boolean array active
public unit array target
public string array Order
public integer array Role
public unit bombsite=null
private constant integer names=33
private string array name
private boolean array name_used
endglobals
//========
// Roles
// 0 - standart
// 1 - bomber
// 2 - pusher
// 3 - wander
private function get_name takes nothing returns string
local integer i
loop
set i=GetRandomInt(0,names)
exitwhen not name_used[i]
endloop
set name_used[i]=true
return name[i]
endfunction
private function type_prefer_knife takes integer i returns boolean
return(i==RAW_ZOMBIE or i==RAW_STALKER or i==RAW_CLOAKED)
endfunction
private function get_random_bombsite takes nothing returns unit
local group g
local group b=CreateGroup()
local unit c
set g=GetUnitsOfTypeIdAll('h001')
loop
set c=FirstOfGroup(g)
exitwhen c==null
if RectContainsUnit(rect_map,c) then
call GroupAddUnit(b,c)
endif
call GroupRemoveUnit(g,c)
endloop
set c=GroupPickRandomUnit(b)
call DestroyGroup(g)
set g=null
call DestroyGroup(b)
set b=null
return c
endfunction
private function get_hp_percent takes unit u returns integer
local real a=GetUnitState(u,UNIT_STATE_MAX_LIFE)
local real b=GetWidgetLife(u)
return R2I((b/a)*100+.5)
endfunction
private function get_gun_range takes integer m returns real
local integer gun=GetUnitAbilityLevel(player_PlayerHero[m].u,RAW_ABIL_ATTACK)
if gun==1 then
return 6250000. //2500
elseif gun==2 then
return 765625. //875
elseif gun==3 then
return 7290000. //2700
elseif gun==4 then
return 2762244. //1662
elseif gun==5 then
return 7562500. //2750
else
return 10000.
endif
endfunction
private function is_target_valid takes integer m returns boolean
return(IsAlive(target[m]) and IsUnitEnemy(target[m],Player(m)))
endfunction
function pica takes nothing returns boolean
return GetUnitAbilityLevel(GetFilterUnit(),'Aloc')==0
endfunction
private function get_random_enemy takes integer m returns nothing
local integer n=MAXPLAYERS
local integer i=0
local integer array a1
local integer a2=0
if mod==4 then
if IsAlive(target[m]) then
return
endif
set target[m]=GroupPickRandomUnit(GetUnitsOfPlayerMatching(Player(10),Condition(function pica)))
return
endif
set a1[0]=-1
loop
exitwhen i==n
if IsPlayerEnemy(Player(m),Player(i)) then
if IsAlive(player_PlayerHero[i].u) then
set a1[a2]=i
set a2=a2+1
endif
endif
set i=i+1
endloop
if a1[0]==-1 then
set target[m]=null
else
set target[m]=player_PlayerHero[a1[GetRandomInt(0,a2-1)]].u
endif
endfunction
private function get_medikit takes integer m returns boolean
local boolean b=false
local unit u
local unit c=null
local integer n=MAXPLAYERS
local integer i=0
local integer x=100
loop
exitwhen i==n
if IsPlayerAlly(Player(m),Player(i)) then
set u=player_PlayerHero[i].u
if IsAlive(u) and get_hp_percent(u)<x then
set i=n-1
set x=get_hp_percent(u)
set c=u
endif
endif
set i=i+1
endloop
if c!=null then
call IssueTargetOrderById(player_PlayerHero[m].u,852609,c)
set b=true
endif
set u=null
set c=null
return b
endfunction
private function get_knife takes integer n returns boolean
local boolean b=false
local real x=GetUnitX(player_PlayerHero[n].u)
local real y=GetUnitY(player_PlayerHero[n].u)
local group g=CreateGroup()
local boolexpr filter
local unit c
local integer f
set conunit=player_PlayerHero[n].u
set filter=Condition(function IsEnemy)
call GroupEnumUnitsInRange(g,x,y,250,filter)
call DestroyBoolExpr(filter)
set filter=null
call GroupRemoveUnit(g,player_PlayerHero[n].u)
if IsPlayerInForce(Player(n),player_Force[0]) then
set f=0
elseif IsPlayerInForce(Player(n),player_Force[1]) then
set f=1
endif
if IsUnitInGroup(target[n],g) then
set b=true
else
loop
set c=FirstOfGroup(g)
if f==0 and c==mission_unit[4] then
set b=true
endif
if IsUnitInForce(c,player_Force[1-f]) and GetOwningPlayer(c)!=Player(11) then
set b=true
set target[n]=c
endif
exitwhen(c==null or b)
call GroupRemoveUnit(g,c)
endloop
endif
call DestroyGroup(g)
set g=null
set c=null
return b
endfunction
private function get_fast_distance takes real x1, real y1, real x2, real y2 returns real
local real x=x2-x1
local real y=y2-y1
return (x*x+y*y)///10000.
endfunction
private function get_hitscan takes integer n returns boolean
local boolean b=true
local boolean r=true
local real d=128.
local real x=GetUnitX(player_PlayerHero[n].u)
local real y=GetUnitY(player_PlayerHero[n].u)
local real x2=GetUnitX(target[n])
local real y2=GetUnitY(target[n])
local integer h1=GetTerrainCliffLevel(x,y)
local integer h2=GetTerrainCliffLevel(x2,y2)
local integer h
local real vx=(x-x2)/d
local real vy=(y-y2)/d
local integer i=R2I((get_fast_distance(x,y,x2,y2)/(d*d))+.5)
//call echo("hiscan x: "+I2S(i))
if i>80 then
return false
endif
loop
exitwhen i<=0
set x=x+vx
set y=y+vy
set h=GetTerrainCliffLevel(x,y)
if h>h1+1 or h>h2+1 then
if not b then
set i=0
set r=false
endif
set b=false
endif
set i=i-1
endloop
return r
endfunction
private function attack takes integer n, Hero h returns nothing
local integer w_k=5
local integer w_g=4
local integer id=GetUnitTypeId(h.u)
local real x=h.foot.x+GetRandomReal(-1500,1500)
local real y=h.foot.y+GetRandomReal(-1500,1500)
if type_prefer_knife(id) then
set w_k=1
call IssuePointOrder(h.u,"summonfactory",x,y)
call TriggerSleepAction(0)
endif
if GetRandomInt(0,w_k)==0 then
if get_knife(n) then
call IssueImmediateOrder(h.u,"inferno") //knife
endif
elseif GetRandomInt(0,w_g)==0 then
//call IssuePointOrder(h.u,"monsoon",x,y) //smoke
if h.id!=RAW_MARINE then
call IssueImmediateOrder(h.u,"starfall")
endif
if h.id==RAW_MEDIC then
call IssueImmediateOrderById(h.u,852273)
call TriggerSleepAction(0)
call get_medikit(n)
endif
call IssueImmediateOrder(h.u,"berserk")
else
set x=GetUnitX(target[n])+GetRandomReal(-50,50)
set y=GetUnitY(target[n])+GetRandomReal(-50,50)
if h.lsd!=0 or GetUnitTypeId(target[n])==RAW_CLOAKED then
set x=x+GetRandomReal(-1000,1000)
set y=y+GetRandomReal(-1000,1000)
endif
if not IsFoggedToPlayer(x,y,Player(n)) then
if get_hitscan(n) then
if h.id==RAW_MARINE and GetRandomInt(0,2)==0 then
if IssueImmediateOrder(h.u,"starfall") then
call TriggerSleepAction(GetRandomReal(0,1))
endif
endif
if get_gun_range(n)>=get_fast_distance(h.foot.x,h.foot.y,x,y) then
call IssuePointOrder(h.u,"absorb",x,y) //shooting
call TriggerSleepAction(GetRandomReal(0,1))
endif
if GetRandomInt(0,6)==0 then
call IssuePointOrder(h.u,"taunt",x,y) //nade
call IssuePointOrder(h.u,"silence",x,y) //lsd/airstrike
call IssuePointOrder(h.u,"monsoon",x,y) //smoke
call IssuePointOrder(h.u,"starfall",x,y)
endif
set Order[n]="run"
else
if GetRandomInt(0,2)==0 then
call TriggerSleepAction(GetRandomReal(0,2))
call get_random_enemy(n)
endif
call IssuePointOrder(h.u,"evileye",h.foot.x,h.foot.y) //sentinel
endif
else
//call IssuePointOrder(h.u,"monsoon",x,y) //smoke
//call IssuePointOrder(h.u,"silence",x,y) //lsd/airstrike
endif
//call IssuePointOrder(h.u,"summonfactory",x,y)
endif
endfunction
private function class takes integer n returns nothing
local integer i=GetRandomInt(0,7)
if i==0 then
set i=RAW_MARINE
elseif i==1 then
set i=RAW_MEDIC
elseif i==2 then
set i=RAW_SNIPER
elseif i==3 then
set i=RAW_SCOUT
elseif i==4 then
set i=RAW_OPERATOR
elseif i==5 then
set i=RAW_GUNNER
elseif i==6 then
set i=RAW_STALKER
elseif i==7 then
set i=RAW_MEDIC
endif
if not IssueNeutralImmediateOrderById(GetOwningPlayer(player_Cam[n]),player_Cam[n],i) then
call TriggerSleepAction(0)
call class(n)
endif
endfunction
function AI_move takes nothing returns nothing
local integer n=N
local Hero h=player_PlayerHero[n]
local integer id=GetUnitTypeId(player_Cam[n])
local real x
local real y
local string order
local integer spread=500
if id==RAW_CLASS then
set bombsite=null
call class(n)
set target[n]=null
set Order[n]="shop"
call TriggerSleepAction(GetRandomReal(3,6))
set Order[n]="stand"
return
elseif h==0 or not IsAlive(h.u)then
return
endif
set x=h.foot.x
set y=h.foot.y
set order=OrderId2String(GetUnitCurrentOrder(h.u))
if not IsAlive(target[n]) then
set target[n]=null
//call TriggerSleepAction(0)
set Order[n]="run"
endif
// polozenie bomby
if mod==2 then
if IsUnitInForce(h.u,player_Force[0]) and GetRandomInt(0,15)==0 then
if GetItemX(mission_item[0])!=0. and GetItemY(mission_item[0])!=0. then
call IssueTargetOrder(h.u,"smart",mission_item[0])
call TriggerSleepAction(0)
endif
endif
if GetUnitAbilityLevel(h.u,'B000')>0 then
if UnitHasItem(h.u,mission_item[0]) then
call TriggerSleepAction(0)
call UnitUseItem(h.u,mission_item[0])
endif
endif
endif
if Role[n]==2 and (GetRandomInt(0,5)==0 or h.id==RAW_ZOMBIE) then
set Order[n]="attack"
endif
if order!="move" then
if (GetRandomInt(0,1)==0 and target[n]!=null)or Order[n]=="attack" then
if h.id==RAW_ZOMBIE or h.id==RAW_STALKER or h.id==RAW_CLOAKED then
set spread=25
set Order[n]="stand"
endif
set x=GetUnitX(target[n])+GetRandomInt(-spread,spread)
set y=GetUnitY(target[n])+GetRandomInt(-spread,spread)
endif
//wander
if GetRandomInt(0,4)==0 and Role[n]==3 then
call TriggerSleepAction(0)
set x=x+GetRandomInt(-500,500)
set y=y+GetRandomInt(-500,500)
endif
//ide na bombovisko
if UnitHasItem(h.u,mission_item[0]) or (Role[n]==1 and GetRandomInt(0,3)==0)then
set x=GetUnitX(bombsite)+GetRandomInt(-250,250)
set y=GetUnitY(bombsite)+GetRandomInt(-250,250)
endif
//ide defuse
if mission_unit[4]!=null and IsPlayerInForce(Player(n),player_Force[1]) and (GetRandomInt(0,2)==0 or Role[n]==1) then
set x=GetUnitX(mission_unit[4])
set y=GetUnitY(mission_unit[4])
call TriggerSleepAction(GetRandomReal(1,2))
call attack(n,h)
endif
if (mod==3 or target[n]==null) or (Role[n]==3 and GetRandomInt(0,3)==0)then
set x=x+GetRandomInt(-64,64)*32
set y=y+GetRandomInt(-64,64)*32
set Order[n]="stand"
call TriggerSleepAction(GetRandomReal(0,2))
set Order[n]="run"
endif
call IssuePointOrder(h.u,"move",x+GetRandomInt(-50,50),y+GetRandomInt(-50,50))
if Order[n]=="stand" then
call TriggerSleepAction(GetRandomReal(0,2))
endif
endif
if(h.id==RAW_ZOMBIE)or(GetRandomInt(0,5)==0 and target[n]!=null)then
call TriggerSleepAction(GetRandomReal(0,.5))
if not is_target_valid(n) then
call get_random_enemy(n)
endif
call attack(n,h)
if GetRandomInt(0,3)==0 then
call TriggerSleepAction(0)
endif
set Order[n]="run"
else
if Order[n]!="shop" then
call TriggerSleepAction(GetRandomReal(1,5))
call get_random_enemy(n)
set Order[n]="attack"
call TriggerSleepAction(GetRandomReal(1,2))
call get_random_enemy(n)
endif
endif
//call echo("ai_move_done")
endfunction
function AI_Round takes nothing returns nothing
local integer n=MAXPLAYERS
local integer i=0
loop
exitwhen i==n
if active[i] then
set Role[i]=GetRandomInt(0,3)
if(mod!=0 or mod!=2)and Role[i]==1 then
set Role[i]=2
endif
endif
set i=i+1
endloop
if mod==2 then
set bombsite=get_random_bombsite()
endif
endfunction
private function tick takes nothing returns nothing
local integer n=MAXPLAYERS
local integer i=0
loop
exitwhen i==n
if active[i] then
set N=i
call ExecuteFunc("AI_move")
endif
set i=i+1
endloop
endfunction
function AI_add takes integer p returns nothing
set active[p]=true
set target[p]=null
call StartCampaignAI(Player(p),"map.ai")
call SetPlayerName(Player(p),"(AI)"+GetPlayerName(Player(p)))
endfunction
private function Init takes nothing returns nothing
local integer n=MAXPLAYERS
local integer i=0
set name[0]="Bob"
set name[1]="Shrapnel"
set name[2]="Bubba"
set name[3]="Dead Eye"
set name[4]="Brass"
set name[5]="Jarhead"
set name[6]="Meth"
set name[7]="Leatherneck"
set name[8]="Devil Dog"
set name[9]="Smoke"
set name[10]="Zoomie"
set name[11]="Baker"
set name[12]="Tank"
set name[13]="Grunt"
set name[14]="Joe"
set name[15]="Spoon"
set name[16]="Doughboy"
set name[17]="Ice"
set name[18]="Mr Nice :)"
set name[19]="Trenky"
set name[20]="Trickey"
set name[21]="Keyord"
set name[22]="Pando"
set name[23]="Quicky"
set name[24]="Jooky"
set name[25]="Hollow"
set name[26]="Alpha"
set name[27]="Shek"
set name[28]="Barto"
set name[29]="ZigZag"
set name[30]="Phobos"
set name[31]="Charon"
set name[32]="Eddie"
set name[33]="Smack"
loop
exitwhen i==n
if GetPlayerCompPlaying(Player(i)) then//or (bj_isSinglePlayer and i!=0) then//or not GetPlayerPlaying(Player(i)) then
call SetPlayerName(Player(i),get_name())
call AI_add(i)
//call echo("ai_"+GetPlayerName(Player(i))+"_activated")
//else
// set active[i]=false
endif
set i=i+1
endloop
call TimerStart(CreateTimer(),period,true,function tick)
call StartCampaignAI(Player(11),"map.ai")
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
//===========================================================================
library DIE initializer Init requires spell
function Trig_Untitled_Trigger_002_Conditions takes nothing returns boolean
return GetUnitTypeId(GetTriggerUnit())=='ncg3' or GetInventoryIndexOfItemTypeBJ(GetTriggerUnit(),'I000')>0
endfunction
function GetInventoryChargesOfItemType takes unit u, integer id returns integer
local integer index
local item indexItem
local integer c=0
set index = 0
loop
set indexItem = UnitItemInSlot(u, index)
if (indexItem != null) and (GetItemTypeId(indexItem) == id) then
set c=c+GetItemCharges(indexItem)
endif
set index=index+1
exitwhen index>=bj_MAX_INVENTORY
endloop
set indexItem=null
return c
endfunction
function Trig_DIE_Actions takes nothing returns nothing
local unit u=GetTriggerUnit()
local unit t=GetKillingUnit()
local real x=GetUnitX(u)
local real y=GetUnitY(u)
local real spread=128
local group g
local boolexpr filter
local unit c
local blur s
local integer i
local integer q=0
local Hero h
if GetUnitTypeId(GetTriggerUnit())=='ncg3' then
if GetUnitUserData(u)==0 then
call TriggerSleepAction(GetRandomReal(0,.3))
call SetUnitUserData(u,1)
elseif GetUnitUserData(u)==1 then
set u=null
set t=null
return
endif
else
set h=GetUnitUserData(u)
set h.revived=false
set i=GetInventoryChargesOfItemType(u,'I000')-1
set i=q
loop
exitwhen i<=0
set c=CreateUnit(Player(PLAYER_NEUTRAL_AGGRESSIVE),'ncg3',x,y,0)
call SetUnitVertexColor(c,0,0,0,0)
call SetUnitPathing(c,false)
call SetUnitX(c,x+GetRandomReal(-spread,spread))
call SetUnitY(c,y+GetRandomReal(-spread,spread))
call SetUnitUserData(c,2)
set i=i-1
endloop
endif
set g=CreateGroup()
// set conunit=u
set filter=Condition(function IsAll)
call GroupEnumUnitsInRange(g,x,y,450,filter)
call DestroyBoolExpr(filter)
set filter=null
//call GroupRemoveUnit(g,u)
loop
set c=FirstOfGroup(g)
exitwhen c==null
call GroupRemoveUnit(g,c)
call UnitDamageTarget(t,c,100+GetRandomInt(0,25),false,false,ATTACK_TYPE_MAGIC,DAMAGE_TYPE_MAGIC,null)
// Blood
if not IsUnitType(c,UNIT_TYPE_MECHANICAL) then
if not IsAlive(c) then
call CreateGib(GetUnitX(c),GetUnitY(c),GetUnitFlyHeight(c),-GetUnitFacing(c),500)
call KillUnitA(c)
else
//if GetRandomInt(0,3)==0 then
call UnitBurn(t,c)
//endif
call DestroyEffect(AddSpecialEffectTarget(MODEL_BLOOD,c,"chest"))
call CreateBloodsplat(GetUnitX(c),GetUnitY(c),GetRandomReal(0.9,1.2))
endif
endif
call CreateBeep(u,c)
endloop
call DestroyGroup(g)
set g=null
set t=null
call EnumDestructablesInCircle(x,y,150,function TreeKill)
call EnumDestructablesInCircle(x,y,500,function TreeShake)
if GetUnitUserData(u)!=2 then
set s=blur.Create(RAW_DUMMY,x,y,GetUnitFlyHeight(u)+12,GetRandomReal(0,360),0)
set s.fadeduration=22
if GetUnitFlyHeight(s.u)>40 then
call s.addfx(MODEL_EXPLO_AIR,"origin")
else
call s.addfx("Model\\EXground2.mdl","origin")
endif
call AddSound(s.u,SOUND_EXPLO())
call AddSoundStereo(s.u,"sound\\explosion_L.mp3","sound\\explosion_R.mp3")
call spell_addmobile(s)
call SetUnitScale(s.u,1.5+(q*0.1),0,0)
call DestroyEffect(s.fx)
set s=blur.Create(RAW_DUMMY,x,y,GetUnitFlyHeight(u)+12,GetRandomReal(0,360),0)
call s.addfx(MODEL_EXPLO_FLARE,"origin")
call SetUnitScale(s.u,4.5,0,0)
call DestroyEffect(s.fx)
endif
call KillUnitA(u)
set c=null
set u=null
endfunction
//===========================================================================
function Init takes nothing returns nothing
set gg_trg_DIE = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_DIE, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_DIE, Condition( function Trig_Untitled_Trigger_002_Conditions ) )
call TriggerAddAction( gg_trg_DIE, function Trig_DIE_Actions )
endfunction
endlibrary
//TESH.scrollpos=21
//TESH.alwaysfold=0
function get_minion_target takes nothing returns integer
local integer n=MAXPLAYERS
local integer i=0
local integer array a1
local integer a2=0
set a1[0]=-1
loop
exitwhen i==n
if IsPlayerInForce(Player(i),player_Force[0]) then
if IsAlive(player_PlayerHero[i].u) then
set a1[a2]=i
set a2=a2+1
endif
endif
set i=i+1
endloop
return a1[GetRandomInt(0,a2-1)]
endfunction
function Trig_vykal_Actions takes nothing returns nothing
local unit u=GetTriggerUnit()
local integer id=GetUnitTypeId(u)
local foot s
if id=='ncg3' then
call SetUnitOwner(u,Player(PLAYER_NEUTRAL_AGGRESSIVE),true)
elseif id=='h002' then
call SetUnitOwner(u,Player(PLAYER_NEUTRAL_AGGRESSIVE),true)
call UnitSetUsesAltIcon(u,true)
elseif id==RAW_MINION then
call SetUnitUseFood(u,true)
set s=foot.Create(u)
call spell_addmobile(s)
loop
exitwhen not IsAlive(u)
if id==-1 or not IsAlive(player_PlayerHero[id].u) then
set id=get_minion_target()
endif
if id==-1 then
call IssueTargetOrder(u,"patrol",player_PlayerHero[GetPlayerId(GetOwningPlayer(u))].u)
else
call IssuePointOrder(u,"attack",GetUnitX(player_PlayerHero[id].u),GetUnitY(player_PlayerHero[id].u))
endif
call TriggerSleepAction(5)
endloop
elseif id=='otau' then
set s=foot.Create(u)
call spell_addmobile(s)
set s.i_shield=CreateItem('rde1',0,0)
call UnitAddItem(u,s.i_shield)
endif
set u=null
endfunction
//===========================================================================
function InitTrig_vykal takes nothing returns nothing
set gg_trg_vykal = CreateTrigger( )
call TriggerRegisterEnterRectSimple( gg_trg_vykal, GetPlayableMapRect() )
call TriggerAddAction( gg_trg_vykal, function Trig_vykal_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_srajda_Conditions takes nothing returns boolean
return GetItemTypeId(GetManipulatedItem())=='tstr'
endfunction
function Trig_srajda_Actions takes nothing returns nothing
local Hero h=GetUnitUserData(GetTriggerUnit())
local integer id=GetItemTypeId(GetManipulatedItem())
//local item i
if GetItemCharges(UnitItemInSlot(h.u,2))==max_grenades then
call msg(GetOwningPlayer(h.u),"|c00FFFF00Notice:|r Grenades already at max!",SOUND_MSG)
call AdjustPlayerStateBJ(50,GetOwningPlayer(h.u),PLAYER_STATE_RESOURCE_GOLD)
else
//if GetItemCharges(UnitItemInSlot(h.u,2))==0 then
// set i=CreateItem(GetItemTypeId(GetManipulatedItem()),0,0)
// call RemoveItem(UnitItemInSlot(h.u,2))
// call UnitAddItem(h.u,i)
//else
call SetItemCharges(UnitItemInSlot(h.u,2),max_grenades)
//endif
endif
//set i=null
endfunction
//===========================================================================
function InitTrig_srajda takes nothing returns nothing
set gg_trg_srajda = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_srajda, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_srajda, Condition( function Trig_srajda_Conditions ) )
call TriggerAddAction( gg_trg_srajda, function Trig_srajda_Actions )
endfunction
//TESH.scrollpos=22
//TESH.alwaysfold=0
function texto takes Hero h returns nothing
call msg(GetOwningPlayer(h.u),"|c0080FF00Weapon:|r "+GetItemName(h.i_weapon),SOUND_MSG)
call msg(GetOwningPlayer(h.u),"|c0080FF00Ammunition:|r "+GetItemName(h.i_ammo),"")
endfunction
function Trig_zbrane_Actions takes nothing returns nothing
local Hero h=GetUnitUserData(GetTriggerUnit())
local integer id=GetItemTypeId(GetManipulatedItem())
local item i
local real r
//========= GUNS ========
if id=='I001' then
set h.weapon="SpellRifle"
set h.i_weapon=GetManipulatedItem()
call UnitAddAbility(h.u,'A000')
call texto(h)
elseif id=='I002' then
set h.weapon="SpellShotgun"
set h.i_weapon=GetManipulatedItem()
call UnitAddAbility(h.u,'A000')
call texto(h)
elseif id=='I008' then
set h.weapon="SpellSniper"
set h.i_weapon=GetManipulatedItem()
call UnitAddAbility(h.u,'A000')
call texto(h)
//========= AMMO ========
elseif id=='I004' or id=='I005' or id=='I009' or id=='I00A' or id=='I00B' then
set h.i_ammo=GetManipulatedItem()
if GetItemCharges(h.i_ammo)==0 then
set h.i_ammo=CreateItem(GetItemTypeId(GetManipulatedItem()),0,0)
call RemoveItem(GetManipulatedItem())
call UnitAddItem(h.u,h.i_ammo)
call SetItemCharges(h.i_ammo,1)
else
call SetItemCharges(h.i_ammo,GetItemCharges(h.i_ammo)+1)
endif
if GetItemLevel(UnitItemInSlot(h.u,0))==GetItemLevel(h.i_ammo) then
call texto(h)
else
set h.i_ammo=null
call msg(GetOwningPlayer(h.u),"|c00FFFF00Notice:|r You cannot use this ammo to your weapon!",SOUND_MSG)
endif
//elseif id=='I007' then
// call SpellC4Death(I2U(GetItemUserData(GetManipulatedItem())))
// call RemoveItem(GetManipulatedItem())
elseif id=='I00D' then
set player_drug[GetPlayerId(GetOwningPlayer(h.u))]=player_drug[GetPlayerId(GetOwningPlayer(h.u))]-300
//call DrugAilments(GetOwningPlayer(h.u))
call SpellLSD(h.u,10,2,0.2,0.6)
call AddSound(h.u,"Units\\Undead\\Ghoul\\Cannibalize.wav")
call SetItemDroppable(GetManipulatedItem(),false)
elseif id=='I00K' then
set player_drug[GetPlayerId(GetOwningPlayer(h.u))]=player_drug[GetPlayerId(GetOwningPlayer(h.u))]+600
//call DrugAilments(GetOwningPlayer(h.u))
set r=GetUnitState(h.u,UNIT_STATE_MAX_LIFE)*.2
if r>=GetWidgetLife(h.u) then
set r=GetWidgetLife(h.u)-1
endif
call SetWidgetLife(h.u,GetWidgetLife(h.u)-r)
//call UnitDamageTarget(h.u,h.u,r,false,false,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_UNKNOWN,null)
call AddSound(h.u,"Sound\\drug.mp3")
elseif id=='I00O' then
set player_drug[GetPlayerId(GetOwningPlayer(h.u))]=player_drug[GetPlayerId(GetOwningPlayer(h.u))]+150
call AddSound(h.u,"Sound\\pills.mp3")
set id=0
call PolledWait(1)
if h.lsd!=0 then
set h.lsd.timed=.5
set id=50
endif
//set id=UnitCountBuffsEx(h.u,true,true,true,true,true,true,true)+1
call SetWidgetLife(h.u,GetWidgetLife(h.u)+50+id)
//call UnitRemoveBuffs(h.u,true,true)
call UnitAddItem(h.u,CreateItem('rres',0,0))
endif
set i=null
endfunction
//===========================================================================
function InitTrig_zbrane takes nothing returns nothing
set gg_trg_zbrane = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_zbrane, EVENT_PLAYER_UNIT_USE_ITEM )
call TriggerAddAction( gg_trg_zbrane, function Trig_zbrane_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_zbran_drop_Actions takes nothing returns nothing
local Hero h=GetUnitUserData(GetTriggerUnit())
local integer id=GetItemTypeId(GetManipulatedItem())
//if GetManipulatedItem()==h.i_weapon then
// call UnitRemoveAbility(h.u,'A000')
//endif
if GetManipulatedItem()==h.i_ammo then
set h.i_ammo=null
endif
if GetManipulatedItem()==h.foot.i_shield then
set h.foot.i_shield=null
endif
endfunction
//===========================================================================
function InitTrig_zbran_drop takes nothing returns nothing
set gg_trg_zbran_drop = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_zbran_drop, EVENT_PLAYER_UNIT_DROP_ITEM )
call TriggerAddAction( gg_trg_zbran_drop, function Trig_zbran_drop_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function ItemPickupShield takes Hero h, item i, boolean fix returns nothing
local boolean b=false
if h.id==RAW_STALKER then
set b=true
else
if h.foot.i_shield==null or fix then
set h.foot.i_shield=i
else
set b=true
endif
endif
if b then
call UnitRemoveItem(h.u,i)
endif
endfunction
function ItemFixPosition takes unit u returns nothing
local integer index=1
local item i=UnitItemInSlot(u,0)
local string s
local Hero h
if i!=null then
loop
if UnitItemInSlot(u,index)==null then
set itempickup=false
call SetItemVisible(i,false)
call UnitAddItemToSlotById(u,GetItemTypeId(i),index)
call SetItemCharges(UnitItemInSlot(u,index),GetItemCharges(i))
if GetItemTypeId(i)=='rde1' then
set h=GetUnitUserData(u)
call ItemPickupShield(h,UnitItemInSlot(u,index),true)
endif
call RemoveItem(i)
set itempickup=true
set index=index+99
endif
set index=index+1
exitwhen index>=bj_MAX_INVENTORY
endloop
endif
if index<99 then
call UnitRemoveItem(u,i)
if GetItemCharges(i)>1 then
set s=" were"
else
set s=" was"
endif
call msg(GetOwningPlayer(u),STRING_NOTICE+GetItemName(i)+s+" dropped because of full inventory",SOUND_MSG)
endif
set i=null
endfunction
function Trig_zbran_pick_Actions takes nothing returns nothing
local Hero h=GetUnitUserData(GetTriggerUnit())
local integer id=GetItemTypeId(GetManipulatedItem())
local integer index
local integer stack
local boolean b=false
if not(itempickup) or id=='tstr' then
return
endif
//call echo("item pickup")
if id=='I00L' then
if not IsUnitInForce(GetManipulatingUnit(),player_Force[0]) then
call UnitRemoveItem(GetManipulatingUnit(),GetManipulatedItem())
endif
elseif id=='rde1' then
call ItemPickupShield(h,GetManipulatedItem(),false)
//if h.id==RAW_STALKER then
// set b=true
//else
// if h.foot.i_shield==null then
// set h.foot.i_shield=GetManipulatedItem()
// else
// set b=true
// endif
//endif
//if b then
// call UnitRemoveItem(h.u,GetManipulatedItem())
//endif
else
if GetItemCharges(GetManipulatedItem())>0 and UnitHasItemOfTypeBJ(h.u,id) then
set index = 0
loop
if GetItemTypeId(UnitItemInSlot(h.u,index))==id and UnitItemInSlot(h.u,index)!=GetManipulatedItem() and GetItemCharges(UnitItemInSlot(h.u,index))!=R2I(GetWidgetLife(GetManipulatedItem())) then
set stack=GetItemCharges(UnitItemInSlot(h.u,index))+GetItemCharges(GetManipulatedItem())
if stack>R2I(GetWidgetLife(GetManipulatedItem())) then
call SetItemCharges(UnitItemInSlot(h.u,index),R2I(GetWidgetLife(GetManipulatedItem())))
call SetItemCharges(GetManipulatedItem(),stack-R2I(GetWidgetLife(GetManipulatedItem())))
else
call SetItemCharges(UnitItemInSlot(h.u,index),stack)
call RemoveItem(GetManipulatedItem())
endif
set index=index+99
endif
set index=index+1
exitwhen index>=bj_MAX_INVENTORY
endloop
endif
endif
if lastitem==GetManipulatedItem() then
call ItemFixPosition(h.u)
set lastitem=null
endif
endfunction
//===========================================================================
function InitTrig_zbran_pick takes nothing returns nothing
set gg_trg_zbran_pick = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_zbran_pick, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddAction( gg_trg_zbran_pick, function Trig_zbran_pick_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_zbran_buy_Actions takes nothing returns nothing
local Hero h=GetUnitUserData(GetTriggerUnit())
local integer id=GetItemTypeId(GetSoldItem())
set lastitem=GetSoldItem()
//call echo("item buy")
if id=='rde1' then
call RemoveItemFromStock(GetSellingUnit(),id)
endif
endfunction
//===========================================================================
function InitTrig_zbran_buy takes nothing returns nothing
set gg_trg_zbran_buy = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_zbran_buy, EVENT_PLAYER_UNIT_SELL_ITEM )
call TriggerAddAction( gg_trg_zbran_buy, function Trig_zbran_buy_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
library DIE2 initializer Init2 requires spell
function Trig_die_turret_Conditions takes nothing returns boolean
return GetUnitTypeId(GetDyingUnit())=='hgtw'
endfunction
function Trig_die_turret_Actions takes nothing returns nothing
local blur s
set s=blur.Create(RAW_DUMMY,GetUnitX(GetDyingUnit()),GetUnitY(GetDyingUnit()),1,GetRandomReal(0,360),0)
set s.fadeduration=4
call s.addfx("Model\\EXground.mdl","origin")
call AddSound(s.u,SOUND_EXPLO())
call AddSoundStereo(s.u,"sound\\explosion_L.mp3","sound\\explosion_R.mp3")
call spell_addmobile(s)
call SetUnitScale(s.u,0.8,0,0)
call DestroyEffect(s.fx)
call ResetUnitLookAt(GetDyingUnit())
call KillUnitA(GetDyingUnit())
endfunction
//===========================================================================
function Init2 takes nothing returns nothing
set gg_trg_die_turret = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_die_turret, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_die_turret, Condition( function Trig_die_turret_Conditions ) )
call TriggerAddAction( gg_trg_die_turret, function Trig_die_turret_Actions )
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_cmd_kill_Actions takes nothing returns nothing
local unit u=GroupPickRandomUnit(GetUnitsSelectedAll(Player(0)))
call UnitRemoveBuffs(u,true,true)
call UnitDamageTargetBJ(u,u,4000,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_UNKNOWN)
set u=null
endfunction
//===========================================================================
function InitTrig_cmd_kill takes nothing returns nothing
set gg_trg_cmd_kill = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_cmd_kill, Player(0), "-kill", false )
call TriggerAddAction( gg_trg_cmd_kill, function Trig_cmd_kill_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_cmd_help_Actions takes nothing returns nothing
call msg_timed(GetTriggerPlayer(),10,"|c0080FF00Hotkeys:|r
|cffffcc00Q|r - Attack
|cffffcc00W|r - Grenade
|cffffcc00E|r - Knife
|cffffcc00Z|r,|cffffcc00X|r,|cffffcc00C|r - Class specific abilities",SOUND_MSG)
endfunction
function Trig_cmd_drug_Actions takes nothing returns nothing
call msg_timed(GetTriggerPlayer(),10,"Your drug dependence: "+I2S(player_drug[GetPlayerId(GetTriggerPlayer())]),SOUND_MSG)
endfunction
//===========================================================================
function InitTrig_cmd_help takes nothing returns nothing
local integer i=0
set gg_trg_cmd_help=CreateTrigger()
loop
call TriggerRegisterPlayerChatEvent(gg_trg_cmd_help,Player(i),"-help", false )
set i=i+1
exitwhen i>9
endloop
call TriggerAddAction( gg_trg_cmd_help, function Trig_cmd_help_Actions )
set gg_trg_cmd_help=CreateTrigger()
set i=0
loop
call TriggerRegisterPlayerChatEvent(gg_trg_cmd_help,Player(i),"-drug", false )
set i=i+1
exitwhen i>9
endloop
call TriggerAddAction( gg_trg_cmd_help, function Trig_cmd_drug_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_cmd_fix_Actions takes nothing returns nothing
local Hero h=player_PlayerHero[GetPlayerId(GetTriggerPlayer())]
local integer f=0
if IsPlayerInForce(GetTriggerPlayer(),player_Force[1]) then
set f=1
endif
if h.u!=null and IsAlive(h.u) then
//set replay_game=true
call h.namepointer.destroy()
call h.hppointer.destroy()
set h.namepointer=label.Create(GetTriggerPlayer(),10,-StringLength(GetPlayerName(GetTriggerPlayer()))*9,-80,h.namepointer.text,7,255,255,255)
set h.namepointer.u=h.u
call SetTextTagPermanent(h.namepointer.t,true)
set h.hppointer=label.Create(GetTriggerPlayer(),11,-80,130,"",5,255,255,255)
set h.hppointer.u=h.u
set h.hppointer.ui=true
call SetTextTagPermanent(h.hppointer.t,true)
call SetTextTagVisibility(h.namepointer.t,IsPlayerInForce(GetLocalPlayer(),player_Force[f]))
call SetTextTagVisibility(h.hppointer.t,IsPlayerInForce(GetLocalPlayer(),player_Force[f]))
call Label_addlabel(h.namepointer)
call Label_addlabel(h.hppointer)
call msg_timed(GetTriggerPlayer(),10,"Your texttags have been fixed",SOUND_MSG)
endif
endfunction
//===========================================================================
function InitTrig_cmd_fix takes nothing returns nothing
local integer i=0
set gg_trg_cmd_fix = CreateTrigger( )
loop
call TriggerRegisterPlayerChatEvent(gg_trg_cmd_fix,Player(i),"-fix", false )
set i=i+1
exitwhen i>9
endloop
call TriggerAddAction( gg_trg_cmd_fix, function Trig_cmd_fix_Actions )
endfunction
//TESH.scrollpos=3
//TESH.alwaysfold=0
function Trig_cmd_kick_Actions takes nothing returns nothing
local string s=SubString(GetEventPlayerChatString(),6,7)
local integer p=S2I(s)
local boolean b=AI_takeover
if s==null or s==" " or p==0 then
call msg_timed(Player(0),10,"Player list:",SOUND_MSG)
set p=0
loop
exitwhen p==MAXPLAYERS
if GetPlayerPlaying(Player(p)) or AI_active[p] then
set s=""
if IsPlayerInForce(Player(p),player_Force[0]) then
set s=COLOR_TEAM1
else
set s=COLOR_TEAM2
endif
set s=s+GetPlayerName(Player(p))+"("+I2S(p)+")"+COLOR_END
call msg_timed(Player(0),10,s,"")
endif
set p=p+1
endloop
return
endif
if AI_active[p] then
set AI_takeover=false
endif
call GameLeaveAction(Player(p))
call RemovePlayer(Player(p),PLAYER_GAME_RESULT_DEFEAT)
set AI_takeover=b
//call msg_timed(GetLocalPlayer(),10,GetPlayerName(Player(p))+" have been kicked from the game",SOUND_MSG)
endfunction
//===========================================================================
function InitTrig_cmd_kick takes nothing returns nothing
set gg_trg_cmd_kick = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_cmd_kick, Player(0), "-kick", false )
call TriggerAddAction( gg_trg_cmd_kick, function Trig_cmd_kick_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Untitled_Trigger_001_Conditions takes nothing returns boolean
if ( not ( GetOwningPlayer(GetTriggerUnit()) == Player(0) ) ) then
return false
endif
return true
endfunction
function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
call echo(I2S(GetIssuedOrderId()))
endfunction
//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
set gg_trg_Untitled_Trigger_001 = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Untitled_Trigger_001, EVENT_PLAYER_UNIT_ISSUED_ORDER )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Untitled_Trigger_001, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Untitled_Trigger_001, EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER )
call TriggerAddCondition( gg_trg_Untitled_Trigger_001, Condition( function Trig_Untitled_Trigger_001_Conditions ) )
call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Untitled_Trigger_003_Func001A takes nothing returns nothing
local trigger t
local foot s
if GetUnitTypeId(GetEnumUnit())!=RAW_DUMMY then
//call echo("bla")
set s=foot.Create(GetEnumUnit())
call spell_addmobile(s)
set t=CreateTrigger()
call TriggerRegisterUnitStateEvent(t,GetEnumUnit(),UNIT_STATE_LIFE,LESS_THAN,100)
call TriggerAddAction(t,function SpellDeath)
set t=null
endif
endfunction
function Trig_Untitled_Trigger_003_Actions takes nothing returns nothing
call ForGroupBJ( GetUnitsInRectAll(GetEntireMapRect()), function Trig_Untitled_Trigger_003_Func001A )
endfunction
//===========================================================================
function InitTrig_Untitled_Trigger_003 takes nothing returns nothing
set gg_trg_Untitled_Trigger_003 = CreateTrigger( )
call TriggerAddAction( gg_trg_Untitled_Trigger_003, function Trig_Untitled_Trigger_003_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Untitled_Trigger_007_Actions takes nothing returns nothing
local string order
if GetRandomInt(0,6)==0 then
set order="flamestrike"
else
set order="absorb"
endif
call GroupPointOrderLocBJ( GetRandomSubGroup(GetRandomInt(1, 1), GetUnitsOfPlayerAndTypeId(Player(1), 'ogru')), order, GetUnitLoc(GroupPickRandomUnit(GetUnitsOfPlayerAll(Player(0)))) )
endfunction
//===========================================================================
function InitTrig_Untitled_Trigger_007 takes nothing returns nothing
set gg_trg_Untitled_Trigger_007 = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_Untitled_Trigger_007, GetRandomReal(1.00, 3.00) )
call TriggerAddAction( gg_trg_Untitled_Trigger_007, function Trig_Untitled_Trigger_007_Actions )
endfunction