Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: Creating a 'guardian' unit
Creating a 'guardian' unit
This topic is locked. You can no longer write replies here.
Jul 23 2009, 4:34 am
By: Saox  

Jul 23 2009, 4:34 am Saox Post #1



In a map, where you build bases and fight the other players, I'd like to switch a terran building(turret) to a defensive structure of a different kind. When the player builds the turret I want it to be removed, and to create a wraith above that destroyed turret, that will work like a defensive structure, I want it to be immobilized and to fire at the enemies. What is the trigger for that ?



None.

Jul 23 2009, 4:50 am Jack Post #2

>be faceless void >mfw I have no face

Force 1

Current player Bring at least 1 Terran Turrdt to Anywhere
Center location removeTurret on Terran Turret at anywhere
Remove 1 Turret at removETurret.
Create 1 wraith for current player at Removeturret
Create one devouring one for Neutral at removeTUrret. Set properties (burrowed and invincible)
Preserve trigger.

The devouring one is for this next part, for keeping the wraith there.you need hypertriggers too. The holdposbig may need some testing for the right size but try 2x2. Holdpossmall should be very small.

Playerx(a computer is best for this)

Always

center location holdposbig on devouring one owned by Neutral at anywhere.

center location holdpossmall on devouring one owned by Neutral at holdposbig.
Give 1 devouring one owned by Neutral at holdpossmall to P8(or other computer)
Order all wraith at holdposbig:attack to holdpossmall
Preserve Trigger.



Red classic.

"In short, their absurdities are so extreme that it is painful even to quote them."

Jul 23 2009, 10:27 am JaFF Post #3



Quote from name:zany_001
Force 1

Current player Bring at least 1 Terran Turrdt to Anywhere
Center location removeTurret on Terran Turret at anywhere
Remove 1 Turret at removETurret.
Create 1 wraith for current player at Removeturret
Create one devouring one for Neutral at removeTUrret. Set properties (burrowed and invincible)
Preserve trigger.

The devouring one is for this next part, for keeping the wraith there.you need hypertriggers too. The holdposbig may need some testing for the right size but try 2x2. Holdpossmall should be very small.

Playerx(a computer is best for this)

Always

center location holdposbig on devouring one owned by Neutral at anywhere.

center location holdpossmall on devouring one owned by Neutral at holdposbig.
Give 1 devouring one owned by Neutral at holdpossmall to P8(or other computer)
Order all wraith at holdposbig:attack to holdpossmall
Preserve Trigger.
First of all, this method does not work conceptually: the wraith will not auto-attack any enemies even if you used 'patrol' instead of command and the player can just fast-click to get the wraith out of its location. You can check if you don't believe me. Also, both triggers will not work as they are intended: you cannot create units for P9-12 and your second trigger will only scan through all the burrowed units only once.

I see no 'elegant' way of doing this except periodically creating and removing the wraiths.



None.

Jul 23 2009, 3:42 pm payne Post #4

:payne:

The only way I could find is to center a location on the turret, remove it, create a wraith and then center an inverted location on this wraith and when you detect it has left the location, you move him back in it ^^



None.

Jul 23 2009, 4:17 pm JaFF Post #5



Quote from payne
The only way I could find is to center a location on the turret, remove it, create a wraith and then center an inverted location on this wraith and when you detect it has left the location, you move him back in it ^^
That's actually a very good solution. To explain a bit more, I'll post the triggers. *wait a bit, I'll edit my post*



None.

Jul 23 2009, 4:26 pm JaBoK Post #6



This system doesn't allow for an undetermined amount of wraiths, though.

I would think that a better solution would involve leaving the turret there, first off, and each trigger pass, centering a 2/2 and an inverted location on the turret, then detecting and possibly moving the wraith. Afterwards, a trigger to give the turret to a computer player until the end of the pass could be added, and the entire system copy-pasted say, 100 times, ending with a trigger that gives back the turrets.

This way, an undetermined amount of turrets could be supported, and the wraiths would be allowed to fight freely without being ordered, stopping only if they were forced to move, which is when enemies leave range anyways. The missile turrets would of course have to be there, but with constant giving to a computer player I do believe they would be unable to attack enemies.



None.

Jul 23 2009, 4:58 pm Kaias Post #7



If you marked each created wraith with a pair burrowed unit you could cycle through the burrowed units placing the inverted location and checking if the wraith is there (if not center a larger location to center it back). This would work with an undetermined amount of them. The burrowed unit will also keep any more turrets from being built there.

Another option is always move all Wraiths to an immovable area (like outside the map boundaries). This will work for any amount of wraiths as well; the setback is that the wraiths will be unkillable. Instead you could place a designated unit beneath it to act as the health, for instance, keep the turret and when it dies kill the wraith. You could use any unit that doesn't move. Then just cycle through the wraiths every couple seconds to see if the health unit is alive below them (if not kill the wraith).



None.

Jul 23 2009, 5:03 pm JaFF Post #8



JaBoK, I was talking about a solution for any number of wraiths. And here's the deal...

First of all, what you must have:
1. A player with Burrowing researched. In the trigger I'll provide, this role is given to Player 8.
2. Zerg Zerglings must not be used for other purposes by Players 8, 9 and 10. Just in case.
3. An inverted location of the size of a Wraith. To create one, create any location in SCMDraft2, go to its properties menu (press enter after selecting it) and put the following values into the corresponding boxes:
Left: 36
Top: 28
Right: 1
Bottom: 1

Now, you will first need to create the wraith with the following trigger:
Code
Trigger("Player 1"){
Conditions:
    Bring("Current Player", "Terran Missile Turret", "Anywhere", At least, 1);

Actions:
    Comment("");
    Preserve Trigger();
    Move Location("Current Player", "Terran Missile Turret", "Anywhere", "Scan");
    Remove Unit At Location("Current Player", "Terran Missile Turret", All, "Scan");
    Create Unit with Properties("Player 8", "Zerg Zergling", 1, "Scan", 1);
    Give Units to Player("Player 8", "Player 9", "Zerg Zergling", All, "Scan");
    Create Unit("Current Player", "Terran Wraith", 1, "Scan");
}

//-----------------------------------------------------------------//


Now that the Wraith is created, we can get down to the actual working of the system. As you may have noticed, we placed a burrowed, invincible (it does not say that in the text triggers) Zerg Zergling for Player 9 under the Wraith. These Zerglings will represent the points where the Wraiths are, and we will use them to scan through the Wraiths.

The scanning and all the required operations are done with a group of three triggers copied many times (as many times as many Wraiths you aexpect to have)...
Code
Trigger("Player 1"){
Conditions:
    Bring("Player 9", "Zerg Zergling", "Anywhere", At least, 1);

Actions:
    Comment("");
    Preserve Trigger();
    Move Location("Player 9", "Zerg Zergling", "Anywhere", "Inverted");
    Move Location("Player 9", "Zerg Zergling", "Anywhere", "Scan");
    Give Units to Player("Player 9", "Player 10", "Zerg Zergling", All, "Scan");
}

//-----------------------------------------------------------------//

Trigger("Player 1"){
Conditions:
    Bring("Player 10", "Zerg Zergling", "Anywhere", At least, 1);
    Bring("Current Player", "Terran Wraith", "Scan", At least, 1);
    Bring("Current Player", "Terran Wraith", "Inverted", Exactly, 0);

Actions:
    Comment("");
    Preserve Trigger();
    Move Unit("Current Player", "Terran Wraith", All, "Scan", "Scan");
}

//-----------------------------------------------------------------//

Trigger("Player 1"){
Conditions:
    Bring("Player 10", "Zerg Zergling", "Anywhere", At least, 1);
    Bring("Current Player", "Terran Wraith", "Scan", Exactly, 0);

Actions:
    Comment("");
    Preserve Trigger();
    Remove Unit At Location("Player 10", "Zerg Zergling", All, "Scan");
}

//-----------------------------------------------------------------//


The first trigger of this croup centers a 1x1 tile location called "Scan" and an inverted, Wraith-sized location called "Inverted" on each Zergling and gives the Zergling to Player 10. The second trigger fires if the Wraith has moved; it puts it back to the Zergling's position. The third trigger fires if the Wraith was killed (or removed by your triggers); it simply removes the Zergling.

After you've copied that group of triggers, say, 100 times, you must finish your system with one trigger that gives the Zerglings from Player 10 back to Player 9:
Code
Trigger("Player 1"){
Conditions:
    Bring("Player 9", "Zerg Zergling", "Anywhere", Exactly, 0);
    Bring("Player 10", "Zerg Zergling", "Anywhere", At least, 1);

Actions:
    Comment("");
    Preserve Trigger();
    Give Units to Player("Player 10", "Player 9", "Zerg Zergling", All, "Anywhere");
}

//-----------------------------------------------------------------//


If you have any questions, please ask in this thread. I hope this helps.

Post has been edited 1 time(s), last time on Jul 23 2009, 5:26 pm by JaFF.



None.

Jul 23 2009, 8:13 pm Jack Post #9

>be faceless void >mfw I have no face

Sorry, i forgot the third trigger, but it would have been like Jaffs last trigger.

But Jaff's way is better because of the triggers being copied, so it does the whole thing in one trigger cycle.



Red classic.

"In short, their absurdities are so extreme that it is painful even to quote them."

Jul 23 2009, 9:13 pm stickynote Post #10



Kaias's way works the best in my opinion. The triggers are simple, and it works well.



None.

Jul 23 2009, 9:28 pm JaFF Post #11



The problem with Kaiases method is that the quicker you want it to react to the HP unit dying the closer its lag will get to 3N laggy operations per trigger loop (where N is the number of wraiths) and the less control you will have over the wraiths.

payne's method always stays at 2N laggy operations with full control of the Wraiths. It also looks much more natural to see the Wraiths getting attacked instead of some other unit that is supposed to represent it. The only problem I see with this method arises when you want ground units to attack the Wraiths; then you have to go with Kaiases method.



None.

Jul 23 2009, 9:41 pm killer_sss Post #12



well if its suppose to be like a watch tower i personally believe that it looks more natural for the tower(turret) to be attacked rather than the wraith. Maybe you could go even further and always cloak the wraith so its more of a lazer watch tower. again this has to deal with more lag so it may not be best but i think visually it would look/act better. Maybe wraiths could be created for an enemy computer player depending on how teams are setup. Otherwise the player will always see his laser shooter =/



None.

Jul 24 2009, 5:48 am Saox Post #13



Hi guys!

Thanks for the ammount and quality of feedback! :) I managed to do this thanks to your advice.



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[2024-4-27. : 9:38 pm]
NudeRaider -- Ultraviolet
Ultraviolet shouted: NudeRaider sing it brother
trust me, you don't wanna hear that. I defer that to the pros.
[2024-4-27. : 7:56 pm]
Ultraviolet -- NudeRaider
NudeRaider shouted: "War nie wirklich weg" 🎵
sing it brother
[2024-4-27. : 6:24 pm]
NudeRaider -- "War nie wirklich weg" 🎵
[2024-4-27. : 3:33 pm]
O)FaRTy1billion[MM] -- o sen is back
[2024-4-27. : 1:53 am]
Ultraviolet -- :lol:
[2024-4-26. : 6:51 pm]
Vrael -- It is, and I could definitely use a company with a commitment to flexibility, quality, and customer satisfaction to provide effective solutions to dampness and humidity in my urban environment.
[2024-4-26. : 6:50 pm]
NudeRaider -- Vrael
Vrael shouted: Idk, I was looking more for a dehumidifer company which maybe stands out as a beacon of relief amidst damp and unpredictable climates of bustling metropolises. Not sure Amazon qualifies
sounds like moisture control is often a pressing concern in your city
[2024-4-26. : 6:50 pm]
Vrael -- Maybe here on the StarEdit Network I could look through the Forums for some Introductions to people who care about the Topics of Dehumidifiers and Carpet Cleaning?
[2024-4-26. : 6:49 pm]
Vrael -- Perhaps even here I on the StarEdit Network I could look for some Introductions.
[2024-4-26. : 6:48 pm]
Vrael -- On this Topic, I could definitely use some Introductions.
Please log in to shout.


Members Online: Zycorax, Roy