• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

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 13
Joined
Nov 4, 2006
Messages
1,239
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