Jump to content
Sign in to follow this  
Baphomet

Help with revive respawn script.

Recommended Posts

I'm trying to get Doolittle's revive respawn script to work with a mission I'm making. However the scripts don't quite fit the criteria necessary for it to be functional.

Firstly, the init.sqs specifies a total of 12 people that can respawn. This is also apparent in the mission as there are 12 markers for each respawnable person in the game.

I had to change both to accomodate 14 playable slots.

However there's one line in the init.sqs that defines what unit types will respawn.

Quote[/b] ]soldierType = "SoldierWB"

I'm using other unit types as well. How would I go about adding more units to that list?

Share this post


Link to post
Share on other sites

There are various ways.

Depending on how exactly you have your units set up.

Probably the easiest way is to list an array of types you wish to use, and then select the appropriately indexed one.

TJ

Share this post


Link to post
Share on other sites

Baphomet, its not an issue.

I'm running a 18 player MP coop with a (modified to also spectate) doolittle revive script using MAP East soldier's ..... with no issues.

FYI, I have two teams A (1-9) and B (1-9)

The only thing relevant in the init.sqs for revive is;

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">respawnA1 = 0

respawnA2 = 0

respawnA3 = 0

respawnA4 = 0

respawnA5 = 0

respawnA6 = 0

respawnA7 = 0

respawnA8 = 0

respawnA9 = 0

respawnB1 = 0

respawnB2 = 0

respawnB3 = 0

respawnB4 = 0

respawnB5 = 0

respawnB6 = 0

respawnB7 = 0

respawnB8 = 0

respawnB9 = 0

For the marker or triggers on the map, just copy and rename some more to suit the number of players. Dont forget to change the INIT line of each new trigger I'm pretty sure the script doesn't care what type of soldier is used.

From the ECP listing by doolittle himself;

Quote[/b] ]You will need to give each of your players a name, like S1, S2, etc. You need to make a trigger for each that will run the script when they are detected as not alive. Call the script by passign the STRING of their name. If they are S1 then you do "S1" exec "respawn.sqs". You need to add the variables respawnS1, respawnS2, etc. to your init.sqs. Also make a marker for each soldier and call each marker S1, S2, etc.

Share this post


Link to post
Share on other sites

For some reason it's not working then. Which is a bit disconcerting since I really don't know what I've done wrong. I'll have to go back and check again.

I've added the additional units, named them. Created their respective triggers and references in the init.sqs.

Positive the soldiertype isn't an issue? I would have thought it was.

I'm not sure on the proper syntax when it comes to most scripting things. Which is where I might be screwing things up.

Share this post


Link to post
Share on other sites

How is it 'not-working'? Are the bodybags created, but when you go near them the unit wont respawn?

Share this post


Link to post
Share on other sites

Trying to remember the original Doolittle script ...... isn't there also a big Trigger that covers the WHOLE play area ..... something like "playeralive" ?

Share this post


Link to post
Share on other sites
Quote[/b] ]How is it 'not-working'? Are the bodybags created, but when you go near them the unit wont respawn?

In the one mission where I've added multiple unittypes to be revived. Yes.

Quote[/b] ]Trying to remember the original Doolittle script ...... isn't there also a big Trigger that covers the WHOLE play area ..... something like "playeralive" ?

There is one large trigger that accompanies the script that runs once. Set to "west" and "not present". The type is set to "end #2". On activation there's a command that says "forceEnd".

I've pretty much put that previous project on the backburner.

I've noticed yet another problem with the revive script that occurs when you take the default amount of players specified in the init.sqs and the mission.sqm and change the amount of them.

The script technically works. The death cinematic where you look down at your corpse after you're killed runs... however it quickly goes from that and your camera view moves directly to your respawned character. Which it's not supposed to do until you've been "revived".

I don't know why this happens. I had thought perhaps that maybe it had something to do with the distance of the respawn point from the actual player, which would be stupid since respawning the player anywhere near the mission area only to be killed while you're viewing your dummy corpse defeats the purpose.

However I tried moving the respawn marker really far in the example map and it still worked. I really don't know why it doesn't work exactly the way it does in the example map when you try to change a few things around such as the type of soldier to be revived or the total number of them.

-EDIT-

I think I've figured out the solution to the camera problem.

Basically that big trigger that's supposed to cover the whole mission... isn't. It appears as if it's supposed to only cover the reviving players. If not. The camera will go from the death cam view straight to where your player secretly respawns to.

So far that issue is fixed. However I still don't quite get why mixing unit types won't work for me.

Share this post


Link to post
Share on other sites

Yeah, there must be a trigger named playeralive that covers the whole mission area, but not where the units secretly spawn.. As for the multiple unit types, they must be defined as the Soldiertype, and as that can only be set to one you'll need to edit the scripts a little.

First, make a script called unittypes.sqs and put this in it<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">SoldierTypes = []

_list = _this

#start

~0.01

_Unit = _list select _i

_type = TypeOf _unit

?! (_Type in SoldierTypes) : SoldierTypes = SoldierTypes + [_type]

_i = _i + 1

?_i < Count _list : Goto "start"

Exit

And replace the respawn.sqs with this version

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">;by Doolittle

_i = 0

_string = _this

_body = call format ["%1", _string]

?_body == player : [] exec "cam.sqs"

~5

_string setMarkerType "Marker"

_string setMarkerPos getPos _body

#notalive

~1

_obj = call format ["%1", _string]

?not alive _obj : goto "notalive"

?not local _body : goto "list"

_respawn = call format ["respawn%1", _string]

_respawn = _respawn + 1

call format ["respawn%1 = _respawn", _string]

?_respawn > param1 : exit

"_obj removeMagazine _x" forEach magazines _obj

"_obj removeWeapon _x" forEach weapons _obj

"_obj addMagazine _x" forEach magazines _body

"_obj addWeapon _x" forEach weapons _body

_obj selectWeapon primaryWeapon _obj

_pos = getPos _body

_pos = [_pos select 0, _pos select 1, 0]

_dir = getDir _body

_dir = _dir - 90

deleteVehicle _body

_body = "Body" createVehicle _pos

_body setDir _dir

_ai = objNull

;edited part------------------

#nearest

_i = _i + 1

? _i >= (Count SoldierTypes) : _i = 0

~0.1

_soldierType = SoldierTypes select _i

_soldier = nearestObject [_body, _soldierType]

?isNull _soldier :goto "nearest"

?not alive _soldier : goto "nearest"

?_ai != _soldier : _ai = _soldier; _ai doMove _pos

?_soldier distance _body > 5 : goto "nearest"

;edited part------------------

~1

deleteVehicle _body

_obj = call format ["%1", _string]

?not alive _obj : exit

_soldier doWatch _obj

_soldier playMove "MedicToCombat"

_obj switchMove "LyingToCombat"

_obj setPos _pos

_obj setDir _dir

_obj setCaptive true

~5

~3.5

_obj setCaptive false

#list

~1

_obj = call format ["%1", _string]

?not (_obj in list playeralive) : goto "list"

_string setMarkerType "Empty"

Now in your init.sqs just put [s1,S2,S3,S4,S5,S6] exec "unitTypes.sqs" (replace the S1 and stuff with the names of your units)

And now you can start the mission, and it should work

Share this post


Link to post
Share on other sites

Yikes, thats a lot of triggers.......

== a lot of tied up cpu time.........

is there a better way?

Share this post


Link to post
Share on other sites

OOOOhhhh! smile_o.gif nice one Korax ..... thanks for that .....

(... Files away script for later)

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  

×