nullsystems 0 Posted July 8, 2007 Hi all. Should be simple this one: Below is a copy of my VRS from someones thread on BI, it works pefectly. My problem is with an addAction that no longer works in MP, but shows up for me and me only if I host the game. Heres how its setup: Chopper named 'heli1' is placed with the correct VRs settings from below. [heli1, 30, 0, 360] exec "vrs.sqs"; [] exec "script.sqs"; As you can see, I have the [] exec "script.sqs"; line also in there....this is for the initial "addaction" setup before it respawns. Once it respawns after death, its in its right place...I can view the addaction again but no one else can. I presume this goes for if it was on a dedicated server also. Can anyone help? PS: all script.sqs does is addaction line, nothing else. It also looks like its keeping its name 'heli1' because it locks the chopper again. ?! (local server): exit _vehicle = _this select 0 _delay = _this select 1 _pos = _this select 2 _dir = _this select 3 ? (_pos == 0): _startpos = getpos _vehicle ? (_dir == 361): _startdir = getdir _vehicle #waiting ; waiting for Vehicle is disabled @ !(canmove heli1) &! (canfire heli1) Â && (getdammage heli1) >=0.3 ; checking if vehicle still is manned @ (isnull driver heli1) && (isnull gunner heli1) && (isnull commander heli1) ~_delay ? (canmove heli1) && (canfire heli1): goto "waiting" _new = typeof heli1 deletevehicle heli1 heli1 = _new createvehicle _startpos heli1 setpos _startpos heli1 setdir _startdir heli1 lock true; heli1 setVehicleVarName "heli1" [] exec "script.sqs"; Â <-- Troubled Line [heli1, _delay, _pos, _dir] exec "heli1.sqs" ; exit Share this post Link to post Share on other sites
bobby budnick 0 Posted July 8, 2007 Hey check out this thread http://www.flashpoint1985.com/cgi-bin....t=65093 In that thread I had the same problem. I think it's because addaction is executed only on the server. So you have to make it execute on the clients too. Basically what Norrin had me do was set the addaction line to an initstring, setVehicleInit the new init string to the respawned vehicle and then run processInitCommands to update the clients. edit:Though it does look like you have a different respawn script than me. Maybe you can use the one I edited as a template? Share this post Link to post Share on other sites
nullsystems 0 Posted July 8, 2007 wow, amazing. I used your respawn and tested... The only problem is, its not adding "addaction" in my script... _InitString = "this addAction [""Defcon1"", ""detonate_vehicle.sqs"", this, 0, false, false, """"]"; Becomes: _IntString = "[] exec ""script.sqs""; --------- I have a hint 'test' at the top of that script, and it shows for me...but doesnt do the add actions. Example script.sqs. hint 'test'; @ player == driver heli1 act1 = heli1 addAction ["Chopper Panel","chopperpanel.sqf"] @ player distance heli1 > 4 ?!alive heli1 : heli1 removeaction _act1;exit heli1 removeaction act goto 'test' I have a feeling that the 'heli1' isnt being grabbed. So how could I fix that ?? Share this post Link to post Share on other sites
bobby budnick 0 Posted July 8, 2007 Have a look at this thread http://www.flashpoint1985.com/cgi-bin....e;st=45 I don't understand why one has to do all that and why it is not documented anywhere else but if you add <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> call compile format["%1 = _vcl;", (vehicleVarName _vcl)]; where he says to, the vehicle keeps it's name after a respawn. I tested it 2 days ago and it works. I had read the thread before but 2 days ago was when it clicked for me that I needed to do that to keep the name. I thought the respawn script was originally set up for that purpose, but apparently not. Before this, I was making a new version of the respawn script for every vehicle. It sounds tedious but I decided to keep doing that anyway because it works better with the vehicle tracking script that way. Also I can't confirm that your script is correct because I don't know enough. It's early and I hope that made sense. Share this post Link to post Share on other sites
nullsystems 0 Posted July 8, 2007 Right, thank you for that but unfortunately the two addactions show for me ( host )...but no one else in MP. Any idea why ? Heres the two scripts below. vrs spawn script private ["_vcl","_respawndelay","_dir","_pos","_type& quot;,"_run","_delay"]; if (!local Server) exitWith {}; _vcl = _this select 0; _name_vcl = _this select 1; _respawndelay = _this select 2; _dir = Getdir _vcl; _pos = Getpos _vcl; _type = typeOf _vcl; _run = TRUE; sleep 5; for [{}, {_run}, {_run}] do { while {canMove _vcl} do { sleep 1; _delay = Time + _respawndelay; }; _delay = Time + _respawndelay; while {!canMove _vcl && Time < _delay} do { sleep 1; }; if (!canMove _vcl && Time >= _delay) then { deleteVehicle _vcl; _vcl = _type createVehicle _pos; _vcl setVehicleVarName _name_vcl; call compile format["%1 = _vcl;", (vehicleVarName _vcl)]; _InitString = "[] exec ""script.sqs"""; _vcl SetVehicleInit _InitString; processInitCommands; _vcl SetVehicleInit ""; _vcl setdir _dir; sleep 1; _vcl setvelocity [0,0,0]; _vcl setpos _pos; sleep 1; _vcl setvelocity [0,0,0]; sleep 2; }; }; ------------------------- script.sqs hint 'Got this far!'; #radius @ player distance heli1 < 4 ?!alive heli1 : heli1 removeaction act;exit ?isEngineOn heli1 : heli1 removeaction act;exit heli1 removeaction act1 act = heli1 addAction ["Code","1.sqf"] hint 'should of added keycode'; @ player == driver heli1 heli1 removeaction act heli1 removeaction act1 act1 = heli1 addAction ["Panel","2.sqf"] hint 'do you see panel?'; @ player != driver heli1 heli1 removeaction act1 ?isEngineOn heli1 : heli1 removeaction act;exit @ player distance heli1 > 4 ?!alive heli1 : heli1 removeaction _act;exit heli1 removeaction act ~1 hint 'Got to the end!'; goto "radius" Share this post Link to post Share on other sites
bobby budnick 0 Posted July 8, 2007 I noticed an extra _vcl SetVehicleInit ""; after your processInitCommands. I don't know if that would affect anything on the clients though. The only thing I can see offhand that you could try doing is adding the addaction commands directly to the _Initstring of the vehicle. If that works, maybe your script has an error. Share this post Link to post Share on other sites
nullsystems 0 Posted July 8, 2007 Hmm, well the problem looks like its to do with the script.sqs where all the conditionals are for the addactions. Since its showing the hints to players, but not the addactions. I dont know why. I tried a simple addaction in the init line of the VRS, that worked for them. So if I could add a conditional to the vrs init line like this: _InitString = "if (player == driver heli1 ) then { act1 = this addAction [""Defcon1"", ""detonate_vehicle.sqs"", this, 0, false, false, """"]";}; else { heli1 removeaction act1 }; But some how, I dont think I could manage that. Plus, I dont think it would repeat working? eg: you would have to be in the pilot seat for it to work when it respawns? Perhaps that conditional would work so I can get rid of the script.sqs Share this post Link to post Share on other sites
nullsystems 0 Posted July 8, 2007 Can no one see why those two scripts dont produce the addaction again after respawn in mp ? Im desperatly lost with it Share this post Link to post Share on other sites
nullsystems 0 Posted July 8, 2007 Can someone please take a look at the scripts above? It respawns, but not with the addaction on it. If I remove the if (!local server) bit, then it works....but with multiple choppers....now that I dont get. Please, its driving me nuts lol. Share this post Link to post Share on other sites
bobby budnick 0 Posted July 8, 2007 You say multiple choppers respawn. Do you have a game logic named server on the map? You have to do that to prevent multiple respawn. Share this post Link to post Share on other sites
nullsystems 0 Posted July 9, 2007 Yeah, as I said.. if I remove it, then it occurs. That shows the addaction is working if there is more than one chopper. All I can think of is that there is a locality issue? Share this post Link to post Share on other sites
nullsystems 0 Posted July 9, 2007 ***EDIT*** Hmm... Heres what ive tested: Arma_server.exe, I ran this and tried connecting to it, ran the scripts....blew up the heli1 and when it respawned it no longer had the addactions from script.sqs. This suggests its losing its name..... 1. I removed the (if local server) system, this showed me the addactions on respawn, but spawned a million other helis..... This suggests some kind of locality? Is there a way of getting around this issue? Ive been trying to get around this for 5 days or more now. Share this post Link to post Share on other sites
nullsystems 0 Posted July 9, 2007 ?! (local server): exit _vehicle = _this select 0 _delay = _this select 1 _pos = _this select 2 _dir = _this select 3 ? (_pos == 0): _startpos = getpos _vehicle ? (_dir == 361): _startdir = getdir _vehicle #waiting ; waiting for Vehicle is disabled @ !(canmove heli1) &! (canfire heli1) && (getdammage heli1) >=0.3 ; checking if vehicle still is manned @ (isnull driver heli1) && (isnull gunner heli1) && (isnull commander heli1) ~_delay ? (canmove heli1) && (canfire heli1): goto "waiting" _new = typeof heli1 deletevehicle heli1 heli1 = _new createvehicle _startpos heli1 setpos _startpos heli1 setdir _startdir [heli1, _delay, _pos, _dir] exec "heli1.sqs" exit ------- Thats my current respawn script which works.... Since its working, it suggests it name is " heli1 " Now....is that only local to this script or something because I have a trigger set: conditional: alive heli1 onact: heli1 addaction blah blah And that doesnt work. Would putting a publicvariable in there somewhere help? If so, how ? Share this post Link to post Share on other sites