Jump to content
Sign in to follow this  
OldGrandad

How do i exec a script to a spawned unit?

Recommended Posts

Ok, my scenario is that I have spawn triggers that spawn groups as I want. That is ok but what I want is for that group then to patrol within the trigger area. I have found a random patrol script so I am guessing that somehow I need to implement it into the spawn script which is as follows:

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

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

; Operation Flashpoint Script

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

; create units

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

;-------------------------------------------------------------

"OfficerE" createunit [getMarkerPos "inf4",east5,"s25=this",1,"LIEUTENANT"]

"SoldierEMG" createunit [getMarkerPos "inf4",east5,"s26=this",0.8,"SERGEANT"]

"SoldierEG" createunit [getMarkerPos "inf4",east5,"s27=this",0.7,"CORPORAL"]

"SoldierEG" createunit [getMarkerPos "inf4",east5,"s28=this",0.7,"CORPORAL"]

"SoldierELAW" createunit [getMarkerPos "inf4",east5,"s29=this",0.6,"PRIVATE"]

"SoldierEMedic" createunit [getMarkerPos "inf4",east5,"s30=this",0.6,"PRIVATE"]

~3

east5 move getmarkerpos "inf4move"

;----------------------------------------------------------------------------

;End of Soldiers and Beginning of Tanks

;----------------------------------------------------------------------------

_tank6 = "BMP2" createvehicle getmarkerpos "tank1"

~2

"SoldierECrew" createunit [getmarkerpos "inf4",armor6,"c18=this",0.8,"SERGEANT"]

"SoldierECrew" createunit [getmarkerpos "inf4",armor6,"c19=this",0.8,"CORPORAL"]

"SoldierECrew" createunit [getmarkerpos "inf4",armor6,"c20=this",0.8,"PRIVATE"]

~2

c18 moveincommander _tank6

c19 moveingunner _tank6

c20 moveindriver _tank6

~2

armor6 move getmarkerpos "tank1move"

;-----------------------------------------------------------------------------

exit

If someone can point a noob in the right direction I would be grateful.

YES. I have tried as of yet unsuccessful search for an answer to my query  wink_o.gif

Share this post


Link to post
Share on other sites
Quote[/b] ]"OfficerE" createunit [getMarkerPos "inf4",east5,"s25=this;[parm] exec {patrol.sqs}",1,"LIEUTENANT"]

or if this doesn't work because of the embedded quotes you could try

Quote[/b] ]init_var={s25=this;[parm] exec "patrol.sqs"}

"OfficerE" createunit [getMarkerPos "inf4",east5,init_var,1,"LIEUTENANT"]

Sorry that I can't test this as I'm at work.  Very interesting problem.

Edit: noticed some missing [] and an extra }

Share this post


Link to post
Share on other sites

Shame, unfortunately both those examples did not work. sad_o.gif

I am still trying to find something to work.

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">...

~3

east5 move getmarkerpos "inf4move"

[east5] exec "patrol.sqs"

;----------------------------------------------------------------------------

;End of Soldiers and Beginning of Tanks

...

Replace [east5] exec "patrol.sqs" with your own line that execute your patroling script.

Share this post


Link to post
Share on other sites

<span style='font-size:17pt;line-height:100%'>DOH!</span>

That would work beutifully!!

I don't know why I was trying to smack that in the init line during CreatUnit??

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  

×