Jump to content
Sign in to follow this  
mattxr

Spwan Script Help.

Recommended Posts

I get an error with this code? :S :S

Quote[/b] ]_dummygroup = call format[{%1dummygroup},_side]

It just doesnt work??

Im trying to make this script work..

Quote[/b] ]

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

; RespawnSquadAI v1.5 by Spankmeyer ONLY FOR USE WITH EAST-GROUPS!! USES AI!

; credits to dr strangelove and general barron. lots of this code where originally from those two.

; (from spawnman2 and vehiclespawn...)

;

; consider this script as part of the Spawnman scripts! without them it wont work!

; THIS ONE WORKS WITH AI. USE ONLY FOR EAST-GROUPS!

;

; easy example: write in the init-field of leader of group:

; [this, 2, 100] exec "respawnSquadAI.sqs"

; the group will be respawned twice at original position of the leader and will patrol around

; this position with a radius of 100. respawn will occur if they are fewer than 3 members.

;

; complex example: write in the init-field of leader of group:

; [this, 2, 100,patrolpos,spawnpos,3] exec "respawnsquadAI.sqs"

; the group of "this" will be respawned 2 times at spawnpos, patrouling around patrolpos

; in a radius of 100, and the group respawns if the group is lower

; than 4 members. respawn will occur three times.

; you would have to set two objects somewhere on the map. one you would have to name patrolpos,

; the other spawnpos...

;

; if any east-units detect west-units the east group here will hunt them!!

;

; parameters: [unit, j, range, patrolpos, spawnpos, number] exec "RespawnSquadAI.sqs"

; unit should be leader of group

; j = number of respawns

; range = range of patrol around patrolpos.

; patrolpos is optional! no value means, patrouling will ocurr around original position.

; spawnpos is optional! no value means respawn will occur at original position.

; number is optional! no value means they respawn if they are fewer than 3 people...

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

? not local server : exit

~(random 2) + 0.5

;========================GET PARAMETERS==========================

_leader = _this select 0

_j = _this select 1

_range = _this select 2

?(count _this > 3):_patrolpos = _this select 3

?(count _this <= 3):_patrolpos = _leader

?(count _this > 4):_pos = getpos (_this select 4)

?(count _this <= 4):_pos = getpos _leader

?(count _this > 5):_triggerscale = _this select 5

?(count _this <= 5):_triggerscale = 2

;=========================INIT VARIABLES==========================

_side = side _leader

_dir = getDir _leader

_group = group _leader

_dummygroup = call format[{%1dummygroup},_side]

_spawncount = 0

_inf =[]

_teamscale = count units _group;

;===============CHECK VALUES===============================

?(_triggerscale > 12):_triggerscale = 12

?(_triggerscale > _teamscale):_triggerscale = _teamscale

;**************build inf array**************************

{_inf = _inf + [typeOf _x]} foreach units _group

{_x exec "spawnman\patroldead.sqs"} foreach units _group

~1

;***********START Patrolscript***************************

;this is a bit complicated: if a patrolpos-parameter is given, a dummy-parameter ("1") is given to

;randpatrol. this dummy-parameter makes randpatrol updating the patrolpos in every loop. (if one

; wants to "move" the patrolpos for any reason...)

if(count _this > 3)then{[_group,_range,4, _patrolpos,1] exec "spawnman\randpatrolAI.sqs";goto "wait"}

[_group,_range,20,_patrolpos] exec "spawnman\randpatrolAI.sqs"

;*****************************AliveLoop*******************

#wait

~4

?(count units _group > _triggerscale): goto "wait"

;***************************SPAWN***************************

;***update respawnpos. (if spawnpos is moving or "teleporting".)

?(count _this > 4) : _pos = getpos (_this select 4)

;time to decay for the dead

~30

;============decide if the leader has to be respawned========

?((count units _group == 0)OR(typeOf (units _group select 0) != (_inf select 0))):goto "spawnleader"

goto "spawnrest"

; ***************************spawn leader ********************

#spawnleader

_unit = _inf select 0

(_unit) createUnit [_pos, _dummygroup, "this exec {spawnman\patroldead.sqs}"]

_member = (units _dummygroup) select 1

[_member] join _group; _group = group _member

?(count units _group >= _teamscale): goto "wait"

~1

;******************spawn rest*******************************

#spawnrest

_unit = _inf select 1 + (random(count _inf-1))

;hint format["typ %1", _unit]

_unit createUnit[_pos, _group, "this exec {spawnman\patroldead.sqs}"]

~(random 1) + 1

?(count units _group < _teamscale): goto "spawnrest"

_spawncount = _spawncount + 1

?(_spawncount > _j): EXIT

goto "wait"

Share this post


Link to post
Share on other sites

I believe you just need to add compile

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_dummygroup = call compile format[{%1dummygroup},_side]

Share this post


Link to post
Share on other sites
I believe you just need to add compile

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_dummygroup = call compile format[{%1dummygroup},_side]

this line still within the error saying invalid line expression.

Share this post


Link to post
Share on other sites

Err - shouldn't those be quotes instead of brances ? Ie,

_dummygroup = call compile format["%1dummygroup",_side] ;

Share this post


Link to post
Share on other sites

didnt quotes not work in ArmA

Edit: OMG your right, no error and the guy started to patrol its just he didnt spawn the rest of his men haha

Share this post


Link to post
Share on other sites

Help Help Help

now i get something is wrong with this

Quote[/b] ]

(_unit) createUnit [_pos, _dummygroup, "this exec {spawnman\patroldead.sqs}"]

saying something like : or ; is mission i think?

Share this post


Link to post
Share on other sites

What about this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">(_unit) createUnit [_pos, _dummygroup, "this exec ""spawnman\patroldead.sqs"""]

Share this post


Link to post
Share on other sites

Its when they spawn i get an error with something mission in the patroldead.sqs above.

edit ill try it.

edit2: i get an error at the start of the mission that theres a ] missing.

were so close tho.

Share this post


Link to post
Share on other sites

any1.. tounge2.gif were too close to stop .. help poor matt yay.gif

why dont these two lines work?

(_unit) createUnit [_pos, _dummygroup, "this exec {spawnman\patroldead.sqs}"]

_unit createUnit[_pos, _group, "this exec {spawnman\patroldead.sqs}"]

Share this post


Link to post
Share on other sites

Ok it doesnt matter after 2 hours of trial and error and reading about scripting all over i have done it. so thx for those who helped me in the first place.

Share this post


Link to post
Share on other sites

Ok now i have ran into a new problem with the mechanized infantry spawn

Quote[/b] ]

{_x addEventHandler [""Killed"", {(_this select 0) removeAllEventHandlers ""Killed""; deleteVehicle (_this select 0)}]} forEach crew _obj

EDIT: ONCE AGAIN I HAVE DONE IT!! Im getting good at converting scripts ^^

Share this post


Link to post
Share on other sites

Mat ...When you have it finished could you please post it ...I used that script in ofp for all my missions I luv it ...I was waiting for someone to port it over ....You Rule ...thx

yay.gif

Share this post


Link to post
Share on other sites

Matt:

The main issue I see is the use of braces {} and quotes.

Unless you're using foreach, i.e. {_x command} foreach array, you need to use quotes instead of braces.

So, when exec'ing any script, it needs to be quotes, not braces and so forth.

If you're erroring out and there are braces involved, change them to quotes.  Just remember that in some cases, you need double quotes.

This "minor" change in code has been a major PITA for me.  Personally, I hate double quotes.  They're an ugly nuisance.  Braces look so much lovlier, especially since one pair of braces could replace double quotes.  Therefore, a ton of my OFP scripts used braces instead of quotes in most areas.  You can imagine the porting headache I'm having.

Doesn't matter.  I'm rewriting most stuff in sqf code format anyway.

Share this post


Link to post
Share on other sites

no with arma ive been needing to change for the for each from quotes to braces to get it to work and yeah i took the double quotes out of the other line and it worked..

and sure, its not my original scripting i will upload in a test mission. i got a driven lesson now tho biggrin_o.gif

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  

×