Jump to content
Sign in to follow this  
opusfmspol

How to Fix Respawn Failure in Warfare2 Editor Missions

Recommended Posts

When I obtained v1.63, the editor Warfare mission I worked on for many months in OA failed to respawn. Death camera, zoom up, respawn failure. Forced respawn caused the same thing to happened again, but at base. Always. But....

I was already using a custom Init Client script for the Warfare module, and after tracking down the problem I was able to use it to get respawn working again. The problem was an incorrect variable in one of the Warfare scripts that v1.62 and prior passed over, but affected v1.63.

On Steam and here on the Forums I found threads appearing from others suffering the same respawn issue. I began responding to a few, but I think it's better to post here how people can fix their editor missions that use Warfare.

This is being written from the very basics for the sake of those who are inexperienced at scripting, so please bear with me. And all, please comment where I get something wrong:

How to Use a Custom Init Client in Warfare Missions:

A custom Init Client is used to modify the Client setup in Warfare. It can bypass core scripts and use scripts from your mission file instead. It can also customize client aspects of your mission's init.

The problem is an incorrect variable: _side in the Client_Killed script, which runs the death camera and the respawn map selection. The error is encountered before respawn occurs and stops the script with the camera overhead. The map doesn't appear, and the camera never terminates. Respawn occurs (under an event handler), but the player remains locked in the overhead camera view.

Once the variable is correctly defined ("SideJoined", not "_side"), the camera will terminate and the player returns to their body - die, respawn, game on.

The process:

-----------------------------------------------------------

1.) Read and understand the Arma Public License (APL) and the Arma Public License Share Alike (APL-SA) licenses posted by BI:

2.) Obtain a copy of the Warfare2 module from the Arma Licensed Data Pack page:

Select the "ALDP_A2_PBOs_APL-SA_part3.zip" file, it contains the Warfare2 module.

DO NOT attempt to use the Warfare2 module from your game files, you risk accidentally messing up your game. Take the Data Pack copy of the Warfare2.pbo from the zip file and place it into a new folder of its own for you to work with. You don't want to mess up the module your game uses.

3.) Obtain the Warfare scripts from the pbo. For this you have to use a PBO extractor. Extract the file Warfare2.pbo. There are a few extractors listed on the Arma: Community Tools page:

Comment: Keep in mind, some extractors don't let you choose a file path and will only extract to the file the pbo is in; another reason I say put the module in a file of its own.

4.) Go into the extracted files and find "Client_Init.sqf". It's in the Scripts\Client\Init folder. Copy it into your mission file. You now have a custom Init Client you can modify.

(--- Edit -- Adding some notes for fixing missions that come with the game: many of them will already have custom files. If the mission already uses a custom Client Init, modify that one instead of pulling a new copy. It will have changes you won't want to lose by pulling a new copy.)

5.) Go into the extracted files and find "Client_Killed.sqf". It's in the Scripts\Client\Functions folder. Copy it into your mission file. You now have a custom copy of the problem script which you can fix.

6.) Go into your mission in the mission editor. In the Warfare module Init field, type this:

(--- Edit -- Note: skip this step if you're editing a mission that already has a Mission Init listed - let the module run the one it has.) http://forums.bistudio.com/showthread.php?180972-How-to-Fix-Respawn-Failure-in-Warfare2-Editor-Missions&p=2783030&viewfull=1#post2783030

BIS_WF_Common SetVariable ["customInitMissionScript","Init_Mission.sqf"];

Save. You have now told Warfare to run a custom mission init from your mission folder.

7.) Go into your mission folder and create a new text file called "Init_Mission.sqf". Watch the end extension; make sure it is sqf and not txt or some other.

In this file type these two lines:

(--- Edit -- Note: if editing a mission that already has a Mission Init, use the lines already in that file; but if absent then add these)

BIS_WF_Common SetVariable ["customInitClientScript","Init_Client.sqf"];
BIS_WF_Common SetVariable ["customInitServerScript",""];

Save. You have now told Warfare to run the custom Init Client from your mission folder instead of core.

Note: The custom Init Server needs no script; the line is only necessary to avoid a functions error and freeze on loading screen.

8.) Go into your mission folder's custom Init Client and find the line for "BIS_WF_ClientKilled." Modify this portion:

(corePath + "Client\Functions\Client_Killed.sqf");

to read this:

("Client_Killed.sqf");

Save. You have now told Warfare to run the custom Client_Killed script from your mission folder instead of core.

Now to fix the respawn...

9.) Go into the Client_Killed script in your mission folder. Find the line that says:

_data = [_side,"Barracks"] Call BIS_WF_GetBaseStructureData;

Change it to read:

_data = [sideJoined,"Barracks"] Call BIS_WF_GetBaseStructureData;

Save. The problem has been fixed. The variable is correctly defined. Save mission and launch the game. Warfare respawn should work.

Hope this helps. P.S. - sorry I can't post a sample mission here, I'm a social media neanderthal and have no website for it.

(:>

Opus

Edited by OpusFmSPol
Updated links to the BI Licenses
  • Like 1

Share this post


Link to post
Share on other sites

What a pain in the ass.... I think I'll wait for BI to fix it. 3 years later :\

Share this post


Link to post
Share on other sites

so i have the same probelm when i make a mission and put in the respawn_east (because its a opfor mission) and create the description folder containing respawn= "BASE"; respawnDelay= 5; and when a player dies they become a butterfly, how could i fix this problem?

Share this post


Link to post
Share on other sites

Fix to the Original Post

To those who have already used this fix, I made a correction in the fix listed in the original post. The problem line in the Client_Killed script needs the Warfare public variable "SideJoined", not "side player" as I had originally posted.

Doing continued debugging on Warfare I found a new nuisance error was generated and it was associated with using the "side player." A little more research in the scripts found that SideJoined was the variable normally passed to the Base Structure function. Using SideJoined, it also means scope isn't a concern as was addressed originally.

Also, as explained here: ... I found it is possible to use this to fix the original missions in your game.

http://forums.bistudio.com/showthread.php?181276-Can-t-Respawn-On-When-Diplomacy-Fails&p=2765799&viewfull=1#post2765799

Edited by OpusFmSPol
final note

Share this post


Link to post
Share on other sites

Great work! Never used the mission editor before, but I've followed your directions and got respawn working in Superpowers when locally hosting.

I've been unable to get respawn working on a dedicated server, however. I transferred the PBO of the newly fixed mission to mpmissions, and I'm able to see and launch the fixed mission, but respawn is still broken there. The one difference I've noted is that my ESC menu looks different: "05: Superpowers" as a client to the dedicated server, and "Superpowers - Respawn Fixed" while locally hosting. My best guess is that the server is allowing clients to load up the original mission, rather than the fixed version.

Here's a Dropbox link, if you'd like to look at the PBO: [link removed]

EDIT: Figured it out. The mission folder/PBO name is apparently what is used to determine which mission for the client to load. I needed to rename folder MP_Superpowers.Chernarus to MP_Superpowers_fixed.Chernarus and re-export to force the client to load the fixed mission.

Edited by kg333

Share this post


Link to post
Share on other sites

I ran your mission and found the "05: Superpowers" is being pulled from the description.ext file, where it has:

onLoadMission = $STR_Description.ext0_14;

I don't know where the stringtable is found that it pulls from, but when I replaced $STR_Description.ext0_14 with a simple string "Superpowers Test", it replaced the "05: Superpowers".

Sorry I can't help with a dedi server test, I only have a local hosting setup myself. Hopefully changing the OnLoadMission will help with it.

----Edit-- oops... too slow, I see you found your problem source. The foldername issue is good to know too.

Edited by OpusFmSPol

Share this post


Link to post
Share on other sites

Using these instructions, I managed to get each of the Original Arma/OA/BAF Warfare Scenarios with the respawn working correctly. However, now the scenarios are all using the default factions (USMC vs RU in Chernarus/Utes and US vs Taki Army in Takistan). No British, CDF, Chedaki, etc. Do you know if there is any way to have the scenarios still use the Mission Configs for the factories? :confused:

Thank you so much for the respawn fix though! Your instructions are very clear and easy to follow.

Share this post


Link to post
Share on other sites
Thank you so much for the respawn fix though! Your instructions are very clear and easy to follow.

Thanx, much appreciated;
Do you know if there is any way to have the scenarios still use the Mission Configs for the factories?

I took a look at the "Crimson Lance" mission to get a sense of what was going on, and the DLC content gets pulled from a custom Init Common running configs which contain the units. The files are contained in the mission folder.

I realized my instructions told people to create a new Init Mission whereas the missions in game will already be using one if they run custom configs.

The problem lies in which Init Common is being run (you're clearly running the one from Warfare core). When you created a new Init Mission to tell Warfare to run a custom Init Client, the mission already had a custom Init Mission of its own. In this case, instead of creating a new file "Init_Mission.sqf", you should let the Warfare logic run the "InitMission.sqf" it already points to, and use that file to add the Init Client file.

Example from "Crimson Lance" mission - it runs a custom InitCommon to apply the BAF configs.
Before applying the fix:
BIS_WF_Common SetVariable ["sidePlacement",[true,-1,-1]];
BIS_WF_Common SetVariable ["customInitClientScript",""];
BIS_WF_Common SetVariable ["customInitCommonScript","InitCommon.sqf"];
BIS_WF_Common SetVariable ["customInitServerScript",""];
BIS_WF_Common SetVariable ["customInitBasesScript",""];
BIS_WF_Common SetVariable ["customBaseLayoutsScript",""];
BIS_WF_Common SetVariable ["customTownsScript",""];

Applying the respawn fix:
BIS_WF_Common SetVariable ["sidePlacement",[true,-1,-1]];
BIS_WF_Common SetVariable ["customInitClientScript","Init_Client.sqf"];
BIS_WF_Common SetVariable ["customInitCommonScript","InitCommon.sqf"];
BIS_WF_Common SetVariable ["customInitServerScript",""];
BIS_WF_Common SetVariable ["customInitBasesScript",""];
BIS_WF_Common SetVariable ["customBaseLayoutsScript",""];
BIS_WF_Common SetVariable ["customTownsScript",""];

Sorry, at the time I did the original writeup I didn't have the fix for missions, only the editor fix. I didn't tell people to use a custom Init Mission already in place if one was there. Edited by opusfmspol
Clarified: the module would already have a mission init set

Share this post


Link to post
Share on other sites

Nice, I'll try this when I find time.

Bohemia should apply your solution to the core and publish a quick fix. This error has been there in official missions too many months by now!

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×