Stealth Ability

cr4xzZz

Also known as azwraith_ftL.
Well, it's kind a stupid situation... I can't imagine that this simple trigger can give me problems.... OK, so this spell is based on WW. On cast if there is an enemy in 450 range the Hero cannot Prowl. The problem is that the Hero prowls even if there are enemies in 450 range. I can't find why it's doing this
JASS:
scope Prowl

globals
    private constant integer ABILITY_RAW = 'A009'
    private constant real MAX_RANGE = 450.
    private constant integer BUFF_RAW = 'B007'
endglobals

private function Conditions takes nothing returns boolean
    return GetSpellAbilityId() == ABILITY_RAW
endfunction

private function Check takes nothing returns boolean
    return IsUnitEnemy(GetEnumUnit(), GetOwningPlayer(GetTriggerUnit())) == true and GetUnitState(GetEnumUnit(), UNIT_STATE_LIFE) >= 0.405
endfunction

private function Actions takes nothing returns nothing
    local unit cast = GetTriggerUnit()
    local group gr = CreateGroup()
    local real cX = GetUnitX(cast)
    local real cY = GetUnitY(cast)
    local string text = "You cannot Prowl in front of enemies"
    call TriggerSleepAction(0.1) // transparency .. + the buff can't be removed instantly on cast
    call GroupEnumUnitsInRange(gr, cX, cY, MAX_RANGE, Condition(function Check))
    if CountUnitsInGroup(gr) > 1 then
        call UnitRemoveAbility(cast, BUFF_RAW)
        call SimError_Call(GetOwningPlayer(cast), text)
    endif
    call DestroyGroup(gr)
    set cast = null
    set text = null
    set gr = null
endfunction

function InitTrig_Prowl takes nothing returns nothing
    local trigger prw = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(prw, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(prw, Condition(function Conditions))
    call TriggerAddAction(prw, function Actions)
endfunction

endscope
 

darkRae

Ueki Fan (Ueki is watching you)
The code looks fine to me. I just learned JASS basics a few weeks ago
How many units were there in 450 range?
If there is 1 enemy unit, and you were able to 'Prowl', well that's because you used '>' 1, instead of '>=', so if there's 1 enemy unit, you still can 'Prowl'

But if there were more than 1 enemy, I don't know..

EDIT:
Shoot >< then I give up JASS is hard..
 

cr4xzZz

Also known as azwraith_ftL.
> But if there were more than 1 enemy, I don't know..
Yep, there were 6 ogres and I was still able to Prowl...
 

0zaru

Learning vJASS ;)
>IsUnitEnemy(GetEnumUnit(), GetOwningPlayer(GetTriggerUnit())) == true and GetUnitState(GetEnumUnit(), UNIT_STATE_LIFE) >= 0.405

replace all GetEnumUnit() with GetFilterUnit(). Also sometimes that boolexpr from the function GroupEnumUnitsInRange doesn't work. Try anyway.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    It happens in corporations. They just absorb the companies they buy and it is not about the love of making awesome games it is how much money can we make with the least amount of cost.
  • The Helper The Helper:
    Blizzard is watered down now hopefully they can pull it together
  • The Helper The Helper:
    they got a server engineer job opening :)
  • Ghan Ghan:
    I really do not want to move to California otherwise I might consider it.
  • The Helper The Helper:
    yeah California is not anywhere you really want to live
  • The Helper The Helper:
    That is why I did not take the job Blizzard offered me back in the day, there is no way I could have moved my family there on what they were offering, not even close and that was like 20 years ago
  • The Helper The Helper:
    yeah they wanted me on the tech support team when they did not get me they got one of the next MVPs in Dinobot
  • The Helper The Helper:
    Dinobot was one of the youngest of the MVPs tkron probably could have worked for Blizzard but he had a good job in Chicago doing business programming already
  • The Helper The Helper:
    Dinobot probably still works for Blizzard would love to reconnect with that guy
  • The Helper The Helper:
    I wonder what ever happened to Wargasm?
  • The Helper The Helper:
    This new version of Xenforo really is awesome
  • Ghan Ghan:
    Wargasm is still around. He works for the domain registrar where thehelper.net is kept.

    Members online

    No members online now.

    Affiliates

    Hive Workshop
    Top