- Joined
- Jul 26, 2008
- Messages
- 1,009
HEY GAIZ!!!!!!one
It's meeeeee. I'm having issues this time with this little diddy I created:
You see the problem is that it is returning (0, 0) for the center of the rects, so I assume it's giving me null. I've looked over the code but just can seem to figure it out, even after trying several things I figured would work.
Also, are all the GetLocalPlayers() being used properly, preventing a desync online?
It's meeeeee. I'm having issues this time with this little diddy I created:
JASS:
//How this works: Players will go to ForceRectOne if they're in Force One and ForceRectTwo
scope DyingHeroWindowTimer initializer Init
globals
private constant real minTime = 30. //This is how long a player will have to wait to be revived at level 1
private constant real maxTime = 150. //Maximum time a maxed out level hero should have to wait to revive
private constant real maxLevel = 25. //Maximum Level as defined by your Gameplayer Constants
rect ForceRectOne = gg_rct_Force1Spawn // Name your region for Team 1 here, gg_rect_ and then the regions name
rect ForceRectTwo = gg_rct_Force2Spawn // Name your Region for Team 2 here, gg_rect_ and then the regions name
private constant string ReviverFX = "Abilities\\Spells\\Human\\Polymorph\\PolyMorphFallingSheepArt.mdl"
private constant string FriendsFX = "Abilities\\Spells\\Human\\ReviveHuman\\ReviveHuman.mdl"
endglobals
private struct Data
unit d
timerdialog timdia
static method create takes unit died returns Data
local Data D = Data.allocate()
set D.d = died
return D
endmethod
endstruct
private function Conditions takes nothing returns boolean
return IsUnitType(GetDyingUnit(), UNIT_TYPE_HERO) == true
endfunction
private function Timer takes nothing returns nothing
local timer tim = GetExpiredTimer()
local Data D = Data(GetTimerData(tim))
local real X
local real Y
local string lol
if IsUnitAlly(D.d, Player(0)) == false then
set X = GetRectCenterX(ForceRectOne)
set Y = GetRectCenterY(ForceRectOne)
else
set X = GetRectCenterX(ForceRectTwo)
set Y = GetRectCenterY(ForceRectTwo)
endif
call BJDebugMsg(R2S(X))
call BJDebugMsg(R2S(Y))
call ReviveHero(D.d, X, Y, false)
if (GetLocalPlayer() == GetOwningPlayer(D.d)) then
call PanCameraTo( X, Y)
call TimerDialogDisplay(D.timdia, false)
set lol = ReviverFX
call ClearSelection()
call SelectUnit(D.d, true)
else
set lol = FriendsFX
endif
call DestroyEffect(AddSpecialEffectTarget(lol, D.d, "origin"))
call DestroyTimerDialog(D.timdia)
call ReleaseTimer(tim)
call D.destroy()
endfunction
private function Actions takes nothing returns nothing
local timer tim = NewTimer()
local Data D = Data.create(GetDyingUnit())
local real curLevel = GetHeroLevel(D.d)
local real dur = (minTime - (maxLevel/maxTime)) + ((maxLevel/maxTime) * curLevel)
call SetTimerData(tim,D)
set D.timdia = CreateTimerDialog(tim)
if (GetLocalPlayer() == GetOwningPlayer(D.d)) then
call TimerDialogDisplay(D.timdia, true)
endif
call TimerStart(tim, dur, false, function Timer)
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition(t, Condition( function Conditions ) )
call TriggerAddAction(t, function Actions )
endfunction
endscope
You see the problem is that it is returning (0, 0) for the center of the rects, so I assume it's giving me null. I've looked over the code but just can seem to figure it out, even after trying several things I figured would work.
Also, are all the GetLocalPlayers() being used properly, preventing a desync online?
Attachments
Last edited by a moderator: