PrisonLove
Hard Realist
- Reaction score
- 78
EDIT: Okay so now I have a stranger problem. These triggers work, but if an item has more than one charge, it creates duplicates of that item and gives them to the dummy unit, but then the dummy unit drops them. It's bizarre and I need to know why this happens. Other than that the trigger works normally. Here are the triggers as they are now.
This initializes the item holder dummy unit
This stores items to the item holder on death
**Note, I think this is where the dummy gets multiples of the same item. Don't know why though.
This revives the unit (creates a new unit) and then the [ljass]loop[/ljass] is what gives the items back.
This initializes the item holder dummy unit
Trigger:
- random shit
- Events
- Map initialization
- Conditions
- Actions
- -------- Create Item holders --------
- Set TempPoint = (Center of DwarfItemHolderSpawn <gen>)
- Player Group - Pick every player in (All allies of Player 1 (Red)) and do (Actions)
- Loop - Actions
- Unit - Create 1 Item Holder for (Picked player) at TempPoint facing 270.00 degrees
- Set ItemHolder[(Player number of (Picked player))] = (Last created unit)
- Loop - Actions
- Custom script: call RemoveLocation(udg_TempPoint)
- Set TempPoint = (Center of GoblinItemHolderSpawn <gen>)
- Player Group - Pick every player in (All enemies of Player 1 (Red)) and do (Actions)
- Loop - Actions
- Unit - Create 1 Item Holder for (Picked player) at TempPoint facing 270.00 degrees
- Set ItemHolder[(Player number of (Picked player))] = (Last created unit)
- Loop - Actions
- Custom script: call RemoveLocation(udg_TempPoint)
- Events
This stores items to the item holder on death
Trigger:
- dont drop items on death
- Events
- Unit - A unit Loses an item
- Conditions
- ((Triggering unit) is dead) Equal to True
- Or - Any (Conditions) are true
- Conditions
- (Unit-type of (Triggering unit)) Equal to Dwarven Mortar Team (Custom)
- (Unit-type of (Triggering unit)) Equal to Goblin Mortar Team (Custom)
- Conditions
- Actions
- Hero - Create (Item-type of (Item being manipulated)) and give it to ItemHolder[(Player number of (Owner of (Triggering unit)))]
- Item - Remove (Item being manipulated)
- Events
**Note, I think this is where the dummy gets multiples of the same item. Don't know why though.
This revives the unit (creates a new unit) and then the [ljass]loop[/ljass] is what gives the items back.
JASS:
function reviveConditions takes nothing returns boolean
return GetUnitTypeId(GetTriggerUnit()) == 039;h004039; or GetUnitTypeId(GetTriggerUnit()) == 039;h005039;
endfunction
function reviveActions takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit u2
local player p = GetOwningPlayer(u)
local integer i = GetUnitTypeId(u)
local timerdialog w
local timer t = CreateTimer()
local location l
local real r = 8.00
local integer j = 1
call TimerStart(t, r, false, null)
call CreateTimerDialogBJ(t, GetPlayerName(p))
set w = GetLastCreatedTimerDialogBJ()
call TimerDialogDisplay( w, false )
call TimerDialogDisplayForPlayerBJ(true, w, p)
call PolledWait(r)
if ( IsPlayerAlly(p, Player(0)) ) then
set l = GetRandomLocInRect(gg_rct_DwarfReviveZone)
set u2 = CreateUnitAtLoc(p, i, l, 270.00)
call SelectUnitForPlayerSingle(u2, p)
endif
if ( IsPlayerEnemy(p, Player(0)) ) then
set l = GetRandomLocInRect(gg_rct_GoblinReviveZone)
set u2 = CreateUnitAtLoc(p, i, l, 270.00)
call SelectUnitForPlayerSingle(u2, p)
endif
loop
exitwhen j == 4
call UnitAddItemById( u2, GetItemTypeId(UnitItemInSlot(udg_ItemHolder[GetConvertedPlayerId(p)], j)) )
call RemoveItem( UnitItemInSlot(udg_ItemHolder[GetConvertedPlayerId(p)], j) )
set j = j + 1
endloop
call PanCameraToTimedLocForPlayer(p,l,0.60)
call DestroyTimerDialog(w)
call RemoveLocation(l)
set u = null
set u2 = null
set t = null
endfunction
//===========================================================================
function InitTrig_revive takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( t, Condition( function reviveConditions ) )
call TriggerAddAction( t, function reviveActions )
endfunction