Staredit Network > Forums > SC2 Assistance > Topic: [SOLVED] Diplomacy Type Trigger Part II
[SOLVED] Diplomacy Type Trigger Part II
Jun 21 2011, 1:35 am
By: Veta  

Jun 21 2011, 1:35 am Veta Post #1



Hey there SEN,

I have another question pertaining to diplomacy type triggers. It's a bit complicated so bear with me. For certain [invincible] buildings (representing large medium or small cities) I would like there to be a circular region of a particular radius (dependent on city tier) such that when an enemy unit enters this region a group of "garrison" units spawn in the region to defend the city. If you are sieging an enemy city, it would be captured [the building would be given to you] once all enemy units (excluding the city itself and factory/resource structures) have been vanquished from the city-region. After a city is captured any enemy player that enters the city-region would then retrigger the garrisons to spawn, but this time for you.

However, if you enter an enemy city-region, trigger its garrison spawn, and then leave the city region (before capturing the city) - then the spawned garrison units will be removed.
If there are no enemy units present at a given city-region any garrison units in that region should disappear. There is also the issue of garrison units being moved out of a city-region (to avoid their removal) and I am not sure if this could be addressed by simply creating a trigger that removes a garrison unit when it is not within proximity of a city.

This next bit is less of a priority (since I'm sure I could figure it out myself once the above is addressed). But I would also like for certain buildings [industry buildings] in the city-region to also be given to the conquering player, from the conquered player.

Edit: Basically whenever a city-region is entered by an enemy, I would like a defensive garrison to spawn. And when all of the defensive units or any other units the player being attacked in the location are gone, the city is lost/captured. In order to distinguish between a city that has yet to spawn its garrisons and once that has lost all its garrisons I was thinking of making the city be burning or have less HP (if that's detectable) or something along those lines whenever its under siege. It would only be capturable when under siege.

I know this is a bit complicated but I am really devoted to my current project and well, short of learning galaxy code I've tried everything. In StarCraft 1 I accomplished the above with individual regions and triggers for each city, as well as switches. Since this proves to be a much more ambitious undertaking (roughly 200 cities) I am hoping this can be accomplished in a much less tedious and time consuming manner.

Thanks you for any advice or input!

Post has been edited 1 time(s), last time on Jun 21 2011, 1:42 am by Veta.



None.

Jun 21 2011, 1:52 am NicholasBeige Post #2



Data Editor Method:

Behavior on the City unit that runs periodically with a Search Area (to define the region/radius/circle for capture).
Once the Search Area finds a unit, it will validate (to check) that the unit is an enemy of the current owner of that City Unit.
This will trigger a Set of effects.
Primarily, it will create units (the garrison), apply a behaviour to them (timed life).
Secondarily, this will trigger a Create Persistent effect, which will run another Search Area, this time, controlling the hand-over of the City.
Finally, it will disable the behaviour (on the City unit) - to stop a constant stream of garrison units spawning.
So, as soon as the garrison is created, this persistent will constantly scan for hostile enemy units.
If it finds hostile enemy units and no garrison units - the City will have a Change Owner effect applied to it.
If it finds garrison units, and no enemy units (perhaps on a larger radius - checking for reinforcements etc), the Garrison will be removed from play, and the initial Behaviour, reactivated.

Trigger Method:

Really? :P

You will need a Region for each City unit. Or a fancier method would involve moving a Region to the city-unit when a unit 'Comes Within x Range' (event). And then leaving this Region there for the duration of the take-over / defence. If you would like to trigger it (I advise not to, it's messy, time consuming, and less efficient), I can edit here.

Further advantages of the Data Editor method include upgrading a city's defence garrison (both it's duration, number of and type of units, as well as their upgrades etc). Or, you could be super fancy, and use a Nydus/Bunker system, whereby the player designates the units he wishes to Garrison in a city.

Edit: In fact, the bunker/nydus system would be a hell of a lot simpler to achieve. It would simply auto-unload when enemy units were nearby, and if no friendly units are either garrisoned or nearby in the presence of hostile units - the structure would change ownership.

Post has been edited 1 time(s), last time on Jun 21 2011, 1:57 am by Cardinal.



None.

Jun 21 2011, 3:13 am Veta Post #3



Interesting so you're saying what I want to be done (which is a set defensive garrison spawn) can be done through the data editor. Would it be able to also change the ownership of special buildings like say Industry (which are buildible around the city and give income) as well? I'd like a system wherein the city is invincible (but perhaps aesthetically on fire when being sieged) and cannot be captured until all enemy men or fortifications are destroyed. Industry would be destructible but also capturable.

If you could devise such a unit in the data for my coauthor (he runs the data) we would be much obliged. And if you still need our terrain we would happily let you use it for figuring this out for us.



None.

Jun 21 2011, 3:18 am NicholasBeige Post #4



The Data Editor is extremely powerful. About 80% of what was triggered in Warcraft 3 map editing can now be achieved through data objects - which is great news since you can then use triggers for fancy shit like banks, dialogues etc.

If you're looking for a co-co-author (another person on your team), I would be willing to help out more. It's just I have 3 projects on the go right now, along with finding a job in real life... so :)



None.

Jun 21 2011, 3:27 am Veta Post #5



Hey cardinal if you have teamspeak you should get on our server and talk to us, if you don't you should definitely download it (just google teamspeak). Let me know when you have it and when works for you and we'll meet in a chat. It's a lot easier for us to coordinate like that so I hope it's not too much trouble for you.

As far as what and how we want the capture mechanisms to work it's based off an old map from Brood War (if you still have a copy of that it'd be easy to demonstrate in a game) otherwise I think we can explain over chat. And yeah not having known you that long you seem like a cool dude, we'd be happy to have you join our team if only in part (don't worry we'll be doing the tedious/groundhog work anyway).

Anyway, I'll try to check the forums more regularly tomorrow and hopefully we can get in touch.

Post has been edited 1 time(s), last time on Jun 21 2011, 4:53 am by Veta.



None.

Jun 21 2011, 12:41 pm Ahli Post #6

I do stuff and thingies... Try widening and reducing the number of small nooks and crannies to correct the problem.

INTRO
You can combine the data editor power and trigger editor power. Basically the data editor can be used to scan for stuff that will trigger other things. It will be pretty easy to modify some effects with some variables, then. I've written some examples in my post.


ENEMY IN RANGE - TO THE ARMS
You can make an "enemy in range of city"-detection with a behavior with a periodic search effect that will cause a dummy effect, if the search area detected an enemy unit.
That dummy effect can be used in a trigger event which will cause some actions defined by the cities stats (e.g. spawning unit count/strength determined by city power/wealth/habitants/size/loyalty...). The city is the source of the effect.

For the periodic effect I would use something like every 2 game seconds or something different that will be less predictable (less exploitable) like 1.7 seconds).
This depends how fast your units are and how big your search area is.

If a city is captured, you need to remove other player's garrison buffs and add the new owner's garrison buff to the building.

That would avoid making 200 regions around each city or periodically checking every region (SC1 works that way) and make the spawning a bit easier to do.


GARRISON UNITS LEAVING CITY AREA
For the unit's removal because of range to the city: Add a behavior that is a slow at checking for a city owned by a specific player within a radius (-> search area effect, like above, just searching for a city). I would mark cities as heroic, structures for easy filter usage.

If you want to add variables to a city for trigger use (sadly no data referencing possible :S), you can use the custom values of the city.



OTHER STUFF
I hope you can see that doing things/timing things for a variable count of units can be done easiest and maybe best with data editor.
Doing complex stuff is mostly easiest with triggers.
In your case I guess combining these things will help your map best because you can easily add stuff to it to make the city system a bit more complex.

The behavior you need is the type "buff".

For the other tasks Cardinal's ideas are good.

btw, I find sc2mapster's posts a bit amusing. No real answer, yet :D


If you notice fps drops every 1.7 seconds because of the search effects, you could add the buffs of the cities asynchronous (add to city, wait, add to city y, wait, add to city z, wait). Then all stuff won't be triggered all the time. Or set a cities default behavior buff (unit -> behavior) to a buff that waits a random time and adds the garrison buff then which would be easier...




Jun 21 2011, 9:27 pm Veta Post #7



Lol Ahli I saw your SC2Mapster post <3

I'd still take SEN over SC2Mapster any day, this community has helped me out a ton. Anyhow, I'll get my data guy to take a look at this (I'm managing triggers, terrain and dialogs) and hopefully he can make more sense of it than me. If we can't figure something out (I hope we can get it all) I'll post in here again but you gave a great walk through. I'm sure you're probably making/made some great maps already.

Edit: Oh and yet the city system is inspired by strategy games like Hearts of Iron and Napoleon Total War. For my team's purposes we're going to apply it during the Age of Rifles (1850-1900) but we'll probably start the game at around 1870 and make it 8 players (Spain, France, Italy, Britain, Russia, Germany, Austria, Ottomans).



None.

Jul 4 2011, 5:02 pm Ahli Post #8

I do stuff and thingies... Try widening and reducing the number of small nooks and crannies to correct the problem.

Because you've send me a PM to make a more detailed explanation, I've just created the enemy search stuff.

The map will spawn 3 marines and send them to the city. The city will spawn 4 marines that will defend it.

Attachments:
garrisonTest.SC2Map
Hits: 7 Size: 31.64kb




Jul 5 2011, 5:05 am Veta Post #9



Wow thanks Ahli, that was super helpful. Gotta say... I don't think the map making community would survive if it wasn't for people like you. Thanks again.



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[01:35 pm]
ninokaw193 -- RioGrand is a reputed name in manufacturing high- quality Criket Bats https://www.riogrand.in
[01:35 pm]
ninokaw193 -- RioGrand is a reputed name in manufacturing high- quality Criket Bats https://www.riogrand.in
[01:35 pm]
ninokaw193 -- RioGrand is a reputed name in manufacturing high- quality Criket Bats https://www.riogrand.in
[01:35 pm]
ninokaw193 -- RioGrand is a reputed name in manufacturing high- quality Criket Bats https://www.riogrand.in
[01:35 pm]
ninokaw193 -- RioGrand is a reputed name in manufacturing high- quality Criket Bats https://www.riogrand.in
[01:34 pm]
ninokaw193 -- RioGrand is a reputed name in manufacturing high- quality Criket Bats https://www.riogrand.in
[01:34 pm]
ninokaw193 -- RioGrand is a reputed name in manufacturing high- quality Criket Bats https://www.riogrand.in
[03:27 am]
m.0.n.3.y -- Maybe because it's an EUD map?
[03:27 am]
m.0.n.3.y -- Can't upload maps to the DB. Error says "The action you have performed caused an Error". Any word?
[2024-4-25. : 7:46 am]
RIVE -- :wob:
Please log in to shout.


Members Online: jun3hong, C(a)HeK