PELHAM 10 Posted December 16, 2010 (edited) Just starting scripting and I am trying to write a custom loadout script for the player in a single mission, run from the players init field with: xhandler = [this] execVM "loadout.sqf"; It works but affects the game engine by: 1-removing the subtitled text from the lower left of screen. 2-audio and audio commands are cut short - only the 1st word is played. 3-the clock postion indicator is removed from lower right. 4-the weapons are not loaded at start of map - you have to press R to load a magazine. (just found a command for No.4 - 'reload unitName' - would that fix it as in 'reload _soldier' at the end of the below .sqf?) Contents of my sqf, what am I doing wrong? I am not very experienced so have cobbled this together from various sources. _Soldier = _this select 0; removeAllWeapons _soldier; removeAllItems _soldier; _soldier addWeapon "ItemMap"; _soldier addWeapon "itemcompass"; _soldier addWeapon "itemwatch"; _soldier addWeapon "NVGoggles"; _soldier addWeapon "Laserdesignator"; _soldier addWeapon "ItemGPS"; _soldier addMagazine "Laserbatteries"; _soldier addWeapon "SCAR_H_STD_EGLM_Spect"; _soldier addMagazine "20Rnd_762x51_B_SCAR"; _soldier addMagazine "20Rnd_762x51_B_SCAR"; _soldier addMagazine "20Rnd_762x51_B_SCAR"; _soldier addMagazine "20Rnd_762x51_B_SCAR"; _soldier addMagazine "20Rnd_762x51_B_SCAR"; _soldier addMagazine "20Rnd_762x51_B_SCAR"; _soldier addMagazine "20Rnd_762x51_B_SCAR"; _soldier addMagazine "20Rnd_762x51_B_SCAR"; _soldier selectWeapon "SCAR_H_STD_EGLM_Spect"; _soldier addMagazine "1Rnd_HE_M203"; _soldier addMagazine "1Rnd_HE_M203"; _soldier addMagazine "1Rnd_HE_M203"; _soldier addMagazine "1Rnd_HE_M203"; _soldier addMagazine "1Rnd_SmokeRed_M203"; _soldier addMagazine "SmokeShellPurple"; _soldier addWeapon "glock17_EP1"; _soldier addMagazine "17Rnd_9x19_glock17"; _soldier addMagazine "17Rnd_9x19_glock17"; _soldier addMagazine "17Rnd_9x19_glock17"; _soldier addMagazine "PipeBomb"; _soldier addBackpack "US_Backpack_EP1"; unitBackpack _soldier addMagazineCargo ["PipeBomb",1]; unitBackpack _soldier addMagazineCargo ["PipeBomb",1]; unitBackpack _soldier addMagazineCargo ["PipeBomb",1]; sleep 10; }; Edited December 16, 2010 by PELHAM More relevant title Share this post Link to post Share on other sites
CarlGustaffa 4 Posted December 16, 2010 Without testing, where is your opening curly? Did you try removing the last two lines? Share this post Link to post Share on other sites
PELHAM 10 Posted December 16, 2010 (edited) Thankyou for your reply Carl! It was my code of course - notice I removed all items and then didn't give my guy back a radio? Surprise surprise, that is why I'm not getting radio messages. The game engine is working perfectly! :386: Duh! RE the curly brackets I know it's important to open and close with them from tinkering I have done with other games but I'm very rusty. If I were to use them in the above .sqf where would I put them and why? I have looked through the scripting guides but they do not cover this. Some of us need something that teaches the very basic ABC's. The custom loadout with backpack works perfectly like this at the moment: (Always add magazines before weapons to start with the weapons loaded - solves #4) _soldier = _this select 0; removeAllWeapons _soldier; _soldier addBackpack "US_Backpack_EP1"; unitBackpack _soldier addMagazineCargo ["PipeBomb",3]; unitBackpack _soldier addMagazineCargo ["20Rnd_762x51_B_SCAR",4]; _soldier addWeapon "NVGoggles"; _soldier addMagazine "Laserbatteries"; _soldier addWeapon "Laserdesignator"; _soldier addWeapon "ItemGPS"; _soldier addMagazine "20Rnd_762x51_B_SCAR"; _soldier addMagazine "20Rnd_762x51_B_SCAR"; _soldier addMagazine "20Rnd_762x51_B_SCAR"; _soldier addMagazine "20Rnd_762x51_B_SCAR"; _soldier addMagazine "20Rnd_762x51_B_SCAR"; _soldier addMagazine "20Rnd_762x51_B_SCAR"; _soldier addMagazine "20Rnd_762x51_B_SCAR"; _soldier addMagazine "20Rnd_762x51_B_SCAR"; _soldier addMagazine "1Rnd_HE_M203"; _soldier addMagazine "1Rnd_HE_M203"; _soldier addMagazine "1Rnd_HE_M203"; _soldier addMagazine "1Rnd_HE_M203"; _soldier addMagazine "1Rnd_SmokeRed_M203"; _soldier addWeapon "SCAR_H_STD_EGLM_Spect"; _soldier addMagazine "SmokeShellPurple"; _soldier addMagazine "PipeBomb"; _soldier addMagazine "17Rnd_9x19_glock17"; _soldier addMagazine "17Rnd_9x19_glock17"; _soldier addMagazine "17Rnd_9x19_glock17"; _soldier addWeapon "glock17_EP1"; _soldier selectWeapon "SCAR_H_STD_EGLM_Spect"; Edited December 16, 2010 by PELHAM Share this post Link to post Share on other sites
Speedle 10 Posted December 16, 2010 Thankyou for your reply Carl!It was my code of course - notice I removed all items and then didn't give my guy back a radio? Surprise surprise, that is why I'm not getting radio messages. The game engine is working perfectly! :386: Duh! RE the curly brackets I know it's important to open and close with them from tinkering I have done with other games but I'm very rusty. If I were to use them in the above .sqf where would I put them and why? I have looked through the scripting guides but they do not cover this. Some of us need something that teaches the very basic ABC's. The custom loadout with backpack works perfectly like this at the moment: (Always add magazines before weapons to start with the weapons loaded - solves #4) _soldier = _this select 0; removeAllWeapons _soldier; _soldier addBackpack "US_Backpack_EP1"; unitBackpack _soldier addMagazineCargo ["PipeBomb",3]; unitBackpack _soldier addMagazineCargo ["20Rnd_762x51_B_SCAR",4]; _soldier addWeapon "NVGoggles"; _soldier addMagazine "Laserbatteries"; _soldier addWeapon "Laserdesignator"; _soldier addWeapon "ItemGPS"; _soldier addMagazine "20Rnd_762x51_B_SCAR"; _soldier addMagazine "20Rnd_762x51_B_SCAR"; _soldier addMagazine "20Rnd_762x51_B_SCAR"; _soldier addMagazine "20Rnd_762x51_B_SCAR"; _soldier addMagazine "20Rnd_762x51_B_SCAR"; _soldier addMagazine "20Rnd_762x51_B_SCAR"; _soldier addMagazine "20Rnd_762x51_B_SCAR"; _soldier addMagazine "20Rnd_762x51_B_SCAR"; _soldier addMagazine "1Rnd_HE_M203"; _soldier addMagazine "1Rnd_HE_M203"; _soldier addMagazine "1Rnd_HE_M203"; _soldier addMagazine "1Rnd_HE_M203"; _soldier addMagazine "1Rnd_SmokeRed_M203"; _soldier addWeapon "SCAR_H_STD_EGLM_Spect"; _soldier addMagazine "SmokeShellPurple"; _soldier addMagazine "PipeBomb"; _soldier addMagazine "17Rnd_9x19_glock17"; _soldier addMagazine "17Rnd_9x19_glock17"; _soldier addMagazine "17Rnd_9x19_glock17"; _soldier addWeapon "glock17_EP1"; _soldier selectWeapon "SCAR_H_STD_EGLM_Spect"; Have you read this? It covers the basics of sqs and sqf scripting. You don't have to use { } in the above .sqf, because they are used to "contain" something, usually between control structures. Don't forget the semi-colon! Share this post Link to post Share on other sites
PELHAM 10 Posted December 16, 2010 ^^ Thankyou for those 2 Speedle - probably just what I need. I will do some reading and experimenting over the next few days. Share this post Link to post Share on other sites