Home   Help Search Login Register  

Author Topic: Stuck with script  (Read 512 times)

0 Members and 1 Guest are viewing this topic.

Ex-RoNiN

  • Guest
Stuck with script
« on: 23 Feb 2004, 19:55:23 »
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.

Code: [Select]
_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:

Code: [Select]
_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
Code: [Select]
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 :)

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:Stuck with script
« Reply #1 on: 23 Feb 2004, 21:31:13 »
1.-2.
The init field is the "" you've in the createUnit array... No guarantees but u can try and put there something like "this moveInCargo _tank"...

3.
Yup... At least according to the Comref  :P

4.
Again, no guarantees, but something like:
"_x doMove (getPos unitname)" forEach units groupname
"_x doFollow unitname" forEach units groupname
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:Stuck with script
« Reply #2 on: 24 Feb 2004, 17:32:52 »
AWW...  :-[

Some stupidity I just spread there... Only the part in red is right, forget the rest in that particular answer segment...  :-\

Quote
1.-2. The init field is the "" you've in the createUnit array... No guarantees but u can try and put there something like "this moveInCargo _tank"...

U need to name the units you create also, not just the AAV... And after that unit creation put a few lines in vein of _unit1 moveInCargo _tank and so on
« Last Edit: 24 Feb 2004, 17:37:33 by HateR_Kint »
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

PsyWarrior

  • Guest
Re:Stuck with script
« Reply #3 on: 24 Feb 2004, 22:01:49 »
Greetings,

Wait a moment, 'lancer...

Almost right...  ;)

However, due to a bug, createUnit doesn't return anything, so you cannot put:
_unit1 = createUnit [...blah, blah...]

However, you could use the init field to accomplish the same thing:

Code: [Select]
"SoldierWCrew" createUnit [(getpos _pos), _groupname, "curUnit = this", 0.7, "CAPTAIN"]
_unit1 = curUnit
"SoldierWCrew" createUnit [(getpos _pos), _groupname, "curUnit = this", 0.7, "CAPTAIN"]
_unit2 = curUnit

and so on. Other than that, the rest seems to be right.

One other thing: you could apply the forEach command to the setbehaviour command as well: "_x setbehaviour ""AWARE""" forEach units _groupname.

Resources: ComRef

-Supreme Commander PsyWarrior
-Psychic Productions Studios

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:Stuck with script
« Reply #4 on: 24 Feb 2004, 22:42:48 »
I knew that...  ::) ;D

For some reason I've been missing a good 98% of my brain for the past few weeks... :P :beat:
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.