This tutorial deals with making transports useable for players other than the owner, with a focus on using Player0 (Neutral) as the primary owner. These neutral transports can then be used as preplaced terrain ojects akin to "neutral spells" in Broodwar maps or abandoned structures in Warhammer40K. While this tutorial will be using Bunkers for all examples the same can be done for mobile transport vehicles.
I will detail 3 different setups, listed in order of increasing complexity.
NeutralBunker
The first, called NeutralBunker, simply allows any player to enter and fire from it. Since enemies don't automatically return fire when attacked from within, this method is not suited for normal, melee-style games unless the added tedium is explicitely desired. Instead, this section focuses on the steps necessary to create a custom transport and on how the Interact ability can replace trigger-based control sharing.
Creating your Transport
First of all you will need a new Unit to represent your neutral structure. You can edit existing units, but this should be avoided if said units will also be used for their original function (for example, if you use the Terran Bunker unit allies would be able to enter player-constructed Bunkers); I will assume basic proficiency with data objects, including the creation of Units and Actors. This section is focused on what constitutes a transport unit specifically.
Now, create a unit from scratch or find one to work from. I will copy the Terran Bunker, specifically the Unit, the Unit type Actor and the Splat type Actor which comprise the basic appearance of the bunker.
Next, create a new ability of the Transport class, I will be calling mine "NeutralBunker Transport". You can set the numerical stats to anything you like, I will be copying the bunker again. The important part is the Ability: Target Filters field, where you must check (allow) "Neutral". The other filter parameters can be set to your leisure to restrict which units are allowed to enter.
Now go to the Units data tab and add the ability to your unit. Also add at least the "unload all" button to the command card unless you're actively trying to annoy your players.
There are some cosmetic effects attached to transport abilities. For the Terrans, loading or unloading a transport plays a sound. To make these play for your neutral transport, go to the Actors tab and find the actors MedivacTransport Load/Unload Sound. Simply add an event identical to the existing ones but referring to your neutral transport ability, you don't have to copy the actor. Protoss Warp Prisms also have a visual effect when loading units, which is controlled by a Model type actor.
In the special case of the bunker, the model has an animation to represent units inside it (where the center roof lowers and the lights go on); If your transport has such an animation you must also locate the actor BunkerTransport Anim of the type Event Macro. Copy it and match the events to your transport ability. You must then add this actor to the Events: Macros+ field of your Unit actor.
You can now test your new unit: Place one for Player0 (Neutral) and some units for yourself, maybe some nearby enemies too. Your units should be able to enter the transport (and shoot enemies if it's based on the bunker), but you can't control the transport, so you can't get your units back out. With a neutral bunker you will also notice enemies run away when attacked rather than engaging the structure, this is an unsolved problem in this version.
Taking Control
Aka I want my units back!
This is actually very simple once you know of it. All you have to do is create an Interact ability with the following specifications:
Stats: Flags: check "Auto Cast", "Share Control" and "Share Vision"
Ability: Target Filters: set Hidden to Required, everything else can stay. For added security you can make this match the target filter of the Transport ability, minus the aforementioned change.
Everything else stays at the default, especially the Range, which must remain 0.
Give this to your transport unit. There is no need to add a command card button.
As for why this works: Units inside a transport have their collision disabled and the Hidden flag enabled, which is also used by workers mining gas. Their position is considered to be the same as that of the transport unit at all times, so a 0-range ability cast by the transport can reach them.
This rudimentary filter has one loophole, in that it doesn't explicitely check whether the target is loaded into the transport. This can be worked around, but requires more work (might be added later); The only scenario where this would be relevant in a standard game is when a Vortex is cast on the transport, said transport is not affected, and air units enter the vortex while flying above the transport.
The control is not transitive, meaning if players 1 and 2 have mutual shared control and player 2 enters the transport, player 1 will be unable to command it.
CaptureBunker
This version aims to solve the shortcomings of the previous one, in that enemies will run away rather than engage a bunker if they aren't enemies of the owner, regardless of its contents. Transferring ownership of a transport also has other possible applications.
Creating your Transport
You should create a new unit type again. This is even more important this time, as the transport will be hardcoded to become neutral once it's empty. I will save myself the work in the demo map and edit the existing Terran Bunker, as there is nothing new to be learned. Your target filter on the transport ability should probably exclude "Enemy".
Taking Control
Start in the Effects data tab. Create 2 new Modify Unit effects, I call them CaptureNeutral ModifyUnit and ReleaseNeutral ModifyUnit
CaptureNeutral ModifyUnit: In Effect: Modification Flags+ check "Owner"; set Target: Launch Unit+ to "Caster"
ReleaseNeutral ModifyUnit: Again check "Owner" in Effect: Modification Flags+, set Effect: Modify Owner Player+ to "Neutral Player" (this is a hardcoded reference to Player0), and add the existing validator "Has No Cargo" to the Effect: Validators+ field.
Now go to the Abilities data tab and create the following 3 abilities:
NeutralTransportInteract: The same Interact ability as in the previous setup, again ensure the target filter requires "Hidden" and check the flags "Auto Cast", "Share Control" and "Share Vision".
CaptureNeutral: Type Effect - Target. Set the Ability: Arc to 360 for good measure, set Stats: Range to 0, and set Effect: Effect+ to "CaptureNeutral ModifyUnit"
Redirect Capture: Type Redirect Target. Set Ability: Ability to "CaptureNeutral"
Create a new Validator of type Unit Compare Cargo, I call it Transport 1Unit. Set Validator: Compare to "Less Than Or Equal To", set Validator: Type to "Load", set Validator: Unit+ to "Caster" and set Validator: Value to "1"
Create a new effect of type Issue Order, I call it LoadBunker IssueCapture. Set Effect: Ability to "CaptureNeutral", Effect: Validators+ to "Transport 1Unit", and Target: Target+ to "Caster Unit"
Edit your Transport ability: Set Ability: Load Cargo Effect to "LoadBunker IssueCapture", and Ability: Unload Transport Effect to "ReleaseNeutral ModifyUnit"
Putting everything together
Give the Transport, NeutralTransportInteract and Redirect Capture abilities to all neutral transport units
Give the CaptureNeutral ability to all units that are meant to be capable of capturing transports. Without the ability units are able to enter and exit the transport, but won't capture it for the player. They will still maintain control of an already captured transport and will cause it to revert to Neutral if they are the last to exit, leaving the transport empty.
Do not add a command card button for the CaptureNeutral ability, with the above data it's an omnipotent, free-to-cast mind control ability, the only thing preventing players from abusing it is the fact they can't issue the order to cast it
The CaptureNeutral ability can also be bestowed upon individual units using Buff type Behaviors or triggers
The upcoming TeamBunker setup uses a different capturing system, which would also work with the CaptureBunker. The main difference is that units without the capturing ability are completely unable to enter a neutral, uncaptured TeamBunker, while a CaptureBunker still acts like a NeutralBunker for them.
TeamBunker
Inspired by Uzurak, this version is intended for maps with 1 or more teams of players, as it will give the captured transport to a "marked" player on the team. Note that if said player is AI-controlled you must avoid the Melee AI and custom AI scripts that will include the transport unit (such as "order all units to attack"), as these will frustrate players trying to control the transport while not directly restricting them unless you spam the script command 20 times per second.
Note that this setup uses dummy units to "mark" the intended transport owner, if you're allergic to this type of solution don't read on and refer to trigger-based systems instead.
Creating your Transport
Same as the previous setups, you need a new transport unit and Transport ability. I will be editing the Terran Bunker again.
Dummy Units and You
You will need a unit to uniquely identify the intended transport owner. This need not be a custom dummy unit that's hidden away in the corner of the map, any unit type will do if it matches the following specifications:
The transport owner is the only player to own this unit type, at least out of those considered an Ally by any player on the team. Having multiple symmetric teams with one "dummy owner" each is okay, as long as the players in one team consider the "dummy owners" of all other teams Enemies
The dummy unit is present at all times and in all gameplay situations where players are able to capture transports. Anything that can die early is a problem, if the death of said unit ends the game it's okay.
If there's a guarantee that at least 1 dummy unit always is within a certain range of a capturable transport this can be used to reduce the maximum search radius (see below), but dotting the map with dummies for this purpose isn't really worth it.
Examples of common unit types that can be used instead of a custom dummy: A team shop for items or upgrades, the Nexus from League Of Legends, the Command Center or other victory condition structure if the AI ally is the only one with a base, dummies already present for other abilities and setups
Taking Control
Validators
Start with the validators, 2 Combine and 2+ Unit Type:
A Unit Type validator for your chosen dummy unit, I call it CaptureNeutral AllyFindUnitType. The only field you have to change is Validator: Value, to said dummy unit type.
A Unit Type validator for each unit type you intend to be a TeamBunker transport, again changing only Validator: Value to said unit type. I use only one, called "Target Is Bunker", referring to the Terran Bunker.
A Combine validator containing all of the above TeamBunker transport Unit Type validators (NOT the dummy unit one!), combine type left at the default "Or". I call mine "CaptureNeutral TargetList", because that's what it's there for. Remember to add to this when you create a new transport type.
A Combine validator containing the above "CaptureNeutral TargetList" and the existing "Has No Cargo" validator, Validator: Type set to "And". It is crucial you set this one up properly or you'll end up with an omnipotent mind control ability (with 0 cost)
Effects
"CaptureNeutral FindAllyUnit", type Search Area: Set Search: Maximum Count to "1", set Search: Search Filters to include everything, but only check "Ally" (i.e. uncheck "Player", "Neutral" and "Enemy"), set Target: Impact Location+ to "Target Unit", optionally add "CaptureNeutral AllowUse" to the Effect: Validators+ field.
"CaptureNeutral ImpactSet", type Set: For now, just set Effect: Validators+ to "CaptureNeutral AllyFindUnitType"
"CaptureNeutral ModifyUnit", type Modify Unit: In Effect: Modification Flags+ check "Owner", set Effect: Modify Owner Player+ and Effect: Transfer Unit+ to "CaptureNeutral ImpactSet: Target", set Target: Impact Unit+ to "CaptureNeutral FindAllyUnit: Target", and finally set Target: Launch Unit+ to "Caster"
"CaptureNeutral IssueEntry", type Issue Order: Set Effect: Ability to your transport ability, set Effect: Player+ and Effect: Unit+ to "CaptureNeutral FindAllyUnit: Target", set Target: Target+ to "Caster Unit"
Revisit "CaptureNeutral FindAllyUnit" and set Search: Areas+ to "Effect: CaptureNeutral ImpactSet", "Radius: 500", rest to default (arc 360, maximum count -1 are important)
Revisit "CaptureNeutral ImpactSet" and add, in this order, "CaptureNeutral ModifyUnit" and "CaptureNeutral IssueEntry" to Effect: Effects+
Finally add the "ReleaseNeutral ModifyUnit" Modify Unit effect, that is, check "Owner" in Effect: Modification Flags+, set Effect: Modify Owner Player+ to "Neutral Player", and set Effect: Validators+ to "Has No Cargo"
Abilities
On your Transport ability, this time you only set Ability: Unload Transport Effect to "ReleaseNeutral ModifyUnit", and in Ability: Target Filters you exclude "Neutral" and "Enemy", leaving only "Player" and "Ally" checked. Yes, we're excluding Neutral, this is how you can prevent units without the capture ability from entering an uncaptured transport.
"CaptureNeutral Interact", type Interact: Check "Auto Cast", "Share Control" and "Share Vision" in Stats: Flags+, ensure the Ability: Target Filters Require "Hidden". You should also exclude "Neutral" and "Enemy", amongst other things this fixes half the "Vortex problem".
"CaptureNeutral", type Effect - Target, the heart of this setup:
Set Ability: Arc to "360"
Set Ability: Smart Priority to a value higher than other smart abilities that can be cast at a transport unit (this depends greatly on the nature of your transport and the other abilities on the capturing unit), a value of "13" works for a bunker.
Set Ability: Smart Validators+ to "CaptureNeutral AllowUse"
Set Ability: Target Filters+ to allow only "Neutral" (thus exclude "Player", "Ally" and "Enemy"), you can add aditional filters but the "TargetList" validator we created at the beginning should make these unnecessary.
Set Effect: Effect+ to "CaptureNeutral FindAllyUnit"
Ensure that in Stats: Flags+ "Smart Command" is checked (the other defaults of "Abort On Allegiance Change", "Best Unit", "Require Target Vision", "Update Charges On Level Change" and "Wait To Spend" are okay and need not be changed.)
Set Stats: Range to "0"
Finalising
Same as with CaptureBunker, you must give the Transport and CaptureNeutral Interact abilities to all capturable transports, and the CaptureNeutral ability to all units allowed to capture transports. Again the capture ability may be bestowed dynamically through Buff Behaviors or triggers.
Again, don't add command card buttons for the CaptureNeutral ability, the Smart Validators+ field only works for right-click smart commands. If you also added "CaptureNeutral AllowUse" to the Validators+ field on "CaptureNEutral FindAllyUnit" this should prevent abuse of the ability, but it's intended to function through simply right-clicking the transport, there is no need to have a button either way.
Undocumented Possibilities (post to request tutorial)
The "Vortex problem" of relying exclusively on the Hidden flag to identify cargo units for the Interact ability can be rectified. There might be a validator type to check cargo links (which I don't know of); otherwise one can use the Cargo Load Effect field on the Transport ability to cast an Issue Order effect for the Interact ability instead of using an autocast
The control sheme of TeamBunker can be used to create a CaptureBunker, mainly by cutting out the dummy unit search
The dummy unit search from TeamBunker can be used to return vacant transports to players other than Player0(Neutral) and Player15(Hostile) by adding a search in front of "ReleaseNeutral ModifyUnit"
It might be possible to make unit AI acquire an occupied NeutralBunker without changing ownership, though I currently don't know of such a solution. Giving the transport to Player15(Hostile) would work, but allies of the occupants would also attack it
Further use/abuse of the Hidden flag can allow for boarding of larger units with actual fights between "crew units", though these can't be microed and thus have limited gameplay value. Redirect abilities could add some strategic depth.
What exactly are you referring to as the "first part"? If you mean only NeutralBunker, I mainly included that for the less experienced people, and to make a point of how the Interact ability operates seperately from the rest of the system.
If you also mean CaptureBunker, I already tried the "simple" behavior-based approach three years ago. It doesn't work if tied to the Transport ability, you have to allow capturing without actually entering the transport, which removes the vehicle+pilot type of application (or annoys players walking past without intending to enter)
The main problem is that if a transport switches owner with units still inside the cargo also switches owner, and I haven't been able to reverse this ownership change with any of the "Player Origin" or "Creator" type presets. The above setups should ensure this, while a 0.25 period search can easily be fooled: Move just outside of search range with 4 Marines owned by different players, stim and run into the bunker. Check results from several tests, or hook up a trigger to give the move order right after a search effect fires. This can be avoided, but at that point it's no simpler than my current system.
Just noticed you had put the link in the Vehicle Systems thread in the Trigger forums. It's awesome SC2Mapster has a Vehicle tutorial now.
Thanks again for all your help Photoloss.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Intro
This tutorial deals with making transports useable for players other than the owner, with a focus on using Player0 (Neutral) as the primary owner. These neutral transports can then be used as preplaced terrain ojects akin to "neutral spells" in Broodwar maps or abandoned structures in Warhammer40K. While this tutorial will be using Bunkers for all examples the same can be done for mobile transport vehicles.
I will detail 3 different setups, listed in order of increasing complexity.
NeutralBunker
The first, called NeutralBunker, simply allows any player to enter and fire from it. Since enemies don't automatically return fire when attacked from within, this method is not suited for normal, melee-style games unless the added tedium is explicitely desired. Instead, this section focuses on the steps necessary to create a custom transport and on how the Interact ability can replace trigger-based control sharing.
Creating your Transport
First of all you will need a new Unit to represent your neutral structure. You can edit existing units, but this should be avoided if said units will also be used for their original function (for example, if you use the Terran Bunker unit allies would be able to enter player-constructed Bunkers); I will assume basic proficiency with data objects, including the creation of Units and Actors. This section is focused on what constitutes a transport unit specifically.
Taking Control
Aka I want my units back!
CaptureBunker
This version aims to solve the shortcomings of the previous one, in that enemies will run away rather than engage a bunker if they aren't enemies of the owner, regardless of its contents. Transferring ownership of a transport also has other possible applications.
Creating your Transport
You should create a new unit type again. This is even more important this time, as the transport will be hardcoded to become neutral once it's empty. I will save myself the work in the demo map and edit the existing Terran Bunker, as there is nothing new to be learned. Your target filter on the transport ability should probably exclude "Enemy".
Taking Control
Putting everything together
TeamBunker
Inspired by Uzurak, this version is intended for maps with 1 or more teams of players, as it will give the captured transport to a "marked" player on the team. Note that if said player is AI-controlled you must avoid the Melee AI and custom AI scripts that will include the transport unit (such as "order all units to attack"), as these will frustrate players trying to control the transport while not directly restricting them unless you spam the script command 20 times per second.
Note that this setup uses dummy units to "mark" the intended transport owner, if you're allergic to this type of solution don't read on and refer to trigger-based systems instead.
Creating your Transport
Same as the previous setups, you need a new transport unit and Transport ability. I will be editing the Terran Bunker again.
Dummy Units and You
You will need a unit to uniquely identify the intended transport owner. This need not be a custom dummy unit that's hidden away in the corner of the map, any unit type will do if it matches the following specifications:
Taking Control
Validators
Effects
Abilities
Finalising
Same as with CaptureBunker, you must give the Transport and CaptureNeutral Interact abilities to all capturable transports, and the CaptureNeutral ability to all units allowed to capture transports. Again the capture ability may be bestowed dynamically through Buff Behaviors or triggers.
Again, don't add command card buttons for the CaptureNeutral ability, the Smart Validators+ field only works for right-click smart commands. If you also added "CaptureNeutral AllowUse" to the Validators+ field on "CaptureNEutral FindAllyUnit" this should prevent abuse of the ability, but it's intended to function through simply right-clicking the transport, there is no need to have a button either way.
Undocumented Possibilities (post to request tutorial)
Reserved for future additions
Also reserved for future additions
Sounds very similar to my ownership changer demo map for the first part.
Contribute to the wiki (Wiki button at top of page) Considered easy altering of the unit textures?
https://www.sc2mapster.com/forums/resources/tutorials/179654-data-actor-events-message-texture-select-by-id
https://media.forgecdn.net/attachments/187/40/Screenshot2011-04-17_09_16_21.jpg
What exactly are you referring to as the "first part"? If you mean only NeutralBunker, I mainly included that for the less experienced people, and to make a point of how the Interact ability operates seperately from the rest of the system.
If you also mean CaptureBunker, I already tried the "simple" behavior-based approach three years ago. It doesn't work if tied to the Transport ability, you have to allow capturing without actually entering the transport, which removes the vehicle+pilot type of application (or annoys players walking past without intending to enter)
The main problem is that if a transport switches owner with units still inside the cargo also switches owner, and I haven't been able to reverse this ownership change with any of the "Player Origin" or "Creator" type presets. The above setups should ensure this, while a 0.25 period search can easily be fooled: Move just outside of search range with 4 Marines owned by different players, stim and run into the bunker. Check results from several tests, or hook up a trigger to give the move order right after a search effect fires. This can be avoided, but at that point it's no simpler than my current system.
Just noticed you had put the link in the Vehicle Systems thread in the Trigger forums. It's awesome SC2Mapster has a Vehicle tutorial now. Thanks again for all your help Photoloss.