HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Bunkers?

06-19-2004, 05:14 AM#1
TheFrozenStool
I'm making a diplomacy-type map, and at the moment I'm stuck on an issue. I'm trying to simulate the StarCraft bunker, where a unit can enter the bunker, and when it attacks, it deals the amount of damage the unit does. (Basically, the unit is shooting from inside the bunker.) I've tryed a modified orc burrow, but that has a set damage and range, and the number of units inside does not modify damage. In what my goal-bunker is, I could have, say, a firebat, a machine gunner, and two snipers enter the bunker, and the snipers could shoot from, say, 800 range dealing 40 damage each, then when a unit gets within 600 units, the machine gunner starts shooting along with the sniper, and then at 250, the firebat opens fire. How do I do this? It seems pretty complex, and if there isn't a way, that's fine, but it would be nice if it was possible. Thanks for your time :)
06-19-2004, 07:13 AM#2
Anitarf
Well, it isn't possible without triggers. You can't use the orc burrow ability, because it only allows a single unit type.

Now, the following solution is theorethical and not tested out in practice, but anyway, here's how I would try to do this: I would try to use the cargo ability of the goblin zeppelin, and detect whenever a unit enters/goes out of it (if that is possible, of course). When a unit was inside, it wouldn't fire, of course, but I would create an invisible unselectable flying unit with no movement speed above the bunker that would have the same attack as the unit that entered it (this means that for every unit that may enter a bunker, you need an additional unit; alternatively, you could use the same unit type, set it's vertex coloring to 100% transparency, give it locust (unselectabilty), and order it to hold, but it wouldn't be above the bunker then). When a unit left the bunker, you would remove the according shooting unit from the area. I believe there is an event "is loaded into a transport", but I'm not sure if there's an event "is unloaded"... there probably is something like that.
06-19-2004, 01:58 PM#3
LegolasArcher
I submitted a way of detecting when units leave a transport. It uses two order events, and will work with everything but "unload all" (you have to manually unload each unit). Check in the repository
06-19-2004, 04:50 PM#4
Dalten
With Triggers, here's how i would try this first:

1) Detect what unit entered the bunker and set the custom value of the bunker to that unit's attack damage.

2) Detect whenever an enemy unit takes damage AND the attacking unit is a bunker.

3) Set a variable called LIFE equel to : (llife of triggering - Custom value of Bunker.)

4) Now run a check to see if LIFE is less than 1, since if it's less than 1 a trigger will kill it and nobody will get credit. IF it is less than 0, create an invisible unit that does 99999 damage with a .25 second generic expiration timer at the location of the triggering unit and tell it to attack.

5) If LIFE isn't less than 1 then just set the LIfe of Triggering unt = LIFE.

OH and give the bunker attack something like 0 or 1 damage so all the damage done is through triggers.

Good luck, I think this should work.
06-19-2004, 04:57 PM#5
Panto
Dalten, interesting system, but it doesn't account for multiple units or different kinds of units.
06-19-2004, 09:44 PM#6
azndragon1313
i know this is a really noobish question, but how would u detect what unit goes in and out?
06-20-2004, 02:36 AM#7
Perfectwingzero
How about have the units in the same spot but make them unable to move. Then have the bunker over them. They can still fire at enemys but enemys have to destroy the bunker to get to them.So make the units invinsible until bunker over them is gone.
06-20-2004, 02:37 AM#8
Dalten
I was curious about the same thing, I wanted to test this before I replied since I didn't know but here's how it works:

Untitled Trigger 001
Events
Unit - A unit Is loaded into a transport
Conditions
Actions
Game - Display to (All players) the text: Orc has entered the building...

It appears a "transport" is pretty much anything that can house a unit, also including units that can Devour others.

Interesting, this kinda spawned a few idea's for me.

Good luck~
06-20-2004, 03:11 AM#9
linkmaster23
I have no clue if this will work, but try removing the collision size of the unit, and make him go inside the Bunker and stand ground.

:EDIT: Make the BUnker big too.
06-21-2004, 07:05 AM#10
azndragon1313
ok anitar and legolasArcher got the right idea. I followed both of their ideas (including LegolasArcher's trigger in the repositroy) BUT im left with one final problem. How do i remove the corresponding hidden unit to the unit that just left the bunker? Lets say for instance, a sniper enters the bunker.

Event:
1) A unit is loaded into transport
Condition:
1) Unit-type of triggering unit is Sniper
Action:
1) Create 1 Sniper (hidden) for player 1 (red) at Position of triggering unit facing defualt building degrees.
2) Animation - Change last created units vertex coloring to (100% 100% 100%) with 100% transparency

Okay, so the sniper has entered the bunker and so the trigger creates a Sniper(Hidden) unit above him. This unit has locust and is now transparent, and it flies just above the bunker, so it looks like the sniper inside the bunker is shooting. Now I want the sniper to leave the bunker. So, the trigger (that legolasArcher created slightly modified) would go something like this:

Event:
1) Unit - A unit is issued an order targeting an object.
Condition:
1) ((Issued order) Equal to (Order (unload))) and ((Unit-type of (triggering unit)) Equal to Sniper)
Actions:
??????

I have no idea what to do! The closest thing ive gotten to is this:
Actions:
1) Pick every unit in (Units with 200 of (Position of (Triggering Unit)) matching ((Unit-type of (Matching unit)) equal to Sniper(Hidden))) and do (Actions)
Loop - Actions
Remove picked unit from the game.

Now, there is one huge flaw with this trigger. What if I put 2 snipers in the bunker? then 2 Snipers(hidden) would have been created, and then both would be destroyed by this trigger if just one left! and the reason why i cant use (Last created unit) is because what if i put a sniper in bunker #1, and then another in bunker #2. Well, if i remove the dude from #1, the sniper(hidden) will be removed from #2. So What the hell do i do?!?!?!? Help would bE MUCH appreciated


Edit - Scratch that last trigger it wont even remove the units so its COMPLETELY useless. NOw im extremely confused...*sigh* :( :(
06-21-2004, 07:23 AM#11
Anitarf
Simple solution: Instead of "pick every unit and do action...." use the following:

Code:
Actions
    Set TempPoint = (Position of (Triggering unit))
    Set TempGroup = (Units within 200.00 of TempPoint matching ((Unit-type of (Matching unit)) Equal to Footman))
    Unit - Remove (Random unit from TempGroup) from the game
    Custom script:   call RemoveLocation( udg_TempPoint )
    Custom script:   call DestroyGroup( udg_TempGroup )
The custom scripts are there to prevent memory leaks from point and unit group objects. I suggest you use this as well when you create the hidden sniper at (position of (triggering unit)) (because that leaks a point object).
Obviously, in your map, your matching unit won't be a footman, but a sniper (hidden).
I think that's about it.
06-21-2004, 02:40 PM#12
azndragon1313
so i just copy and paste that in to my last trigger and replace footman with SNiper(hiddeN)? im really noob at triggers, so excuse my tendency to somehow not understand simple directions.
06-21-2004, 04:03 PM#13
-={tWiStÄr}=-
You dont dont c&p you recreate with trigger editor. so set the 2 vars then find the rest of the functions and use them. on the last 2 lines u do c&p everything after the custom script: and paste it in in the custom script box.
06-21-2004, 09:34 PM#14
azndragon1313
heh..ran into a problem...i followed the trigger, then i converted it to custom scsript and then copied and pasted the last 2 lines. Only problem is that when i saved, it said that there was something wrong with one of the lines concerning Remove Sniper (hidden).

Edit - Okay i found out that if i dont add the last 2 lines to the custom script then the trigger saves perfectly. I realize that its probably because i just copy the last 2 lines straight into the script (dont worry im not copying "custom script") but i notice a lot of the other script has all this formatting and stuff. I really have no idea of what im doing, pls help.

Also, Anitar recommended that i use the custom script and do the same thing for when i load units in. How exactly do i do that? Im guessing that im going to redo my loading triggers to include variables and if i do, can i simply use TempPoint and TempGroup or will i have to create new ones? *confused*
06-21-2004, 09:56 PM#15
azndragon1313
ok anitar i tried ure method and i didnt work, but most likely to no fault of ure own. Im guessing that u thought i made variables from the start, but no, im too stupid, i have no variables, only the ones u gave me, so its not working. It doesnt remove the hidden units. *sigh*