Lifee
New Member
- Reaction score
- 46
What isnt working ? i dont understandok.When i test it it wored.Now that i am testing the map is not working.Why this is happening?
What isnt working ? i dont understandok.When i test it it wored.Now that i am testing the map is not working.Why this is happening?
@Next Post by LifeeYour trigger isn't going to work if the triggering unit disappears from the game by decay, Lifee. Furthermore, that trigger example leaks more than just a location and will cause the game to lag.
A system isn't something that takes only one line of GUI. We'll first be able to help you on this subject once you are willing to accept that there is work and a learning process involved in making a map.
It maybe leaks but it works ! And he can find other from searsh link that bogrim already posted.@Next Post by Lifee
1st: Your trigger leaks.
2nd: Check Quote.
Creep Setup
Events
Map initialization
Conditions
Actions
Set [COLOR="Red"]TempGroup[/COLOR] = (Units owned by [COLOR="SeaGreen"]Player owning your creeps![/COLOR])
Unit Group - Pick every unit in [COLOR="Red"]TempGroup[/COLOR] and do (Actions)
Loop - Actions
Set [COLOR="Red"]Integer[/COLOR] = ([COLOR="Red"]Integer[/COLOR] + 1)
Unit - Set the custom value of (Picked unit) to [COLOR="Red"]Integer[/COLOR]
Set [COLOR="Red"]CreepLoc[/COLOR][[COLOR="Red"]Integer[/COLOR]] = (Position of (Picked unit))
Custom script: call DestroyGroup(udg_[COLOR="Red"]TempGroup[/COLOR])
Respawn
Events
Unit - A unit Dies
Conditions
(Owner of (Dying unit)) Equal to [COLOR="SeaGreen"]Player owning your creeps![/COLOR]
Actions
Wait [COLOR="SeaGreen"]Respawn Time[/COLOR] seconds
Unit - Create 1 (Unit-type of (Dying unit)) for (Owner of (Dying unit)) at [COLOR="Red"]CreepLoc[/COLOR][(Custom value of (Dying unit))] facing Default building facing degrees
Unit - Set the custom value of (Last created unit) to (Custom value of (Dying unit))
Create new units where? If he use the palette in the editor they will automatically be counted in this.surely for your trigger :Creep Setup: you would want it every second and not at initialisation? cos what if he creates new units?
Set [COLOR="Red"]Integer[/COLOR] = ([COLOR="Red"]Integer[/COLOR] + 1)
Unit - Set the custom value of (Last created unit) to [COLOR="Red"]Integer[/COLOR]
Set [COLOR="Red"]CreepLoc[/COLOR][[COLOR="Red"]Integer[/COLOR]] = (Position of (Last created unit))
It shouldn't matter much.Just a small note, there's no reason to use "Dying unit". Just use Triggering unit. The unit that activates the event will always be the triggering unit, and all the event responses that correspond to triggering unit are completely pointless.
sorry, but i seem remember that triggering unit last forever in the trigger but dying unit, casting unit and etc are not.It shouldn't matter much.
JASS:
are both natives and if he uses dying unit, he wouldn't get confused later, even if Triggering Unit is faster.
globals
real Respawn_Time = 30
location array CreepLoc
endglobals
scope Respawn initializer Init
private function Conditions takes nothing returns boolean
return GetOwningPlayer(GetDyingUnit()) == Player(9)
endfunction
private function Actions takes nothing returns nothing
local unit re
call TriggerSleepAction(Respawn_Time)
set re = CreateUnitAtLoc(GetOwningPlayer(GetDyingUnit()), GetUnitTypeId(GetDyingUnit()), CreepLoc[GetUnitUserData(GetDyingUnit())], GetRandomReal(1, 360))
call SetUnitUserData(re, GetUnitUserData(GetDyingUnit()))
set re = null
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
local integer lint = 0
loop
call TriggerRegisterPlayerUnitEvent(t, Player(lint), EVENT_PLAYER_UNIT_DEATH, null)
set lint = lint + 1
exitwhen lint == 11
endloop
call TriggerAddCondition(t, Condition(function Conditions))
call TriggerAddAction(t, function Actions)
set t = null
endfunction
endscope
While triggerunit is a local variable that will persist through any wait period, it is still just a handle and if the unit itself disappears from the game (for any reason, such as decay, being the target of a Raise Dead-type spell or removed by a trigger) before the handle is used, the game cannot retrieve the necessary information. For this same reason, you saved the location variables in the map initialization rather than as an attached variable to the unit.Could you explain exactly why ?![]()
library Respawn initializer onInit uses KT
private function RespawnTime takes nothing returns real
return 60.00
endfunction
struct Data
integer rawcode
player owner
real x
real y
private static method create takes unit u returns thistype
local thistype this=thistype.allocate()
set this.rawcode=GetUnitTypeId(u)
set this.owner=GetOwningPlayer(u)
set .x=GetUnitX(u)
set .y=GetUnitY(u)
return this
endmethod
endstruct
private function callback takes nothing returns boolean
local Data data=KT_GetData() // I forget how to inline this.
call CreateUnit(data.owner,data.int,data.x,data.y,0)
return true
endfunction
private function Action takes nothing returns nothing
local Data data=Data.create(GetUnitTypeId(GetTrigerUnit()))
call KT_Add(function callback,data,RespawnTime())
endfunction
private function onInit takes nothing returns nothing
local trigger t=CreateTrigger()
local integer int=BJ_MAX_PLAYERS+1
loop
set int=int-1
call TriggerRegisterPlayerUnitEvent(t,Player(int),EVENT_PLAYER_UNIT_DEATH,null)
exitwhen lint==0
endloop
call TriggerAddAction(t,function Action)
set t=null
endfunction
endlibrary