TheCrystal
New Member
- Reaction score
- 36
For some reason my spell "Holy" is not working. It loops once, stops, and I don't know why it is doing this. It's a simple JASS trigger with two GUI ones initializing it.
Note: I'm still learning JASS, so I basically use GUI whenever it's the simpler of things instead of finishing up basic JASS training (Events, figuring out things like this)
It's the correct buff, "NoBuff" never appears, "Looped" appears once, both messages appear in the GUI. The buff stays on the unit.
AbilityTimers[0] is set on Map Init, lots of clutter in that wont so wont post.
If I change local group g = udg_PaladinHolyGroup
to
local group g = null
call GroupAddGroup(udg_PaladinHolyGroup,g)
Looped doesn't appear
If I change
call SetUnitLifeBJ(u,(GetUnitState(u,UNIT_STATE_LIFE))+udg_TempReal)
to
call SetUnitLifeBJ(u,(GetUnitState(u,UNIT_STATE_LIFE))+100)
it Adds 100 HP once (Loop only appears once), but not when I use GroupAddGroup
If I add a message OUTSIDE the loop it shows it every .05 seconds, like I want it to.
I dunno what's wrong with it, but I hope it isn't one of those obvious kind of things.
Edit: Whole point of ability is to heal a target X amount every .05 second then show the message of how much it healed after 1 second. Sorry for forgetting.
Note: I'm still learning JASS, so I basically use GUI whenever it's the simpler of things instead of finishing up basic JASS training (Events, figuring out things like this)
Trigger:
- PaladinHoly
- Events
- Unit - A unit Starts the effect of an ability
- Conditions
- (Ability being cast) Equal to (==) Holy
- Actions
- Unit Group - Add (Target unit of ability being cast) to PaladinHolyGroup
- Set TempReal = (((Real((Level of (Ability being cast) for (Triggering unit)))) / (30.00 / (Real((Level of (Ability being cast) for (Triggering unit)))))) x (Real(ZZZWisdom[(Player number of (Owner of (Triggering unit)))])))
- Game - Display to (All players) the text: AddedToGroup
- Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- TempReal Less than (<) 1.00
- Then - Actions
- Set TempReal = 1.00
- Game - Display to (All players) the text: LessThen1
- Else - Actions
- If - Conditions
- Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Set TempUnit = (Target unit of ability being cast)
- Custom script: set IndexReal2[GetUnitUserData(udg_TempUnit)] = udg_TempReal
- Events
Trigger:
- PaladinHolyPeriod05
- Events
- Time - AbilityTimers[0] expires
- Conditions
- Actions
- Custom script: call PaladinHolyTimer()
- Events
JASS:
function InitTrig_PaladinHolyTimer takes nothing returns nothing
endfunction
function PaladinHolyTimer takes nothing returns nothing
local real p = 0
local real p2 = 0
local integer i = 0
local group g = udg_PaladinHolyGroup
local unit u = null
loop
set u = FirstOfGroup(g)
exitwhen u == null
if UnitHasBuffBJ(u,039;B002039;)==false then
call GroupRemoveUnit(udg_PaladinHolyGroup,u)
call DisplayTextToPlayer(Player(0), 0, 0, "NoBuff")
endif
call DisplayTextToPlayer(Player(0), 0, 0, "Looped")
set i = GetUnitUserData(u)
set udg_TempReal = IndexReal2<i>
call SetUnitLifeBJ(u, (GetUnitState(u,UNIT_STATE_LIFE))+udg_TempReal)
set HolyTimerTime<i>=HolyTimerTime<i>+.05
if HolyTimerTime<i> >= 1 then
set HolyTimerTime[1] = 0
call GoldText(R2I(udg_TempReal)*20,u)
endif
call GroupRemoveUnit(g,u)
endloop
endfunction
</i></i></i></i>
JASS:
function GoldText takes integer I, unit whichunit returns nothing
local real p = GetUnitX(whichunit)
local real p2 = GetUnitY(whichunit)
local texttag T = CreateTextTag()
set UnitID = GetUnitTypeId(whichunit)
if IsUnitDeadBJ(whichunit) == false and UnitID !=DummyUnit1 and UnitID != DummyUnit2 and UnitID != DummyUnit3 then
call SetTextTagPermanent(T, false )
call SetTextTagPos(T, p, p2, 10)
call SetTextTagFadepoint(T, 2)
call SetTextTagLifespan(T, 3)
call SetTextTagTextBJ(T, "|c00CCCC00" + I2S(I), 8)
call SetTextTagVelocityBJ( T, 64, GetRandomReal(200.00, 245.00) )
else
call DestroyTextTag(T)
endif //Nothings Wrong, but haven't tested this specifically
endfunction
It's the correct buff, "NoBuff" never appears, "Looped" appears once, both messages appear in the GUI. The buff stays on the unit.
AbilityTimers[0] is set on Map Init, lots of clutter in that wont so wont post.
If I change local group g = udg_PaladinHolyGroup
to
local group g = null
call GroupAddGroup(udg_PaladinHolyGroup,g)
Looped doesn't appear
If I change
call SetUnitLifeBJ(u,(GetUnitState(u,UNIT_STATE_LIFE))+udg_TempReal)
to
call SetUnitLifeBJ(u,(GetUnitState(u,UNIT_STATE_LIFE))+100)
it Adds 100 HP once (Loop only appears once), but not when I use GroupAddGroup
If I add a message OUTSIDE the loop it shows it every .05 seconds, like I want it to.
I dunno what's wrong with it, but I hope it isn't one of those obvious kind of things.
Edit: Whole point of ability is to heal a target X amount every .05 second then show the message of how much it healed after 1 second. Sorry for forgetting.