Just going to export and upload, as well as copy and paste, triggers from the Wc3:WoW campaign before it got annihilated from the 1.24 patch. In order to view the campaign, you need to have patch version 1.21 - 1.23. If you don't know how to downgrade your game, just reinstall WarCraft III Reign of Chaos and Frozen Throne and download the 1.23 patch from the bnet site. Then just delete whatever is the cause of the crashes with 1.24 in the World Editor and hopefully then you can install patch 1.24 after and see if it works.
Exported TriggersExported these triggers from K-Mu-South (Southern Mulgore) and Start (Character Creation Map) for you to delete the wrongs in the triggers so it works in 1.24. I strongly recommend you keep 1.23 installed when working on this; 1.24 will ruin it in its current state.
http://www.hiveworkshop.com/forums/pastebin.php?id=t27i6l
http://www.hiveworkshop.com/forums/pastebin.php?id=fty2ca
JASS:
//TESH.scrollpos=378
//TESH.alwaysfold=0
function DistanceBetweenUnits takes unit unitA, unit unitB returns real
return SquareRoot((GetUnitX(unitB) - GetUnitX(unitA)) * (GetUnitX(unitB) - GetUnitX(unitA)) + (GetUnitY(unitB) - GetUnitY(unitA)) * (GetUnitY(unitB) - GetUnitY(unitA)))
endfunction
function Distance takes real x1, real y1, real x2, real y2 returns real
return SquareRoot((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2))
endfunction
function PolarProjectionY takes real y, real angle, real distance returns real
return y + SinBJ(angle)*distance
endfunction
function PolarProjectionX takes real x, real angle, real distance returns real
return x + CosBJ(angle)*distance
endfunction
// a required function for the current base of bonusmod.
// to increase the base you need to change the constant 10.
function Ix takes integer x, integer y returns integer
return(x*10+y)
endfunction
//**************************************************************
// BonusMod code:
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
// Bonus mod is a system which allows you to add arbitrary stats to units
// which have no trigger methods of modifying these values. It is
// currently in optimal form, but does get the job done.
//
// Function Overview:
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
// int BONUSMAX() returns the max bonus appliable using bonusmod.
//
// void clearBonus(unit who,int t): clears all bonuses applied to a unit
// by the bonus mod system.
//
// int getBonus(unit who,int t): finds out the amount of bonus of that type
// is currently applied to a unit
//
// bool setBonus(int amount,unit who,int t): applies the specified amount of
// type bonus to a unit
//
// bool addBonus(int amount,unit who,int t): a quick fluff functions which
// allows you to add or subtract a bonus to a unit.
// Local variables:
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
// unit who: Refers to the unit that is receiving the bonus.
// integer amount: The amount of bonus.
// integer t: the type of the bonus being applied
// Use this little reference chart
// t=type
// ¯¯¯¯¯¯
// 0=dmg
// 1=armor
// 2=hitpoints
// 3=mana
//**************************************************************
function BONUSMAX takes nothing returns integer
return ( R2I(Pow( 2, Ix(1,0)))-1)
endfunction
function clearBonus takes unit who,integer t returns nothing
local integer i=0
local integer limit=Ix(1,-1)
loop
call UnitRemoveAbility( who , udg_BnsBit[Ix(t,i)] )
exitwhen i==limit
set i=i+1
endloop
endfunction
// This returns the amount of bonus type t the unit has.
function getBonus takes unit who,integer t returns integer
local integer array bit
local integer i=1
local integer bonus=0
local integer limit=Ix(1,-1)
set bit[0]=1
loop
set bit[i]=bit[i-1]*2
exitwhen i==limit
set i=i+1
endloop
loop
if (GetUnitAbilityLevel(who,udg_BnsBit[Ix(t,i)])==1) then
set bonus=bonus+bit[i]
endif
exitwhen i==0
set i=i-1
endloop
return bonus
endfunction
// sets the bonus type "t" to amount "amount". Returns true if it was fine
// if it reached the max or you are a moron and gave it bad inputs.
function setBonus takes integer amount,unit who,integer t returns boolean
local integer bonus=amount
local integer array bit
local integer i=1
local integer limit=Ix(1,-1)
set bit[0]=1
loop
set bit[i]=bit[i-1]*2
exitwhen i==limit
set i=i+1
endloop
call clearBonus(who,t)
loop
if (bonus>=bit[i]) then
call UnitAddAbility( who, udg_BnsBit[Ix(t,i)] )
set bonus=bonus-bit[i]
endif
exitwhen i==0
set i=i-1
endloop
return (amount<=BONUSMAX() and t<=3 and t>=0 and amount>=0 and who!=null)
endfunction
//If I was blizzard this was be a prime example of a blizzard.j fluff function.
//It just runs setbonus with the guys current amount of bonus 't'+the amount you send it.
function addBonus takes integer amount,unit who,integer t returns boolean
return setBonus((getBonus(who,t)+amount),who,t)
endfunction
// !!!!!!!!!!!!!!Make sure to call this at map init!!!!!!!!!!!!
// You need to define abilities at increasing powers of 2.
// example: entry 0 will be an attack bonus of 1, entry 1 an attackbonus of 2
// entry 2 will be 4, entry 3 will be 8...
// You also can't remove the creating and removing of dummy unit
// war3 needs to load these or else you get very nasty lag the first
// time each is loaded.
function InitBonusMod takes nothing returns nothing
local unit dummy=CreateUnit(Player(15),'hfoo',0,0,bj_UNIT_FACING )
local integer i=0
call ShowUnit( dummy,false )
set udg_BnsBit[0]='A63X' //dmg
set udg_BnsBit[1]='A63Y'
set udg_BnsBit[2]='A640'
set udg_BnsBit[3]='A641'
set udg_BnsBit[4]='A642'
set udg_BnsBit[5]='A643'
set udg_BnsBit[6]='A644'
set udg_BnsBit[7]='A685'
set udg_BnsBit[8]='A687'
set udg_BnsBit[9]='A689'
set udg_BnsBit[10]='A63H' //armor
set udg_BnsBit[11]='A63I'
set udg_BnsBit[12]='A63M'
set udg_BnsBit[13]='A63O'
set udg_BnsBit[14]='A63P'
set udg_BnsBit[15]='A63Q'
set udg_BnsBit[16]='A63R'
set udg_BnsBit[17]='A63S'
set udg_BnsBit[18]='A63U'
set udg_BnsBit[19]='A63V'
set udg_BnsBit[20]='A68A' //hp
set udg_BnsBit[21]='A68B'
set udg_BnsBit[22]='A68D'
set udg_BnsBit[23]='A68E'
set udg_BnsBit[24]='A68F'
set udg_BnsBit[25]='A68G'
set udg_BnsBit[26]='A68H'
set udg_BnsBit[27]='A68J'
set udg_BnsBit[28]='A68K'
set udg_BnsBit[29]='A68M'
set udg_BnsBit[30]='A68N' //mp
set udg_BnsBit[31]='A68P'
set udg_BnsBit[32]='A68Q'
set udg_BnsBit[33]='A68S'
set udg_BnsBit[34]='A68T'
set udg_BnsBit[35]='A68V'
set udg_BnsBit[36]='A68X'
set udg_BnsBit[37]='A68Y'
set udg_BnsBit[38]='A690'
set udg_BnsBit[39]='A691'
loop
call addBonus( BONUSMAX(), dummy,i)
call addBonus( -1*BONUSMAX(), dummy,i)
set i=i+1
exitwhen (i==4)
endloop
call RemoveUnit(dummy)
endfunction
//Sim Error
// Requries
// - udg_SimError (sound)
function SimError takes player ForPlayer, string msg returns nothing
if udg_SimError==null then
set udg_SimError=CreateSoundFromLabel( "InterfaceError",false,false,false,10,10)
endif
if (GetLocalPlayer() == ForPlayer) then
call ClearTextMessages()
call DisplayTimedTextToPlayer( ForPlayer, 0.52, -1.00, 2.00, "|cffffcc00"+msg+"|r" )
call StartSound( udg_SimError )
endif
endfunction
//Handle Vars modified for Auto Init
// Requires
// - udg_HandleVars (gamecache)
function GC_Filename takes nothing returns string
// Defines the GameCache name used in your map
return "GC.w3v"
endfunction
// ===========================
function HV_H2I takes handle h returns integer
return h
return 0
endfunction
function HV_InitGC takes nothing returns nothing
call FlushGameCache(InitGameCache(GC_Filename()))
set udg_HandleVars = InitGameCache(GC_Filename())
endfunction
// ===========================
function LocalVars takes nothing returns gamecache
if udg_HandleVars == null then
call HV_InitGC()
endif
return udg_HandleVars
endfunction
function SetHandleHandle takes handle subject, string name, handle value returns nothing
if value==null then
call FlushStoredInteger(LocalVars(),I2S(HV_H2I(subject)),name)
else
call StoreInteger(LocalVars(), I2S(HV_H2I(subject)), name, HV_H2I(value))
endif
endfunction
function SetHandleInt takes handle subject, string name, integer value returns nothing
if value==0 then
call FlushStoredInteger(LocalVars(),I2S(HV_H2I(subject)),name)
else
call StoreInteger(LocalVars(), I2S(HV_H2I(subject)), name, value)
endif
endfunction
function SetHandleBoolean takes handle subject, string name, boolean value returns nothing
if value==false then
call FlushStoredBoolean(LocalVars(),I2S(HV_H2I(subject)),name)
else
call StoreBoolean(LocalVars(), I2S(HV_H2I(subject)), name, value)
endif
endfunction
function SetHandleReal takes handle subject, string name, real value returns nothing
if value==0 then
call FlushStoredReal(LocalVars(), I2S(HV_H2I(subject)), name)
else
call StoreReal(LocalVars(), I2S(HV_H2I(subject)), name, value)
endif
endfunction
function SetHandleString takes handle subject, string name, string value returns nothing
if value==null then
call FlushStoredString(LocalVars(), I2S(HV_H2I(subject)), name)
else
call StoreString(LocalVars(), I2S(HV_H2I(subject)), name, value)
endif
endfunction
function GetHandleHandle takes handle subject, string name returns handle
return GetStoredInteger(LocalVars(), I2S(HV_H2I(subject)), name)
return null
endfunction
function GetHandleInt takes handle subject, string name returns integer
return GetStoredInteger(LocalVars(), I2S(HV_H2I(subject)), name)
endfunction
function GetHandleBoolean takes handle subject, string name returns boolean
return GetStoredBoolean(LocalVars(), I2S(HV_H2I(subject)), name)
endfunction
function GetHandleReal takes handle subject, string name returns real
return GetStoredReal(LocalVars(), I2S(HV_H2I(subject)), name)
endfunction
function GetHandleString takes handle subject, string name returns string
return GetStoredString(LocalVars(), I2S(HV_H2I(subject)), name)
endfunction
function GetHandleUnit takes handle subject, string name returns unit
return GetStoredInteger(LocalVars(), I2S(HV_H2I(subject)), name)
return null
endfunction
function GetHandlePlayer takes handle subject, string name returns player
return GetStoredInteger(LocalVars(), I2S(HV_H2I(subject)), name)
return null
endfunction
function GetHandleTimer takes handle subject, string name returns timer
return GetStoredInteger(LocalVars(), I2S(HV_H2I(subject)), name)
return null
endfunction
function GetHandleTrigger takes handle subject, string name returns trigger
return GetStoredInteger(LocalVars(), I2S(HV_H2I(subject)), name)
return null
endfunction
function GetHandleEffect takes handle subject, string name returns effect
return GetStoredInteger(LocalVars(), I2S(HV_H2I(subject)), name)
return null
endfunction
function GetHandleGroup takes handle subject, string name returns group
return GetStoredInteger(LocalVars(), I2S(HV_H2I(subject)), name)
return null
endfunction
function GetHandleLightning takes handle subject, string name returns lightning
return GetStoredInteger(LocalVars(), I2S(HV_H2I(subject)), name)
return null
endfunction
function GetHandleWidget takes handle subject, string name returns widget
return GetStoredInteger(LocalVars(), I2S(HV_H2I(subject)), name)
return null
endfunction
function FlushHandleLocals takes handle subject returns nothing
call FlushStoredMission(LocalVars(), I2S(HV_H2I(subject)) )
endfunction
//* CSSafety for Custom Script
// Required Vars:
// - udg_CSS_Count (integer)
// - udg_CSS_Timer (timer array)
function NewTimer takes nothing returns timer
if (udg_CSS_Count==0) then
return CreateTimer()
endif
set udg_CSS_Count=udg_CSS_Count-1
return udg_CSS_Timer[udg_CSS_Count]
endfunction
//==========================================================================================
function ReleaseTimer takes timer t returns nothing
call PauseTimer(t)
if (udg_CSS_Count==8191) then
debug call BJDebugMsg("Warning: Timer stack is full, destroying timer!!")
//stack is full, the map already has much more troubles than the chance of bug
call DestroyTimer(t)
else
set udg_CSS_Timer[udg_CSS_Count]=t
set udg_CSS_Count=udg_CSS_Count+1
endif
endfunction
//Slow System
constant function SlowSys_MovementId takes nothing returns integer
return 'A63E' //The slow spell rawcode (movement)
endfunction
constant function SlowSys_MovementBuffId takes nothing returns integer
return 'B006' //The slow buff rawcode (movement)
endfunction
constant function SlowSys_AttackRateId takes nothing returns integer
return 'A63C' //The slow spell rawcode (attack rate)
endfunction
constant function SlowSys_AttackRateBuffId takes nothing returns integer
return 'B007' //The slow buff rawcode (attack rate)
endfunction
constant function SlowSys_CheckRate takes nothing returns real
return .3 //The slow check rate if disspelled
endfunction
function SlowSys_Check takes nothing returns nothing
local timer tim = GetExpiredTimer()
local unit t = GetHandleUnit(tim,"Target")
if GetUnitAbilityLevel(t,GetHandleInt(tim,"Buff")) < 1 then
if GetHandleInt(tim,"Type") == 0 then
call UnitRemoveAbility(t,SlowSys_MovementBuffId())
endif
if GetHandleInt(tim,"Type") == 1 then
call UnitRemoveAbility(t,SlowSys_AttackRateBuffId())
endif
call FlushHandleLocals(tim)
call ReleaseTimer(tim)
endif
set t = null
set tim = null
endfunction
function SlowSys_Apply takes integer w, unit t, player o, integer h, integer correspbuff, boolean ismissle returns nothing
local unit d = CreateUnit(o,'hfoo',GetUnitX(t),GetUnitY(t),bj_UNIT_FACING)
local timer tim = NewTimer()
call ShowUnit(d,false)
call SetHandleHandle(tim,"Target",t)
call SetHandleInt(tim,"Buff",correspbuff)
call SetHandleInt(tim,"Type",w)
if w == 0 then
call UnitAddAbility(d,SlowSys_MovementId())
call SetUnitAbilityLevel(d,SlowSys_MovementId(),h)
endif
if w == 1 then
call UnitAddAbility(d,SlowSys_AttackRateId())
call SetUnitAbilityLevel(d,SlowSys_AttackRateId(),h)
endif
call IssueTargetOrder(d,"slow",t)
call UnitApplyTimedLife(d,'BTLF',2.)
if ismissle == true then
call PolledWait(1.)
endif
call TimerStart(tim,SlowSys_CheckRate(),true,function SlowSys_Check)
set d = null
set t = null
set tim = null
endfunction
function SlowSys_ApplyBoth takes unit t, player o, integer h, integer correspbuff, boolean ismissle returns nothing
call SlowSys_Apply(0,t,o,h,correspbuff,true)
call SlowSys_Apply(1,t,o,h,correspbuff,true)
endfunction
function SlowSys_Init takes nothing returns nothing
set bj_groupEnumOwningPlayer = Player(13)
set bj_forLoopAIndex = 0
set bj_lastCreatedUnit = CreateUnit(bj_groupEnumOwningPlayer,'hfoo',100.,100,bj_UNIT_FACING)
call UnitAddAbility(bj_lastCreatedUnit,SlowSys_MovementId())
call UnitAddAbility(bj_lastCreatedUnit,SlowSys_AttackRateId())
loop
exitwhen bj_forLoopAIndex > 100
call SetUnitAbilityLevel(bj_lastCreatedUnit,SlowSys_MovementId(),bj_forLoopAIndex)
call SetUnitAbilityLevel(bj_lastCreatedUnit,SlowSys_AttackRateId(),bj_forLoopAIndex)
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
call RemoveUnit(bj_lastCreatedUnit)
endfunction
//Learning Sys
function SetUnitLabel takes unit u, string s returns nothing
call StoreString(LocalVars(),"Class",I2S(HV_H2I(u)),s)
call StoreBoolean(LocalVars(),"Class",I2S(HV_H2I(u)),true)
endfunction
function Learn_Condition takes unit p returns boolean
if GetStoredString(LocalVars(),"Class",I2S(HV_H2I(p))) == "Warrior" then
return true
endif
return false
endfunction
function Learn_Actions takes nothing returns nothing
local unit p = GetTriggerUnit()
if Learn_Condition(p) then
endif
set p = null
endfunction
function SetUnitClass takes string s, unit u returns nothing
local trigger t = CreateTrigger()
call SetUnitLabel(u,s)
call TriggerRegisterUnitEvent(t,u,EVENT_UNIT_PICKUP_ITEM)
call TriggerAddAction(t,function Learn_Actions)
set t = null
endfunction
//===========================================================================
// MBItemWidth
//===========================================================================
function MBItemWidth takes multiboard whichMB, integer row, integer col, real colWidth returns nothing
local multiboarditem mbItem = MultiboardGetItem(whichMB, row, col)
call MultiboardSetItemWidth( mbItem, colWidth)
call MultiboardReleaseItem(mbItem)
set mbItem = null
endfunction
//===========================================================================
// MBItemStyle
//===========================================================================
function MBItemStyle takes multiboard whichMB, integer row, integer col, boolean sData, boolean sIcon returns nothing
local multiboarditem mbItem = MultiboardGetItem(whichMB, row, col)
call MultiboardSetItemStyle( mbItem, sData, sIcon)
call MultiboardReleaseItem(mbItem)
set mbItem = null
endfunction
//===========================================================================
// MBItemValue
//===========================================================================
function MBItemValue takes multiboard whichMB, integer row, integer col, string myString returns nothing
local multiboarditem mbItem = MultiboardGetItem(whichMB, row, col)
call MultiboardSetItemValue( mbItem, myString)
call MultiboardReleaseItem(mbItem)
set mbItem = null
endfunction
//===========================================================================
// MBItemIcon
//===========================================================================
function MBItemIcon takes multiboard whichMB, integer row, integer col, string myString returns nothing
local multiboarditem mbItem = MultiboardGetItem(whichMB, row, col)
call MultiboardSetItemIcon(mbItem, myString)
call MultiboardReleaseItem(mbItem)
set mbItem = null
endfunction
function MBUnitProperties takes unit whichUnit, integer c returns nothing
local real x = 1
local integer y = 0
local integer row = c-1
local real HPp = 0
local real MPp = 0
local string s = ""
local unit hero = whichUnit
if (IsUnitAliveBJ(hero) == false) then
set y=1
loop
exitwhen y > 9
call MBItemIcon( udg_multiboardCombat, row, y, "MBBars\\BarEmpty.tga")
set y=y+1
endloop
set y=11
loop
exitwhen y > 16
call MBItemIcon( udg_multiboardCombat, row, y, "MBBars\\BarEmpty.tga")
set y=y+1
endloop
return
endif
set HPp = GetUnitLifePercent(hero)
set MPp = GetUnitManaPercent(hero)
//------------------
// HP Data
//------------------
if (HPp > 37.5 and HPp <= 62.5) then
set s = "MBBars\\BarYellow_0"
elseif (HPp > 12.5 and HPp <= 37.5) then
set s = "MBBars\\BarOrange_0"
elseif (HPp <= 12.5) then
set s = "MBBars\\BarRed_0"
else
set s = "MBBars\\BarGreen_0"
endif
//------------------
// HP Bar
//------------------
set x=0
set y=1
loop
exitwhen x > 100
if (HPp < x) then
if (HPp >= x-2.5) then
call MBItemIcon( udg_multiboardCombat, row, y, s+"4.tga")
elseif (HPp >= x-5 and HPp < x-2.5) then
call MBItemIcon( udg_multiboardCombat, row, y, s+"3.tga")
elseif (HPp >= x-7.5 and HPp < x-5) then
call MBItemIcon( udg_multiboardCombat, row, y, s+"2.tga")
elseif (HPp >= x-10 and HPp < x-7.5) then
call MBItemIcon( udg_multiboardCombat, row, y, s+"1.tga")
else
call MBItemIcon( udg_multiboardCombat, row, y, "MBBars\\BarEmpty.tga")
endif
else
call MBItemIcon( udg_multiboardCombat, row, y, s+"5.tga")
endif
set x=x+12.5
set y=y+1
endloop
//------------------
// EP Data
//------------------
if (MPp > 40 and MPp <= 65) then
set s = "MBBars\\BarYellow_0"
elseif (MPp > 20 and MPp <= 40) then
set s = "MBBars\\BarOrange_0"
elseif (MPp <= 20) then
set s = "MBBars\\BarRed_0"
else
set s = "MBBars\\BarBlue_0"
endif
//------------------
// EP Bar
//------------------
set x=0
set y=11
loop
exitwhen x > 100
if (MPp < x) then
if (MPp >= x-4) then
call MBItemIcon( udg_multiboardCombat, row, y, s+"4.tga")
elseif (MPp >= x-8 and MPp < x-4) then
call MBItemIcon( udg_multiboardCombat, row, y, s+"3.tga")
elseif (MPp >= x-12 and MPp < x-8) then
call MBItemIcon( udg_multiboardCombat, row, y, s+"2.tga")
elseif (MPp >= x-16 and MPp < x-12) then
call MBItemIcon( udg_multiboardCombat, row, y, s+"1.tga")
else
call MBItemIcon( udg_multiboardCombat, row, y, "MBBars\\BarEmpty.tga")
endif
else
call MBItemIcon( udg_multiboardCombat, row, y, s+"5.tga")
endif
set x=x+20
set y=y+1
endloop
endfunction
//===========================================================================
// CombatMBSetup
//===========================================================================
function CombatMBSetup takes nothing returns nothing
local integer i = 1
local integer x = 1
local integer row = 0
local integer numPlayers = 1
local string heroIcon = ""
if (udg_A_SAVE_NPC1_IS_DEAD == false) then
set numPlayers = numPlayers + 1
if (udg_A_SAVE_NPC2_IS_DEAD == false) then
set numPlayers = numPlayers + 1
endif
endif
call MultiboardClear( udg_multiboardCombat )
set udg_multiboardCombat = CreateMultiboard()
call MultiboardSetTitleText (udg_multiboardCombat, "Hero HP EP ")
call MultiboardSetColumnCount(udg_multiboardCombat, 17)
call MultiboardSetRowCount (udg_multiboardCombat, numPlayers)
set heroIcon = "UI\\Glues\\ScoreScreen\\scorescreen-hero-alchemist.blp"
set x=1
//-----------------------------
// hLvl
//-----------------------------
call MBItemWidth(udg_multiboardCombat, row, 0, .05)
call MBItemValue(udg_multiboardCombat, row, 0, "Lv. "+I2S(GetHeroLevel(udg_A_UNIT_HERO)))
call MBItemIcon( udg_multiboardCombat, row, 0, heroIcon)
//-----------------------------
// HP Bar
//-----------------------------
loop
exitwhen x > 9
call MBItemStyle(udg_multiboardCombat, row, x, false, true)
call MBItemWidth(udg_multiboardCombat, row, x, .01)
call MBItemIcon( udg_multiboardCombat, row, x, "MBBars\\BarGreen_05.tga")
set x=x+1
endloop
//-----------------------------
// Spacer Bar
//-----------------------------
call MBItemWidth(udg_multiboardCombat, row, x, .01)
call MBItemStyle(udg_multiboardCombat, row, x, false, false)
set x=x+1
//-----------------------------
//-----------------------------
// EP Bar
//-----------------------------
loop
exitwhen x > 16
call MBItemStyle(udg_multiboardCombat, row, x, false, true)
call MBItemWidth(udg_multiboardCombat, row, x, .01)
call MBItemIcon( udg_multiboardCombat, row, x, "MBBars\\BarBlue_05.tga")
set x=x+1
endloop
set row=row+1
if (udg_A_SAVE_NPC1_IS_DEAD == false) then
set heroIcon = "UI\\Glues\\ScoreScreen\\scorescreen-hero-alchemist.blp"
set x=1
//-----------------------------
// hLvl
//-----------------------------
call MBItemWidth(udg_multiboardCombat, row, 0, .05)
call MBItemValue(udg_multiboardCombat, row, 0, "Lv. "+I2S(GetHeroLevel(udg_A_UNIT_NPC1)))
call MBItemIcon( udg_multiboardCombat, row, 0, heroIcon)
//-----------------------------
// HP Bar
//-----------------------------
loop
exitwhen x > 9
call MBItemStyle(udg_multiboardCombat, row, x, false, true)
call MBItemWidth(udg_multiboardCombat, row, x, .01)
call MBItemIcon( udg_multiboardCombat, row, x, "MBBars\\BarGreen_05.tga")
set x=x+1
endloop
//-----------------------------
// Spacer Bar
//-----------------------------
call MBItemWidth(udg_multiboardCombat, row, x, .01)
call MBItemStyle(udg_multiboardCombat, row, x, false, false)
set x=x+1
//-----------------------------
//-----------------------------
// EP Bar
//-----------------------------
loop
exitwhen x > 16
call MBItemStyle(udg_multiboardCombat, row, x, false, true)
call MBItemWidth(udg_multiboardCombat, row, x, .01)
call MBItemIcon( udg_multiboardCombat, row, x, "MBBars\\BarBlue_05.tga")
set x=x+1
endloop
set row=row+1
endif
if (udg_A_SAVE_NPC2_IS_DEAD == false) then
set heroIcon = "UI\\Glues\\ScoreScreen\\scorescreen-hero-alchemist.blp"
set x=1
//-----------------------------
// hLvl
//-----------------------------
call MBItemWidth(udg_multiboardCombat, row, 0, .05)
call MBItemValue(udg_multiboardCombat, row, 0, "Lv. "+I2S(GetHeroLevel(udg_A_UNIT_NPC2)))
call MBItemIcon( udg_multiboardCombat, row, 0, heroIcon)
//-----------------------------
// HP Bar
//-----------------------------
loop
exitwhen x > 9
call MBItemStyle(udg_multiboardCombat, row, x, false, true)
call MBItemWidth(udg_multiboardCombat, row, x, .01)
call MBItemIcon( udg_multiboardCombat, row, x, "MBBars\\BarGreen_05.tga")
set x=x+1
endloop
//-----------------------------
// Spacer Bar
//-----------------------------
call MBItemWidth(udg_multiboardCombat, row, x, .01)
call MBItemStyle(udg_multiboardCombat, row, x, false, false)
set x=x+1
//-----------------------------
//-----------------------------
// EP Bar
//-----------------------------
loop
exitwhen x > 16
call MBItemStyle(udg_multiboardCombat, row, x, false, true)
call MBItemWidth(udg_multiboardCombat, row, x, .01)
call MBItemIcon( udg_multiboardCombat, row, x, "MBBars\\BarBlue_05.tga")
set x=x+1
endloop
endif
set i = 0
set x = 0
set row = 0
set numPlayers = 0
call MultiboardDisplay(udg_multiboardCombat, true)
endfunction
//===========================================================================
// MBCombat
//===========================================================================
function MBCombat takes nothing returns nothing
call MBUnitProperties(udg_A_UNIT_HERO, 1 )
if (udg_A_SAVE_NPC1_IS_DEAD == false) then
call MBUnitProperties(udg_A_UNIT_NPC1, 2 )
if (udg_A_SAVE_NPC2_IS_DEAD == false) then
call MBUnitProperties(udg_A_UNIT_NPC2, 3 )
endif
endif
endfunction
// ===========================
// Local Handle Vars Addons and general functions for InvenEx
// ===========================
function H2I takes handle h returns integer
return h
return 0
endfunction
function I2U takes integer i returns unit
return i
return null
endfunction
function I2T takes integer i returns trigger
return i
return null
endfunction
function I2TT takes integer i returns texttag
return i
return null
endfunction
function I2It takes integer i returns item
return i
return null
endfunction
function I2D takes integer i returns destructable
return i
return null
endfunction
function I2Tk takes integer i returns trackable
return i
return null
endfunction
function GetHandleDestructable takes handle subject, string name returns destructable
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
// ===========================
// Trackable API
function GetTrackableX takes trackable tc returns real
return GetHandleReal(tc, "x")
endfunction
function GetTrackableY takes trackable tc returns real
return GetHandleReal(tc, "y")
endfunction
function GetTrackablePath takes trackable tc returns string
return GetHandleString(tc, "path")
endfunction
function GetTrackableGroup takes trackable tc returns string
return GetHandleString(tc, "group")
endfunction
function GetTrackableEffect takes trackable tk returns destructable
return GetHandleDestructable(tk, "effect")
endfunction
function GetTrackableName takes trackable tk returns string
return GetStoredString(LocalVars(), I2S(GetStoredInteger(LocalVars(),I2S(GetDestructableTypeId(GetTrackableEffect(tk))), "itemID")), "name")
endfunction
function GetTrackableDesc takes trackable tk returns string
return GetStoredString(LocalVars(), I2S(GetStoredInteger(LocalVars(),I2S(GetDestructableTypeId(GetTrackableEffect(tk))), "itemID")), "desc")
endfunction
function GetTrackableSlot takes handle track returns integer
return GetStoredInteger(LocalVars(), I2S(H2I(track)), "slot")
endfunction
function GetTrackableByXY takes real x, real y returns trackable
return I2Tk(GetStoredInteger(LocalVars(), "inv", "tk_" + R2S(x) + R2S(y)))
endfunction
function NewTrackable takes string path, real x, real y, string groupName returns trackable
local destructable d = CreateDestructableZ( 'OTip', x * 13, y * 13, 2261, 0.00, 1.00, 0 )
local trackable tc = CreateTrackable(path, x * 13, y * 13, 0)
call RemoveDestructable( d )
set d = null
call StoreInteger(LocalVars(), "inv", "tk_" + R2S(x) + R2S(y), H2I(tc))
call SetHandleReal(tc, "x", x)
call SetHandleReal(tc, "y", y)
call SetHandleString(tc, "group", groupName)
call SetHandleString(tc, "path", path)
return tc
endfunction
///////////Config\\\\\\\\\\\\
function setcfg takes string key, string val returns nothing
call StoreString(LocalVars(), "config", key, val)
endfunction
function cfg takes string key returns string
return GetStoredString(LocalVars(), "config", key)
endfunction
function cfgr takes string key returns real
return S2R(cfg(key))
endfunction
function cfgi takes string key returns integer
return S2I(cfg(key))
endfunction
///////////Current Status\\\\\\\\\\\\\\\
function setstatus takes string key, string val returns nothing
call StoreString(LocalVars(), "status", key, val)
endfunction
function status takes string key returns string
return GetStoredString(LocalVars(), "status", key)
endfunction
function statusr takes string key returns real
return S2R(status(key))
endfunction
function statusi takes string key returns integer
return S2I(status(key))
endfunction
function StoreEffect takes integer id, string name returns nothing
call StoreInteger(LocalVars(), "FX", name, id)
endfunction
function GetEffect takes string name returns integer
return GetStoredInteger(LocalVars(), "FX", name)
endfunction
function NewItem takes integer i, integer did, string name, string desc, integer gold, integer silver, integer copper returns nothing
call StoreString(LocalVars(), I2S(i), "name", name)
call StoreString(LocalVars(), I2S(i), "desc", desc)
call StoreInteger(LocalVars(),I2S(i), "gold", gold)
call StoreInteger(LocalVars(),I2S(i), "silver", silver)
call StoreInteger(LocalVars(),I2S(i), "copper", copper)
call StoreInteger(LocalVars(),I2S(did), "itemID", i)
call StoreEffect(did, "item" + I2S(i))
endfunction
function GetItemEffect takes integer id returns integer
return GetStoredInteger(LocalVars(), "FX", "item" + I2S(id))
endfunction
function GetItemIDByDestID takes integer did returns integer
return GetStoredInteger(LocalVars(), I2S(did), "itemID")
endfunction
function AddEffect takes integer did, real x, real y returns destructable
local integer id = GetStoredInteger(LocalVars(),"inv", "effects")
local destructable d = CreateDestructableZ(did, x * 13, y * 13, 2261, 0, 1, 0)
call StoreInteger(LocalVars(),"inv", "effect" + I2S(id), H2I(d))
call StoreInteger(LocalVars(),"inv", "effects", id + 1)
return d
endfunction
function AddEffectTK takes integer did, real x, real y returns destructable
local integer id = GetStoredInteger(LocalVars(),"inv", "effects")
local destructable d = CreateDestructableZ(did, x * 13, y * 13, 2261, 0, 1, 0)
call StoreInteger(LocalVars(),"inv", "effect" + I2S(id), H2I(d))
call StoreInteger(LocalVars(),"inv", "effectXY" + R2S(x) + R2S(y), H2I(d))
call StoreInteger(LocalVars(),"inv", "effects", id + 1)
call SetHandleHandle(GetTrackableByXY(x, y), "effect", d)
return d
endfunction
function GetBagSlotItemCharges takes unit u, integer bagNum, integer slot returns integer
return GetStoredInteger(LocalVars(),I2S(H2I(u)) + I2S(bagNum), "charges" + I2S(slot))
endfunction
function SetBagSlotItemCharges takes unit u, integer bagNum, integer slot, integer charges returns nothing
call StoreInteger(LocalVars(),I2S(H2I(u)) + I2S(bagNum), "charges" + I2S(slot), charges)
endfunction
function CountBagItems takes unit u, integer bagNum returns integer
return GetStoredInteger(LocalVars(), I2S(H2I(u)) + I2S(bagNum), "numItems")
endfunction
function GetBagSlotItem takes unit u, integer bagNum, integer slot returns integer
return GetStoredInteger(LocalVars(), I2S(H2I(u)) + I2S(bagNum), "slot" + I2S(slot))
endfunction
function AddBagSlotItem takes unit u, integer id, integer bagNum, integer slot, integer charges returns nothing
call StoreInteger(LocalVars(),I2S(H2I(u)) + I2S(bagNum), "slot" + I2S(slot), id)
call StoreInteger(LocalVars(),I2S(H2I(u)) + I2S(bagNum), "charges" + I2S(slot), charges)
call StoreInteger(LocalVars(),I2S(H2I(u)) + I2S(bagNum), "numItems", CountBagItems(u, bagNum) + 1)
endfunction
function RemoveBagSlotItem takes unit u, integer bagNum, integer slot returns nothing
call FlushStoredInteger(LocalVars(),I2S(H2I(u)) + I2S(bagNum), "slot" + I2S(slot))
call StoreInteger(LocalVars(),I2S(H2I(u)) + I2S(bagNum), "numItems", CountBagItems(u, bagNum) - 1)
endfunction
function FirstEmptyBagSlot takes unit u, integer bagNum returns integer //from 0-cfgi("bag0")
local integer i = 0
loop
exitwhen i == cfgi("bag" + I2S(bagNum))
if GetBagSlotItem(u, bagNum, i) == null then
return i
endif
set i = i + 1
endloop
return -1
endfunction
function StoreHeroBags takes gamecache saveSlot returns nothing
local integer i = 0
local unit u = udg_A_UNIT_HERO
loop
exitwhen i > cfgi("bag0")
if GetBagSlotItem(u, 0, i) != null then
call StoreInteger( saveSlot, "heroInven", "slot" + I2S(i), GetBagSlotItem(u, 0, i))
call StoreInteger( saveSlot, "heroInven", "slot" + I2S(i) + "charges", GetBagSlotItemCharges(u, 0, i))
else
call FlushStoredInteger( saveSlot, "heroInven", "slot" + I2S(i))
call FlushStoredInteger( saveSlot, "heroInven", "slot" + I2S(i) + "charges")
endif
set i = i + 1
endloop
set u = null
endfunction
function RestoreHeroBags takes gamecache saveSlot returns nothing
local integer i = 0
local unit u = udg_A_UNIT_HERO
loop
exitwhen i > cfgi("bag0")
if GetStoredInteger( saveSlot, "heroInven", "slot" + I2S(i)) != null then
call AddBagSlotItem(u, GetStoredInteger( saveSlot, "heroInven", "slot" + I2S(i)), 0, i, GetStoredInteger( saveSlot, "heroInven", "slot" + I2S(i) + "charges"))
endif
set i = i + 1
endloop
set u = null
endfunction
// ===========================
// *END* Local Handle Vars Addons and general functions for InvenEx *END*
// ===========================
JASS:
function Trig_Save_and_Quit_Actions takes nothing returns nothing
call ClearTextMessages()
call DialogClear( udg_SAVE_AND_QUIT )
call DialogSetMessage( udg_SAVE_AND_QUIT, "Are you sure?" )
set udg_SAVE_YES = DialogAddButton( udg_SAVE_AND_QUIT, "Yes", 0 )
call DialogAddButton( udg_SAVE_AND_QUIT, "No", 0 )
call DialogDisplay( Player(0), udg_SAVE_AND_QUIT, true )
endfunction
//===========================================================================
function InitTrig_Save_and_Quit takes nothing returns nothing
set gg_trg_Save_and_Quit = CreateTrigger( )
call TriggerRegisterPlayerEventEndCinematic( gg_trg_Save_and_Quit, Player(0) )
call TriggerAddAction( gg_trg_Save_and_Quit, function Trig_Save_and_Quit_Actions )
endfunction
JASS:
function Trig_Save_and_Quit_Yes_Conditions takes nothing returns boolean
if ( GetClickedButtonBJ() == udg_SAVE_YES ) then
return true
endif
return false
endfunction
function Trig_Save_and_Quit_Yes_Actions takes nothing returns nothing
if ( udg_A_UNIT_HERO_ALTERNATE == true ) then
call DisplayTextToForce( GetPlayersAll(), "|c00ff0000WARNING!|r
Your hero is in an alternate form or is using a mount, please revert back to original form or un-mount before quiting." )
else
call ConditionalTriggerExecute( gg_trg_Auto_Save_to_Slot )
//call CinematicModeBJ( false, bj_FORCE_PLAYER[0] )
call ShowInterface( false, 2.00 )
call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 2.00, "ReplaceableTextures\\CameraMasks\\White_mask.blp", 0, 0, 0, 0 )
call TriggerSleepAction( 1.7 )
call CustomVictoryBJ( Player(0), false, false )
endif
endfunction
//===========================================================================
function InitTrig_Save_and_Quit_Yes takes nothing returns nothing
set gg_trg_Save_and_Quit_Yes = CreateTrigger( )
call TriggerRegisterDialogEventBJ( gg_trg_Save_and_Quit_Yes, udg_SAVE_AND_QUIT )
call TriggerAddCondition( gg_trg_Save_and_Quit_Yes, Condition( function Trig_Save_and_Quit_Yes_Conditions ) )
call TriggerAddAction( gg_trg_Save_and_Quit_Yes, function Trig_Save_and_Quit_Yes_Actions )
endfunction