Somerville 0 Posted February 1, 2007 Hi there, Many thanks to The Unknown for providing me with his vast amounts of scripting knowledge! However, I've looked through these forums to try and find a solution to my problem, but to no avail. I have the following respawn 'script' (well, it's in the description.ext, but who gives a monkey?): <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">Respawn = "BASE"; RespawnDelay = 30; ShowCompass = true; ShowGPS = false; ShowMap = true; ShowPad = true; ShowRadio = false; How can I add to this to make a dead unit respawn without any weapons? Cheers guys. -{GOL}-Somerville Share this post Link to post Share on other sites
Big Dawg KS 6 Posted February 1, 2007 You can't, because that isn't a script, it's a description.ext, and you can't use it for scripting. Now, you can ask how to do it with a REAL script, then I'd be glad to help. Edit: I've decided to take the initiative, and so to respond to the question you should have asked... Ex: Init field of a playable soldier named Soldier1: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">"Soldier1" execVM "respawn.sqf" respawn.sqf <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_name = _this; waitUntil {_unit = (call format ["%1",_name]); !(alive _unit)}; sleep 1; waitUntil {_unit = (call format ["%1",_name]); (alive _unit)}; _unit = (call format ["%1",_name]); removeallweapons _unit; _name execVM "respawn.sqf"; The unit must have a name, and the name must be in quotes when executing the script through the init field. And no I don't know for sure if it works. Share this post Link to post Share on other sites
Somerville 0 Posted February 2, 2007 The units begin the missions with magazine-less M16A2's, hence I put the following in each playable Unit's init line: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> removeAllWeapons this; this addWeapon "M16A2"; "Soldier1" execVM "respawn.sqf"; The unit's Ammunition is then set to 0 accordingly. However, when I run press Enter, it says: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> Type script, expected nothing Any ideas? Share this post Link to post Share on other sites
Eda Mrcoch 0 Posted February 2, 2007 You can't, because that isn't a script, it's a description.ext, and you can't use it for scripting. But there is the line: playerRespawnScript = "onPlayerRespawn.sqs"; in main config. Default respawn scripts are in ca.pbo -> data -> scripts. Interestingly, there is no one named "onPlayerRespawn.sqs" (just seagull and respawn as other unit). I believe, that if you put "onPlayerRespawn.sqs" with code removing the weapons in your mission pbo it will be executed on player respawn (just the same like old OFp's onPlayerKilled works). Share this post Link to post Share on other sites
Big Dawg KS 6 Posted February 2, 2007 You can't, because that isn't a script, it's a description.ext, and you can't use it for scripting. But there is the line: playerRespawnScript = "onPlayerRespawn.sqs"; in main config. Default respawn scripts are in ca.pbo -> data -> scripts. Interestingly, there is no one named "onPlayerRespawn.sqs" (just seagull and respawn as other unit). I believe, that if you put "onPlayerRespawn.sqs" with code removing the weapons in your mission pbo it will be executed on player respawn (just the same like old OFp's onPlayerKilled works). Perhaps, but that would still only work for players, whereas my script works for both players and AI, and he never specified which he needed it for. Besides, .sqf is always better. The units begin the missions with magazine-less M16A2's, hence I put the following in each playable Unit's init line:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">removeAllWeapons this; this addWeapon "M16A2"; "Soldier1" execVM "respawn.sqf"; The unit's Ammunition is then set to 0 accordingly. However, when I run press Enter, it says: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">Type script, expected nothing Any ideas? First, Soldier1 was an example, you need to first (if not already done) give each respawning unit a name, then replace Soldier1 with the name of that unit who's init field you're putting it in. Second, I'm not sure what that error means, it's not documented on the Biki, and I've never encountered it in OFP, but are you sure you have the respawn.sqf file in the right place? Share this post Link to post Share on other sites
the unknown 0 Posted February 3, 2007 Well I happen to know it is for players. would it work if you use a script called onPlayerKilled.sqs and put this in it removeallweapons player exit Share this post Link to post Share on other sites
KaRRiLLioN 0 Posted February 3, 2007 To do an execVM from an init field, you have to use a dummy variable to make the code parser happy. s = [] execVM "script.sqf" Put the s = at the beginning, in other words. Not necessary if exec'ing from within another script. Share this post Link to post Share on other sites