hpat 1 Posted November 17, 2015 Alright, I've been editing for some time, but only started scripting about two days ago. I've got a nice noobish question, that I suspect someone's going to say is obvious: I've got a script to put a random wepon in a vehicle called 'base,' and it's triggered by an action attached to the unit. I can activate the action, but the weapon fails to appear. Can anyone please point out what I'm doing wrong? Thank you. Script randomweps.sqf: waituntil {!isnil "bis_fnc_init"}; weapon = ["RH_m14","RH_m1sacog","RH_sc2shd","M4A1_HWS_GL_CAMO","M4A1","RH_m1sacog","RH_Deaglemz","RH_mk22","RH_uspm","RH_usp","RH_g19","RH_mk2","RH_tt33","RH_p226","RH_anacg ","RH_python","RH_bull","M16A2GL","M4SPR","m8_Carbine","G36K","MG36","MP5A5","M136","AK_47_S","AKS_74_Kobra","SVD","RPG7V","huntingrifle","PK",""AK_107_GL_PSO", "bizon","VSS_Vintorez","BAF_L85A2_RIS_Holo","BAF_L110A1_Aim","BAF_LRR_scoped","BAF_L17_40mm","AA12_PMC","CZ805_A1_ACR","UK59_ACR","LeeEnfield","SCAR_L_CQC_Holo", "SCAR_H_STD_EGLM_Spect","SCAR_H_LNG_Sniper","Acog Sa58V_RCO_EP1","M60A4_EP1","M47Launcher_EP1"] call BIS_fnc_SelectRandom; base addWeaponCargo [weapon,1]; mag=(getArray (configFile/"Cfgweapons"/weapon/"magazines")) select 0; base addMagazineCargo [mag,round (random 5)]; Calling code is init base: this setBehaviour "SAFE"; player action ["lightOn", this]; this allowDamage false; this addAction ["Random Wepon", "randomweps.sqf"]; Share this post Link to post Share on other sites
Ranwer135 308 Posted November 17, 2015 Try this: randomweps.sqf: _weapon = ["RH_m14","RH_m1sacog","RH_sc2shd","M4A1_HWS_GL_CAMO","M4A1","RH_m1sacog","RH_Deaglemz","RH_mk22","RH_uspm","RH_usp","RH_g19","RH_mk2","RH_tt33","RH_p226","RH_anacg ","RH_python","RH_bull","M16A2GL","M4SPR","m8_Carbine","G36K","MG36","MP5A5","M136","AK_47_S","AKS_74_Kobra","SVD","RPG7V","huntingrifle","PK","AK_107_GL_PSO", "bizon","VSS_Vintorez","BAF_L85A2_RIS_Holo","BAF_L110A1_Aim","BAF_LRR_scoped","BAF_L17_40mm","AA12_PMC","CZ805_A1_ACR","UK59_ACR","LeeEnfield","SCAR_L_CQC_Holo", "SCAR_H_STD_EGLM_Spect","SCAR_H_LNG_Sniper","Acog Sa58V_RCO_EP1","M60A4_EP1","M47Launcher_EP1"] call BIS_fnc_SelectRandom; base addWeaponCargo [_weapon, 1]; _mag = (getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines")) select 0; base addMagazineCargo [_mag, round(random 5)]; Share this post Link to post Share on other sites
Mirek 166 Posted November 18, 2015 waituntil {!isnil "bis_fnc_init"}; _weapon = ["RH_m14","RH_m1sacog","RH_sc2shd","M4A1_HWS_GL_CAMO","M4A1","RH_m1sacog","RH_Deaglemz","RH_mk22","RH_uspm","RH_usp","RH_g19","RH_mk2","RH_tt33","RH_p226","RH_anacg ","RH_python","RH_bull","M16A2GL","M4SPR","m8_Carbine","G36K","MG36","MP5A5","M136","AK_47_S","AKS_74_Kobra","SVD","RPG7V","huntingrifle","PK","AK_107_GL_PSO", "bizon","VSS_Vintorez","BAF_L85A2_RIS_Holo","BAF_L110A1_Aim","BAF_LRR_scoped","BAF_L17_40mm","AA12_PMC","CZ805_A1_ACR","UK59_ACR","LeeEnfield","SCAR_L_CQC_Holo", "SCAR_H_STD_EGLM_Spect","SCAR_H_LNG_Sniper","Acog Sa58V_RCO_EP1","M60A4_EP1","M47Launcher_EP1"] call BIS_fnc_SelectRandom; base addWeaponCargoGlobal [_weapon, 1]; _mag = (getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines")) select 0; base addMagazineCargoGlobal [_mag, round(random 5)]; This should work in multiplayer. Share this post Link to post Share on other sites