For Kimi: PlayerSpawnManagers, ScriptedTriggers and You

For posting your maps.
Post Reply
User avatar
Azarael
UT2004 Administrator
Posts: 5365
Joined: Thu 11 Feb , 2010 10:52 pm

For Kimi: PlayerSpawnManagers, ScriptedTriggers and You

Post by Azarael » Tue 23 Mar , 2010 12:28 pm

Kimi asked me to write a tut on how to use PlayerSpawnManagers and ScriptedTriggers with respect to Assault maps, so here we go...

PlayerSpawnManagers define which PlayerStarts each team can currently spawn at. Properties of the PlayerSpawnManager are:

AssaultTeam - defines which team should spawn at this PlayerStart
bAllowTeleporting - defines whether or not players are allowed to teleport to this spawn when it becomes enabled
bEnabled - whether this spawn is active or not
DisabledVehicleFactoriesTag - This is important and I don't often see it used in lower-class maps. When a spawn changes, this will cause any vehicle factories associated with that spawn (by tag) to become disabled, AND any vehicles produced from that spawn will be destroyed. Depending on the vehicle, this will either eject or silently destroy any players inside the vehicle. This should be used to clean up previous areas of a map that have gone out of scope. It should also be used for disabling Sentinels that have gone out of scope or are in a spawn previously aligned with the defenders that the attackers are later going to use.
ForcedPawnClass - this can be used to make players spawn as a different class to the default, which is xGame.xPawn. Set Onslaught.ONSPRV for example and players should spawn as Hellbenders. Note that since the player WILL be the Hellbender with this method, they will be unable to eject from the vehicle.
OverridePawnClass - Not much use to you.
PlayerStartTeam - Associates this spawn with all PlayerStarts with the same team number.

Moving through spawns using a ScriptedTrigger

Ideally in a map, spawns are sequential, so the first two spawns are teams 0 and 1, the next are teams 2 and 3, etc. The first spawns for each side in a map should be bEnabled True, the others should be bEnabled False.

To change spawns in response to an event, such as an objective:

- Add a ScriptedTrigger. In the AIScript tab of the properties, click Actions then Add. You should get a drop down menu, which defaults to Action_ASOpenSentinel.
- Scroll down the menu to Action_WAITFOREVENT. Set the event to whatever the event you want the trigger to respond to, such as "ObjectiveOneDown" for example.
- Now add another action, and select Action_ASSetPlayerSpawnArea. What this does is allow you to set whether a spawn is active or not, directly, without any business of alternating between True and False every time the spawn is triggered. This is more flexible in the case of optional spawns in a map, where you can simply set the two potential previous spawns to False and the new one to True.
- In the properties of ASSetPlayerSpawnArea, enter the tag of the Attacker spawn you want to turn off, and then set bEnabled underneath to False. Repeat this for the defender spawn, by adding another ASSetPlayerSpawnArea action.
- Do the same thing for the two spawns you want the teams to move to, except this time, you should set bEnabled to True.

Example:
WAITFOREVENT
Event ObjectiveOneDown
ASSetPlayerSpawnArea
PlayerSpawnManagerTag AttackOne
bEnabled False
ASSetPlayerSpawnArea
PlayerSpawnManagerTag DefenseOne
bEnabled False
ASSetPlayerSpawnArea
PlayerSpawnManagerTag AttackTwo
bEnabled True
ASSetPlayerSpawnArea
PlayerSpawnManagerTag DefenseTwo
bEnabled True

Notes about ScriptedTriggers

Unlike regular Triggers, the tag of a ScriptedTrigger is utterly and completely meaningless to the engine. If you trigger a ScriptedTrigger, absolutely nothing will happen. When you want to trigger a ScriptedTrigger, you should set the event you want it to respond to using Action_WAITFOREVENT.

Useful actions of ScriptedTrigger:

(These are all prefixed with Action_, but I'm leaving that out for reasons of speed.)

ASSetPlayerSpawnArea - used to set whether a spawn is active or not.
ASTeleportToSpawnArea - used to teleport a team to a specified PlayerSpawnManager. The team to be teleported is the team set in that PlayerSpawnManager.

If you're going to use this, make sure it's absolutely necessary / convenient and you offer a countdown using DisplayMessage and WaitForTimer before forcing a port. Strictly speaking the ONLY USE for this is to move players from spacefighters to normal foot pawns, because spacefighters can't teleport to a spawn. This was created with AS-Mothership in mind (and later AS-BP2-Acatana) so you should NEVER use this unless you're making a map that has players move from vehicles that they can't eject from to being on foot, because unnecessary and sudden forced porting is extremely irritating.

ChangeLevel
- Changes the server's map. I don't recommend using this if you enjoy having upload access, but it is useful for single-player levels, as it will transition between two levels. This can also be done using a Teleporter actor.
ConsoleCommand - Enters a console command. You can't use admin commands without the right permissions, but if you specify an Exec command for a mutator for example, you can execute it using this ScriptedTrigger.
DestroyActor - Destroys an Actor (vehicle etc) by its tag.
DisableObjective - Disables an objective. Used in Junkyard for magnet route.
DisableThisScript - Duh.
DisplayMessage - Draws a nice big blue message for you.
GoToAction - works like GOTO in Basic, returns you (or moves you forward) to an action later on the script.
IfCondition and EndSection - This is an if / endif block in programming. If the condition (this is a placeable actor if I remember that you have to trigger) is true, everything between IFCONDITION and ENDSECTION is executed. If not, this section is ignored completely.
PlayAnnoucement - Makes noise. The volume is set by AnnouncementVolume.
PlaySound - Makes noise. The volume is set by SoundVolume.
PlayMusic - Changes the level's music. I'd love to find a way to make this work with maps with custom music, to play a default track if the player doesn't have the custom one.
SetObjectiveActiveStatus - Toggles whether an objective is active or not. This is vital for optional objectives - you should use this to set them to Disabled when they are no longer of any benefit. An example of this is in Convoy, if you don't get the forward weapons cache and complete the rear door objective.
TriggerEvent - Used to make the ScriptedTrigger trigger something else.
WaitForTimer - The ScriptedTrigger pauses for the number of seconds you specify.
WaitForEvent - The scripted trigger pauses until the specified event happens. ALL ScriptedTriggers should begin with this!

User avatar
KimiRäikkönen
Member
Posts: 287
Joined: Sat 13 Feb , 2010 12:48 am
Location: the hood
Contact:

Re: For Kimi: PlayerSpawnManagers, ScriptedTriggers and You

Post by KimiRäikkönen » Tue 23 Mar , 2010 5:53 pm

Thanks man I really appreciate it, I will be using your TUT and angelmappers' TUT to finish my map, hopefully I can do it all by myself now, though I might need to ask you about the bender spawning after first obj, but I'll try to work it out myself first :D

┌∩┐(◣_◢)┌∩┐

User avatar
Azarael
UT2004 Administrator
Posts: 5365
Joined: Thu 11 Feb , 2010 10:52 pm

Re: For Kimi: PlayerSpawnManagers, ScriptedTriggers and You

Post by Azarael » Tue 23 Mar , 2010 6:02 pm

Np, feel free to ask if you need anything.

Cartoon

Re: For Kimi: PlayerSpawnManagers, ScriptedTriggers and You

Post by Cartoon » Tue 23 Mar , 2010 9:06 pm

When summer comes I will start learning ED and it all make sense ^^ but for now that just looks like another language ^^ - GJ though

Post Reply

Who is online

Users browsing this forum: No registered users and 28 guests