Havoc302 Posted January 10, 2015 Report Share Posted January 10, 2015 So I'd really like to put the minigun armed versions of these choppers on my server to make it a little more interesting but they really need their rockets removed. This is what I came up with to do it but it's erroring and I can't think of any other way to do it and i can't work out why. Repurposing the code from something similar we used to do in ARMA 2 Epoch. private ["_object"]; if (isServer) then { if (_object isKindOf "O_Heli_Light_02_F") then { // PO-30 Orca _object removeWeapon "missiles_DAGR"; _object removeMagazine "12Rnd_PG_missiles"; _object removeMagazine "24Rnd_PG_missiles"; }; if (_object isKindOf "I_Heli_light_03_F") then { // WY-55 Hellcat _object removeWeapon "missiles_DAGR"; _object removeMagazine "12Rnd_PG_missiles"; _object removeMagazine "24Rnd_PG_missiles"; }; if (_object isKindOf "B_Heli_Light_01_armed_F") then { // AH-9 Pawnee _object removeWeapon "missiles_DAGR"; _object removeMagazine "12Rnd_PG_missiles"; _object removeMagazine "24Rnd_PG_missiles"; }; }; Wanted it to just run once, when the first person logs in to remove the weapons and ammo from those choppers rockets, unless someone can tell me a better method of doing it? Teax 1 Link to comment Share on other sites More sharing options...
TheVampire Posted January 10, 2015 Report Share Posted January 10, 2015 Maybe this? if (isClient) then { [] spawn { if (player != vehicle player) then { switch {true} do { case ((vehicle player) in ["I_Heli_light_03_F","O_Heli_Light_02_F","B_Heli_Light_01_armed_F"]): { (vehicle player) removeWeapon "missiles_DAGR"; (vehicle player) removeMagazines "12Rnd_PG_missiles"; (vehicle player) removeMagazines "24Rnd_PG_missiles"; }; }; waitUntil{ player == vehicle player }; }; uiSleep 1; }; }; Would go on the clientside, and you would use different cases for different weapon sets. Link to comment Share on other sites More sharing options...
Nic Posted January 10, 2015 Report Share Posted January 10, 2015 I'm no scripter, but could you add an init to the vehicle? Link to comment Share on other sites More sharing options...
Havoc302 Posted January 11, 2015 Author Report Share Posted January 11, 2015 Anyone else got any ideas on this? I'd really love to get these vehicles into the server, having only the armed Ghosthawk and Huron is a little boring. I already added the Hunter HMG. Ifrit, Ifrit HMG, Strider and Strider HMG which is making it much more interesting. Link to comment Share on other sites More sharing options...
Bushwick Posted January 11, 2015 Report Share Posted January 11, 2015 Try changing the Ammo values? I have no idea, just a thought. Link to comment Share on other sites More sharing options...
Havoc302 Posted January 12, 2015 Author Report Share Posted January 12, 2015 Problem with that is they can be rearmed still. Need to remove the weapon. Link to comment Share on other sites More sharing options...
TheVampire Posted January 12, 2015 Report Share Posted January 12, 2015 Problem with that is they can be rearmed still. Need to remove the weapon. Did the code I post not work from the init.sqf? It should clear all the ammo and weapons in a vehicle when the player enters it. Might need to add a check that the weapon exists first, or setVariable used. Link to comment Share on other sites More sharing options...
Brez Posted January 12, 2015 Report Share Posted January 12, 2015 I recall the weapons still being mounted but they were not usable. If your server doesn't have the ammo available then that should do it. Just make sure when a chopper is purchased and/or server restarts it doesn't rearm the guns. I can imagine keeping ammo count on them at zero should do it. Link to comment Share on other sites More sharing options...
Havoc302 Posted January 12, 2015 Author Report Share Posted January 12, 2015 Did the code I post not work from the init.sqf? It should clear all the ammo and weapons in a vehicle when the player enters it. Might need to add a check that the weapon exists first, or setVariable used. Nah didn't work tried it but it gave me an error in the RPT of the server about the (isClient). Tried changing it to (!isServer) and that didn't work either. Link to comment Share on other sites More sharing options...
Havoc302 Posted January 12, 2015 Author Report Share Posted January 12, 2015 Very strange, this script got it to remove the weapons from two of the helicopters the first time I tried it but now doesn't remove any, ARMA, you confuse me. if (isServer) then { if (_object isKindOf "O_Heli_Light_02_F") then { // PO-30 Orca _object removeWeapon "missiles_DAGR"; _object removeMagazine "12Rnd_PG_missiles"; _object removeMagazine "24Rnd_PG_missiles"; }; if (_object isKindOf "I_Heli_light_03_F") then { // WY-55 Hellcat _object removeWeapon "missiles_DAGR"; _object removeMagazine "12Rnd_PG_missiles"; _object removeMagazine "24Rnd_PG_missiles"; }; if (_object isKindOf "B_Heli_Light_01_armed_F") then { // AH-9 Pawnee _object removeWeapon "missiles_DAGR"; _object removeMagazine "12Rnd_PG_missiles"; _object removeMagazine "24Rnd_PG_missiles"; }; }; It also gave me an undefined variable error which was _object, took it straight out of a fix for using military vehicles in DayZ Epoch, but it was intended to be put into the server_monitor. Any ideas a way to adapt it? I'd ultimately like it either one of two ways, it removes the weapon as soon as player gets in it or it just removes it server wide on mission load. Can't seem to get either to work. Link to comment Share on other sites More sharing options...
Legolas_xp Posted January 12, 2015 Report Share Posted January 12, 2015 Anyone else got any ideas on this? I'd really love to get these vehicles into the server, having only the armed Ghosthawk and Huron is a little boring. I already added the Hunter HMG. Ifrit, Ifrit HMG, Strider and Strider HMG which is making it much more interesting. What did u used to add the Strider and Ifrit to the game? I would like be able to use this in our server,, if you don't mind to share. Thanks Link to comment Share on other sites More sharing options...
Fog Horn Posted January 12, 2015 Report Share Posted January 12, 2015 Choose from this list http://wiki.7thcavalry.us/wiki/ARMA_3_Vehicles , and put them in epochconfig.hpp Cubitron 1 Link to comment Share on other sites More sharing options...
Havoc302 Posted January 12, 2015 Author Report Share Posted January 12, 2015 What did u used to add the Strider and Ifrit to the game? I would like be able to use this in our server,, if you don't mind to share. Thanks Yep, just as FogHorn says, I just added them to the Epoch config. Link to comment Share on other sites More sharing options...
Havoc302 Posted January 12, 2015 Author Report Share Posted January 12, 2015 What did u used to add the Strider and Ifrit to the game? I would like be able to use this in our server,, if you don't mind to share. Thanks Also be warned, you can't sell them / add them to the traders to be sold. And you'll need to make some server rules about using them to take down player built bases, the HMG can take down a cinder wall in 80 rounds. And you'll need to add some rearming vehicles for people to find to be able to rearm. Link to comment Share on other sites More sharing options...
Havoc302 Posted January 15, 2015 Author Report Share Posted January 15, 2015 Anyone else got any ideas on this? So far I've tried: Diag_log "Starting loading rockets removal script"; Sleep 45; // wait for server to start properly and load all vehicles private ["_object1","_object2","_object3"]; _object1 = "O_Heli_Light_02_F"; _object2 = "I_Heli_light_03_F"; _object3 = "B_Heli_Light_01_armed_F"; if (isServer) then { if (vehicle player == _object1) then { // PO-30 Orca _object1 removeWeapon "missiles_DAR"; _object1 removeWeapon "missiles_DAGR"; _object1 removeMagazine "12Rnd_PG_missiles"; _object1 removeMagazine "24Rnd_missiles"; }; if (vehicle player == _object2) then { // WY-55 Hellcat _object2 removeWeapon "missiles_DAR"; _object2 removeWeapon "missiles_DAGR"; _object2 removeMagazine "12Rnd_PG_missiles"; _object2 removeMagazine "24Rnd_missiles"; }; if (vehicle player == _object3) then { // AH-9 Pawnee _object3 removeWeapon "missiles_DAR"; _object3 removeWeapon "missiles_DAGR"; _object3 removeMagazine "12Rnd_PG_missiles"; _object3 removeMagazine "24Rnd_missiles"; }; }; Diag_log "Finished loading rockets removal script"; Which doesn't error but also doesn't remove the weapons or ammo. This: Diag_log "Starting loading rockets removal script 2"; if (vehicle player isKindOf "O_Heli_Light_02_F") then { // PO-30 Orca player removeWeapon "missiles_DAR"; player removeWeapon "missiles_DAGR"; player removeMagazine "12Rnd_PG_missiles"; player removeMagazine "24Rnd_missiles"; }; if (vehicle player isKindOf "I_Heli_light_03_F") then { // WY-55 Hellcat player removeWeapon "missiles_DAR"; player removeWeapon "missiles_DAGR"; player removeMagazine "12Rnd_PG_missiles"; player removeMagazine "24Rnd_missiles"; }; if (vehicle player isKindOf "B_Heli_Light_01_armed_F") then { // AH-9 Pawnee player removeWeapon "missiles_DAR"; player removeWeapon "missiles_DAGR"; player removeMagazine "12Rnd_PG_missiles"; player removeMagazine "24Rnd_missiles"; }; Sleep 1; Diag_log "Finished loading rockets removal script 2"; Trying to run it client side to it cycles and catches any time a player hops in a chopper, again, runs, doesn't error but doesn't do the job. And this I just knocked up and tried and also ran without error but didn't do what it says: Diag_log "Starting loading rockets removal script 3"; private ["_helis"]; _helis = ["O_Heli_Light_02_F","I_Heli_light_03_F","I_Heli_light_03_F"]; { this removeWeapon "missiles_DAR"; this removeWeapon "missiles_DAGR"; this removeMagazine "12Rnd_PG_missiles"; this removeMagazine "24Rnd_missiles"; } forEach _helis; Diag_log "Finished loading rockets removal script 3"; Those rocket pods and ammo are correct for all three helis too, just no matter what it doesn't seem to do it. Link to comment Share on other sites More sharing options...
Havoc302 Posted January 23, 2015 Author Report Share Posted January 23, 2015 Bump. Anyone got this working as yet? I've tried everything that's been suggested to me and everything that I can think of, I even got some help on armaholics and they confirmed their script works, I put it in my mission file for my Epoch server and it doesn't work, is it possible that somehow Epoch is blocking the removalWeapon function or something else about it? http://www.armaholic.com/forums.php?m=posts&q=30668 Link to comment Share on other sites More sharing options...
Nic Posted January 23, 2015 Report Share Posted January 23, 2015 If you think Epoch might be blocking it, have you tried running the script without anti hack enabled just to see if that is the issue? Link to comment Share on other sites More sharing options...
Havoc302 Posted January 26, 2015 Author Report Share Posted January 26, 2015 So I've noticed that my scripts to remove rockets seem to be running before Epoch has loaded the servers vehicles which I assume is why it's not being done. I've put a sleep at the start of the script all way up to 5 minutes now but it still doesn't seem to be doing it, anyone got any ideas? Link to comment Share on other sites More sharing options...
Havoc302 Posted February 3, 2015 Author Report Share Posted February 3, 2015 Bump, anyone been able to get this to work? I've tried everything that's been recommended to me and everything I can think of. Link to comment Share on other sites More sharing options...
DirtySanchez Posted February 5, 2015 Report Share Posted February 5, 2015 Havoc,I am using the A3E AI that Face has created and in there his Vehicle AI are using Armed choppers with the rockets removed.Maybe check that out. I did look at the code and it looks useable if Face doesn't mind. Link to comment Share on other sites More sharing options...
Havoc302 Posted February 6, 2015 Author Report Share Posted February 6, 2015 Havoc, I am using the A3E AI that Face has created and in there his Vehicle AI are using Armed choppers with the rockets removed. Maybe check that out. I did look at the code and it looks useable if Face doesn't mind. That's awesome! Thanks a bunch DirtySanchez! Link to comment Share on other sites More sharing options...
Face Posted February 6, 2015 Report Share Posted February 6, 2015 The difficult part is that without full modify access to the Epoch server files, you can't ever get a direct reference to each vehicle as it's spawned. The best bet is to start from Vampire's code, though I don't know if BE will throw any fits for removeWeapon/removeMagazine commands. This is my version of the code, keep in mind this is untested: if (isClient) then { [] spawn { waitUntil {uiSleep 5; player isEqualTo player}; while {true} do { waitUntil {uiSleep 1; !(player isEqualTo (vehicle player))}; _vehicleObject = (vehicle player); _vehicleType = typeOf _vehicleObject; call { if (_vehicleType in ["I_Heli_light_03_F","O_Heli_Light_02_F","B_Heli_Light_01_armed_F"]) exitWith { _vehicleObject removeWeapon "missiles_DAGR"; _vehicleObject removeMagazines "12Rnd_PG_missiles"; _vehicleObject removeMagazines "24Rnd_PG_missiles"; }; //Additional vehicle-weapon exceptions can be added here }; waitUntil {{uiSleep 1; player isEqualTo (vehicle player)};}; }; }; }; If you want to know why the code you have tried doesn't work, read on ahead. Regarding the code from these posts: The reason they don't work is explained by the undefined variable error - the _object error is not defined anywhere in that script. As far as the server knows, _object could refer to anything (any object, player, number, string, array, etc) that exists in the game. The reason it works in the server_monitor in A2 Epoch is that _object is defined in that file, you can't just take a random chunk of code, chuck it in another chunk of code, and expect to have it work (I know, I've made this mistake tons of times). The reason the code in () doesn't work is that you're trying to use removeWeapon/removeMagazine commands on a classname, not an object reference. If you try to remove weapons from a classname, the server has no way of knowing of which vehicle (or if it's even a vehicle) to remove from: one vehicle, a set of vehicles, or all vehicles? For your reference: "B_Heli_Light_01_armed_F" //This is a classname (string) player //This is an object reference to the player object itself. It will never return a reference to the player's vehicle if they are in a vehicle. (vehicle player) //This is an object reference to the player's vehicle, or the player itself if not in a vehicle. This is the only example where you can remove/add weapons/magazines/etc to a vehicle typeOf (vehicle player) //This gives you the classname (string) of the player's vehicle (or the player's unit if not in a vehicle). TolH 1 Link to comment Share on other sites More sharing options...
Talib Posted February 6, 2015 Report Share Posted February 6, 2015 The difficult part is that without full modify access to the Epoch server files, you can't ever get a direct reference to each vehicle as it's spawned. The best bet is to start from Vampire's code, though I don't know if BE will throw any fits for removeWeapon/removeMagazine commands. This is my version of the code, keep in mind this is untested: if (isClient) then { [] spawn { waitUntil {uiSleep 5; player isEqualTo player}; while {true} do { waitUntil {uiSleep 1; !(player isEqualTo (vehicle player))}; _vehicleObject = (vehicle player); _vehicleType = typeOf _vehicleObject; call { if (_vehicleType in ["I_Heli_light_03_F","O_Heli_Light_02_F","B_Heli_Light_01_armed_F"]) exitWith { _vehicleObject removeWeapon "missiles_DAGR"; _vehicleObject removeMagazines "12Rnd_PG_missiles"; _vehicleObject removeMagazines "24Rnd_PG_missiles"; }; //Additional vehicle-weapon exceptions can be added here }; waitUntil {{uiSleep 1; player isEqualTo (vehicle player)};}; }; }; }; If you want to know why the code you have tried doesn't work, read on ahead. Regarding the code from these posts: The reason they don't work is explained by the undefined variable error - the _object error is not defined anywhere in that script. As far as the server knows, _object could refer to anything (any object, player, number, string, array, etc) that exists in the game. The reason it works in the server_monitor in A2 Epoch is that _object is defined in that file, you can't just take a random chunk of code, chuck it in another chunk of code, and expect to have it work (I know, I've made this mistake tons of times). The reason the code in () doesn't work is that you're trying to use removeWeapon/removeMagazine commands on a classname, not an object reference. If you try to remove weapons from a classname, the server has no way of knowing of which vehicle (or if it's even a vehicle) to remove from: one vehicle, a set of vehicles, or all vehicles? For your reference: "B_Heli_Light_01_armed_F" //This is a classname (string) player //This is an object reference to the player object itself. It will never return a reference to the player's vehicle if they are in a vehicle. (vehicle player) //This is an object reference to the player's vehicle, or the player itself if not in a vehicle. This is the only example where you can remove/add weapons/magazines/etc to a vehicle typeOf (vehicle player) //This gives you the classname (string) of the player's vehicle (or the player's unit if not in a vehicle). hi my thank you or is your srypt put this ?? :huh: Link to comment Share on other sites More sharing options...
Havoc302 Posted February 7, 2015 Author Report Share Posted February 7, 2015 Thanks Face so much for looking into it for me. The script you posted didn't work but I'll try and experiment with it. Link to comment Share on other sites More sharing options...
Guest Posted February 8, 2015 Report Share Posted February 8, 2015 I recall the weapons still being mounted but they were not usable. If your server doesn't have the ammo available then that should do it. Just make sure when a chopper is purchased and/or server restarts it doesn't rearm the guns. I can imagine keeping ammo count on them at zero should do it. How do you get them to rearm on restart? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now