Jump to content
Sign in to follow this  
OldGrandad

What am i doing wrong? good guidance needed

Recommended Posts

All I want is a script that will be triggered that will move a crew into a tank (or multiple crews into multiple tanks) and then move on to a particular marker and patrol. Firstly is my poor attempt to script (never done it before)

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

_c2 moveingunner _tank1

_c3 moveindriver _tank1

~1

_tank1 move getmarkerpos "tank1move"

~2

_c4 moveincommander _tank2

_c5 moveingunner _tank2

_c6 moveindriver _tank2

~1

_tank2 move getmarkerpos "tank2move"

exit

2 tanks and 2 sets of crew already waiting. The trigger gets activated and my crews jump into their tanks and rush off to investigate, well that's my intention. I have spent a few fruitless hours mucking around without any joy. Please help an old frustrated wannabe OPF scripter. wink_o.gif

Share this post


Link to post
Share on other sites

Putting an underscore before a word makes it a private variable that works only in the script. Therefore, if your tanks are tank1 and tank2 and your guys are c1, c2, c3, c4, c5, and c6 (Don't use underscores while naming units in the editor), then your script will look like this:

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

c2 moveingunner tank1

c3 moveindriver tank1

~1

(commander tank1) move getmarkerpos "tank1move"

~2

c4 moveincommander tank2

c5 moveingunner tank2

c6 moveindriver tank2

~1

(commander tank2) move getmarkerpos "tank2move"

exit

Share this post


Link to post
Share on other sites

Should the word move be commandmove instead, in order for a script to command a unit to move to a direction and take all under his command with him.

Share this post


Link to post
Share on other sites
Quote[/b] ]Should the word move be commandmove instead, in order for a script to command a unit to move to a direction and take all under his command with him.

I'm pretty sure that move or domove will work too.

Share this post


Link to post
Share on other sites

Well commandmove got them into the tanks, but they refused to go anywhere after starting the tanks up sad_o.gif

In the on activation field in the trigger I had <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[tank1,tank2] exec "tanksupport.sqs" with 2 invisible "H"s named tank1move and tank2move respectively. Um, any more ideas?

Many thanks for your help so far  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">(commander tank1) move getmarkerpos "tank1move"

getMarkerPos is only used for markers.

your invisible h is an object an it's posistion is called by using

getPos

e.g

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">(commander tank1) move getpos tank1move

Hopes this helps

Share this post


Link to post
Share on other sites

Thank you it worked but, I now have another problem which I find rather strange. The tanks and crew were already on the map ready to roll but at the same time the tanks are triggered so is a spawn trigger spawning 8 troops. Trouble is the troops start taking on the tanks and they are all "east"!!! How or why is this happening? I can't believe I get over one issue only to be faced with another. sad_o.gif

Share this post


Link to post
Share on other sites

Well... when you spawn East troops on top of West units, they're gonna fight. smile_o.gif

Or do you mean that you don't want your East troops spawning on top of West unit? Is the East spawn supposed to be off in the distance?

Share this post


Link to post
Share on other sites

No, all units on the map are exclusively "east" with no sign of an "enemy" unit.

Share this post


Link to post
Share on other sites

this setcaptive true might come in handy (If you put it in a units init line, it prevents everyone from shooting at the units). You can cancel this effect with this setcaptive false.

Share this post


Link to post
Share on other sites

It would be helpful if you detailed how the spawn trigger is working.  Also, could you do the tank thing with only waypoints?

Here is an alternative method of accomplishing what you are trying to do with the tank crews:

Create your tank crews, and in their inits put this AssignAsposition tank1 where position could be Driver, Commander, or Gunner and tank1 would be the name of the tank this crew member is supposed to man.  Make sure the commander, driver and gunner for each tank are grouped together, then create waypoints of HOLD, GETIN, and MOVE for each group.  Then create a trigger of type SWITCH and sync (F5) it with the HOLD waypoints.

Now when the SWITCH trigger is activated, the tank crews will man their tanks, and then move off to the MOVE waypoints positioned where you have the Invisible H's.

Share this post


Link to post
Share on other sites

also, if you spawn east crews into west tanks they will be spotted as enemies to the east.

Share this post


Link to post
Share on other sites
this setcaptive true might come in handy (If you put it in a units init line, it prevents everyone from shooting at the units). You can cancel this effect with this setcaptive false.

I have placed "this setcaptive true" into the crews and tanks init lines but all I get then is the troops getting massacred by the tanks then.

My issues do not lie with getting my tanks to roll now but the in house fighting, what gives???

crazy_o.gif

noundo, thanks for your assistance but it is the fighting each other that is puzzling me. My trigger operates when Resistance enters the area and execs a script. I will try your alternate solution but will it stop them fighting each other?rock.gif

sad_o.gif

Share this post


Link to post
Share on other sites
It would be helpful if you detailed how the spawn trigger is working.  Also, could you do the tank thing with only waypoints?

Here is an alternative method of accomplishing what you are trying to do with the tank crews:

Create your tank crews, and in their inits put this AssignAsposition tank1 where position could be Driver, Commander, or Gunner and tank1 would be the name of the tank this crew member is supposed to man.  Make sure the commander, driver and gunner for each tank are grouped together, then create waypoints of HOLD, GETIN, and MOVE for each group.  Then create a trigger of type SWITCH and sync (F5) it with the HOLD waypoints.

Now when the SWITCH trigger is activated, the tank crews will man their tanks, and then move off to the MOVE waypoints positioned where you have the Invisible H's.

I did try your example and even though it worked a treat it did not stop them being targeted by the spawned troops. crazy_o.gif

Share this post


Link to post
Share on other sites

Try spawning the Units with:

_unit SetCombatMode "BLUE"

Then when you want them to fire just set it to "RED" smile_o.gif

Share this post


Link to post
Share on other sites

Could you try putting yoursself (player) as one of the tank crew and see how the tank crew group see's the spawned soldiers (friend or foe)?

Another thought would be to have an high ranking object that you temporarily group everyone to (tank crews and spawned troops) so that they are all forced to be friendly. You would only have to gorup them with this object for split second as each unit was created.

Quote[/b] ]My trigger operates when Resistance enters the area and execs a script.

Can you post the contents of your spawn script? I would be willing to bet 2 smileys that there is something in there messing with the side the spawned troops are assigned to.

Share this post


Link to post
Share on other sites

Thank you all for responding with thoughts and ideas for workarounds. I have now resolved the issue after overlooking the most obvious and looking for the most complicated answer.

Please do not laugh, I use "dummies" as spawn group references and when I checked them they were indeed "west" units. Even though they were triggered to delete themselves they obviously had an effect on the spawned "east" units. I changed them to "east dummies" and there is no in house fighting. crazy_o.gif

Boy oh boy, sometimes you do not see what is in front of you wink_o.gif

Share this post


Link to post
Share on other sites

smile_o.gifsmile_o.gif

Theres your 2 smileys I owe you since it wasn't the spawn script!!!

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  

×