Jump to content
Sign in to follow this  
Spikekid

Radio Spawn

Recommended Posts

I want a script who can spawn friendly soldiers(parachuting) and join them to me. I want to activate that with the radio (0-0-1). So when I call the command 0-0-1 there will be parachuting frendly soldiers coming to join me(Repidiately)! Is that possible and how can I do it??

Singleplayer!!!

10x

Share this post


Link to post
Share on other sites

Guys, I realy need that one. Im part of the ofp comunity too, so please help me with that script! help.gif

Share this post


Link to post
Share on other sites

A couple of points:

1. < 24 hours is not overlong to have to wait

2. I am not clear how much help you need.

I presume you know how to create a repeating 0-0-1 radio trigger and to make it run a script.

The script should:

- create a parachute at the location you want  - do you know how to do this?

- create a soldier - do you know how to do this?

- put the soldier into the parachute using the command moveInDriver - do you know how to do that?

- the soldier should then join you

[unitname] join player

You see the problem?   Someone could spend quite a long time explaining a lot of stuff to you that you already know - and so waste their own time.

I think you would get a better response if you asked these questions individually.  I presume you don't want someone to write the whole script fo you - that would be like making a meal but subcontracting the cooking , and where's the fun in that? smile_o.gif

Share this post


Link to post
Share on other sites

i think that you would certainly found the answer if you would search the forums - and that's probably the case nobody posted the answer to your question yet, but here it goes:

Make a 'repetitive' trigger activated by "RADIO ALPHA", and put the following into it's "On activation" field:

[] exec "paradrop.sqs"

Then into the misison init.sqs script, put this line:

1 SetRadioMsg "Call in the reinforcements"

Now make a script named "paradrop.sqs" which contains this:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">? ParaInProgress : exit

ParaInProgress = true

_i = Count Units Group Player

_grp = Group Player

#drop

? _i > 11 : ParaInProgress = false; exit

_x = (getPos Player select 0) - 150 + Random 300

_y = (getPos Player select 1) - 150 + Random 300

_z = 200

PARA = "ParachuteWest" CreateVehicle [_x,_y,_z]

"SoldierWB" CreateUnit [[_x,_y,_z], _grp, "this moveInDriver PARA", Random 1, "PRIVATE"]

PARA setPos [_x,_y,150]

~.1

_i = _i + 1

goto "drop"

Share this post


Link to post
Share on other sites

Create a radio trigger which calls this script.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">;[group] exec "paraBackup.sqs"

;group: name of group to join

;init

_grp = _this select 0

_nbFreeSlot = 12 - (count units _grp)

_x = -60

_y = -60

;call backup creating unit

#backup

_unit = "ParachuteWest" createVehicle [(getPos leader _grp select 0)+_x,(getPos leader _grp select 1)+_y,200]

"SoldierWB" createUnit [[(getPos leader _grp select 0)+_x,(getPos leader _grp select 1)+_y,200], _grp]

nearestObject [_unit, "SoldierWB"] moveInDriver _unit

_nbFreeSlot = _nbFreeSlot -1

_x = _x + 10

_y = _y + 10

~1

?(_nbFreeSlot > 0):goto "backup"

exit

I wrote this quickly, so i am not sure it works, but you can modify it and clear bugs... I think it's the way to solve your problem.

smile_o.gif

Share this post


Link to post
Share on other sites
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">? ParaInProgress : exit

ParaInProgress = true

_i = Count Units Group Player

_grp = Group Player

#drop

? _i > 11 : ParaInProgress = false; exit

_x = (getPos Player select 0) - 150 + Random 300

_y = (getPos Player select 1) - 150 + Random 300

_z = 200

PARA = "ParachuteWest" CreateVehicle [_x,_y,_z]

"SoldierWB" CreateUnit [[_x,_y,_z], _grp, "this moveInDriver PARA", Random 1, "PRIVATE"]

PARA setPos [_x,_y,150]

~.1

_i = _i + 1

goto "drop"

How can I spawn random soldiers?(LAW,granade,MG)

Share this post


Link to post
Share on other sites

try making an array of the different classnames (which I don't know so I'm just going top put an example:

////////////////////////////////////////////////////

_unitArray = [soldier,soldierLaw,soldierMG,Engineer,Medic]

_Ax = 1+ random 4

_unit = _unitArray select _Ax

_unit CreateUnit [[_x,_y,_z], _grp, "this moveInDriver PARA", Random 1, "PRIVATE"]

PARA setPos [_x,_y,150]

/////////////////////////////////////////////////////

This is totally untested If it doesn't work the first thing I'd suggest is speech marks in every classname in the array. also, you will need to change the classnames in the array for their real in game counterparts.. those were just an example. Search around for COMREF and you will find a list of all classnames.

Share this post


Link to post
Share on other sites

? ParaInProgress : exit

ParaInProgress = true

_i = Count Units Group Player

_grp = Group Player

#drop

? _i > 11 : ParaInProgress = false; exit

_x = (getPos Player select 0) - 150 + Random 300

_y = (getPos Player select 1) - 150 + Random 300

_z = 200

_x = 1+ random 4

_unit = _unitArray select _x

_unitArray = ["SoldierWB","SoldierWLaw","SoldierWMG","SoldierWMiner&

quot;,"SoldierWMedic"]

PARA = "ParachuteWest" CreateVehicle [_x,_y,_z]

_unit CreateUnit [[_x,_y,_z], _grp, "this moveInDriver PARA", Random 1, "PRIVATE"]

PARA setPos [_x,_y,150]

~.1

_i = _i + 1

goto "drop"

///////////////////////////////////////////////////////////

This is my .sqs file!

As you see I fixed the class names. Now when I call the radio I see the soldiers in my command window,but they are somewhere in A55!

Where is the problem?

Share this post


Link to post
Share on other sites

SpikeKid, you would have a conflict between the postion varibale _x and the array selector variable _X.

Rename the array selector variable to _Ax.

_Ax = 1+ random 4

_unit = _unitArray select _Ax

So I'm guessing my script worked.. I've been writing mainly in theory the past few days since I haven't actually been into ofp.. might implement a couple of the scripts I've created for others into my invasion mission..

Share this post


Link to post
Share on other sites
SpikeKid, you would have a conflict between the postion varibale _x and the array selector variable _X.

Rename the array selector variable to _Ax.

_Ax = 1+ random 4

_unit = _unitArray select _Ax

So I'm guessing my script worked.. I've been writing mainly in theory the past few days since I haven't actually been into ofp.. might implement a couple of the scripts I've created for others into my invasion mission..

Yeah Its all right now. Thank you for everything you did for me. Only one question remains now - I wanna spawn only one medic in the group? How can I do that?

Share this post


Link to post
Share on other sites

take medic out of the array and create him without any randomness. Create the medic before the others or after, and make sure it's not in the loop.

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  

×