• 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] Ordering Units under Conditions

Status
Not open for further replies.
Level 1
Joined
May 14, 2008
Messages
3
Lets say if a unit like a ghoul entered a Region and then i want to order that unit to go to another region becuase it needs to follow a certin path. but the condition is that the trigger unit must be owned by a player.

JASS:
function MoveToLocation takes nothing returns nothing
    call GetUnitsInRectAll(GetRectCenter(Undead_Top_Left_Spawn)
    call IssuePointOrderLoc(GetUnitsInRectOfPlayer(GetRectCenter(Undead_Top_Left_Spawn), Player(0)), attack, GetRectCenter(Top_Lane_Attacks_Here))
endfunction

Am i close to the function i want?
Please hlep.
 
Level 9
Joined
Dec 4, 2007
Messages
562
Ummm....It works on GUI, but I dont know a shit about JASS....well maybe this helps you anyways.

  • Test
    • Events
      • Unit - A unit enters No region
    • Conditions
      • (Owner of (Entering unit)) Equal to Player 1 (Red)
      • (Unit-type of (Entering unit)) Equal to Ghoul
    • Actions
      • Unit - Order (Entering unit) to Patrol To (Center of No region)
And then you just chose the first region called "No region"(at the first row) to the region that the unit enters and the second region at the last row is the region that it shall walk to...

And I just changed "Patrol To" instead of "Move to" because if you use Patrol it will attack a target that comes close to it and when the target is dead it will continue to walk to its goal. Instead of just walking to its goal even if it is attacked if you choose "Move To".

Hope that helps you I-Touch-You.
 
Level 5
Joined
Jan 25, 2006
Messages
103
Lets say if a unit like a ghoul entered a Region and then i want to order that unit to go to another region becuase it needs to follow a certin path. but the condition is that the trigger unit must be owned by a player.

JASS:
function MoveToLocation takes nothing returns nothing
    call GetUnitsInRectAll(GetRectCenter(Undead_Top_Left_Spawn)
    call IssuePointOrderLoc(GetUnitsInRectOfPlayer(GetRectCenter(Undead_Top_Left_Spawn), Player(0)), attack, GetRectCenter(Top_Lane_Attacks_Here))
endfunction

Am i close to the function i want?
Please hlep.

where is the player condition?
Anyways thats pretty easy to test and find out for yourself, you would 100% loose more time just posting this question, in this time you would have tested the map at least 10 times and find out if it works!
 
Level 1
Joined
May 14, 2008
Messages
3
Ummm....It works on GUI, but I dont know a shit about JASS....well maybe this helps you anyways.

  • Test
    • Events
      • Unit - A unit enters No region
    • Conditions
      • (Owner of (Entering unit)) Equal to Player 1 (Red)
      • (Unit-type of (Entering unit)) Equal to Ghoul
    • Actions
      • Unit - Order (Entering unit) to Patrol To (Center of No region)
And then you just chose the first region called "No region"(at the first row) to the region that the unit enters and the second region at the last row is the region that it shall walk to...

And I just changed "Patrol To" instead of "Move to" because if you use Patrol it will attack a target that comes close to it and when the target is dead it will continue to walk to its goal. Instead of just walking to its goal even if it is attacked if you choose "Move To".

Hope that helps you I-Touch-You.

Thanks for the Gui Trigger but im is desperate need for JASS cause i want to learn it.
 
Level 9
Joined
Nov 28, 2008
Messages
704
My apologies.. have you done any JASS at all?

You have two options: add a condition to the trigger (you can see hwo this works by making a gui trigger with conditions and doing edit -> custom text, or using an

JASS:
if GetOwningPlayer(GetTriggerUnit()) == Player(0) and tempInt == 1 then
//roar!
endif
 
Level 7
Joined
Oct 14, 2008
Messages
340
something like this perhaps?

JASS:
function MoveGhoulConds takes nothing returns boolean
    return GetOwningPlayer(GetTriggerUnit()) == Player(x) and GetUnitTypeId(GetTriggerUnit()) == 'goul'
endfunction

function MoveGhoulActions takes nothing returns nothing
    local unit g = GetTriggerUnit()
    local real x = GetRectCenterX(gg_rct_TargetRect)
    local real y = GetRectCenterY(gg_rct_TargetRect)
    call IssuePointOrder(g, "attack", x, y)
    set g = null
endfunction

//===========================================================================
function InitTrig_MoveMyGhoul takes nothing returns nothing
    set gg_trg_MoveMyGhoul = CreateTrigger()
    call TriggerRegisterEnterRectSimple(gg_trg_MoveMyGhoul, gg_rct_MyRect)
    call TriggerAddCondition(gg_trg_MoveMyGhoul, Condition(function MoveGhoulConds))
    call TriggerAddAction(gg_trg_MoveMyGhoul, function MoveGhoulActions)
endfunction
 
Status
Not open for further replies.
Top