OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: Pope_Zog on 20 Aug 2002, 14:24:18

Title: Respawning
Post by: Pope_Zog on 20 Aug 2002, 14:24:18
Adding Respawning
Create a new text document inside your mission directory. Write the following in this document:
Code: [Select]
respawn=2;
respawndelay=20;

The value respawndelay is in seconds. Codes for respawn are below.

Save and close the document and rename it to description.ext
Make sure your system is set to display file extensions so that its name doesn't accidentally become "description.ext.txt".

Remember to set your units as playable in the editor. If you use the setting above they will now respawn where they died after 20 seconds.

Respawn Codes

  0 (or "NONE")
  - No respawn. The camera zooms slowly out from the player's corpse.

  1 (or ["BIRD"])
  - Respawn as a seagull after respawndelay.

  2 (or "INSTANT")
  - Respawn at the place of death after respawndelay.

  3 (or "BASE")
  - Respawn at a random spot in the side's marker zone after respawndelay.
    The names of the different zones are:
        West: respawn_west
        East: respawn_east
        Resistance: respawn_guerrila
        Civilians: respawn_civilian

  4 (or "GROUP")
  - Respawn into any alive AI in the player's squad after respawndelay.
    If noone is left then the player respawns as a seagull.

  5 (or "SIDE")
  - Exactly the same as number 4 (GROUP) - at least in v1.46.

Two pitfalls must be pointed out before you start testing:

 1. Note that respawning will not work if you run the mission from the editor. You will have to Save and Export to Multiplayer, exit the Mission Editor, select Multiplayer, create a new server, select your mission, and test it.

 2. If your rename your mission when exporting it, you'll be in trouble. The editor only copies the mission.sqm file and ignores everything else :( It's easier to rename the mission folder in Windows before opening it in OFP and then exporting it with its new name.

Pope Zog
Title: Re:Respawning
Post by: Tomahawk on 29 Aug 2002, 13:48:17


[attachment deleted by admin]
Title: Re:Respawning
Post by: US-NATO_Term on 16 Sep 2002, 00:08:07
can u make markers appear? like if i made a coop wheres theres no respawn, and once the black ops do the mission, i skip time, i kill off all the players, and then the marker appears on the map, and they respawn at like an air port, so they do another mission later that day???
Title: Re:Respawning
Post by: icarus_uk on 16 Sep 2002, 00:47:56
No need to post your question in two places, esspecialy not highjacking another thread for your purposes.  If someone knows the answer to your question then they can reply in the thread you have already made here (http://www.ofpec.com/yabbse/index.php?board=7;action=display;threadid=1592)
Title: Re:Respawning
Post by: US-NATO_Term on 16 Sep 2002, 02:44:09
 :'( srry but thats a different question, and i forgot to ask for replies, :booty: lol,  and i made my post after i put that in, since his was dealing with respawn i tohught if someone awnsered my question in there ppl would  get another way of respawn??
Title: Re:Respawning
Post by: Pope_Zog on 16 Sep 2002, 12:04:24
This thread was intended for reference only - to dispose with the umpteen posts on the old board asking essentially the same questions.

I guess it's time to add this info to the Editor's Depot (http://www.ofpec.com/editors/index.php).

Happy scripting,

Pope Zog
Title: Re:Respawning
Post by: Pope_Zog on 12 Nov 2002, 14:12:51
The Norwegian author Arne Garborg once said: "I am an honest man, and therefore I can change my mind."

So this is what I'm doing as well. This thread is now open again for any and all suggestions, comments, hints, tips or remarks regarding respawning.

Pope Zog
Title: Re:Respawning
Post by: Kraz on 15 Nov 2002, 03:23:19
So essentially if I want to create a "hold the town" mission with an unending supply of respawning enemies all that I need to do is:

Create the respawn_east marker
make all of the enemy squads "playable"
and specify the respawning the the description.ext file as
Respawn=3
respawndelay=20
 ?
I don't want the defenders to respawn (including the player(s))
and Im pretty sure I've tried this but I have yet to see an unending wave of badguys..
Thanks
Title: Re:Respawning
Post by: Pope_Zog on 19 Nov 2002, 14:46:46
Are we talking a) Single Mission or b) Multiplayer?

a) It won't work. There's no respawn at all in SM/SP.
b) Well, yes. But what happens if a player chooses to play as the enemy? Is that OK?

Pope Zog
Title: Re:Respawning
Post by: Commando on 27 Nov 2002, 17:34:51
How do I make a multiplayer mission where there will be
A: CUSTOM MUSIC

B: RESPAWN

All my atempts to make a description.ext file with both features have failed.
Earlier I had to choose if the mission would have respawn or custom music and that sucks don't it?

please someone give me some help! :'(
Title: Re:Respawning
Post by: Pope_Zog on 29 Nov 2002, 11:57:34
This is what one of my description.ext files looks like:

Code: [Select]
respawn=3
respawndelay=10

onLoadMission="Control the Continent"

class CfgMusic
{
   tracks[]=
   {
       kaizers_kontroll
   };


   class kaizers_kontroll
   {
       name = "Kontroll paa kontinentet";
       sound[] = {\sound\kaizers.ogg, db+0, 1.0};
   };
};

I've got the file kaizers.ogg in a subdirectory called sound - inside my mission directory. The song shows up in the trigger effects Music popup menu as Kontroll paa kontinentet. Never had any problems with it...

Pope Zog
Title: Re:Respawning
Post by: Commando on 29 Nov 2002, 14:45:03
I'll try that thanks! :)
You guys are the best.
Title: Re:Respawning
Post by: Terox on 05 Dec 2002, 00:36:23
A couple of more things on respawning players that probably belongs here, seeing as its supposed to be a reference post

____________________________________________________________________
Creating random respawn areas
ie where a soldier respawns in one of X amount of respawn zones

Script as follows
--------------------------------------------------------------------------
Quote
;Respawn.sqs (random respawn)

_player = _this select 0
_numzone = _this select 1
_radius = 50
_respawnzone = "Respawn_West"

;randomly choose a respawn zone:
_num = random(_numzone)

;get integer
_num = _num - (_num mod 1)
-------------------------------------------------------------------------------
Create a marker for each respawn zone you want
Call them (if you want west to have the random respawn location)

respawn_west
respawn_west1
respawn_west2 etc etc
--------------------------------------------------------------------------------
For each soldier you want to respawn in these randon locations, create the following trigger
(As seen in mission.sqm file)

   class Item0
      {
         position[]={8654.632813,9.634197,12625.308594};
         a=0.000000;
         b=0.000000;
         repeating=1;
         age="Actual";
         text="A1_Respawn";
         name="A1_Respawn";
         expCond="!(alive A1)";
         expDesactiv="[A1,6]exec ""respawn.sqs""";
         class Effects
         {
         };
      };
--------------------------------------------------------------------------
Where A1 is the name of the soldier
and  "expDesactiv="[A1,6]"
the 6 denotes the number of respawn zones you created
ie respawn_west to respawn_west5
________________________________________________________________________
_________________________________________________________________________
If you want an extra respawn zone in addition to respawn_west

Quote
; rescue_respawn.sqs
; Script that respawns players in a specific zone.
; Simplified from Backoff's multiple respawn script.
;
; Syntax: [player name, respawn marker name] exec "respawn_rescue.sqs"
;
; "Player name" is the name given to the player.
; "respawn marker name" is the name of the respawn marker the player
; should respawn in.
;
; Example: [Rescue1, "rescuers_area"] exec "respawn_rescue.sqs"
;
_player = _this select 0
_zone = _this select 1
_radius = 10

_pos = getMarkerPos _zone

; Create random number to set the player position
_randx = random (_radius)
? ( random(10) < 5 ): _randx = _randx * -1
_randy = random(_radius)
? ( random(10) < 5 ): _randy = _randy * -1

; Set the position.
_player setpos [(_pos select 0) + _randx, (_pos select 1) + _randy, 0]

Exit
-------------------------------------------------------------------------------------
Create a marker for it, calling it ****_respawn
in the following example this is called "rescue_respawn"
----------------------------------------------------------------------------
and then a trigger for each player that is required to respawn at this other location
In this example player is called "RP5"
------------------------------------------------------------------------------

      class Item19
      {
         position[]={8673.614258,6.824206,12584.245117};
         a=0.000000;
         b=0.000000;
         repeating=1;
         age="UNKNOWN";
         text="RP5 respawn trigger";
         name="RP5_Respawn_";
         expCond="alive RP5";
         expActiv="[RP5, ""rescue_respawn""] exec ""rescue_respawn.sqs""";
         class Effects
         {
         };
      };
   };
};

Title: Re:Respawning
Post by: eye-liquid on 16 Dec 2002, 17:38:26
thanks for the code but when i respawn i get respanwed to a bird... and at the other numbers i get a bird to so PLZ HELP
Title: Re:Respawning
Post by: eye-liquid on 16 Dec 2002, 20:05:00
ive got it working now
but i want less than 20 seconds respawning
how can i do that???
Title: Re:Respawning
Post by: Pope_Zog on 16 Dec 2002, 22:03:34
Quote
The value [of the variable] respawndelay is in seconds.

Pope Zog
Title: Re:Respawning
Post by: Soapyfrog on 15 Jan 2003, 04:14:52
How do I specify equipment carried by the respawned soldiers?  Default seems to be M16...
Title: Re:Respawning
Post by: Pope_Zog on 16 Jan 2003, 12:53:59
> How do I specify equipment carried by the respawned soldiers?

In this thread (http://www.ofpec.com/yabbse/index.php?board=7;action=display;threadid=2271) you'll find a simple way of changing this.

I'd also recommend you have a look at Backoff's reloadguy script (http://www.backoff.ch/ofp/files/script/reloadguy.Eden.zip).

Toadlife presented an excellent tip in this thread (http://www.ofpec.com/yabbse/index.php?board=7;action=display;threadid=3327), and since he's mentioned, you should also examine the Universal Weapons Respawn Script (http://www.ofpec.com/editors/snippet_view.php?id=166) he and Hamdinger submitted in the snippets section.

And finally, you could have a look at this thread (http://www.flashpoint1985.com/cgi-bin/ikonboard301/ikonboard.cgi?s=3e268d2b7dcdffff;act=ST;f=7;t=5995;st=0) in the official forums.

Pope Zog
Title: Re:Respawning
Post by: Soapyfrog on 16 Jan 2003, 20:39:40
Thanks for your help!
Title: Re:Respawning
Post by: djstoker on 02 Feb 2003, 18:50:57
hi, im trying to get respawning to work, but im having problems.
i either only respawn as a seagul, and other times i get an error saying "y" has no "=" which crashes ofp.
in wordpad i have written
respawn=2;
respawndelay=5;
______________-
i know that if you go to save as and save it as description.ext it will save it as a description.ext.txt, some1 said there was a way to get wordpad to stop doing this, how do i do it? i also renamed the file as EXT which seems to work, but i still get the problems in game as listed above,
can any1 help me or point out what im doing wrong, thanks in advance :)
Title: Re:Respawning
Post by: Pope_Zog on 03 Feb 2003, 14:55:00
Your "description.ext" may be saved encoded in unicode format. That'll result in the file having two "strange" characters at the beginning. My suggestions are:

1) Don't use WordPad - use Notepad.
2) Save the file with ANSI encoding.
3) In Notepad you can select type "All files" when saving the file. It'll then accept the extension you give it without adding ".txt". (This applies to Win2000... can't speak for other versions.)

Pope Zog
Title: Re:Respawning
Post by: djstoker on 09 Feb 2003, 11:18:00
ok thanks, ill try that 8)
Title: Re:Respawning
Post by: Jobu on 18 Feb 2003, 07:47:55
Just wanted to say thanks Pope Zog, this forum has been a saviour. I spent most of the day trying to figure out how to respawn. I have seen many fine advanced tips on this site, but no basics till i checked out this area. Again, Thank You!!
 ;D ;D ;D ;D

Jobu
Title: SPAWNING
Post by: MAGIC SNIPER on 14 Mar 2003, 20:59:36
HOW DO U SPAWN STUFF? AND HOW DO I MAKE UNITS STAY STANDING IN COMBAT SITUATIONS? HHHHHHEEEEEEELLLLP!!!!!!
Title: Re:Respawning
Post by: DoomedSoldier on 01 Apr 2003, 03:33:13
i need major help. i downloaded some WW2 soldiers and tanks. i have got it where the men respawn but i want to get it where all the men respawn with the guns they started with. the AI start with M16s and AK47s after they are killed. its geting me mad. i been looking at the forums here and all it is showing me how to get one person to respawn with the right gun and its geting me confused lol. can someone tell me how to get all the players to respawn with the right weapons. if there AI or not.    also how do i get the ww2 tanks to respawn then they are distoryed. PLZ help me. my poor, poor, poor head it hurts. need help! pl..............ease! (faints)
Title: Re:Respawning
Post by: RONIN =ASP= on 03 Apr 2003, 01:42:04
HI ppl...

     Real noob question...but I think I know the answer,wonder if any1 could confirm for me if there is a way to use a group of enemy AI over and over in an MP Co-op mission...

For example....MP players squad assaults village, Brutally massacaring the enemy position...

The dead enemy AI bodies are then removed,brought back to life in a different location,and given waypoints to follow as if nothing had happened....

I think this would b infinately kool and raise numerous oppurtunitys in which to create less laggy missions, with extended length....

Just athought...... ;D ;D ;D ;D ;D

Is this possible  ???  ???  ???  ???
Title: Re:Respawning
Post by: FSDave on 03 Apr 2003, 17:46:39
I found that when I tried this it didn't work. What am I doing wrong? My description.ext file read as:
Code:
respawn=4;
respawndelay=10

But it still did the seagull thing. Any ideas why? I'm confused. Spent an hour trying to work out what was wrong but my head started to hurt so much I gave up. PLease help if you can!
Title: Re:Respawning
Post by: Commando on 11 Apr 2003, 13:23:35
any one know if it is possible to make people respawn on a concrete block or in the scond floor of a building for an example.. ???
Title: Re:Respawning
Post by: Gadjuka on 11 Apr 2003, 15:05:16
FSDave, have you tried to do it without the semi-colons? I don't think they should be there.
respawn=4
respawndelay=10

Also you should "export to multiplayer mission" and run it from "Multi-player" instead of test it by pressing the "Preview" button in the editor (if you do).

(When exporting to multi (or single) player mission, don't rename the file)
Title: Re:Respawning
Post by: Priest950 on 22 Apr 2003, 00:34:00
How about combining two of the respawns? For example, doing the squad respawn, and once the entire squad is gone, you respawn at the home base. Anyone know how that could be done?
Title: Re:Respawning
Post by: GodHatesUsAll on 29 Apr 2003, 12:38:49
I need a simple way to make a Plane Spawn, with a pilot, thats flying.

Because i havea WW2 mission, and the plane isnt needed until a bit through the mission.

Also is there an EASY way to make a sqaud SPAWN, not respawm.

Ofpec's tutes are too hard to follow.
Title: Re:Respawning
Post by: Pope_Zog on 01 May 2003, 12:47:46
An initial comment: I'd recommend that you use this thread more for reference and less for posting questions. In most cases, posting a new thread with your question will get it answered more promptly. It also has the advantage that you'll be able to specify its topic more clearly than just "Respawning". I'm not saying you should stop using this thread at all :)

Now for some answers (yes, I know many of them may be late):

Quote
DoomedSoldier wrote in Reply #24:

1) [...]the men respawn but i want to get it where all the men respawn with the guns they started with[...]

2) [...]also how do i get the ww2 tanks to respawn then they are distoryed[...]

1) Use toadlife's Universal Respawn Script (http://www.ofpec.com/editors/resource_view.php?id=301). It's exactly what you're looking for. See the example mission for how it's used.

2) Use doolittle's AI Vehicle Respawn script (http://www.ofpec.com/editors/resource_view.php?id=410). Again, it should be what you're looking for. The page referenced explains how it's used.

Quote
RONIN =ASP= wrote in Reply #26:

if there is a way to use a group of enemy AI over and over in an MP Co-op mission

There are several ways of doing this. The easiest way would be to let the enemies respawn as well (by making them playable) but of course then you risk players selecting a unit from that side which may not be what you're looking for.

I've personally had problems "reviving" dead enemy soldiers - they don't come properly back to life. If anyone has solved this, I'd like to see the solution posted for everyone's benefit.

In the thread Domove not working in MP ?!? (http://www.ofpec.com/yabbse/index.php?board=7;action=display;threadid=6309) you'll find a way of creating new units on the fly. This should work just as well, only I don't know how to assign waypoints to the created units. Again I'd like to see such a solution posted if anyone has one. You can however "force" the group to move to a specific location, and this may be enough for your purposes. I.e. create the soldiers, set their combat mode, and send them to the village.

Quote
Commando wrote in Reply #27:

if it is possible to make people respawn on a concrete block or in the scond floor of a building

Set the height of the unit when it respawns in its "init". E.g. this setPos [this getPos select 0, this getPos select 1, (this getPos select 2) + 2.3] where you'd substitute 2.3 with whatever height the concrete block or second floor is. I make no guarantees on this one, I've had problems making units respawn inside buildings that I've "inserted into" the map.

Quote
Priest950 wrote in Reply #29:

How about combining two of the respawns? For example, doing the squad respawn, and once the entire squad is gone, you respawn at the home base.

This is where you meet the OFP wall. It can't be done. Sorry. You can only set one type of respawn for the entire mission and that has to apply to both sides as well. So when your squad has been wiped out, you're forced to end up with a flock of seagulls. Hopefully BI will do something about this in OFP 2.

Quote
GodHatesUsAll wrote in Reply #30:

1) I need a simple way to make a Plane Spawn, with a pilot, thats flying.

2) Also is there an EASY way to make a sqaud SPAWN, not respawm.

1) See answer 2 to DoomedSoldier's question above.
2) See the answer to RONIN =ASP='s question, also above.


Since it's May 1st let me just holler: "Worker of the world unite!" ;)

Pope Zog
Title: Re:Respawning
Post by: Commando on 02 May 2003, 00:35:58
 :D Thx Pope Zog! I see what you mean ;)
Title: Re:Respawning
Post by: RONIN =ASP= on 21 May 2003, 01:45:39
Wow...

POPE ZOG rulez man...

Thanx for the info dude..Very helpful...

 ;D ;D ;D
Title: Re:Respawning
Post by: Fiendish on 03 Jul 2003, 01:50:46
I can't get the respawn in base thing to work... And I've tried for weeks!

I wrote this in my Description.ext:

Respawn=2:
respawndelay=10;


 and made a trigger named respawn_west...

Is'nt that what you're supposed to do?
What do I do wrong?
Title: Re:Respawning
Post by: Commando on 04 Jul 2003, 11:31:58
have you saved your description.ext file as all files?
Title: Re:Respawning
Post by: Zombie on 04 Jul 2003, 11:47:09
respawn_west is a MARKER, not a trigger, and I am pretty sure it has to be at least 20x20, I haven't had any luck with a spawn area smaller than that
Title: Re:Respawning
Post by: NASFMike on 06 Aug 2003, 00:42:03
Have not seen a multiple respawn in here. i dont mean a random respawn.

how could a respawn be made if you are killed then you respawn to the main respawn "respawn_west" then once everyone is killed you respawn a new location to play the next section of the map and so on untill no more respawn zone are set.

i guess this is like that OYC real team fight map. (if u played it)
Title: Re:Respawning
Post by: NASFMike on 06 Aug 2003, 00:45:35
Zombie, respawn can be any kind of marker and any size. Aslong as you have the proper name and the right command in the description.exe it should all work/
Title: Re:Respawning
Post by: SH@dow 113 on 30 Aug 2003, 23:02:40
in a FlagFight tut, they use a elipse as Marker (u know round thingy), where u can choose between(solid, stripes, etc.)

make ur size (e.g. 250x250) and u will respawn randomly in the markers area

enjoy :cheers:
Title: Re:Respawning
Post by: Glamhoth on 04 Nov 2003, 16:50:25
I'm sorry im a noob.. But.. I made the "Description.ext" file..
I put it in the folder named
X:\program files\Codemasters\OperationFlashpoint\Users\Username\missions\name.Intro
Where the "mission.sqm" also is..
I made it with "base respawning" and i made a marker named respawn_west... I saved it, loaded the map in multiplayer, killed myself and then i didnt respawn..?!
Title: Re:Respawning
Post by: charunks on 29 Dec 2003, 17:40:25
hummzzz. is it possible for you to respawn while nonplayable units really die?
Title: Re:Respawning
Post by: Terox on 29 Dec 2003, 19:17:18
respawn_west is a MARKER, not a trigger, and I am pretty sure it has to be at least 20x20, I haven't had any luck with a spawn area smaller than that

I have used a 3 X 3 ellipse respawn for over 2 years now and it has never caused me a problem.

The one thing you need to be aware of when creating larger respawn areas is not to have items like buildings or med tents in the respawn area as this may cause the player to respawn inside the object with no way of escape


Have not seen a multiple respawn in here. i dont mean a random respawn.

how could a respawn be made if you are killed then you respawn to the main respawn "respawn_west" then once everyone is killed you respawn a new location to play the next section of the map and so on untill no more respawn zone are set.

i guess this is like that OYC real team fight map. (if u played it)

As for the question about a progressive respawn location. EG respawning at a different location when a certain objective has been achieved.

Simply Public variable a boolean when that stage has been reached using a trigger or a line in a script
(eg. stageone = true; Publicvariable "stageone")

and then in your respawn script


;;Respawn.sqs"
#START
@! alive player
@ alive player
? (stagethree): goto "THREE"
? (stagetwo): goto "TWO"
? (stageone): goto "ONE"
goto "START"

#ONE
Player setpos (getmarkerpos "MARKER_A")
goto "START"

#TWO
Player setpos (getmarkerpos "MARKER_B")
goto "START"

#THREE
Player setpos (getmarkerpos "MARKER_C")
goto "START"

1)Create the number of markers you need for your respawn locations
(In this case there are three, _A, _B and _C)

2)Have the script check in reverse order, this way your player is repositioned at the furthest marker in the stages

3) Execute your script from the Init.sqs
eg.
 ?!(local server):[] exec "Respawn.sqs"


You dont actually respawn in a different location, what basically happens is at the moment of your rebirth you are instantly relocated to whichever mark the stage is at

*****************************************************************
If you wanted to do this because a player jas been killed x amount of times, then add a counter into the script

eg


;;Respawn.sqs"

_count = 0
#START
@! alive player
_count = _count + 1
@ alive player
? (_count >= 3): goto "THREE"
? (_count >= 2): goto "TWO"
? (_count >= 1): goto "ONE"
goto "START"

#ONE
Player setpos (getmarkerpos "MARKER_A")
goto "START"

#TWO
Player setpos (getmarkerpos "MARKER_B")
goto "START"

#THREE
Player setpos (getmarkerpos "MARKER_C")
goto "START"


In this scenario everytime a player dies, his counter is increased by 1
When he is reborn the script looks at the value of the counter and then jumps to whichever "Label" is relevant"
Title: Respawning
Post by: shadow0001 on 05 Jan 2004, 20:27:34
hi i have respawn in my mission and when i die i becone to the place where i died ik make a trigger named WEST-RESPAWN but it dont work:s pls help me ho to i get when i die a place where i alway's become when i die ho do il do it?  ???pls help me contact me on msn or e mail dimitri_engelen@hotmail.com
Title: Re:Respawning
Post by: gothicv on 15 Jan 2004, 04:06:27
How would you make it so that there was only a certain number of soldiers allowed?

for example, this current mission I'm working on, I want there to be 12 soldiers per side, but I want them to be respawned from nowhere (so that they won't get shot just standing around.) I want to make it fair for both sides, and also to help the newbies by letting them respawn more than everyone else if they need it.
Title: Re:Respawning
Post by: Nedal on 28 Jan 2004, 18:10:27
i wana make a death match multiplayer map
my idea is that as te mission starts a script moves the respawn_west marker to the position of one of the 5 markers sp1,sp2,sp3


so if you start the map, you never now in wich City the match will be


here the script wich is in the init.sqs


; random start point
_num = random 5
? 0 < _num =< 1: setpos _respawn_west getpos _sp1;
? 1 < _num =< 2: setpos _respawn_west getpos _sp2;
? 2 < _num =< 3: setpos _respawn_west getpos _sp3;
? 3 < _num =< 4: setpos _respawn_west getpos _sp4;
? 4 < _num =< 5: setpos _respawn_west getpos _sp5;



but it does not work, i get error at start of mission
can someone help me?
 



Title: Re:Respawning
Post by: Artak on 28 Jan 2004, 18:59:09
In the words of Mr. Spock, your script is illogical.  :D

?_num > 0 && _num <= 1: "respawn_west" setpos getmarkerpos "sp1"
?_num > 1 && _num <= 2: "respawn_west" setpos getmarkerpos "sp2"
...
The above should be more like the way to go.
If _num is above 0 and if _num is equal or less than 1, set respawn_west marker to where marker sp1 is.

However, using random in MP mission I'm assuming that you're using publicvariable familiar with publicvariable? If not you can look it up, there's many many great many threads about it in the MP forum.
If you don't publicvariable a random which is created in a script that runs on all computers, the value of random is different on all computers, thus placing your marker to different places on all computers. Or if your script is running only on the server, the others won't know anything about it still resulting in misfortune  :)
Title: Re:Respawning
Post by: Nedal on 28 Jan 2004, 19:08:17
uhh  did not know that

i am not familar with publicvariables

i am also not familar with random

does random5 means  0 or 1 or.... until 5
or does it start with 1?


here is the basic map i am working on
http://www.bikeadventure.ch/ofp/random.zip (http://www.bikeadventure.ch/ofp/random.zip)

i guess you know what i try to build,    is there a missionexample with something lake that, so i can have a look on it?
Title: Re:Respawning
Post by: Jinef on 07 Mar 2004, 18:51:38
Sorry i placed a post in wrong place.
Title: Re:Respawning
Post by: Garcia on 20 Mar 2004, 13:04:01
Time to put my question that I'm pretty sure the answer is "no!" to here :P

Is there any way to make 1 group of US soldiers respawn to base, and another group of US soldiers respawn to group?

And if that ain't possible, is it then possible to make some groups of US soldiers respawn to base, all east units respawn to base, and res units respawn to group? Where only 1 US group is playable, the rest of the US groups are AI, all east groups are AI, and the res group is playable. With AI I mean, that they can't be playable. ;)

Also need the east AI to respawn randolmy at 7 different markers. Though, if I in some way could remove the markers, and make them respawn randomly at i.e 7 different game logics, that would be good ;)

Garcia
Title: Re:Respawning
Post by: Hellfish6.2 on 31 Mar 2004, 14:29:32
Does anyone know how to disable the camera view when you have a "group" respawn? Right now, your character dies and then the camera moves to the new soldier. I'd like to instantaneously move to the new soldier.
Title: Re:Respawning
Post by: minimonkay on 06 Apr 2004, 21:55:50
i need help, im almost finished making a mission but i cant get the respawn to work, in description.ext i have:

respawn=5
respawndelay=2

and i have playable AI and non-playable AI to spawn into but it doesnt work!
please help me.
monkay
Title: Re:Respawning
Post by: Artak on 07 Apr 2004, 05:53:11
I wonder if you can use respawndelay with respawn number five. The respawn number five is defined as "immidiate respawn to the next unit in group".
If you want a group respawn with two seconds of delay, try changing respawn=5 to respawn=4
Title: Re:Respawning position
Post by: Stigern on 11 Jun 2004, 11:02:42
I dont get it. How i make a respawning position for the west.
In my mission i only want the west to respawn at a marker. but how??

My respawn script work just fine, but i start where i died, and thats not what i want.

PS: sorry for my english, im norwegian  ;)
Title: Re:Respawning
Post by: Billdude on 21 Jun 2004, 02:15:17
Create a new text document inside your mission directory. Write the following in this document:
Code:respawn=2;
respawndelay=20;

ok when you say that you mean to create the document here?

C:\Program Files\Codemasters\OperationFlashpoint\Missions

sorryy but im a total newb just trying to make a mission for me and a friend of mine im trying to get hooked

i tried to read it and i tried what i thought it was saying to do but im not having any luck
thanks for any help you can offer
Title: Re:Respawning
Post by: Planck on 21 Jun 2004, 04:55:07
You really should read all of that posting.

When you make your new text document, use Notepad.

Write these 2 lines in it:

respawn=2;
respawndelay=20;


Now, when you save the document from Notepad make sure you save as Type: All Files and call the document description.ext

If you save it as a Type: Text  and name it description.ext, you will end up with a file called description.ext.txt......which is not what you want.

This document then goes inside your mission folder, which will be something like:

C:\Program_Files\Codemasters\OperationFlashpoint\Users\YourName\Missions\YourMissionFolder


Planck
Title: Re:Respawning
Post by: Commando on 08 Aug 2004, 21:17:41
i have searched the whole thread but does anyone know about how to respawn into a vehicles cargo area?
i got a coop on the aec islands and i wish that my men would be able to respawn at a LSD ship addon inside it because its supposed to be used when going between the islands as a mobile respawn place.
Title: Re:Respawning
Post by: rezz on 08 Sep 2004, 23:46:45
What do I have to do, if I only want the players to respawn and not the AI.
Is the only possibility to make every other soldier non-playable??
Title: Re:Respawning
Post by: Vindamiatrix on 07 Dec 2004, 15:31:32
Hey everybody.. This thread really helps us scripting noobs out :) I for one can now make a nice respawn thingy... I added a little SQS of my own by the way... :) Since I am a noob at scripting... it may suck in the eyes of a master scripter.. but hey... you've got to give me some credit for trying :) ok here it is:

the player is called.. well.. just PLAYER... now here we go:

Quote
#alive
~1
?alive player: goto "alive";
goto "dead"

#dead
~0.001
?alive player: goto "remove"
goto "dead"

#remove
removeallweapons player;
goto "alive"

The "ALIVE" chapter of the script.. continues to check if the unit called PLAYER is still alive... if it is.. it goes back to the beginning of the chapter and starts checking again.. with a delay of 1 second...

if the player isn't alive it goes on to Chapter 2... "DEAD"... here it actually does the same as in chapter one.. only then vise versa....  it now continues to loop untill the player is alive again.. and then moves on to chapter three.. "REMOVE".. where all the weapons of "player" will be removed....  because the loop time in chapter 2 is set to 0.001 seconds..   you won't see the remove happening.. it's as if you spawn without the weapons....

So the result is quite cool....  You start with weapons... you die... you respawn next to your dead body....with your first weapons still on the ground... so you can pick them up again.. this way you wont respaw'n with an m16.. and prevent a field from flooding with dead gi's with m16's :)
Title: How to make respawn for a game someone else made?
Post by: rakovsky on 14 Dec 2004, 07:12:16
hey guys I have downloaded different PBO files of cool multiplayer games like "fatherland" and golikovs raid.
  They are in PBO format. How can I make it so that they have respawn in them?
  I have the DePBoers called DESQM and UNPACK SQM.
  One thing I tried was unpacking using these programs. I renamed it mission.sqm and then the DESQM program turned it into a text file. Then I renamed it back as Mission.SQM and set it in a folder of its own GOLIKOVSraid.Eden.
  Then I set up a description.ext file inside the folder that is suppoosed to do the respawning.
  However, whenever I try to run a program that I have DEPBOed using these programs, even if I haven't added anby description file, then it says
error, C/OperationFlashpoint/Mission.sqm/artillery has . instead of "="
and CRASHES!
Please say what the easiest, safest way is to add respawn, thank you,
Hal
Title: Re:Respawning
Post by: Planck on 14 Dec 2004, 20:59:02
Use Amalfi's PBO decrypter instead, you can get it from the Editors Depot.

For repacking use StuffPBO, however I don't know if it is available in the Editors Depot or not.......go look  ::)



Planck
Title: Re:Respawning
Post by: rakovsky on 16 Dec 2004, 11:05:46
ok thanks.
so what your saying is that i should dePBO the file first, and then do something to the file and then repack it? what should i do?
please reply.
Rako
Title: Re:Respawning
Post by: Planck on 16 Dec 2004, 20:49:17
What I meant was:

Use Amalfi's PBO Decrypter to unpack the mission PBO's.

Do the editing you want to do

Pack it all back into a PBO with StuffPBO.



Planck
Title: Re:Respawning
Post by: Ric11 on 02 Jan 2005, 22:26:56
Hi,

No ones really posted about this for a week or so, but im still having problems.
At first i wasnt sure where to put it, but im pretty sure ive got it right now, i made a simple mission to test this on called "test".

So i made the document, i put

respawn=2;
respawndelay=20;

inside it, then i went to "save as",
I called it "description.ext"
i set the type as "All Files"
and the coding was already on "ANSI"

so i assume it wasnt a .txt file.
I put this document in:
"C:\Program Files\Codemasters\OperationFlashpoint\Users\Richard\missions\test.noe"

In this scenario i just have 2 men set as "Playable" and i just go into it in multiplayer having exported it without changing the name. and i just blew myself up, then it fades out and starts to spin round and i turn into the damn seagul  >:(. Im not sure what is wrong because i have read all the other posts and people still seem to be having the same problem as i have. However i did notice one thing when i went to change the respawndelay to see if that would work, when i re-saved it with the same settings, same name, all files, ANSI  it said there was already a "description.ext.txt" file there, even though i thought i had made it just an .ext file, i was wondering if this is just a thing that always comes up or might this be something to do with it, its making a txt file for some reason.

Any help will be appriciated, because i know you guyz have a lot of posts to answer as a lot of other people are having the same problem.

Thx.
Title: Re:Respawning
Post by: Planck on 02 Jan 2005, 22:38:17
Using Notepad.........

If you call the file description.ext and have the file type set to 'All Files (*.*)' it should save it as description.ext.

What program did you use to make your file.

Try the one I posted below.   ;D
Just unzip it.



Planck
Title: Re:Respawning
Post by: Ric11 on 02 Jan 2005, 22:46:22
AHhhh

It didnt work, i really dont get this, i did use notepad before and when i put your file in it just overited mine, and still no difference, i just turned into the seagul, you think it has something to do with my scenario? i have both the men set as playable and i just kill myself with a nade and nothing happens :(.

i really doubt thats it but... :(
Title: Re:Respawning
Post by: Planck on 02 Jan 2005, 22:51:57
Did you save your mission as a MP mission or just a SP mission from the editor?

If it is a MP mission, are you playing via MP and not in the editor?

Respawning doesn't work in the Editor.....I think

EDIT:  Just ignore me........you wouldn't get a seagull otherwise   ::)   ::)


Planck ::)   ::)
Title: Re:Respawning
Post by: Ric11 on 02 Jan 2005, 22:56:22
Yer i exported it to multiplayer under the same name, then i went and tried it on multiplayer.
Title: Re:Respawning
Post by: Planck on 02 Jan 2005, 23:01:30
De-pbo your MP mission and check that your description.ext file is actually in there.


Planck
Title: Re:Respawning
Post by: Ric11 on 02 Jan 2005, 23:16:39
De-Pbo, do you mean take out all my custom made missions  in

"C:\Program Files\Codemasters\OperationFlashpoint\Users\Richard\missions"
Title: Re:Respawning
Post by: Planck on 02 Jan 2005, 23:35:01
NO

I mean, when you exported your mission to MP, it was made into a PBO file.

De-pbo this file and you will get a folder which will contain your mission.sqm and (hopefully) your description.ext.

You do have a De-pbo utility don't you?


Planck
Title: Re:Respawning
Post by: Ric11 on 02 Jan 2005, 23:47:07
Well, if i go into MPMissions i do see it as a PBO file, but i go into the Users/Richard/missions/test and it is already in a .sqm file and i can see the ext , thats where i put the file in the first place.
Title: Re:Respawning
Post by: Planck on 02 Jan 2005, 23:58:18
The one you see in your:

"C:\Program Files\Codemasters\OperationFlashpoint\Users\Richard\missions\test.noe"

Is the Editor copy, this is not the copy you will be playing if you are playing from the MP Interface.

The copy which is made into a PBO in your MP folder is the one you exported and it might not contain the description.ext file.

If you get a De-pbo utility you can unpack the pbo in the MP folder to check if it actually contains the file.

Or maybe just re-export you mission under a different name.

Planck
Title: Re:Respawning
Post by: Planck on 03 Jan 2005, 00:15:34
I just made a mission on Desert Island......me and another guy.

I saved the mission.

Alt-Tabbed out of the game, went and found the mission folder and put the description.ext in it.

Back into game, I make both guys playable and export to multiplayer.

I quit the editor and went to multiplayer and chose that mission to play........killed myself.....and 20 seconds later I respawned.

It works ok

If you like I can post the mission here for you to try?



Planck

Title: Re:Respawning
Post by: Lord_Bamse on 09 Jan 2005, 14:00:20
I have a small problem. I have created a MP mission, but I want only one side to respawn. I can make both sides respawn, but that's not what I want. I tried only putting a respawn marker for one team, but then the other team (that I don't want to respawn) respawns there too. How is it done, if it is done at all?
Title: Re:Respawning
Post by: DBR_ONIX on 09 Jan 2005, 15:34:37
What about making the other side's respawn in a remote island or something, and have a trigger (that call's a script) that moves the people to a locked heli or something?

Code: [Select]
_unit = _this select 0
_heli = _this select 1
_unit moveincargo _heli
exit

And in the trigger activation feild :
[this,heliname] exec "script.sqs"

- Ben
Title: Re:Respawning
Post by: newb on 14 Jan 2005, 04:19:47
hey i dont mean to hijack... but since everyone is talking about respawning i just thought i might ask.

Is non-playables respawnable in MP?
Title: Re:Respawning
Post by: Lt.Ryan on 15 Jan 2005, 05:35:01
Hey I played a MP mission that had spwan pionts and as we advanced up the road the spawn pionts would move with us. Any one have an idea how do do this. I would love to use it in some of my missions.

 :cheers:
Title: Re:Respawning
Post by: Richard99 on 16 Jan 2005, 03:18:06
Simple Question 4 u, does respawn side  actual work now.
 i can get all the other 2 work bar that 1 ?
thanks
Title: Re:Respawning
Post by: Serial Killer on 29 Jan 2005, 10:35:54
If I use that base respawn with a FDF units, there is a little problem..
When they have respawned, they'll get AK47 >:( I want that they get RK62 ( FDF weapon ) or something like that..

Can anyone help me?
Title: Re:Respawning
Post by: Rocko Bonaparte on 08 Feb 2005, 17:07:51
I just had an anomaly testing a mission last night.  I have teamspawn enabled, and it has worked flawlessly ever since until now.  I was squad leader and got bagged.  Normally, when I am team spawned, I will resume command of the group.  This time, it didn't happen.  The rest of the quad went stupid and we couldn't get them to do what we wanted.

Well, technically the rest of the squad wasn't near me.  It was possible they were all dead.  However, they were showing up on my Recruit-level screen, although they weren't moving.  Does this actually happen often?



Quote
hey i dont mean to hijack... but since everyone is talking about respawning i just thought i might ask.

Is non-playables respawnable in MP?
Yes -- I was working on a mission for respawning tanks, and the non-playable tank crews would respawn without a problem.

Edit: Actually no, I just made them playable but I forgot that I had written a ton of code to make them function like AI if they weren't human controlled.  Fooled by my own machinations.
Title: Re:Respawning
Post by: Terox on 08 Feb 2005, 21:30:30
hey i dont mean to hijack... but since everyone is talking about respawning i just thought i might ask.

Is non-playables respawnable in MP?


NO

*************************************************************
*************************************************************
*************************************************************

Hey I played a MP mission that had spwan pionts and as we advanced up the road the spawn pionts would move with us. Any one have an idea how do do this. I would love to use it in some of my missions.

 :cheers:

Init.sqs
player addEventHandler ["killed", {_this exec "myrespawn.sqs"}]

MyRespawn.sqs
Player removealleventhandlers "Killed"
@ alive player
Player setpos  (getpos objectname)
or
Player setpos (getmarkerpos "markername")
player addEventHandler ["killed", {_this exec "myrespawn.sqs"}]

*************************************************************
*************************************************************
*************************************************************

If I use that base respawn with a FDF units, there is a little problem..
When they have respawned, they'll get AK47 >:( I want that they get RK62 ( FDF weapon ) or something like that..

Can anyone help me?


The following will give the unit the weapons it started with

Unit's Init field
_this addEventHandler ["killed", {_this exec "unitspawn.sqs"}]

MyRespawn.sqs
_unit = _this select 0
_unit removealleventhandlers "Killed"
_weapArray = weapons _unit
_magArray = magazines _unit
_primary = primaryweapon _unit
@ alive _unit
removeallweapons _unit
_unit addEventHandler ["killed", {_this exec "unitspawn.sqs"}]
{_unit addMagazine _x} forEach _magArray
{_unit addWeapon _x} forEach _weapArray
_unit selectWeapon _primary


alternatively you can specify a different loadout

@ alive _unit
removeallweapons _unit
_unit addmagazine "XXXXX"
_unit addmagazine "XXXXX"
_unit addmagazine "XXXXX"
_unit addweapon "XXXXX"

Title: Re:Respawning
Post by: Demitron Rage on 09 Feb 2005, 02:49:56
Ok, Im completely new to the editor. I have my map made. I just want to know how to make the respawn infinite. I just want the west to respawn at the base when they die. I figured out the description.ext file but is that all I need to type is respawn=3 respawndelay=2 and how do I place a maker for the respawn. I need details on that. I need to know what all to type in this file and where to put it. For example, do I need to make a folder and put the 2 together or what. I cant figure out why name the file description.ext and not the name of the map? I know Im asking 20 questions here but I can understand better if I knew why or how. Thanks for any help.
Title: Re:Respawning
Post by: Planck on 09 Feb 2005, 04:25:57
Most if not all the info you require on respawn is contained in this thread.

If you want it badly enough try reading through it.

Not all missions require a description.ext file, but those that do have it contained in the same folder or pbo as the mission.sqm.

The description.ext is used to set up various things for a mission......for instance music, sounds, identities....etc.....etc.

And of course the respawn parameters.

If you have the parameters listed in the description.ext then that is basically it.

Anyway read through the thread and glean the relevant info, it will save my poor fingers from extra typing.


Planck
Title: Re:Respawning
Post by: Neptune on 03 Mar 2005, 16:12:41
The mission "Real-Paintball" has an EXCELENT round-respawn script.  8) :o
I tried to understand the script, but in vain.

I allso tried to make a certain script my self...allso in vain.

Is there a script like that out there? I would REALLY like to know how to do this!  :-\
Title: Re:Respawning
Post by: Planck on 30 May 2005, 20:27:30
Another sticky bites the dust.

The important information contained in this topic has been condensed into a Mini-tutorial document type thing, and is available in the Editors Depot here: -

http://www.ofpec.com/editors/resource_view.php?id=829

*Topic now unstuck*


Planck
Title: Re:Respawning
Post by: Rocko Bonaparte on 14 Jun 2005, 02:45:50
OK I'll move my respawn question over to here as it is fundamentally an MP respawn question--albeit asked in a rather wacky way.  I've done a bunch of respawn code before, so I'm not completely oblivious.

What I'm trying to do is change the unit type of the player based on a squad they choose.  When this squad all is dead, they can pick a new one and spawn as that squad instead.  It's all very tricky.

So I figured out that I can't set the player to a created unit.  The hack I'm trying is to team respawn into the desired group.  Say, if I want the player to change from his base unit type to a sniper, I create the sniper first as a part of his group, and he can spawn into it.

The problem I have is when the squad is all expired--seagull time.  The trick I tried was to IMMEDIATELY create a new unit for the squad to spawn into.  This doesn't work.  I think the game sees that at the moment I died, there was nobody else in my squad, so I went seagull even if I added another unit a split second later.

The last thing I haven't tried is a custom death handler.  All I'm hoping is that handler is called before OFP takes over and seagulls me.  

As for some amusement, I tested this all out with some kind of round-robin death script.  With two guys at the start, I'd spawn a new person into the group immediately after the next died.  I'd have the player die every 10 seconds.  So I just sat there, watching myself skip from body to body to body; they started to pile up.
Title: Re:Respawning
Post by: Terox on 14 Jun 2005, 15:35:24
for group respawn
you need an additional body in the group already alive before you die

this is easy enough, as all you need is a killed eventhandler attached to the guy which counts the units in his group after each respawn and if that count is less than 2 always create an additional unit

then to have him spawn into a soldier of of a different class type, simply create that soldier type somewhere safe and then have your player join that unit's group, kill the players soldier and hey presto, you are now a soldier of a chosen class type , then immediately rejoin your initial group and setpos yourself back to a starting position
Title: Re:Respawning
Post by: Rocko Bonaparte on 14 Jun 2005, 17:54:55
I did notice that if I started creating new guys before the last one dies, I can keep respawning people.  That was an amusing test, as I watched the bodies pile up as the script merrily killed the player every 10 seconds.  ;D

I think it would be confusing to have that last guy showing up in the command bar because he could always be given orders and otherwise manipulated.  I'd have to script it so that guy cannot be manipulated, and take it on faith that everybody playing the mission wouldn't get completely confused.

Unfortunately, I doubt that.
Title: Re: Respawning
Post by: Clayborne on 21 Feb 2010, 13:12:13
Ok so I have a mission that uses an updating respawn zone as the players progress. The reason for using this instead of group respawn is that the mission takes place in a structure I have built, and the AI just run through the walls if they are in formation.

What I would like to know is, if I have two playable characters, named for example player1 and player2, will they still be called player1 and player2 after dying and respawning?

At the end of the mission I want both players to be setpos'd to a specific location, but obviously player1 setpos getpos whatever will not work if the player isn't called player1 anymore.

If this is the case, how can I make sure the players have names so I can setpos them later? Just give each player their own respawn script that will keep renaming then when it runs, or is there an easier way?
Title: Re: Respawning
Post by: dr. seltsam on 21 Feb 2010, 18:54:33
If you write a name for a human playable soldier in the unit box where it says name, the game engine will transfer the new body as the new content to that variable after respawning. It seems like that these variables (in the box) always behave like a function that will find the actual body that is representing that variable.

You run into problems with the following cases:

If you give that soldier a name: player1
And you duplicate the variable, like for example: hero1=player1
player1 will contain the new body after respawn, but hero1 not (hero1 is a dead body then)

If you start a script: [player1] exec "Whatever.sqs"
_soldier=_this select 0
After the death of player1 also _soldier is a dead body, it won't get updated automatically
You have to execute "Whatever.sqs" again, and make sure that the old script ends (to save performance)

If you build an array: soldier_array=[player1,player2,..]
After a while some player die... and you want to get the actual respawned bodies from that array.. won't work
soldier_array will only contain dead bodies after a while

Here is a trick for arrays:

soldier_array = ["player1","player2",...]                 <-- check out the strings
_string         = soldier_array select 0
_soldier        = call _string

With the call command the game engine treats strings like code. The script is forced to find out what "player1" really is in that moment, and _soldier will contain the actual body of player1 (dead or alive does not matter).

If you want to have an always running client process, that only needs to know your actual body independent from how often you respawned... then you can use the inbuilt ofp function: player

? alive player : player groupchat "I feel good"

player always contains the actual body controlled by your game. On a dedicated server the content of player is always objNull.

http://community.bistudio.com/wiki/objNull

:D
Title: Re: Respawning
Post by: Clayborne on 23 Feb 2010, 12:31:58
Thanks, that's helpful!

I do tend to use arrays like that for ending triggers and such, and in this particular mission there will be a point where all players have to be in a certain zone for the mission to progress.

So in init.sqs I usually have something like

Code: [Select]
group_array = []

"if (alive _x) then {group_array = group_array + [_x]}" foreach [player1,player2]

So when one of the players enters the trigger, I can execute a script like this (?)

Code: [Select]
_string1         = group_array select 0
_string2         = group_array select 1

_soldier        = call _string1
_soldier2        = call _string2

I'm not sure where to go from there. Normally I would use a trigger with the condition

Code: [Select]
"_x in thislist" count group_array == "alive _x" count group_array AND "alive _x" count group_array > 0"
But how do I use that with the strings?


(Actually I could just do this by having the players in the same group and grouping them to the trigger, right? But I would like to know this in case I ever have to do something similar with players in different groups  :) )

Title: Re: Respawning
Post by: savedbygrace on 24 Feb 2010, 03:37:29
Forgive me If I am misunderstanding but couldn't you attach a killed eventhandler to each respawning soldier that runs a script, that creates them and then set positions them precisely where yuo need them? At the same time of creation, you could add the same weapons that they died with by using the weapons command, they would all be in the same group and any triggers that require activation by all or any of the members could actually be set in the tirggers activation type (by any member OR by the whole group, etc.) This would also allow you to avoid global variables if need be.
Title: Re: Respawning
Post by: Clayborne on 24 Feb 2010, 20:54:20
Well I've already got the updating respawn script that does that. The bit in the mission where they will be setpos'd is right at the end, and to detect the players in the trigger zone I was going to use an array, which dr. seltsam has just informed me might not work after the players have respawned.

I know if they're in the same group I can just group them to the trigger and use that to detect them, but I'd still like to know how it would be done using the array.
Title: Re: Respawning
Post by: dr. seltsam on 25 Feb 2010, 00:51:14
I think it also depends how you use the array:

If you build that group_array, and only use that variable for checking in triggers and scripts, then you only check for dead bodies after a while.

The alternative would be to always use the explicit form of that array: [player1,player2,...]
That will force the engine to check what player1,player2,... is in the moment when a calculation is done. But, that array can contain undefined values, if for example nobody chooses to be player2...