Requirements: Extended eventhandlers
Date: 2010-05-29 22:29
ArmA Single Player Respawn
I noticed that when the player is killed in a single player mission, other units in the players group continued to fight, or moved on to the next waypoint or mission objective, so it seemed that the game engine was continuing with the mission even though the player was dead.
So I thought it would be a great idea to create a mod that would use a free camera to allow the user to follow how the mission progresses while the player is dead, and then, at a suitable moment, respawn back into the same mission and continue.
I wrote this mod because it allows mission designers to play-test missions to the end, so that the mission objectives and end results could always be seen.
I read in some ArmA forums that when mission designers were testing a mission that they were working on, they found it very frustrating to be killed, and would have to load a saved position to continue, therefore losing any recent progress they had made.
Some mission designers used event handlers to make the player invincible, but in testing, I found that the enemy A.I. would continue to fire at the player until they ran out of ammo, and therefore the enemy A.I. units would then behave differently, so making the player invincible did not properly represent how the A.I. would behave in the rest of the mission.
What I have done with the SPR Mod is to allow the player to die as normal, but the user can then watch the rest of the mission progress without the player.
I have designed it so that the user can choose to respawn anywhere on the current map, change sides, take control of any vehicle or unit in the mission, or just observe the mission, mission designers will find this very useful.
I have also included a modified Kegetys spectator script so that the user can have complete control over monitoring the mission.
Using the spectator and the free camera modes, the user can observe the gameplay until such time that the user decides where and when to rejoin the mission.
When using the spectator mode to monitor the mission, the user can return to the respawn dialog by pressing Escape.
In addition to monitoring missions in the editor, the SPR Mod will give the user full control over any single player mission in the game including the campaign missions.
As a bonus, I have added a new feature to Kegetys spectator script which will allow the user to teamswitch to the last unit that was being observed, this means that the user can change sides and select any vehicle or unit to control during the mission, the last unit that was observed in the spectator mode is added to the teamswitch menu.
When the player is killed, a free manual camera will become active, the user will then be able to control the camera with the keyboard and mouse, to exit the camera press the V key, and then the respawn dialog will display.
In the controls setup menu in the game, you can define the keyboard and mouse settings for the Bulldozer controls, these defines will control the manual camera.
Some of these keys are pre-defined such as the Numpad 5 key to reset the camera zoom and unlock it from a target. (free look)
Other keys like the V key to exit the camera are hard coded into the game engine and cannot be altered.
Check the included readme for more info about the key controls.
As we always recommend use modfolders.
Check our FAQ for a clear explanation.
The files in the SPR Mod consist of two PBOs, one is a replacement of the ca.pbo file that is found in the ArmA Addons folder, the other is the SP_respawn.pbo file which now has the client addon for Kegetys spectator script incorporated into it.
The SPR Mod is activated by adding a command to the target line of your ArmA 2 shortcut on the desktop, the command to add is '-@SP_respawn'.
The original ca.pbo file is not altered and so de-activating the mod will return gameplay to normal.
Included .pbo files:
The files in the SPR Mod now consist of two PBOs, one is a replacement of the ca.pbo file that is found in the ArmA Addons folder, the other is the SP_respawn.pbo file which now has the client addon for Kegetys spectator script incorporated into it.
Fixed a problem when the player is in a boat, the chase camera took too long to release control to the user if the player was killed in a boat.
Fixed a bug when the game engine deleted a boat after it sank, an RHIB for example, the free camera would not function, and the user could not do anything, the only way to escape was to do a CTRL-ALT-DELETE back to the desktop.
If the user is in the free camera mode from the action menu and the player dies, that free camera will now remain active, and a message is displayed on screen to let the user know, this changes the way version 2.46 did it.
The automatic free camera mode will activate when the player dies, if the user is not using either the spectator or free camera modes from the action menu.
Spectator script changes :-
I found that the missile camera had stopped working due to some coding I added, this is now fixed, and the missile camera angle is improved.
Re-worked the colours for the markers in map mode to be the same as the game engine, ie green for west, red for east, yellow for resistance (mine), and blue for civilians.
In full map mode the 2D bullet lines are colour coded to the colour used by each side, instead of yellow for all sides.
When tags are switched on in the 3D view, the 3D bullet bars are now colour coded to be the same as the colour used by each side, adding blue 3D bullet bars for civilians.
When the user clicks a unit on the map, the target list drop down box should have had that unit highlighted when using the target list, this is now fixed.
If the user is in the spectating mode and the player dies, then when the user exits the spectator mode, the respawn dialog will now display immediately, instead of the user going into the free camera mode first, this changes the way version 2.46 did it.
Added an on screen message if the player dies while the user is spectating.
Changed the F1 help message to be part of the user interface, and updated the help text.
Changed the colour of the text of the targeted unit in the user interface, from grey to orange to make it clearer when using a dropped camera.
Removed the Filter key and its function from the camera menu because this was only needed for multiplayer anyway.
Added "(Cargo)" to the displayed name of a unit inside a vehicle, if the role of the unit is not the commander, driver or gunner.
Changed "(Driver)" to "(Pilot)" of the displayed role, if the unit is the driver of an air vehicle.
If you have a previous version of this mod, then delete the @SP_respawn folder from your main Arma folder and extract the new one.
If a mission has the onPlayerKilled.sqs file in it, the SPR Mod will not activate, I have found that the mission called Blood, Sweat & Tears has its own onPlayerKilled.sqs file in it, which prevents the SPR Mod from activating.
Simply un-pbo the mission and remove the onPlayerKilled.sqs file and re-pbo it into the missions folder if you want to play this mission using the SPR Mod.
Credit goes to Kegetys for his brilliant spectator script, enhanced and modified for single player mode.
See notes above
- Fixed a small bug in Kegetys spectator script which happened when the player started the spectator mode from the action menu while inside a vehicle, and then exiting the spectator mode,
sometimes the camera view was not back in the player, but was stuck at the unit that was being observed, and so the user could not get control of the player again.
- Fixed a CTD when the player is killed by friendly fire, or is killed by one of his own side because the player had become a renegade, and then the user clicks the respawn button.
- Changed the way the on screen message is displayed when the player dies to keep the action flowing.
- The chase camera will now follow the player if he a soldier and is hit by a tank shell or RPG, or is killed by a very large explosion which sends him into the air, instead of a fixed camera watching the dead player.
- A few tweaks to improve the response time when spectating while the player is alive and then exiting the spectator mode after the player has died.
- The free camera that is started from the action menu now has a camera location setup dialog which is the same as the respawn dialog camera, so that the user can view any location on the map while the player is still alive.
- Kegetys spectator mode camera now sets the camera NVG automatically the same as the free camera does, and can be toggled on or off using the N key.
- If the player dies while spectating, the user can continue to spectate as normal, but when the user exits the spectator mode, the player will be dead, and the free camera will become active.
- If the user is in the free camera mode and the player dies, then that free camera will terminated, and a new free camera will be activated, this lets the user know that the player is dead.
- The Spectator mode camera will now correctly view units if they are at a height above ground level, for example if the unit is on top of a building.
- For the benefit of mission designers,the player can now activate the Spectator and FreeCamera modes from the action menu, even while the player is still alive, and then exit to continue the mission. Remember that the V key exits the FreeCamera mode, and the Escape key exits the Spectator mode.
- The players rank is now restored after respawning, unfortunately the players rating cannot be restored as this is deleted automatically by the game engine when the player dies.
- When the player dies and it is dark, the automatic activation of the NVG for the free camera now works properly.
- If the player was in a parachute when killed, the camera will release control to the player much sooner, instead of waiting for the dead player to touch the ground.
- The teamswitch menu button is removed if the mission is aborted.
- A few minor tweaks to the config file have removed errors from the arma.RPT file log.
- Chase camera improved. (see readme first.rtf)
- Abort camera fixed. (see readme first.rtf)
- The respawn dialog interface has been improved to give smoother operation over the different functions, the camera icon when placed will now switch the view instantly when the icon is moved.
- The icons for dead, respawn, and camera are now removed after respawning or teamswitching.
- The Abort camera is improved.
Credits & thanks:
Credit goes to Kegetys for his brilliant spectator script, enhanced and modified for single player mode.
- Extended eventhandlers
Tags: No tags