• 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.

Starcraft bunkers! (counting units inside a burrow)

Status
Not open for further replies.
Ok, in my map basically I am trying to implement a starcraft bunker system. Only one type of unit can enter the burrows though so I figured I would just use Pheonix fire and have four separate ones that I can give the burrow depending on how many units are in it. Problem is I can't seem to find how to count units inside a burrow, and I can't find a event that will allow me to sense it. (there are alot of bunkers on the map so I dont think checking every once in a while would be a very effective strategy)

Somebody help me out.
 
Level 9
Joined
Apr 3, 2008
Messages
700
You need to use global variable array of type rct in event.
JASS:
function Trig_T1_A takes nothing returns nothing
    set udg_Bunker[i] = ( udg_Bunker[i] + 1 )
endfunction

//===========================================================================
function InitTrig_T1 takes nothing returns nothing
    set gg_trg_T1 = CreateTrigger(  )
    call TriggerRegisterEnterRectSimple( gg_trg_T1, udg_rct[i] )
    call TriggerAddAction( gg_trg_T1, function Trig_T1_A )
endfunction
 
Level 14
Joined
Nov 4, 2006
Messages
1,241
i'm using a system with items in my commandandconquer map, it creates an item in the bunkers inventory which has the pheonix fire ability, so 4 units inside -> 4 items

  • bunker
    • Events
      • Unit - A unit is loaded into a transport.
    • Conditions
      • (Unit-type of (Triggering unit)) equal to your unit-type
      • (Unit-type of (Loading unit)) equal to Bunker
    • Actions
      • Set TempPoint = (Position of (Loading Unit))
      • Item - Create <Pheonixfire-Item> at (TempPoint))
      • Unit - Order (Transporting unit) to Rightclick (Last created item)
      • Custom script: call RemoveLocation(udg_TempPoint)
  • bunker leave
    • Events
      • Unit - A unit finishes casting an ability
    • Conditions
      • (Ability being cast) equal to leave Bunker (unload all)
    • Actions
      • Item - Remove (Item carried by (Triggering unit) in slot 1)
      • Item - Remove (Item carried by (Triggering unit) in slot 2)
      • Item - Remove (Item carried by (Triggering unit) in slot 3)
      • Item - Remove (Item carried by (Triggering unit) in slot 4)
      • Item - Remove (Item carried by (Triggering unit) in slot 5)
      • Item - Remove (Item carried by (Triggering unit) in slot 6)
if you remove single units from the bunker use:

  • unload one unit
    • Events
      • Unit - A unit is issued an order targeting an object
    • Conditions
      • (Issued order) equal to (Order(unload))
      • (Unit-type of (Triggering unit)) equal to Bunker
    • Actions
      • Item - Remove (Item carried by (Triggering unit) in slot (Number of items carried by (Triggering unit)))
 
Hrmm... Day Elven maybe if there was a set amount of bunkers and I could manage each one, but there isnt, and that is still not a way to check how many units are in it. Besides, units can enter the bunker without going on it, and there is flying units, and bunkers are real close in some areas.

UreDe4d, that is exactly what I wanted to do and the a pretty good way of doing it, +rep, Thanks.

Locust units. Hmm, here I see too many options for exploits and glitches. And it is a bit wierd to manage. And I would still have the issue of seeing how many units there are in the bunker. I couldnt use area, because some bunkers could be really close... Hrmmm

Im gonna go with UreDe4d's way.
Will post back I get it working.

Side note, do you have issues if they tell two units to load in at the same time? Also, if I wanted to use abilities and not items, how would I tell how many units are already in the bunker? And how do you make an item so they cannot drop it? Oo or is there a way to hide inventory but still have it?
 
Status
Not open for further replies.
Top