Last active
February 9, 2023 13:21
-
-
Save danthedaniel/8c20f5c5582e84f7fd6c64a9a2247423 to your computer and use it in GitHub Desktop.
DayZ SA Init Script - PvP Classes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() | |
{ | |
Hive ce = CreateHive(); | |
if (ce) | |
ce.InitOffline(); | |
Weather weather = g_Game.GetWeather(); | |
weather.GetOvercast().SetLimits(0.0, 1.0); | |
weather.GetRain().SetLimits(0.0, 1.0); | |
weather.GetFog().SetLimits(0.0, 0.25); | |
weather.GetOvercast().SetForecastChangeLimits(0.0, 0.2); | |
weather.GetRain().SetForecastChangeLimits(0.0, 0.1); | |
weather.GetFog().SetForecastChangeLimits(0.15, 0.45); | |
weather.GetOvercast().SetForecastTimeLimits(1800, 1800); | |
weather.GetRain().SetForecastTimeLimits(600, 600); | |
weather.GetFog().SetForecastTimeLimits(1800, 1800); | |
weather.GetOvercast().Set(Math.RandomFloatInclusive(0.0, 0.3), 0, 0); | |
weather.GetRain().Set(Math.RandomFloatInclusive(0.0, 0.2), 0, 0); | |
weather.GetFog().Set(Math.RandomFloatInclusive(0.0, 0.1), 0, 0); | |
weather.SetWindMaximumSpeed(15); | |
weather.SetWindFunctionParams(0.1, 0.3, 50); | |
} | |
class CustomMission: MissionServer | |
{ | |
override PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string characterName) | |
{ | |
Entity playerEnt = GetGame().CreatePlayer(identity, characterName, pos, 0, "NONE"); | |
Class.CastTo(m_player, playerEnt); | |
GetGame().SelectPlayer(identity, m_player); | |
return m_player; | |
} | |
void addMags(PlayerBase player, string mag_type, int count) | |
{ | |
if (count < 1) | |
return; | |
EntityAI mag; | |
for (int i = 0; i < count; i++) { | |
mag = player.GetInventory().CreateInInventory(mag_type); | |
} | |
player.SetQuickBarEntityShortcut(mag, 1, true); | |
} | |
EntityAI assaultClass(PlayerBase player) | |
{ | |
EntityAI gun = player.GetHumanInventory().CreateInHands("M4A1"); | |
gun.GetInventory().CreateAttachment("M4_RISHndgrd_Black"); | |
gun.GetInventory().CreateAttachment("M4_MPBttstck_Black"); | |
gun.GetInventory().CreateAttachment("ACOGOptic"); | |
addMags(player, "Mag_STANAG_30Rnd", 3); | |
return gun; | |
} | |
EntityAI sniperClass(PlayerBase player) | |
{ | |
EntityAI gun = player.GetHumanInventory().CreateInHands("SVD"); | |
gun.GetInventory().CreateAttachment("PSO1Optic"); | |
addMags(player, "Mag_SVD_10Rnd", 3); | |
return gun; | |
} | |
EntityAI smgClass(PlayerBase player) | |
{ | |
EntityAI gun = player.GetHumanInventory().CreateInHands("UMP45"); | |
gun.GetInventory().CreateAttachment("PistolSuppressor"); | |
addMags(player, "Mag_UMP_25Rnd", 3); | |
return gun; | |
} | |
override void StartingEquipSetup(PlayerBase player, bool clothesChosen) | |
{ | |
player.RemoveAllItems(); | |
player.GetInventory().CreateInInventory("TTSKOPants"); | |
player.GetInventory().CreateInInventory("TTsKOJacket_Camo"); | |
player.GetInventory().CreateInInventory("CombatBoots_Black"); | |
player.GetInventory().CreateInInventory("ImprovisedBag"); | |
player.GetInventory().CreateInInventory("SodaCan_Pipsi"); | |
player.GetInventory().CreateInInventory("SpaghettiCan"); | |
player.GetInventory().CreateInInventory("HuntingKnife"); | |
ItemBase rags = player.GetInventory().CreateInInventory("Rag"); | |
rags.SetQuantity(4); | |
EntityAI primary; | |
EntityAI axe = player.GetInventory().CreateInInventory("FirefighterAxe"); | |
switch (Math.RandomInt(0, 3)) { | |
case 0: primary = assaultClass(player); break; | |
case 1: primary = sniperClass(player); break; | |
case 2: primary = smgClass(player); break; | |
} | |
player.LocalTakeEntityToHands(primary); | |
player.SetQuickBarEntityShortcut(primary, 0, true); | |
player.SetQuickBarEntityShortcut(rags, 2, true); | |
player.SetQuickBarEntityShortcut(axe, 3, true); | |
} | |
}; | |
Mission CreateCustomMission(string path) | |
{ | |
return new CustomMission(); | |
} |
Using this init.c I spawn with all items EXCEPT the gun, no matter the class. I'm running v1.0. Like burns1972 I'm new to this as well.
Any suggestions?
Thanks,
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Alex,
I am real new to all of this.
I have a very basic understanding of coding
I am trying to setup a DayZ SA server which i have running but trying to tweak some files.
Where do I put these changes based on the above.
EntityAI primary;
ItemBase itemBs;
primary = BasicLoadoutClass(player);itemBs = ItemBase.Cast(primary);
itemBs = ItemBase.Cast(primary);
Any help is appreciated.
It would be easier if you just gave the whole thing again with the changes.
Much appreciated.