celludriel 79 Posted August 16, 2015 Hey For the past two evenings I have been googling my hearth out trying to find a simple mobilehq script. I've found a few solutions, looked through the code of several missions but none ever met the criteria of being simple and reusable in any mission. =BTC= revive was probably one of the better once , but that didn't only include mobilehq but also a revive system I personally didn't need. The next for me best script was in Domination and variants, but xeno programmed it in such a way that it is all over the place and not that easy to cherry pick. Then we also have champ-1 chmq which is a nice piece of work, but all that composition stuff is again fun and all, but not optional. So that only leaves me with one option and that is to write it myself. So now I just need to determine the requirements and see if it is actually achievable so that is why I made this post and I'll try to keep this one updated as I go along. What I believe I need to get this done. - As a mission designer I want a way to make any vehicle initialize as a mhq - As a mission designer I want mhq vehicles to respawn in their original location - As a player I want to be able to deploy a mhq vehicle anywhere on the map - As a player I want to be able to undeploy a mhq vehicle - As a player I want a user friendly way to choose where to respawn after the respawn counter goes to zero Now if we break these stories down I believe we have a few tasks to do - create a function we can put in the init script of any vehicle fe: [] execVM "init_as_mhq.sqf" - create a respawn eventhandler on the vehicle to make sure it is a mhq again after any kind of respawn script did it's thing and respawned the vehicle - create two addAction scripts on the vehicle so players can deploy and undeploy - add a respawn eventhandler on all players that when they respawn a dialog should open where they can pick the respawn point, if no mhq is deployed just spawn at the regular spawnpoint as fallback - create a respawn dialog with a list of all deployed mq and an action button to respawn I'm just wondering here did I miss anything ? Are there scripters out here that have experience with this that can point out any pitfalls to me. Does this maybe already exist in some form in a dark place on the internet google can't find ? In the end I just want a simple pluggable script that any mission editor can use in his work without giving him thousand headaches to set it up. Share this post Link to post Share on other sites
-lordsoth- 15 Posted August 16, 2015 You need grimes simple revive. You can easily disable the revive function so you are just left with the respawn. He has all that you have asked for even with a great function to be able to set a script that will fire every time that vehicle respawns. It really is easy and works flawlessly. Share this post Link to post Share on other sites
celludriel 79 Posted August 16, 2015 I believe I came across grimes script, I'll re-investigate it, since I probably discarded that choice for some reason or another, probably because it had revive stuff in it. edit: He actually didn't do a bad job with it, clean organized code, I just wished he had separated the MHQ part in another module from the revive part. Personally I was using farooq's revive script, and needed an mhq script. I like to keep concerns separated where possible and make it possible to plug in just functionality that I need. Never the less , I could take out the farooq revive and uses the grimes way. I won't argue with something that works, a bit stupid I did all that analysis breakdown for something that already existed though :p Share this post Link to post Share on other sites
celludriel 79 Posted August 16, 2015 Well after investigation I'm not sure Grimes's script is still the good way to go. I either have to fix a bug or two in his scripts fe: 13:00:55 Error in expression <uPosition_systemSelect",false]&&count BIS_fnc_respawnMenuPosition_positions > >13:00:55 Error position: <BIS_fnc_respawnMenuPosition_positions > >13:00:55 Error Undefined variable in expression: bis_fnc_respawnmenuposition_positions13:00:55 File C:\Users\Sunspot\Documents\Arma 3\mpmissions\Tug%20Of%20War.Stratis\G_Revive\G_Killed.sqf, line 318 and also it seems that all my MPeventhandlers("MPrespawn", "blabla") are not triggering anymore, which is a huge dealbreaker for the script to be viable :( Share this post Link to post Share on other sites
celludriel 79 Posted August 16, 2015 Well I've tried several things but with grimes eating the eventhandlers of my other script modules, I'm back to writing it myself. My current hurdle is finding a way to disable a vehicle from being driven once it is deployed. My first thought was to just lock the vehicle, but if I compare with other scripts that deploy vehicles they all use ... "other" techniques one more complicated then the other. So I'm wondering why locking a vehicle shouldn't be enough to simulate a "deployed" vehicle. Share this post Link to post Share on other sites
kremator 1065 Posted August 16, 2015 Can't you setfuel=0 when deployed? Share this post Link to post Share on other sites
celludriel 79 Posted August 16, 2015 That is a possibility maybe in combination with locking the vehicle. I tested the locking a bit ago and at least it did what I expected on a local server instance. If I combine it with setfuel to zero I'm sure it's not going anywhere. My next challenge will be opening a dialog to choose where to respawn. Not sure what the event is for that, does the "Respawn" event trigger before or after the respawn ? Share this post Link to post Share on other sites
celludriel 79 Posted August 16, 2015 Well a few hours later I almost have something working. I'm using the spawntemplates from BIS and adding spawnmarkers on deploy of a vehicle and removing them on undeploy or destruction. It's a crude sollution but it should do the trick for having a simple mhq solution. However I'm struggeling with a locality issue it seems. in initserver.sqf I'm running following code diag_log format ["Executing mhq_init.sqf with %1", _this]; if(isServer)then{ mhqList = _this select 0; if(isnil("mhqList")) exitWith {diag_log format ["ERROR: No mhq list given"]}; { _x setVariable ["MhqDeployed", false, true]; _x addAction ["Deploy", {[[[_this select 0, _this select 2], "scripts\mhq\mhq_deploy_action.sqf"], "BIS_fnc_execVM", true, true] call BIS_fnc_MP;}]; _x addMPEventHandler ["MPRespawn", {_this addAction ["Deploy", "scripts\mhq\mhq_deploy_action.sqf"];}]; }forEach mhqList; }; However when I call mhq_deploy_action.sqf and want to fetch teh variable from the mhq object with _isDeployed = _mhq getVariable ["MhqDeployed"]; diag_log format ["_isDeployed: %1", _isDeployed]; It is always null ! I beleived the true parameter on setVariable should have broadcasted the change to all clients , current and JIP ? So why isn't it known in the action ? Share this post Link to post Share on other sites
dreadedentity 278 Posted August 16, 2015 The syntax you are using for getVariable is wrong. _mhq getVariable "MhqDeployed"; //or _mhq getVariable ["MhqDeployed", false]; Share this post Link to post Share on other sites
celludriel 79 Posted August 16, 2015 oh ... right ... damnit such a foolish mistake , I was staring blindly to locality while it was just syntax ... edit: Well I got it to work, I still have to test blowing up the MHQ vehicles I'm pretty sure that will break it right now. So I'm getting close. All I needed was three scripts and use the default templates of arma. .Used together with two other scripts you get the desired scenario - new MHQ script - Farooks revive script - OOPS Simple vehicle respawn script Three seperate concerns working in harmony just how I like it :) Share this post Link to post Share on other sites