• 🏆 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!

Starcraft Bunker System

Status
Not open for further replies.
Level 16
Joined
Mar 27, 2011
Messages
1,349
Hey guys, I'm trying to create a bunker system in my Terran Base Defence map. I have a system in place, but it doesn't work when there are 2 or more bunker on the map. I am aware of why, but Ive never been good at fixing this sort of problem (like making spells MUI so they can work for more than 1 hero, etc).

Here is the triggers:
  • Marine Load
    • Events
      • Unit - A unit Is loaded into a transport
    • Conditions
      • (Unit-type of (Loading unit)) Equal to Marine
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Bunker_Count_Marine[(Player number of (Owner of (Triggering unit)))] Equal to 0
        • Then - Actions
          • Unit - Add Marine Fire to (Transporting unit)
          • Unit - Add Marine Slot to (Transporting unit)
          • Set Bunker_Count_Marine[(Player number of (Owner of (Triggering unit)))] = 1
          • Wait until (((Triggering unit) is loaded into (Transporting unit)) Equal to False), checking every 2.00 seconds
          • Set Bunker_Count_Marine[(Player number of (Owner of (Triggering unit)))] = (Bunker_Count_Marine[1] - 1)
          • Unit - Remove Marine Fire from (Transporting unit)
          • Unit - Remove Marine Slot from (Transporting unit)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Bunker_Count_Marine[(Player number of (Owner of (Triggering unit)))] Equal to 1
            • Then - Actions
              • Unit - Increase level of Marine Fire for (Transporting unit)
              • Unit - Increase level of Marine Slot for (Transporting unit)
              • Set Bunker_Count_Marine[(Player number of (Owner of (Triggering unit)))] = 2
              • Wait until (((Triggering unit) is loaded into (Transporting unit)) Equal to False), checking every 2.00 seconds
              • Set Bunker_Count_Marine[(Player number of (Owner of (Triggering unit)))] = (Bunker_Count_Marine[1] - 1)
              • Unit - Set level of Marine Fire for (Transporting unit) to Bunker_Count_Marine[1]
              • Unit - Set level of Marine Slot for (Transporting unit) to Bunker_Count_Marine[1]
            • Else - Actions
              • Do nothing
  • Firebat Load
    • Events
      • Unit - A unit Is loaded into a transport
    • Conditions
      • (Unit-type of (Loading unit)) Equal to Firebat
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Bunker_Count_Firebat[(Player number of (Owner of (Triggering unit)))] Equal to 0
        • Then - Actions
          • Unit - Add Firebat Fire to (Transporting unit)
          • Unit - Add Firebat Slot to (Transporting unit)
          • Set Bunker_Count_Marine[2] = 1
          • Wait until (((Triggering unit) is loaded into (Transporting unit)) Equal to False), checking every 0.25 seconds
          • Set Bunker_Count_Marine[2] = (Bunker_Count_Marine[2] - 1)
          • Unit - Remove Firebat Fire from (Transporting unit)
          • Unit - Remove Firebat Slot from (Transporting unit)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Bunker_Count_Firebat[(Player number of (Owner of (Triggering unit)))] Equal to 1
            • Then - Actions
              • Unit - Increase level of Firebat Fire for (Transporting unit)
              • Unit - Increase level of Firebat Slot for (Transporting unit)
              • Set Bunker_Count_Marine[2] = 2
              • Wait until (((Triggering unit) is loaded into (Transporting unit)) Equal to False), checking every 0.25 seconds
              • Set Bunker_Count_Marine[2] = (Bunker_Count_Marine[2] - 1)
              • Unit - Set level of Firebat Fire for (Transporting unit) to Bunker_Count_Marine[2]
              • Unit - Set level of Firebat Slot for (Transporting unit) to Bunker_Count_Marine[2]
            • Else - Actions
              • Do nothing
There are only 2 types of units allowed in bunkers (marines and firebats) and a max of 2 units can fit inside the bunker. If you've played starcraft 1 or 2, you'd understand that if a firebat enters the bunker, it gets a fire attack. If a marine enters the bunker, it gets a machine gun like attack. So I've used the "pheonixes fire" ability to the bunker.

I have used a wait function to detect a unit leaving the bunker and this wait function makes the system not MUI and glitches if there are more than 1 bunker. Does anybody know how to fix this system please?
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
Here's an ideal bunker system: http://www.hiveworkshop.com/forums/...v1-4-a-222023/?prev=search=bunker&d=list&r=20

It works by creating invisible dummy units at the bunker's position to attack instead of the occupants.

Advantages over using pheonix fire:
- You can target fire
- Special unit attacks, e.g. splash damage
- Damage is properly reduced by armour

(There's also a bunker system in my sig which allows for an infinite number of occupants, but for your purposes the linked system is better)
 
Level 16
Joined
Mar 27, 2011
Messages
1,349
Thanks for the link, however I'm having a problem installing it.

Upon copying the "Unit Event" system, I recieve an error:

attachment.php


I don't know jass or anything, I just followed the map's method. The other triggers appear to have copied fine. What went wrong?
 

Attachments

  • Compile Error.jpg
    Compile Error.jpg
    131.8 KB · Views: 569
Level 16
Joined
Mar 27, 2011
Messages
1,349
Unfortunately I encountered the same problem. The "Unit Event" trigger disabled upon saving the map.

attachment.php

I even started a new map to test the system with no luck.

How to install
Copy Unit Indexer from the demo map (if you don't have it yet)
Copy the DeathEvent Ability from Object Editor
Copy the following trigger (Death Event)
Set the DEvAbility variable in that trigger to the ability

I followed each step in order. I posted the test map below if you could take a look. Thanks.
 

Attachments

  • Unit Event.jpg
    Unit Event.jpg
    110.1 KB · Views: 425
  • Test Map Unit Event.w3x
    23.3 KB · Views: 104
Level 16
Joined
Mar 27, 2011
Messages
1,349
This is wierd. I reopened the test map and the triggers were enables like you said (Wierd since they were disabled upon saving the map). But when I save it again, it just disables.

My actual map's "Unit Event" trigger is still disabled though...wtf??

I'm sorry I cant explain myself better, but I didn't make up those screenshots posted above.

Edit: Does the trigger in this map still work?
 

Attachments

  • Test Map Unit Event.w3x
    23.4 KB · Views: 78
Level 25
Joined
Jul 10, 2006
Messages
3,315
Nope, now I'm getting the same error as you. I'll take a look further.

EDIT: You need to explicit create the timer variable: DEvTimer
The error message, "expected a name", means that a referenced variable doesn't exist. DEvTimer isn't in the GUI Trigger Editor variable list, so I manually created it there, and it saves fine. Spell it exactly like this:
Code:
DEvTimer
Type: timer
Array: no
 
Level 16
Joined
Mar 27, 2011
Messages
1,349
Ahh, works, thanks very much man.

Just one more question. The bunker system adds an ability to all indexed units (based off the defend ability). I don't want this ability to show in the unit's command card. Is this possible? Maybe if I set the system to run off an item based ability (which don't have icons)?

Note the ability already has "art - Icon" set to "None"

Edit: In case your wondering what exactly is wrong, here is an image. No I'm not complaing that its green, Im asking if theres a way so no icon shows at all.

attachment.php
 

Attachments

  • Defend.jpg
    Defend.jpg
    96.4 KB · Views: 834
Level 12
Joined
Mar 24, 2011
Messages
1,082
Nope, now I'm getting the same error as you. I'll take a look further.

EDIT: You need to explicit create the timer variable: DEvTimer
The error message, "expected a name", means that a referenced variable doesn't exist. DEvTimer isn't in the GUI Trigger Editor variable list, so I manually created it there, and it saves fine. Spell it exactly like this:
Code:
DEvTimer
Type: timer
Array: no

Are you sure that I haven't left a note about that ?
As I recall I struggled like 3 hours before finding that the exactly same thing is screwing with me...
 
Status
Not open for further replies.
Top