WolfieeifloW
WEHZ Helper
- Reaction score
- 372
I have six triggers that use [ljass]globals[/ljass], and quite a few of the same ones.
I'm trying to make a trigger with a globals block so they can all call from the same one.
Now, when I try to use this global [ljass]globals[/ljass] block, 3/6 of my triggers make the map not load, and instead just go to the main screen when I try to test map.
I'm going to show all my triggers so people can see, and hopefully help.
Globals (Contains all the globals; When I try to use globals from here, the first three triggers make the map not work):
FULearn (Breaks when trying to use [ljass]globals[/ljass] from 'Globals':
DKLevel (Breaks when trying to use [ljass]globals[/ljass] from 'Globals':
FUPresence (Breaks when trying to use [ljass]globals[/ljass] from 'Globals':
DKS1 (Works when trying to use [ljass]globals[/ljass] from 'Globals':
DKS2 (Works when trying to use [ljass]globals[/ljass] from 'Globals':
DKS3 (Works when trying to use [ljass]globals[/ljass] from 'Globals':
I tested this by turning off all of the triggers at once; The map loads fine.
Globals, and DKS3 on; Loads.
Globals, DKS3, and DKS2; Loads.
Globals, DKS3, DKS2, and DKS1; Loads.
Globals, DKS3, DKS2, DKS1, and any of the other three; Fails.
Globals, and FULearn or DKLevel or FUPresence; Fails.
Why are those three making the map 'crash'..?
If any more information is needed or something, please let me know..
I don't want each trigger to have to have it's own globals block.
I'm trying to make a trigger with a globals block so they can all call from the same one.
Now, when I try to use this global [ljass]globals[/ljass] block, 3/6 of my triggers make the map not load, and instead just go to the main screen when I try to test map.
I'm going to show all my triggers so people can see, and hopefully help.
Globals (Contains all the globals; When I try to use globals from here, the first three triggers make the map not work):
JASS:
globals
//Presence IDs
constant integer f = 039;A000039;
constant integer u = 039;A001039;
constant integer fd = 039;A003039;
constant integer ud = 039;A002039;
//Frost IDs
constant integer Ob = 039;A006039;
constant integer IT = 039;A008039;
constant integer CI = 039;A005039;
//Unholy IDs
constant integer PS = 039;A009039;
constant integer DC = 039;A007039;
constant integer UF = 039;A00A039;
constant integer SB = 039;A004039;
endglobals
FULearn (Breaks when trying to use [ljass]globals[/ljass] from 'Globals':
JASS:
scope FULearn initializer FULearnInit
//globals
//private constant integer SB = 'A004'
//private constant integer f = 'A000'
//private constant integer u = 'A001'
//private constant integer fd = 'A003'
//endglobals
private function FUL takes unit t returns nothing
call UnitAddAbility(t, SB)
call SetPlayerAbilityAvailable(GetOwningPlayer(t), u, false)
call SetUnitAbilityLevel(t, f, 1)
call SetPlayerAbilityAvailable(GetOwningPlayer(t), SB, false)
endfunction
private function Conditions takes nothing returns boolean
if GetLearnedSkill() == fd then
call FUL(GetLearningUnit())
endif
return false
endfunction
private function FULearnInit takes nothing returns nothing
local integer index = 0
local trigger tr = CreateTrigger()
loop
call TriggerRegisterPlayerUnitEvent(tr, Player(index), EVENT_PLAYER_HERO_SKILL, null)
set index = index + 1
exitwhen index == bj_MAX_PLAYER_SLOTS
endloop
call TriggerAddCondition(tr, Condition(function Conditions))
endfunction
endscope
DKLevel (Breaks when trying to use [ljass]globals[/ljass] from 'Globals':
JASS:
scope DKLevel initializer DKLevelInit
//globals
//private constant integer f = 'A000'
//private constant integer u = 'A001'
//private constant integer fd = 'A003'
//private constant integer ud = 'A002'
//private constant integer Ob = 'A006'
//private constant integer IT = 'A008'
//private constant integer CI = 'A005'
//private constant integer PS = 'A009'
//private constant integer DC = 'A007'
//private constant integer UF = 'A00A'
//endglobals
private function DKL takes unit t returns nothing
local integer l = GetUnitAbilityLevel(t, u)
call SetPlayerAbilityAvailable(GetOwningPlayer(t), u, false)
call SetPlayerAbilityAvailable(GetOwningPlayer(t), f, true)
call UnitRemoveAbility(t, ud)
call UnitAddAbility(t, fd)
call SetUnitAbilityLevel(t, fd, l)
call SetUnitAbilityLevel(t, f, l)
//Ability 1
if (GetUnitAbilityLevel(t, PS) >=1) then
set l = GetUnitAbilityLevel(t, PS)
call SetPlayerAbilityAvailable(GetOwningPlayer(t), PS, false)
call SetPlayerAbilityAvailable(GetOwningPlayer(t), Ob, true)
call SetUnitAbilityLevel(t, Ob, l)
endif
//Ability 2
if (GetUnitAbilityLevel(t, DC) >=1) then
set l = GetUnitAbilityLevel(t, DC)
call SetPlayerAbilityAvailable(GetOwningPlayer(t), DC, false)
call SetPlayerAbilityAvailable(GetOwningPlayer(t), IT, true)
call SetUnitAbilityLevel(t, IT, l)
endif
//Ability 3
if (GetUnitAbilityLevel(t, UF) >= 1) then
set l = GetUnitAbilityLevel(t, UF)
call SetPlayerAbilityAvailable(GetOwningPlayer(t), UF, false)
call SetPlayerAbilityAvailable(GetOwningPlayer(t), CI, true)
call SetUnitAbilityLevel(t, CI, l)
endif
endfunction
private function Conditions takes nothing returns boolean
if GetUnitTypeId(GetLevelingUnit()) == 039;U000039; and GetUnitAbilityLevel(GetLevelingUnit(), u) >= 1 then
call DKL(GetLevelingUnit())
endif
return false
endfunction
private function DKLevelInit takes nothing returns nothing
local integer index = 0
local trigger tr = CreateTrigger()
loop
call TriggerRegisterPlayerUnitEvent(tr, Player(index), EVENT_PLAYER_HERO_LEVEL, null)
set index = index + 1
exitwhen index == bj_MAX_PLAYER_SLOTS
endloop
call TriggerAddCondition(tr, Condition(function Conditions))
endfunction
endscope
FUPresence (Breaks when trying to use [ljass]globals[/ljass] from 'Globals':
JASS:
scope FUPresence initializer FUPresenceInit
//globals
////Presence IDs
//private constant integer f = 'A000'
//private constant integer u = 'A001'
//private constant integer fd = 'A003'
//private constant integer ud = 'A002'
////Frost IDs
//private constant integer Ob = 'A006'
//private constant integer IT = 'A008'
//private constant integer CI = 'A005'
////private constant integer MF = ''
////Unholy IDs
//private constant integer PS = 'A009'
//private constant integer DC = 'A007'
//private constant integer UF = 'A00A'
////private constant integer DG = ''
//endglobals
private function FU takes unit t, integer a, integer b, integer ab, integer bb returns nothing
local integer l
//Switch the presences
set l = GetUnitAbilityLevel(t, ab)
call SetPlayerAbilityAvailable(GetOwningPlayer(t), a, false)
call SetPlayerAbilityAvailable(GetOwningPlayer(t), b, true)
call UnitRemoveAbility(t, ab)
call UnitAddAbility(t, bb)
call SetUnitAbilityLevel(t, bb, l)
call SetUnitAbilityLevel(t, b, l)
if (ab == fd) then //F2U
//Ability 1
if (GetUnitAbilityLevel(t, Ob) >= 1) then
set l = GetUnitAbilityLevel(t, Ob)
call SetPlayerAbilityAvailable(GetOwningPlayer(t), Ob, false)
call SetPlayerAbilityAvailable(GetOwningPlayer(t), PS, true)
call SetUnitAbilityLevel(t, PS, l)
endif
//Ability 2
if (GetUnitAbilityLevel(t, IT) >=1) then
set l = GetUnitAbilityLevel(t, IT)
call SetPlayerAbilityAvailable(GetOwningPlayer(t), IT, false)
call SetPlayerAbilityAvailable(GetOwningPlayer(t), DC, true)
call SetUnitAbilityLevel(t, DC, l)
endif
//Ability 3
if (GetUnitAbilityLevel(t, CI) >= 1) then
set l = GetUnitAbilityLevel(t, CI)
call SetPlayerAbilityAvailable(GetOwningPlayer(t), CI, false)
call SetPlayerAbilityAvailable(GetOwningPlayer(t), UF, true)
call SetUnitAbilityLevel(t, UF, l)
endif
//Ability 4
//if (GetUnitAbilityLevel(t, ) >=1) then
//endif
elseif (ab == ud) then //U2F
//Ability 1
if (GetUnitAbilityLevel(t, PS) >=1) then
set l = GetUnitAbilityLevel(t, PS)
call SetPlayerAbilityAvailable(GetOwningPlayer(t), PS, false)
call SetPlayerAbilityAvailable(GetOwningPlayer(t), Ob, true)
call SetUnitAbilityLevel(t, Ob, l)
endif
//Ability 2
if (GetUnitAbilityLevel(t, DC) >=1) then
set l = GetUnitAbilityLevel(t, DC)
call SetPlayerAbilityAvailable(GetOwningPlayer(t), DC, false)
call SetPlayerAbilityAvailable(GetOwningPlayer(t), IT, true)
call SetUnitAbilityLevel(t, IT, l)
endif
//Ability 3
if (GetUnitAbilityLevel(t, UF) >= 1) then
set l = GetUnitAbilityLevel(t, UF)
call SetPlayerAbilityAvailable(GetOwningPlayer(t), UF, false)
call SetPlayerAbilityAvailable(GetOwningPlayer(t), CI, true)
call SetUnitAbilityLevel(t, CI, l)
endif
//Ability 4
//if (GetUnitAbilityLevel(t, ) >=1) then
//endif
endif
endfunction
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == fd then
call FU(GetTriggerUnit(), f, u, fd, ud)
elseif GetSpellAbilityId() == ud then
call FU(GetTriggerUnit(), u, f, ud, fd)
endif
return false
endfunction
private function FUPresenceInit takes nothing returns nothing
local integer index = 0
local trigger tr = CreateTrigger()
loop
call TriggerRegisterPlayerUnitEvent(tr, Player(index), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
set index = index + 1
exitwhen index == bj_MAX_PLAYER_SLOTS
endloop
call TriggerAddCondition(tr, Condition(function Conditions))
endfunction
endscope
DKS1 (Works when trying to use [ljass]globals[/ljass] from 'Globals':
JASS:
scope DKS1 initializer DKS1Init
//globals
//private constant integer Ob = 'A006'
//private constant integer PS = 'A009'
//endglobals
private function S1 takes unit t returns nothing
call UnitAddAbility(t, PS)
call SetPlayerAbilityAvailable(GetOwningPlayer(t), PS, false)
endfunction
private function Conditions takes nothing returns boolean
if GetLearnedSkill() == Ob then
call S1(GetLearningUnit())
endif
return false
endfunction
private function DKS1Init takes nothing returns nothing
local integer index = 0
local trigger tr = CreateTrigger()
loop
call TriggerRegisterPlayerUnitEvent(tr, Player(index), EVENT_PLAYER_HERO_SKILL, null)
set index = index + 1
exitwhen index == bj_MAX_PLAYER_SLOTS
endloop
call TriggerAddCondition(tr, Condition(function Conditions))
endfunction
endscope
DKS2 (Works when trying to use [ljass]globals[/ljass] from 'Globals':
JASS:
scope DKS2 initializer DKS2Init
//globals
//private constant integer DC = 'A007'
//private constant integer IT = 'A008'
//endglobals
private function S2 takes unit t returns nothing
call UnitAddAbility(t, DC)
call SetPlayerAbilityAvailable(GetOwningPlayer(t), DC, false)
endfunction
private function Conditions takes nothing returns boolean
if GetLearnedSkill() == IT then
call S2(GetLearningUnit())
endif
return false
endfunction
private function DKS2Init takes nothing returns nothing
local integer index = 0
local trigger tr = CreateTrigger()
loop
call TriggerRegisterPlayerUnitEvent(tr, Player(index), EVENT_PLAYER_HERO_SKILL, null)
set index = index + 1
exitwhen index == bj_MAX_PLAYER_SLOTS
endloop
call TriggerAddCondition(tr, Condition(function Conditions))
endfunction
endscope
DKS3 (Works when trying to use [ljass]globals[/ljass] from 'Globals':
JASS:
scope DKS3 initializer DKS3Init
//globals
//constant integer UF = 'A00A'
//constant integer CI = 'A005'
//endglobals
private function S3 takes unit t returns nothing
call UnitAddAbility(t, UF)
call SetPlayerAbilityAvailable(GetOwningPlayer(t), UF, false)
endfunction
private function Conditions takes nothing returns boolean
if GetLearnedSkill() == CI then
call S3(GetLearningUnit())
endif
return false
endfunction
private function DKS3Init takes nothing returns nothing
local integer index = 0
local trigger tr = CreateTrigger()
loop
call TriggerRegisterPlayerUnitEvent(tr, Player(index), EVENT_PLAYER_HERO_SKILL, null)
set index = index + 1
exitwhen index == bj_MAX_PLAYER_SLOTS
endloop
call TriggerAddCondition(tr, Condition(function Conditions))
endfunction
endscope
I tested this by turning off all of the triggers at once; The map loads fine.
Globals, and DKS3 on; Loads.
Globals, DKS3, and DKS2; Loads.
Globals, DKS3, DKS2, and DKS1; Loads.
Globals, DKS3, DKS2, DKS1, and any of the other three; Fails.
Globals, and FULearn or DKLevel or FUPresence; Fails.
Why are those three making the map 'crash'..?
If any more information is needed or something, please let me know..
I don't want each trigger to have to have it's own globals block.