Home   Help Search Login Register  

Author Topic: Scripting Issues.  (Read 1215 times)

0 Members and 1 Guest are viewing this topic.

Offline OrnelP

  • Members
  • *
  • "The true battlefield is within"
Scripting Issues.
« on: 04 Jun 2006, 08:52:32 »
 ??? Hey all.  I have a problem while scripting a mission im creating.  What im doing is, i have 8 soldiers in the capital area of Nogova.  I have "removeallweapons this" in each units init and a trigger that is activated right away that activate a weapon script.

When i start the mission only 1 out of the 8 soldiers has the weapons that i armed them with through the script... Then i was playing around and found they could all be armed but needed to wait 1 sec between each unit.  Any answers would be usefull is it to much for the game to run to activate all the scripts instantly or do i have to keep running them with time between each LOON? THX
War is delightful to those who have had no experience of it
- Deciderius Erasmus

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re: Scripting Issues.
« Reply #1 on: 04 Jun 2006, 11:58:52 »
Use the same system to un-arm and rearm them, there is no need for triggers


Place the following in the INIT field of each unit you want to arm



[this "LABELNAME"] exec "Rearm.sqs"

using the following example will rearm the unit with the MGUNNER loadout ( eg #MGUNNER)

[this "MGUNNER"] exec "Rearm.sqs"


REARM.SQS
Quote
_unit = _this select 0
_label = _this select 1

removeallweapons _unit
goto _label



#SNIPER
{_unit addMagazine _x} forEach ["SVDDragunov", "SVDDragunov", "SVDDragunov", "SVDDragunov"]
{_unit addWeapon _x} forEach ["SVDDragunov", "Binocular"]
_unit selectweapon "SVDDragunov"
exit

#OFFICER
{_unit addMagazine _x} forEach ["AK74","AK74", "AK74", "AK74", "Grenadelauncher", "Grenadelauncher", "Smokeshellred"]
{_unit addWeapon _x} forEach ["AK74GrenadeLauncher", "Binocular","NVGoggles"]
;;;  NB>>  selecting muzzle fire from the AK74 GL
_unit selectweapon "AK74Muzzle"
exit


#MGUNNER
{_unit addMagazine _x} forEach ["PK", "PK", "PK"]
{_unit addWeapon _x} forEach ["PK"]
_unit selectweapon "PK"
exit


#RPG
{_unit addMagazine _x} forEach ["AK74","AK74", "AK74", "AK74", "RPGlauncher", "RPGlauncher"]
{_unit addWeapon _x} forEach ["AK74", "RPGLauncher"]
_unit selectweapon "AK74"
exit




ALTERNATIVELY

still create the "REARM.sqs, but use it as a reference text file and then simply do the following


lets say we wanted to rearm the RPG guy with our exisiting RPG loadout from the above example

so we have the code

Quote
#RPG
{_unit addMagazine _x} forEach ["AK74","AK74", "AK74", "AK74", "RPGlauncher", "RPGlauncher"]
{_unit addWeapon _x} forEach ["AK74", "RPGLauncher"]
_unit selectweapon "AK74"


now what we can do, is combine all this together and place it all in the INIT field of the UNIT, this will then allow you to see the unit's loadout in the briefing stage (Gear tab) of the notebook


so we do the following
___ STAGE 1 ___
edit the Label, adding an additional line of code and a semi colon after each statement
(all aditions highlighted in red

eg

Quote
#RPG

removeallweapons this ;
{_unit addMagazine _x} forEach ["AK74","AK74", "AK74", "AK74", "RPGlauncher", "RPGlauncher"] ;
{_unit addWeapon _x} forEach ["AK74", "RPGLauncher"] ;
_unit selectweapon "AK74"


___ STAGE 2 ___
we now copy everything, apart from the #RPG into the INIT field of the UNIT
example

Quote
removeallweapons this ;
{_unit addMagazine _x} forEach ["AK74","AK74", "AK74", "AK74", "RPGlauncher", "RPGlauncher"] ;
{_unit addWeapon _x} forEach ["AK74", "RPGLauncher"] ;
_unit selectweapon "AK74"


over a period of time (making missions) your REARM.txt will increase, containing a miriad of custom loadouts that can then quickly be copied into your units init field for every mission
« Last Edit: 04 Jun 2006, 12:01:21 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Offline Flauta

  • Members
  • *
  • There is no knownledge, that is no power
    • Chek mi FLog
Re: Scripting Issues.
« Reply #2 on: 05 Jun 2006, 03:42:41 »
It may be
Code: [Select]
[this,"LABELNAME"] exec "Rearm.sqs"than [this "LABELNAME"] exec "Rearm.sqs".. you missed a comma...

hope that helped

Offline OrnelP

  • Members
  • *
  • "The true battlefield is within"
Re: Scripting Issues.
« Reply #3 on: 05 Jun 2006, 06:22:26 »
thx all i'll try it, i'm sure it will work, i just didnt want my fingers to bleed by typing all this stuff in :) -OrnelP
War is delightful to those who have had no experience of it
- Deciderius Erasmus

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re: Scripting Issues.
« Reply #4 on: 05 Jun 2006, 17:11:52 »
It may be
Code: [Select]
[this,"LABELNAME"] exec "Rearm.sqs"than [this "LABELNAME"] exec "Rearm.sqs".. you missed a comma...

hope that helped


oops so i did silly typo
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123