Trigger Trouble
Mar 26 2014, 9:07 pm
By: sigsaucy  

Mar 26 2014, 9:07 pm sigsaucy Post #1



Hi, I'm attempting to make a Total War style map with city taking over that goes like

-bring men to enemy city
-enemy spawns units
-once all enemy dead around city you get control of it

The issue i'm having is that cities are spawning units twice, once when you initially bring your units, and again when you take the city.

You can run the attached map to see what im talking about.

I think the error has something to do with switches.

Thanks, here are the triggers




CITY SPAWN TRIGGER

Trigger("Player 1","Player 2","Player 3","Player 4","Player 5","Player 6","Player 7","Player 8"){
Conditions:
Switch("Switch1", not set);
Bring("Current Player", "Terran Supply Depot", "1", Exactly, 1);
Bring("Foes", "Men", "1", At least, 1);

Actions:
Set Switch("Switch1", set);
Create Unit("Current Player", "Tassadar (Templar)", 3, "1");
Modify Unit Hit Points("Current Player", "Terran Supply Depot", 50, 0, "1");
Display Text Message(Always Display, "Under Attack");
Minimap Ping("1");
Minimap Ping("1");
Preserve Trigger();
Comment("1 spawn");
}



CITY CAPTURE TRIGGER
//-----------------------------------------------------------------//

Trigger("Player 1","Player 2","Player 3","Player 4","Player 5","Player 6","Player 7","Player 8"){
Conditions:
Bring("Foes", "Terran Supply Depot", "1", At least, 1);
Bring("Foes", "Men", "1", Exactly, 0);
Bring("Current Player", "Men", "1", At least, 1);
Switch("Switch1", set);

Actions:
Give Units to Player("Foes", "Current Player", "Terran Supply Depot", All, "1");
Modify Unit Hit Points("All players", "Terran Supply Depot", 100, 0, "1");
Display Text Message(Always Display, "We have taken this city");
Preserve Trigger();
Comment("1 capture");
Set Switch("Switch1", clear);
}




CITY DEFENDED TRIGGER
//-----------------------------------------------------------------//

Trigger("Player 1","Player 2","Player 3","Player 4","Player 5","Player 6","Player 7","Player 8"){
Conditions:
Bring("Foes", "Men", "1", Exactly, 0);
Bring("Current Player", "Terran Supply Depot", "1", At least, 1);
Switch("Switch1", set);

Actions:
Remove Unit At Location("Current Player", "Tassadar (Templar)", All, "1");
Modify Unit Hit Points("All players", "Terran Supply Depot", 100, 0, "1");
Set Switch("Switch1", clear);
Preserve Trigger();
Comment("1 defended");
}

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

Attachments:
test.scm
Hits: 3 Size: 109.5kb




Mar 27 2014, 1:33 am death6373 Post #2



I found the bug. There was nothing wrong with your triggers but the thing that was causing the units to spawn twice was a bring condition bug. Starcraft sometimes does not update correctly between triggers and the "Bring" condition will return true when we know it to be false. http://www.staredit.net/starcraft/Bring_Condition_Bug. It thought that player 8 still had a depot there when it did not therefore it spawned the units twice. I put in a move location action to force starcraft to update correctly between the triggers.

Attachments:
TestZ.scm
Hits: 1 Size: 109.5kb



None.

Mar 27 2014, 7:07 pm sigsaucy Post #3



Thanks! that fixed it.

Although the link you sent said "Remove 1 Map Revealer for Player at Location" is the best trigger to use to refresh locations due to not doing anything.

Is there any reason I should use a move location trigger instead of this? Is one of these faster or more efficient to use?

There will be alot of triggers (around 200 cities) which is why i want the best one.




Mar 27 2014, 7:52 pm jjf28 Post #4

Cartography Artisan

Most people consider the 255 location limit to be very extreme should you use gridding systems but assuming this is not a concern we can do some comparison...

In both I assume the unit ID is not present.

Move location: src location, unit, player, dest location (note that this always moves the location regardless of whether the dest unit is found)
    1. Find unit at dest location (at best, binary tree search of pre-compiled data)
    2. Change location coordinates (4 values)
    3. Validate location coordinates (4 comparisons)
    4. Refresh location data

Remove unit at location: amount, unit, player, location
    1. Find unit at location (at best, binary tree search or pre-compiled data)
    2. (remove nothing)
    3. Refresh location data

Remove unit at location for a unit that does not exist should be slightly better.



TheNitesWhoSay - Clan Aura - github

Reached the top of StarCraft theory crafting 2:12 AM CST, August 2nd, 2014.

Mar 28 2014, 12:25 pm Sacrieur Post #5

Still Napping

Quote from jjf28
Most people consider the 255 location limit to be very extreme should you use gridding systems but assuming this is not a concern we can do some comparison...

But not necessarily, since grid systems are very limited and aren't perfected. There is a system that would completely eliminate the need for locations in most applications, but it has not yet been documented (I'm working on it). The truth is that most sc1 documentation isn't very complete and thorough.



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[2026-7-18. : 2:27 am]
Symmetry -- https://staredit.net/topic/18903/ THE REVIEWS ARE HERE! "ok these are pretty good memes" - ssj9Kevin
[2026-7-17. : 2:58 pm]
Ultraviolet -- Symmetry
Symmetry shouted: Man I wish we had this tech back in the day when people played ums lmao
fr fr
[2026-7-17. : 2:39 am]
Symmetry -- Man I wish we had this tech back in the day when people played ums lmao
[2026-7-16. : 6:28 am]
NudeRaider -- EUD actions, specifically. The conditions remained. Today we can even have actions again, but they're all virtualized/whitelisted (not sure on the actual technical implementation) so you can only use them for specific intended purposed, not arbitrary code injections.
[2026-7-16. : 6:26 am]
NudeRaider -- I mean yes, maps - through EUDs - were theoretically able to do that as well, but that was patched quickly.
[2026-7-16. : 6:25 am]
NudeRaider -- Symmetry
Symmetry shouted: Ohhh imagine a SC map that could delete itself
not the map, the editor
[2026-7-16. : 2:28 am]
Symmetry -- I vaguely remember Voy doing some ACE back in the day, but I had no idea EUDs could do that kind of shit. I am very much catching up on the technology
[2026-7-16. : 2:28 am]
Symmetry -- Ohhh imagine a SC map that could delete itself
[2026-7-15. : 8:51 pm]
NudeRaider -- Symmetry
Symmetry shouted: NudeRaider Is EUD editor capable of writing shit onto the player's harddrive? That seems like it would be dangerous
yeah an editor that isn't allowed to write files sounds rather pointless, so I'd assume it can. Like most other programs too btw. and yes, obviously that's dangerous, but also kinda necessary. MS introduced that virtualization for exactly that reason.
[2026-7-15. : 4:10 am]
Ultraviolet -- I don't think so. I think they shut that shit down after 1.16, maybe even earlier
Please log in to shout.


Members Online: O)FaRTy1billion[MM], Excalibur