• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] 2 small questions

Status
Not open for further replies.
Level 6
Joined
Apr 16, 2011
Messages
158
hay :goblin_good_job:
I have a spell for dummy ("Starfall") and a spell for the hero cast
but the function IssueTargetOrder() requires a target
the goal and do "Starfall" so that the hero does not have to keep casting
how make?
JASS:
library SlowTime initializer init requires SpellEffectEvent 
    
    globals
    private constant integer ABILITY_ID      = 'A005'
    private constant integer ABILITY_DUMMY   = 'A004'
    private constant integer DUMMY_ID        = 'u000'
    private constant real    RADIUS          = 1.000
    endglobals

private function run takes nothing returns nothing
    
    local unit    u         = GetTriggerUnit()
    local real    x         = GetUnitX(u)
    local real    y         = GetUnitY(u)
    local unit    d       
    local integer i         = GetUnitAbilityLevel(u, ABILITY_ID)

    
    set d = CreateUnit(GetTriggerPlayer(), DUMMY_ID, GetUnitX(u), GetUnitY(u), 0)
    call UnitAddAbility(d, ABILITY_DUMMY)
    call SetUnitAbilityLevel(d,ABILITY_DUMMY, i)
    call IssueTargetOrder(d, "starfall",///HERRRR!@@1!// )
    call UnitApplyTimedLife(d, 'BTLF', .10)    
    

     set u = null
     set d = null
     
endfunction


private function init takes nothing returns nothing
 call RegisterSpellEffectEvent(ABILITY_ID, function run)
endfunction

endlibrary

the second quest is about GroupRemoveUnit()
in which of these two sites is correct?


JASS:
 call GroupEnumUnitsInRange(bj_lastCreatedGroup, x, y, RADIUS, null)
    loop
      set j = FirstOfGroup(bj_lastCreatedGroup)
      exitwhen j == null
      call GroupRemoveUnit(bj_lastCreatedGroup, j) // here ? 
      if IsUnitEnemy(j, p) and not IsUnitType(j, UNIT_TYPE_DEAD) and not IsUnitType(j, UNIT_TYPE_STRUCTURE) and not IsUnitType(j, UNIT_TYPE_MAGIC_IMMUNE) then
       // ....
      endif
 // or here ?
     endloop

ty for help
I knew the answers: ((
but I was long forgotten ~~back to programing
 
Level 5
Joined
Jun 16, 2004
Messages
108
For the first you are probably looking for IssueImmediateOrder(unit, string)

For the second either of the two places is fine for the GroupRemoveUnit call. I normally put it at the end to separate it from the rest of the loop actions, though. Also, might not be a good idea to use bj_lastCreatedGroup. Although it is a pretty good idea to use one dedicated group for general enums.
 
Status
Not open for further replies.
Top