Jump to content
Sign in to follow this  
Johan_D

Respawn a group

Recommended Posts

Hi.

I am looking for a simple way to respawn a group of soldiers.

The ones I found at OFPEC and here are not what I want.

I want to place a group on the map, give them a waypoint, and if they are killed, the group is spawned from the beginning and continues the waypoint from start.

I know this sounds simple, and I have seen it in some downloads I did, but most of them are complicated with interfering scripts who are not wanted by me.

The one what did what I liked was from Crashburn, but has a great lag during the respawn. The newer scripts use empty groups and have no lag.

Since I do not know where to begin for doing it myself, I hope someone has made a script earlier what simply respawnes a group of given soldiers.

Please help'

Johan

Share this post


Link to post
Share on other sites

Be prepared for a bunch of idiots who just point to the search button and give you no help. That's all I got when I asked this question: a request for a simple respawn script seems to be too much these days.

Share this post


Link to post
Share on other sites

an example of a very simple self made script i used in one of my quick skirmish

-create an East soldier , put this in its init line, for this example

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">teamA1=group this; this move getpos GOTHERE; teamA1 allowfleeing 0; [] exec "allspawn.sqs"

-create a game logic , where you want the killed units to respawn

name this gamelogic for this example

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

-create a 2nd game logic , where you want the east squad to go

name this game logic

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

-Have the following script , name it

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

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

~1

"SoldierEB" createUnit [EASTBASE,teamA1,"man1=this; this addeventhandler [{killed},{_this exec {killbody.sqs}}]",0.5,"CORPORAL"]

"_x move getpos GOTHERE" foreach units _teamA1

~1

goto "looping1"

-Have this second script (used to delete the dead bodies after some time, to prevent some lag)

name it

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

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

_unit removealleventhandlers "killed"

~18

deletevehicle _unit

exit

-tested, woking and lag free on my low end system-

Adapt this to the situation you are facing, it should be lag free (i never had any with this) and should be simple enough to be modified easily.

There are lot of chance it will not work for MP missions as OFP is more limited to what can or can't work there, but works perfectly on SP missions

Share this post


Link to post
Share on other sites

Great, a simple and easy to use spawn.. Ill test it right away!

BRB

Johan

EDIT.. works great, gonna modify it a tad, thanks a lot!

Share this post


Link to post
Share on other sites

This is what I came up with for INV44 units..

It requires a gamelogic, a unit with waypoints what executes the script like this;

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">teamW1=group this; ["west",teamW1,g2,2] exec "spawnw.sqs";deletevehicle this

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

; *****************************************************

; ** Operation Flashpoint Script File

; *****************************************************

~(random 1) + 1

_side = _this select 0

_team = _this select 1

_spawnpoint = _this select 2

_min = _this select 3

? (_side == "west"):goto "loop2"

~(random 1) + 1

#loop1

~12

? (count units _team > _min):goto "loop1"

"WH_SQDLDR2" createUnit [_spawnpoint,_team,"man1=this",0.5,"CORPORAL"]

~0.5

"WH_Panzerschreck1" createUnit [_spawnpoint,_team,"man2=this",0.3,"PRIVATE"]

~0.5

"WH_Schutze6" createUnit [_spawnpoint,_team,"man3=this",0.3,"PRIVATE"]

~0.5

"WH_Schutze1" createUnit [_spawnpoint,_team,"man4=this",0.3,"PRIVATE"]

~0.5

"WH_Schutze2" createUnit [_spawnpoint,_team,"man5=this",0.3,"PRIVATE"]

~0.5

"WH_Schutze1" createUnit [_spawnpoint,_team,"man6=this",0.3,"PRIVATE"]

~0.5

"WH_Schutze3" createUnit [_spawnpoint,_team,"man7=this",0.3,"PRIVATE"]

~0.5

"WH_Schutze4" createUnit [_spawnpoint,_team,"man8=this",0.3,"PRIVATE"]

~0.5

"WH_Schutze5" createUnit [_spawnpoint,_team,"man9=this",0.3,"PRIVATE"]

~0.5

"WH_LMGunner" createUnit [_spawnpoint,_team,"man10=this",0.3,"PRIVATE"]

~0.5

"WH_LMAmmo" createUnit [_spawnpoint,_team,"man11=this",0.3,"PRIVATE"]

~0.5

"WH_Medic" createUnit [_spawnpoint,_team,"man12=this",0.3,"PRIVATE"]

~0.5

("_x addeventhandler [ {killed} , {_this exec {killbody.sqs}} ] " foreach units _team)

~0.5

;allow for easier enemies

;("_x setdammage -1" foreach units _team)

("_x allowfleeing 0.5" foreach units _team)

hint "GERMAN created"

goto "loop1"

;======================west===================================

#loop2

~10

? (count units _team > _min):goto "loop2"

"82_ABNCO2" createUnit [_spawnpoint,_team,"wman1=this",0.5,"CORPORAL"]

~0.5

"82_ABMGAMMO" createUnit [_spawnpoint,_team,"wman2=this",0.3,"PRIVATE"]

~0.5

"82_ABMGUN" createUnit [_spawnpoint,_team,"wman3=this",0.3,"PRIVATE"]

~0.5

"82_ABBLAUNCHER" createUnit [_spawnpoint,_team,"wman4=this",0.3,"PRIVATE"]

~0.5

"82_ABRIFLEMAN1" createUnit [_spawnpoint,_team,"wman5=this",0.3,"PRIVATE"]

~0.5

"82_ABRIFLEMAN1" createUnit [_spawnpoint,_team,"wman6=this",0.3,"PRIVATE"]

~0.5

"82_ABRIFLEMAN2" createUnit [_spawnpoint,_team,"wan7=this",0.3,"PRIVATE"]

~0.5

"82_ABRIFLEMAN2" createUnit [_spawnpoint,_team,"wan8=this",0.3,"PRIVATE"]

~0.5

"82_ABRIFLEMAN3" createUnit [_spawnpoint,_team,"wan9=this",0.3,"PRIVATE"]

~0.5

"82_ABRIFLEMAN3" createUnit [_spawnpoint,_team,"wan10=this",0.3,"PRIVATE"]

~0.5

"82_ABBAR" createUnit [_spawnpoint,_team,"wan11=this",0.3,"PRIVATE"]

~0.5

"82_ABMEDIC" createUnit [_spawnpoint,_team,"wan12=this",0.3,"PRIVATE"]

~0.5

("_x addeventhandler [ {killed} , {_this exec {killbody.sqs}} ] " foreach units _team)

~0.5

("_x allowfleeing 0.5" foreach units _team)

;("_x setdammage -1" foreach units _team)

hint "USA created"

goto "loop2"

and killbody.sqs

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

_unit = _this select 0

_unit removealleventhandlers "killed"

~60

deletevehicle _unit

exit

Simple, and they keep comming over and over again..

Share this post


Link to post
Share on other sites

Nice rework

And easy to modify (as you just need the soldiers classes names) to adapt to every kind of soldier in the OFP battlefields .

Should be usefull to add such script (with just BIS default units) to the Mission Editing FAQ , as the spawning question come back often

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  

×