Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: trigger assistance needed
trigger assistance needed
Nov 14 2009, 11:42 pm
By: SONIC_7  

Nov 14 2009, 11:42 pm SONIC_7 Post #1



i need a simple trigger for replacing a unit.

what I need done is this: When a probe creates a building unit, e.g., photon cannon, I need it to be removed and replaced in the same location immediately by another building unit of same size, e.g., floor gun trap or other 2x2 building.

It sounds easy but I need a global trigger or triggers so I don't have to have hundreds of locations all over the map with triggers specific to players and locations.

I believe it was done on a SPAWN D map (a sheild battery would turn into a missile turret) but for the life of me I can't get the triggers right.

here's what I have so far:
//-----------------------------------------------------------------//

Trigger("Player 1"){
Conditions:
Bring("Current Player", "Protoss Shield Battery", "Anywhere", At least, 1);
Bring("Current Player", "Terran Missile Turret", "P1Change059", At most, 0);

Actions:
Move Location("Current Player", "Protoss Shield Battery", "Anywhere", "P1Change053");
Remove Unit At Location("Current Player", "Protoss Shield Battery", 1, "P1Change053");
Create Unit with Properties("Current Player", "Terran Missile Turret", 1, "P1Change059", 1);
Move Unit("Current Player", "Terran Missile Turret", 1, "P1Change059", "P1Change053");
Preserve Trigger();
}

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

Trigger("Player 1"){
Conditions:
Bring("Current Player", "Terran Missile Turret", "P1Change059", At least, 1);

Actions:
Move Unit("Current Player", "Terran Missile Turret", 1, "P1Change059", "P1Change053");
Preserve Trigger();
}

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

Trigger("Player 1"){
Conditions:
Bring("Current Player", "Protoss Shield Battery", "Anywhere", At least, 1);
Bring("Current Player", "Terran Missile Turret", "P1Change059", At least, 1);

Actions:
Move Location("Current Player", "Protoss Shield Battery", "Anywhere", "P1Change053");
Remove Unit At Location("Current Player", "Protoss Shield Battery", 1, "P1Change053");
Display Text Message(Always Display, "\ UNPLACEABLE! MONEY REFUNDED!");
Move Unit("Current Player", "Terran Missile Turret", 1, "P1Change059", "P1Change053");
Set Resources("Current Player", Add, 300, ore);
Preserve Trigger();
}

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



the locations (P1Change053 etc.) are in space

thx



None.

Nov 14 2009, 11:46 pm Devourer Post #2

Hello

I do not get for what you use the P1Change059 location, here is what I would make:
you need only a 2x2 location (lets call it "loca")

Current Player brings at least 1 (pylon) to anywhere
-> move location "loca"
-> remove pylon for current player at "loca"
-> create photon for current player at "loca"
-> preserve trigger


That's pretty much it.



Please report errors in the Staredit.Network forum.

Nov 14 2009, 11:51 pm SONIC_7 Post #3



i understand that. but i need a global one.
The restriction is not to just a 2x2 area but the entire placeable map. So regardless of where or what type of building unit it has to be removed from there and replaced in the same spot by another building unit. for ex: a pylon, created anywhere on the map, will be replaced with a bunker specifically at that location.
i also have stacking so making specific triggers for each tiny little location would not work. thanks



None.

Nov 14 2009, 11:58 pm FatalException Post #4



I'm afraid I don't understand the problem. Using the "Move Location" action does exactly that, it centers the location on where you tell it to go. If you use the Move Location action, you don't really have need for any more than one location per player, since you can reuse the location as many times as they build things, which thus removes the need to have locations all over the map.



None.

Nov 15 2009, 12:17 am Devourer Post #5

Hello

Quote from SONIC_7
i understand that. but i need a global one.
The restriction is not to just a 2x2 area but the entire placeable map. So regardless of where or what type of building unit it has to be removed from there and replaced in the same spot by another building unit. for ex: a pylon, created anywhere on the map, will be replaced with a bunker specifically at that location.
i also have stacking so making specific triggers for each tiny little location would not work. thanks

I don't get it but I assume you want to replace all pylons with a photon cannon, each supply depot with a bunker and so on (just examples)
you only need 3 locations:
2x2 (for cannons, pylons, sunkens....)
3x2 (for supply-depots, bunkers, forges....)
4x3 (for CCs, nexus, hatechery....)

You detect what player commands at least and move the specific location over that building and replace it.
As I see it you do not know what the move location effects: it centers a preplaced location on the map over the unit owned by the specificed unit which has been selected in the trigger itself.
Means, when you move a location over a pylon of Player 1, remove 1 pylon at that location and create 1 cannon there. Means there will be a photon instead of a pylon.



Please report errors in the Staredit.Network forum.

Nov 15 2009, 12:53 am darksnow Post #6



with moving locations you can reuse the same location over and over, so no locations wasted.
what are you not getting?



None.

Nov 15 2009, 1:06 am SONIC_7 Post #7



got it. i will mod. thx guys



None.

Nov 15 2009, 7:46 am NudeRaider Post #8

We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch

You need 3 locations, as Devourer said, and not 3 per player if you replace them in a single trigger loop.
This is because players fire their triggers 1 after another. First ALL of P1's triggers, then ALL of P2's triggers, and so on.




Nov 15 2009, 8:34 am Wormer Post #9



SONIC_7,
you should take a lil problem into consideration: the location may center on the building which is not finished.



Some.

Nov 16 2009, 3:13 am PearS Post #10



ya wormer has a good point. i ran into that problem on a map i'm finalizing now with supply depots that turn into mineral deposits. When the trigger recognizes a completed building, the action portion of that trigger can center over completed buildings but ALSO non completed ones as well. And it will do it from the bottom left corner up. so if your players are allowed to make more than one at a time it may be messy.



None.

Nov 16 2009, 4:05 am scwizard Post #11



You need a 1x1 location, and a data disc owned by neutral in the exact center of the map. In addition to this you need to not use data discs anywhere else in your map.

Cond:
Always
Action:
center "1x1" around "protoss pylon" owned by Neutral at "Anywhere"
preserve

Cond:
Neutral brings exactly 0 "data disc" to "1x1"
Action:
Remove 1 "protoss pylon" at "1x1"
Create 1 "protoss photon canon" at "1x1"
preserve

If you do this, the second you start warping in a pylon at a location, it will turn into a photon canon.

It's impossible to cleanly replace only complete pylons with photon canons. This is because lets say x under construction and y is a pylon that just finished.
x .
. y

You'll never be able to center around y, since when you say "center around photon canon" it'll center around x.

That is, unless the "give" action works for under construction buildings. I don't know the details of that.

I used a similar method in my version of Heaven's Last Stand to make it so that moving a hallucination to a beacon would have an effect.



None.

Nov 16 2009, 11:43 am Wormer Post #12



Why I express myself so gingerly is because we don't know if SONIC_7 has these problems. There might be at most one building in construction per player at a given moment. Reasons might be different, but if that is the case SONIC_7 doesn't need to care.

Nevertheless for the completeness I would like to tell what I would have done at his place. scwizard, though for hallucinations detection your solution is probably the only thing one can make, there is a better way for buildings.

There are two facts which are worth knowing themselves:
1. Incomplete buildings don't count under the bring condition with modifiers "at least" or "exactly", though they do under the condition with the modifier "at most". (ADDITION: morphing zerg buildings count as incomplete buildings of the type of the previous form, for example a creep morphing to the sunken is considered an incomplete creep colony or lair morphing into hive is an incomplete lair.)
2. Units which are loaded in transport or bunker don't count under the bring condition with the "at most" modifier, though they do under the condition with modifiers "at least" and "exactly".

In other words the first entails:
when one compares buildings quantity using "at most" relation, she compares all buildings (incomplete or complete). However when one compares buildings quantity using "at least" or "exactly" relations, she compares only complete buildings.

Using the first it is easy to construct a system which cycles through all buildings of the given type and converts only complete ones (and yes, the incomplete buildings can be passed between players with the action "give"). The system will work instantly (in one trigger cycle), given that one limits herself with a reasonable high bound of the quantity of incomplete buildings possible at a given moment. The only minor drawback left is that the possible player selection of an incomplete building will be removed when one of them completes.

Post has been edited 7 time(s), last time on Nov 16 2009, 12:27 pm by Wormer.



Some.

Nov 16 2009, 5:58 pm scwizard Post #13



Oh thanks a lot, I didn't know that. That's certainly some strange behavior.

Is it the same with hallucinated units?



None.

Nov 16 2009, 9:44 pm Wormer Post #14



Unfortunately this doesn't work with hallucinations :(



Some.

Nov 16 2009, 9:57 pm Norm Post #15



Use "Bring at least" to avoid detecting incomplete buildings.
You can only make replacements to buildings of the same size with 100% accuracy.
You might have to factor in moving the worker unit before you try to replace the building.
You need to use hypertriggers of course.



None.

Nov 17 2009, 5:22 pm NudeRaider Post #16

We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch

Quote from Norm
Use "Bring at least" to avoid detecting incomplete buildings.
But when you build a 2nd building before the first has started you have a problem. We already discussed that a few posts earlier.

Quote from Norm
You need to use hypertriggers of course.
No.




Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[04:49 pm]
Ultraviolet -- SEN membership is like the supreme court, we're here for life baby
[04:13 am]
O)FaRTy1billion[MM] -- ya
[02:46 am]
slayer766 -- wtf farty you around still hahaah
[2024-11-09. : 4:24 pm]
Oh_Man -- da real donwano
da real donwano shouted: Who can crack into an old protected map & remove the trigger for insta-defeat for playing solo?
me
[2024-11-09. : 12:48 am]
RIVE -- j
[2024-11-08. : 10:41 pm]
lil-Inferno -- p
[2024-11-07. : 7:38 pm]
Zoan -- M
[2024-11-07. : 11:26 am]
Zycorax -- F
[2024-11-06. : 7:31 pm]
O)FaRTy1billion[MM] -- L
[2024-11-06. : 9:45 am]
TF- -- Blumph win :wob:
Please log in to shout.


Members Online: jjf28