reddford 0 Posted February 8 Hi everyone, this is my issue. Im trying to force the game to display a specific asset on respawn . This is the export code from the virtual garage : _veh = createVehicle ["amf_pvp_01_mag_DA_f",position player,[],0,"NONE"]; [ _veh, ["DA",1], ["showeod",1,"turretshieldhide",1,"showCamonetHull",1] ] call BIS_fnc_initVehicle; So basically, i call my vehicle p1 and write this on the init of the vanilla respawn module : this setVehicleVarName "p1"; [p1,["showeod",1,"turretshieldhide",1,"showCamonetHull",1]]call BIS_fnc_initVehicle; BUT ... did nothing, the vehicle respawn with basic camo texture, no error message on preview during the script exec. BTW there is a mod than a user sent me but it dont work. If you saw an error on my script pls explain to me because i dont understand .. Share this post Link to post Share on other sites
Harzach 2517 Posted February 8 23 minutes ago, reddford said: write this on the init of the vanilla respawn module Paste in the expression field, not the init. Code in the expression field will execute when the vehicle respawns, and in reference to that vehicle. params [_newVeh,_oldVeh]; [_newVeh, ["DA",1], ["showeod",1,"turretshieldhide",1,"showCamonetHull",1] ] call BIS_fnc_initVehicle; 1 1 Share this post Link to post Share on other sites
reddford 0 Posted February 8 thx you saved the day ❤️ Share this post Link to post Share on other sites
EveryEmpireFalls 0 Posted February 10 (edited) Hello! I would like to piggyback off this thread, as it so happens that I have a related conundrum. First, the basic premise of what I am attempting to do is to respawn an existing vehicle with the same custom pylons set by the pylon/dynamic loadout editor in 3den, all with unlimited ammo. I know the unlimited ammo and pylons before the vehicle respawns, but not after (in whole). Second, a code dump and summary of what is where: This is the unlimited ammo expression I have in the existing F/A-181 (and other vehicles). Ideally, the missiles & bombs would refresh on a delay, hence the {sleep 45} segment. This part works perfectly for my purposes. this addEventHandler ["Fired",{[_this select 0,getNumber (configFile/"CfgAmmo"/(_this select 4)/"explosive")] spawn {if (_this select 1==1) then {sleep 45};_this select 0 setVehicleAmmo 1}}]; This code is present in the expression of a game logic and synced to all relevant vehicles. It works perfectly for my purposes. [this] call { if (!isServer) exitWith {}; params ["_thisObject"]; _vehs = synchronizedobjects _thisObject; _initScript = { params ["_vehicle", ["_pylons", "none"]]; if (typeName _pylons == typeName []) then { private _pylonPaths = (configProperties [configFile >> "CfgVehicles" >> typeOf _vehicle >> "Components" >> "TransportPylonsComponent" >> "Pylons", "isClass _x"]) apply {getArray (_x >> "turret")}; { _vehicle removeWeaponGlobal getText (configFile >> "CfgMagazines" >> _x >> "pylonWeapon") } forEach getPylonMagazines _vehicle; { _vehicle setPylonLoadout [_forEachIndex + 1, _x, true, _pylonPaths select _forEachIndex] } forEach _pylons; }; }; { [_x] call _initScript; } foreach _vehs; [_vehs, _initScript] spawn { params ["_vehs", "_initScript"]; sleep 1; _respawnlist = []; {_respawnlist = _respawnlist + [[_x, position _x, [vectorDir _x, vectorUp _x], getPylonMagazines _x]]} forEach _vehs; while {true} do { sleep 1; { _veh = _x # 0; _respawnpos = _x # 1; _playerdistance = 200; {if (_veh distance _x < _playerdistance) then {_playerdistance = _veh distance _x};} foreach allPlayers; if (!alive _veh || (_veh distance _respawnpos > 20 && _playerdistance > 20)) then { _vehType = typeOf _veh; [_veh, _respawnlist] spawn { params ["_veh", "_respawnlist"]; deleteVehicleCrew _veh; _veh lock true; _inSpawn = false; waitUntil { sleep 0.5; _inSpawn = false; { _respawnpos = _x # 1; if ((_veh distance _respawnpos) < 30) exitWith {_inSpawn = true;}; } forEach _respawnlist; _inSpawn || ((speed _veh == 0) && (isTouchingGround _veh)); }; if (!_inSpawn) then {sleep 30}; deleteVehicle _veh; }; sleep 10; _newveh = _vehType createVehicle _respawnpos; _newveh setPos _respawnpos; _newveh setVectorDirAndUp (_x # 2);[_newveh, _x # 3] call _initScript; _respawnlist set [_forEachIndex, [_newveh, _respawnpos, _x # 2, _x # 3]];};} foreach _respawnlist; }; };}; This is the current code present in the Vehicle Respawn Module System Specific expression (not its Init). It does not work at all. params [_newVeh, oldVeh]; [_newVeh, addEventHandler ["Fired",{[_newVeh, select 0, getNumber (configFile/"CfgAmmo"/(_newVeh, select 4)/"explosive")] spawn {if (_newVeh, select 1==1) then {sleep 0.5}; _newVeh, select 0.5 setVehicleAmmo 1}}]] call BIS_fnc_initVehicle; It throws the following error upon mission launch, but not upon vehicle respawn (which happened in some previous iterations of my attempts). Here is a screencap of the 3den editor of the scene in question: As you can see, the left F/A-181 is the primary test subject, as it is synced to both the Vehicle Respawn and the game logic. The right F/A-181 is synced only to the game logic. Both jets initially spawn with the proper pylons/dynamic loadouts and unlimited ammo. Both jets respawn with the proper pylons/dynamic loadouts. Neither jet respawns with unlimited ammo, currently. I feel rather close to solving this, but I am blind to what I am missing/adding unnecessarily. I am sure there is some redundancy between the Vehicle Respawn Module and the game logic, and I would appreciate any simplifications there. However, that is a secondary concern. Thanks for reading this far! Hopefully you can help me and anyone else who wants to do this. Edited February 12 by EveryEmpireFalls additional information Share this post Link to post Share on other sites
Harzach 2517 Posted February 10 Your syntax is broken by all of the unnecessary commas. Share this post Link to post Share on other sites
EveryEmpireFalls 0 Posted February 11 10 hours ago, Harzach said: Your syntax is broken by all of the unnecessary commas. Thanks for the response Harzach. Here is the new line: params [_newVeh, oldVeh]; [_newVeh addEventHandler ["Fired",{[_newVeh select 0, getNumber (configFile/"CfgAmmo"/(_newVeh select 4)/"explosive")] spawn {if (_newVeh select 1==1) then {sleep 0.5}; _newVeh select 0.5 setVehicleAmmo 1}}]] call BIS_fnc_initVehicle; It does not give any errors, however, it still does not work upon vehicle respawn. FYI I am not very experienced at coding. I have some friends who are, and they are assisting me but they're about as confused as I am. Share this post Link to post Share on other sites
Harzach 2517 Posted February 11 You still have a comma after your first "select 0." Commas are used to separate elements in an array. Share this post Link to post Share on other sites
EveryEmpireFalls 0 Posted February 11 52 minutes ago, Harzach said: You still have a comma after your first "select 0." Commas are used to separate elements in an array. Removing the comma made no difference. And now it throws a syntax error. Share this post Link to post Share on other sites