MattL Posted September 29, 2014 Report Share Posted September 29, 2014 instead of using if var == var then { why don't you just use switch? It's faster. Link to comment Share on other sites More sharing options...
Mikeeeyy Posted September 29, 2014 Report Share Posted September 29, 2014 instead of using if var == var then { why don't you just use switch? It's faster. https://community.bistudio.com/wiki/Code_Optimisation#If_Else_If_Else_If_Else_... Link to comment Share on other sites More sharing options...
MattL Posted September 29, 2014 Report Share Posted September 29, 2014 https://community.bistudio.com/wiki/Code_Optimisation#If_Else_If_Else_If_Else_... The point of linking me something i've already seen before was? I've seen this, and used scripts in game to personally test the times. Switch was always faster for me, personally. Link to comment Share on other sites More sharing options...
Richie Posted September 30, 2014 Report Share Posted September 30, 2014 Hey Spodermayt, did you manage to find a way for me to use your script with Chernarus spawn selection ? No biggie if not but yours is the only random loadout script out and it works :) just a shame it clashes Link to comment Share on other sites More sharing options...
Spodermayt Posted September 30, 2014 Author Report Share Posted September 30, 2014 Hey Spodermayt, did you manage to find a way for me to use your script with Chernarus spawn selection ? No biggie if not but yours is the only random loadout script out and it works :) just a shame it clashes Not sure, i thought that the idea of dayz is to survive, so i didn't add that ;) But i think its not the spawnselection thats the problem. Can you tell me if it works that you call the loadout+.sqf before epoch variables? here: startLoadingScreen ["","RscDisplayLoadCustom"]; cutText ["","BLACK OUT"]; enableSaving [false, false]; dayZ_instance = 11; dayzHiveRequest = []; initialized = false; dayz_previousID = 0; player setVariable ["BIS_noCoreConversations", true]; enableRadio false; enableSentences false; //loadout m8// execVM "YourPath/loadout+.sqf"; spawnShoremode = 1; // Default = 1 (on shore) spawnArea= 1500; // Default = 1500 MaxVehicleLimit = 300; // Default = 50 MaxDynamicDebris = 500; dayz_MapArea = 14000; // Default = 10000 dayz_maxLocalZombies = 30; // Default = 30 dayz_paraSpawn = false; dayz_minpos = -1; dayz_maxpos = 16000; dayz_sellDistance_vehicle = 10; dayz_sellDistance_boat = 30; dayz_sellDistance_air = 40; dayz_maxAnimals = 5; // Default: 8 dayz_tameDogs = true; /* and so on */ Try it and if it doesn't work tell me. Then ill add that script myself and test. Richie 1 Link to comment Share on other sites More sharing options...
Richie Posted September 30, 2014 Report Share Posted September 30, 2014 Not sure, i thought that the idea of dayz is to survive, so i didn't add that ;) But i think its not the spawnselection thats the problem. Can you tell me if it works that you call the loadout+.sqf before epoch variables? here: <snip> Try it and if it doesn't work tell me. Then ill add that script myself and test. Nope, still freezes with a grey screen :( Thanks for trying though, I'd love to use this :) Link to comment Share on other sites More sharing options...
MattL Posted September 30, 2014 Report Share Posted September 30, 2014 Nope, still freezes with a grey screen :( Thanks for trying though, I'd love to use this :) It's how he's executing it. In my experience, spawn selection doesn't like adding gear before it get initialized. So, we use rdmspwn = compile preprocessFileLineNumbers "loadout.sqf"; waitUntil {!isNil ("PVDZE_plr_LoginRecord")}; if (dayzPlayerLogin2 select 2) then { player spawn rdmspwn; }; and add _randomSpot in server_playerSetup in the dayzplayerlogin array, then make your own loadout.sqf using addMagazine / addWeapon. Link to comment Share on other sites More sharing options...
Richie Posted September 30, 2014 Report Share Posted September 30, 2014 Any chance of a bit more info please :) I get what you mean but have no idea what files are affected. Link to comment Share on other sites More sharing options...
MattL Posted September 30, 2014 Report Share Posted September 30, 2014 Any chance of a bit more info please :) I get what you mean but have no idea what files are affected. the rdmspwn bit goes at the bottom of the init, then in your server files find server_playerSetup.sqf and find dayzPlayerLogin2 = ["blah","blah"]; and in the dayzPlayerLogin2 array add _randomSpot Link to comment Share on other sites More sharing options...
Spodermayt Posted September 30, 2014 Author Report Share Posted September 30, 2014 the rdmspwn bit goes at the bottom of the init, then in your server files find server_playerSetup.sqf and find dayzPlayerLogin2 = ["blah","blah"]; and in the dayzPlayerLogin2 array add _randomSpot I thought something like this would work, had no idea how the spawnselection affected files. Well good if it works. Link to comment Share on other sites More sharing options...
Richie Posted September 30, 2014 Report Share Posted September 30, 2014 Well it no longer gives me the freeze screen but the random loadouts are not being applied :unsure: spawning with a torch, bandage, patrol pack and pain killers, everytime i respawn. But it's progress :) Link to comment Share on other sites More sharing options...
MattL Posted September 30, 2014 Report Share Posted September 30, 2014 Well it no longer gives me the freeze screen but the random loadouts are not being applied :unsure: spawning with a torch, bandage, patrol pack and pain killers, everytime i respawn. But it's progress :) if you're still trying to use the epoch loadout variables that's why. You can't. addMagazine is your friend in this situation. Link to comment Share on other sites More sharing options...
Richie Posted September 30, 2014 Report Share Posted September 30, 2014 Ok so it is loading the default Epoch loadout, the part of the loadout+ script i'm using is : // Select a loadout 0-4 _loadout=floor(random 4); //Change this as you like, remember it starts with 0. In this case we have 5 options to spawn with. if (_loadout == 0) then { DefaultMagazines = ["ItemBandage","ItemBandage","ItemPainkiller","10x_303"]; DefaultWeapons = ["ItemMap","LeeEnfield"]; DefaultBackpack = ["DZ_Patrol_Pack_EP1"]; DefaultBackpackWeapon = ""; }; if (_loadout == 1) then { DefaultMagazines = ["ItemBandage","ItemPainkiller","15Rnd_W1866_Slug"]; DefaultWeapons = ["Winchester1866","ItemMap"]; DefaultBackpack = ["DZ_Patrol_Pack_EP1"]; DefaultBackpackWeapon = ""; }; if (_loadout == 2) then { DefaultMagazines = ["ItemBandage","ItemPainkiller","15Rnd_9x19_M9SD","15Rnd_9x19_M9SD"]; DefaultWeapons = ["M9SD","ItemMap"]; DefaultBackpack = ["DZ_Patrol_Pack_EP1"]; DefaultBackpackWeapon = ""; }; if (_loadout == 3) then { DefaultMagazines = ["ItemBandage","BoltSteel","BoltSteel","BoltSteel"]; DefaultWeapons = ["ItemToolbox","ItemMap","Crossbow"]; DefaultBackpack = ["DZ_Patrol_Pack_EP1"]; DefaultBackpackWeapon = ""; }; if (_loadout == 4) then { DefaultMagazines = ["ItemBandage"]; DefaultWeapons = ["MeleeHatchet","ItemMap"]; DefaultBackpack = ["DZ_Patrol_Pack_EP1"]; DefaultBackpackWeapon = ""; }; Matt, do you mean use : addMagazine instead of DefaultMagazines ? Link to comment Share on other sites More sharing options...
MattL Posted September 30, 2014 Report Share Posted September 30, 2014 Ok so it is loading the default Epoch loadout, the part of the loadout+ script i'm using is : // Select a loadout 0-4 _loadout=floor(random 4); //Change this as you like, remember it starts with 0. In this case we have 5 options to spawn with. if (_loadout == 0) then { DefaultMagazines = ["ItemBandage","ItemBandage","ItemPainkiller","10x_303"]; DefaultWeapons = ["ItemMap","LeeEnfield"]; DefaultBackpack = ["DZ_Patrol_Pack_EP1"]; DefaultBackpackWeapon = ""; }; if (_loadout == 1) then { DefaultMagazines = ["ItemBandage","ItemPainkiller","15Rnd_W1866_Slug"]; DefaultWeapons = ["Winchester1866","ItemMap"]; DefaultBackpack = ["DZ_Patrol_Pack_EP1"]; DefaultBackpackWeapon = ""; }; if (_loadout == 2) then { DefaultMagazines = ["ItemBandage","ItemPainkiller","15Rnd_9x19_M9SD","15Rnd_9x19_M9SD"]; DefaultWeapons = ["M9SD","ItemMap"]; DefaultBackpack = ["DZ_Patrol_Pack_EP1"]; DefaultBackpackWeapon = ""; }; if (_loadout == 3) then { DefaultMagazines = ["ItemBandage","BoltSteel","BoltSteel","BoltSteel"]; DefaultWeapons = ["ItemToolbox","ItemMap","Crossbow"]; DefaultBackpack = ["DZ_Patrol_Pack_EP1"]; DefaultBackpackWeapon = ""; }; if (_loadout == 4) then { DefaultMagazines = ["ItemBandage"]; DefaultWeapons = ["MeleeHatchet","ItemMap"]; DefaultBackpack = ["DZ_Patrol_Pack_EP1"]; DefaultBackpackWeapon = ""; }; Matt, do you mean use : addMagazine instead of DefaultMagazines ? // Select a loadout 0-4 _loadout=floor(random 4); //Change this as you like, remember it starts with 0. In this case we have 5 options to spawn with. if (_loadout == 0) then { {player addMagazine _x;} forEach ["ItemBandage","ItemBandage","ItemPainkiller","10x_303"]; {player addWeapon _x;} forEach ["ItemMap","LeeEnfield"]; player addBackpack "DZ_Patrol_Pack_EP1"; }; if (_loadout == 1) then { {player addMagazine _x;} forEach ["ItemBandage","ItemPainkiller","15Rnd_W1866_Slug"]; {player addWeapon _x;} forEach ["Winchester1866","ItemMap"]; player addBackpack "DZ_Patrol_Pack_EP1"; }; if (_loadout == 2) then { {player addMagazine _x;} forEach ["ItemBandage","ItemPainkiller","15Rnd_9x19_M9SD","15Rnd_9x19_M9SD"]; {player addWeapon _x;} forEach ["M9SD","ItemMap"]; player addBackpack "DZ_Patrol_Pack_EP1"; }; if (_loadout == 3) then { {player addMagazine _x;} forEach ["ItemBandage","BoltSteel","BoltSteel","BoltSteel"]; {player addWeapon _x;} forEach["ItemToolbox","ItemMap","Crossbow"]; player addBackpack "DZ_Patrol_Pack_EP1"; }; if (_loadout == 4) then { player addMagazine "ItemBandage"; {player addWeapon _x;} forEach ["MeleeHatchet","ItemMap"]; player addBackpack "DZ_Patrol_Pack_EP1"; }; Richie 1 Link to comment Share on other sites More sharing options...
Richie Posted September 30, 2014 Report Share Posted September 30, 2014 Yay :d Cheers Matt, I owe you a beer or 3 and thank you Spordermayt for the original script. Richie is a happy chappy now B) Link to comment Share on other sites More sharing options...
Spodermayt Posted September 30, 2014 Author Report Share Posted September 30, 2014 Yay :d Cheers Matt, I owe you a beer or 3 and thank you Spordermayt for the original script. Richie is a happy chappy now B) Good to hear you got that working :) You could add removeMagazine/weapon to get rid of the default loadout tho :p (Or add the empty loadout into your init.) If i were you i'd leave it like that :) Happy survivin! Link to comment Share on other sites More sharing options...
MattL Posted September 30, 2014 Report Share Posted September 30, 2014 I know a decent amount about scripting and try to help out where I can. Like I said, I wrote a neat little script for loadouts for my buddies server (his is overwatch and 100% pvp) that completely randomizes the weapons (and has blacklists etc) which I am willing to post up for you guys to use/edit/study if anyone requests. It's still kind of a work in progress but it's 99% functional Link to comment Share on other sites More sharing options...
Richie Posted September 30, 2014 Report Share Posted September 30, 2014 Well i'm aiming for a PvP Overpoch server so yeah that would be handy, I just prefer players to head to a compound for gear and leave fresh spawns alone rather than giving the too much to start. Link to comment Share on other sites More sharing options...
Spodermayt Posted September 30, 2014 Author Report Share Posted September 30, 2014 I know a decent amount about scripting and try to help out where I can. Like I said, I wrote a neat little script for loadouts for my buddies server (his is overwatch and 100% pvp) that completely randomizes the weapons (and has blacklists etc) which I am willing to post up for you guys to use/edit/study if anyone requests. It's still kind of a work in progress but it's 99% functional Pastebin link or something? I've really scripted for a few weeks, and am kinda interested how you did it :p Link to comment Share on other sites More sharing options...
MattL Posted September 30, 2014 Report Share Posted September 30, 2014 http://pastebin.com/f0yGwdXQ remember, this is edited 100% for his server. You guys can feel free to add me on skype if you have any questions regarding this particular script (or anything else i've worked on) and i'll do my best to help. (My skype is on my profile ) Link to comment Share on other sites More sharing options...
hansi Posted November 3, 2014 Report Share Posted November 3, 2014 hi i use this random loadout and humanity based loadout private ["_loadout","_humanity"]; _loadout = floor (random 4); _humanity = (player getVariable["humanity",0]); if (_loadout == 0) then { {player addMagazine _x;} forEach ["DDOPP_1Rnd_X26","DDOPP_1Rnd_X26","DDOPP_1Rnd_X26","DDOPP_1Rnd_X26","ItemBandage","ItemBandage","ItemPainkiller"]; {player addWeapon _x;} forEach ["DDOPP_X26","ItemMap"]; player addBackpack "DZ_Patrol_Pack_EP1"; }; if (_loadout == 1) then { {player addMagazine _x;} forEach ["DDOPP_1Rnd_X26","DDOPP_1Rnd_X26","DDOPP_1Rnd_X26","DDOPP_1Rnd_X26","ItemBandage","ItemBandage","ItemPainkiller"]; {player addWeapon _x;} forEach ["DDOPP_X26_b","ItemFlashlight","ItemMap"]; player addBackpack "DZ_Patrol_Pack_EP1"; }; if (_loadout == 2) then { {player addMagazine _x;} forEach ["DDOPP_3Rnd_X3","ItemBandage","ItemBandage","ItemPainkiller"]; {player addWeapon _x;} forEach ["DDOPP_X3_b","ItemFlashlightRed","ItemMap"]; player addBackpack "DZ_Patrol_Pack_EP1"; }; if (_loadout == 3) then { {player addMagazine _x;} forEach ["DDOPP_3Rnd_X3","ItemBandage","ItemBandage","ItemPainkiller"]; {player addWeapon _x;} forEach ["DDOPP_X3","ItemFlashlight","ItemMap"]; player addBackpack "DZ_Patrol_Pack_EP1"; }; if (_humanity <= -24999) then { removeAllWeapons player; removeAllItems player; removeBackpack player; {player addMagazine _x;} forEach ["7Rnd_45ACP_1911","ItemBandage","ItemBandage","ItemPainkiller"]; {player addWeapon _x;} forEach ["revolver_EP1","ItemFlashlightRed","ItemMap"]; player addBackpack "DZ_TerminalPack_EP1"; }; if (_humanity >= 24999) then { removeAllWeapons player; removeAllItems player; removeBackpack player; {player addMagazine _x;} forEach ["7Rnd_45ACP_1911","ItemBandage","ItemBandage","ItemPainkiller"]; {player addWeapon _x;} forEach ["revolver_EP1","ItemFlashlightRed","ItemMap"]; player addBackpack "DZ_TerminalPack_EP1"; }; Link to comment Share on other sites More sharing options...
Spodermayt Posted November 5, 2014 Author Report Share Posted November 5, 2014 hi i use this random loadout and humanity based loadout private ["_loadout","_humanity"]; _loadout = floor (random 4); _humanity = (player getVariable["humanity",0]); if (_loadout == 0) then { {player addMagazine _x;} forEach ["DDOPP_1Rnd_X26","DDOPP_1Rnd_X26","DDOPP_1Rnd_X26","DDOPP_1Rnd_X26","ItemBandage","ItemBandage","ItemPainkiller"]; {player addWeapon _x;} forEach ["DDOPP_X26","ItemMap"]; player addBackpack "DZ_Patrol_Pack_EP1"; }; if (_loadout == 1) then { {player addMagazine _x;} forEach ["DDOPP_1Rnd_X26","DDOPP_1Rnd_X26","DDOPP_1Rnd_X26","DDOPP_1Rnd_X26","ItemBandage","ItemBandage","ItemPainkiller"]; {player addWeapon _x;} forEach ["DDOPP_X26_b","ItemFlashlight","ItemMap"]; player addBackpack "DZ_Patrol_Pack_EP1"; }; if (_loadout == 2) then { {player addMagazine _x;} forEach ["DDOPP_3Rnd_X3","ItemBandage","ItemBandage","ItemPainkiller"]; {player addWeapon _x;} forEach ["DDOPP_X3_b","ItemFlashlightRed","ItemMap"]; player addBackpack "DZ_Patrol_Pack_EP1"; }; if (_loadout == 3) then { {player addMagazine _x;} forEach ["DDOPP_3Rnd_X3","ItemBandage","ItemBandage","ItemPainkiller"]; {player addWeapon _x;} forEach ["DDOPP_X3","ItemFlashlight","ItemMap"]; player addBackpack "DZ_Patrol_Pack_EP1"; }; if (_humanity <= -24999) then { removeAllWeapons player; removeAllItems player; removeBackpack player; {player addMagazine _x;} forEach ["7Rnd_45ACP_1911","ItemBandage","ItemBandage","ItemPainkiller"]; {player addWeapon _x;} forEach ["revolver_EP1","ItemFlashlightRed","ItemMap"]; player addBackpack "DZ_TerminalPack_EP1"; }; if (_humanity >= 24999) then { removeAllWeapons player; removeAllItems player; removeBackpack player; {player addMagazine _x;} forEach ["7Rnd_45ACP_1911","ItemBandage","ItemBandage","ItemPainkiller"]; {player addWeapon _x;} forEach ["revolver_EP1","ItemFlashlightRed","ItemMap"]; player addBackpack "DZ_TerminalPack_EP1"; }; Allright thanks for sharing 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