• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] Is there a function that....

Status
Not open for further replies.
Level 4
Joined
Mar 23, 2008
Messages
87
pizzatime

  • Construction
    • Events
      • Unit - A unit Begins construction
    • Conditions
    • Actions
      • Set unitArr[0] = (Constructing structure)
      • Set unitArr[1] = (Triggering unit)
 
Last edited:
Level 16
Joined
Mar 3, 2006
Messages
1,564
That was in GUI but since the thread has a
JASS:
 title.
 
native:[code=jass]call TriggerRegisterPlayerUnitEvent(trig, Player(index), whichEvent, null)

BJ:
JASS:
function TriggerRegisterAnyUnitEventBJ takes trigger trig, playerunitevent whichEvent returns nothing

And the whichEvent will be EVENT_PLAYER_UNIT_CONSTRUCT_START
 
Level 4
Joined
Mar 23, 2008
Messages
87
Aww... and i though i was clever :(
kk, I'll experiment some with
  • Unit - A unit Is issued an order targeting a point
and then report my findings when I'm done.

That was in GUI but since the thread has a
JASS:
 title.[/QUOTE]
Ooops... sorry, didn't notice :D JASS from now on, got it ;)
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
Try this
  • Untitled Trigger 001
    • Events
      • Unit - A unit Begins construction
      • Unit - A unit Is issued an order targeting a point
    • Conditions
    • Actions
      • Set structure = (Constructing structure)
      • Set constructor = (Ordered unit)
      • Game - Display to (All players) the text: (String((Unit-type of structure)))
      • Game - Display to (All players) the text: (String((Unit-type of constructor)))
 
Level 4
Joined
Mar 23, 2008
Messages
87
@Starquizer: [ JASS ] remember?

Findings:
JASS:
function Trig_Building_Actions takes nothing returns nothing
    local string u = UnitId2String(String2UnitIdBJ(OrderId2StringBJ(GetIssuedOrderIdBJ())))

    if u!=null then
        call DisplayTextToForce( GetPlayersAll(), UnitId2StringBJ(GetUnitTypeId(GetTriggerUnit()))+" is building: "+u )
    else
        call DisplayTextToForce( GetPlayersAll(), "other order" )
    endif
endfunction

//===========================================================================
function InitTrig_Building takes nothing returns nothing
    set gg_trg_Building = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Building, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER )
    call TriggerAddAction( gg_trg_Building, function Trig_Building_Actions )
endfunction
You should be able to find both building unit and unit being built using this :)
 
Last edited:
Level 8
Joined
Jul 28, 2008
Messages
211
Thanks guys!

Try this

Untitled Trigger 001

Events

Unit - A unit Begins construction
Unit - A unit Is issued an order targeting a point

Conditions
Actions

Set structure = (Constructing structure)
Set constructor = (Ordered unit)
Game - Display to (All players) the text: (String((Unit-type of structure)))
Game - Display to (All players) the text: (String((Unit-type of constructor)))

Since it was your idea....
Did I ever tell you that you're epic?? I mean you helped me with my missle system and now this! Thanks :D
 
Level 4
Joined
Mar 23, 2008
Messages
87
You're welcome.

But don't forget to add a condition to check the issued order, but I don't know the build order string so that the trigger don't fire every time an order other than building is issued.

My script checks if the order is a unit type, which usually means structure :)
Otherwise you would have to go through every structure the unit can build.
 
Status
Not open for further replies.
Top