killingdyl
Active Member
- Reaction score
- 6
its up to date are u using a like custiom gui trigger?
///////////////////////////////////////////////////////////////////////////////////////////
//This is a simple attach system, it's function is limited.
//
//Can only attach unit to unit.
//
//It is enough for your request.
//////////////////////////////////////////////////////////////////////////////////////////
library SAS
globals
private constant integer HASH_DOWN = 524288
private constant integer HASH_UP = 2134900736
private constant integer HASH_BIAS = 4096
//This sytem use Hash to calculate the integer after converting handles.
endglobals
private function H2I takes handle h returns integer//H2I is a common function use in converting handle into integer
return h
return 0
endfunction
private function H2U takes handle h returns unit
return h
return null
endfunction
/////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////Storing Engine////////////////////////////////////////////
private struct StoredUnit
unit u
static method StoreUnitz takes unit attached returns StoredUnit
local StoredUnit Index = StoredUnit.allocate()
set Index.u = attached
return Index
endmethod
method GetUnit takes nothing returns unit
return .u
endmethod
method onDestroy takes nothing returns nothing
set .u = null
endmethod
endstruct
///////////////////////////////////////////////////////////////////////////////////////////
//! textmacro SAS takes number
globals
private integer array Sandbox$number$//We use text macroes to create multi instanceable system.
endglobals
////////////////////////////Attach Unit to tower///////////
function SetUnitToTower$number$ takes unit attacher, unit attached returns nothing
local StoredUnit S = StoredUnit.StoreUnitz(attached)
set Sandbox$number$[(H2I(attacher)*HASH_UP)/HASH_DOWN+HASH_BIAS] = S
endfunction
//////////////////////////////////////////////////////////
////////////////////////////Get Unit From Tower/////////////
function GetAttachedUnit$number$ takes unit attacher returns unit
local StoredUnit S = Sandbox$number$[(H2I(attacher)*HASH_UP)/HASH_DOWN+HASH_BIAS]
return S.GetUnit()
endfunction
////////////////////////////////////////////////////////////
////////////////////////////Clear Attached Units//////////
function ClearAttachedUnit$number$ takes unit attacher returns nothing
local StoredUnit S = Sandbox$number$[(H2I(attacher)*HASH_UP)/HASH_DOWN+HASH_BIAS]
call S.destroy()
endfunction
//////////////////////////////////////////////////////////
//! endtextmacro
//! runtextmacro SAS("A")
//! runtextmacro SAS("B")
//! runtextmacro SAS("C")
//! runtextmacro SAS("D")
//! runtextmacro SAS("E")
endlibrary
call SetUnitToTowerB(tower,u)
function RemoveUnit takes unit returns nothing
endfunction
call RemoveUnit(unit u want to remove)
local <variable> <variable039;s name>
local unit hello
set hello = <Unit you want to set>
hey i did everything perfectly with the trigger but it still wont create the 2 childs. HELP
Trigger:
- Two Child
- Events
- Unit - A unit Finishes an upgrade
- Conditions
- (Unit-type of (Triggering unit)) Equal to |cFF00FFFF2 Childs|r
- Actions
- Custom script: local unit u
- Custom script: local unit tower = GetTriggerUnit()
- Unit - Create 1 Dummy Child for (Owner of (<b>Constructed structure</b>)) at ((Position of (Constructed structure)) offset by 32.00 towards 0.00 degrees) facing Default building facing degrees
- Custom script: set u = GetLastCreatedUnit()
- Custom script: call SetUnitToTowerA(tower,u)
- Unit - Create 1 Dummy Child for (Owner of (<b>Constructed structure</b>)) at ((Position of (Constructed structure)) offset by 32.00 towards 180.00 degrees) facing Default building facing degrees
- Custom script: set u = GetLastCreatedUnit()
- Custom script: call SetUnitToTowerB(tower,u)
- Custom script: set u = null
- Custom script: set tower = null