Jump to content
Sign in to follow this  
Ex-RoNiN

Stuck with script

Recommended Posts

I have the following script, which gets activated once a trigger gets activated. I have a gamelogic and an empty group that give the created unit/group its name and starting position.

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

_pos = _this select 0

_groupname = _this select 1

_tank = "AAV7" createvehicle (getpos _pos)

"SoldierWCrew" createUnit [(getpos _pos), _groupname, "", 0.7, "CAPTAIN"]

"SoldierWCrew" createUnit [(getpos _pos), _groupname, "", 0.7, "CAPTAIN"]

"SoldierWCrew" createUnit [(getpos _pos), _groupname, "", 0.7, "CAPTAIN"]

~0.5

((units _groupname) select 0) moveindriver _tank

((units _groupname) select 1) moveincommander _tank

((units _groupname) select 2) moveingunner _tank

exit

I want to expand this now, so that the AAV also has 4 Marine soldiers in its cargo. I experimented with this and tried the following:

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

_pos = _this select 0

_groupname = _this select 1

_tank = "AAV7" createvehicle (getpos _pos)

"SoldierWCrew" createUnit [(getpos _pos), _groupname, "", 0.7, "CAPTAIN"]

"SoldierWCrew" createUnit [(getpos _pos), _groupname, "", 0.7, "CAPTAIN"]

"SoldierWCrew" createUnit [(getpos _pos), _groupname, "", 0.7, "CAPTAIN"]

"SUCHusmcrifle" createUnit [(getpos _pos), _groupname, "", 0.7, "LIEUTENANT"]

~0.5

((units _groupname) select 0) moveindriver _tank

((units _groupname) select 1) moveincommander _tank

((units _groupname) select 2) moveingunner _tank

((units _groupname) select 3) moveincargo _tank

exit

This, however, didn't work.

So my questions are this:

1) How do I add soldiers to the cargo of the AAV?

2) Where is the individual units' "init" field?

3) How do I set the entire group's behaviour to "aware"? Is it <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">g1 setbehaviour "aware" after I am finished with adding soldiers to the AAV (g1=groupname)?

4) How do I tell the group to go to the position of unitname and follow unitname wherever unitname goes?

Thanks a lot in advance smile_o.gif

Share this post


Link to post
Share on other sites

1:

Have you tried an simple

me moveInCargo vehicle

e.g.

initline of your soldier

this moveInCargo vehicleAAV

?

If this doesn't work, look in the cfg for the vehicle if there are any cargo spots configured.

2:

"SoldierWCrew" createUnit [(getpos _pos), _groupname, "This is the initline", 0.7, "CAPTAIN"]

3:

You are correct!

You can also use:

"CARELESS", "SAFE","COMBAT", "STEALTH".

4:

Like this(I think):

(leader group) doFollow (getPos otherUnit)

Share this post


Link to post
Share on other sites

Hello !

The problem comes from the unit you select when you type :

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">((units _groupname) select 0) moveindriver _tank

((units _groupname) select 1) moveincommander _tank

((units _groupname) select 2) moveingunner _tank

((units _groupname) select 3) moveincargo _tank

Actually, ((units _groupname) select 0) refers to... the gamelogic itself !

Therefore, your vehicle has no driver, and your marine no assignment (as he is in fact ((units _groupname) select 4)).

There are several solutions to fix this, depending on whether you want to call the script several times or not.

As far as I have noticed, the init line of spawned units (which comes right after _groupname and right before 0.7 in your sample) won't work with local variables : you then have to give your tank a global variable name.

Therefore, a simple fix goes as follows :

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

_groupname = _this select 1

tank = "aav7 createvehicle (getpos _pos)

"SoldierWCrew" createUnit [(getpos _pos), _groupname, "this moveingunner tank", 0.7, "CAPTAIN"]

"SoldierWCrew" createUnit [(getpos _pos), _groupname, "this moveincommander tank", 0.7, "CAPTAIN"]

"SoldierWCrew" createUnit [(getpos _pos), _groupname, "this moveindriver tank", 0.7, "CAPTAIN"]

"SUCHusmcrifle" createUnit [(getpos _pos), _groupname, "this moveincargo tank", 0.7, "LIEUTENANT"]

_groupname setbehaviour "aware"

exit

To make the team follow another unit ALL THE TIME, I'd say the best would be to use another script.

Ig.

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  

×