Jump to content
CaptainFist

Edit the init.c

Recommended Posts

Hi,

here´s my init.c

But when a player spawn  he is not spawned with the selected Character. Where is my mistake???

 

Quote

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
{
void SetRandomHealth(EntityAI itemEnt)
{
int rndHlt = Math.RandomInt(60,100);
itemEnt.SetHealth("","",rndHlt);
}

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;
}

override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
{
player.RemoveAllItems();

EntityAI itemEnt;
ItemBase itemBs;

switch (Math.RandomInt(0, 11)) {
case 0:
// Soldier
player.GetInventory().CreateInInventory("TTSKOPants");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("TShirt_Green");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("CombatBoots_Black");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("CombatKnife");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("Barrel_Green");itemBs = ItemBase.Cast(itemEnt);
break;
case 1:
// Paramedic
player.GetInventory().CreateInInventory("ParamedicPants_Green");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("ParamedicJacket_Green");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("KitchenKnife");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("SalineBagIV");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("BandageDressing");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("Barrel_Green");itemBs = ItemBase.Cast(itemEnt);
break;
case 2:
// Office worker
player.GetInventory().CreateInInventory("SlacksPants_Black");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("WoolCoat_Black");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("AthleticShoes_Black");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("KitchenKnife");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("Paper");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("SodaCan_Cola");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("ThinFramesGlasses");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("Barrel_Green");itemBs = ItemBase.Cast(itemEnt);
break;
case 3:
// Biker
player.GetInventory().CreateInInventory("Jeans_Black");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("RidersJacket_Black");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("MotoHelmet_Red");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("HikingBootsLow_Black");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("Matchbox");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("KitchenKnife");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("Pipe");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("Barrel_Green");itemBs = ItemBase.Cast(itemEnt);
break;
case 4:
// Hiker
player.GetInventory().CreateInInventory("HikingJacket_Red");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("CargoPants_Blue");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("HikingBootsLow_Blue");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("MountainBag_Blue");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("KitchenKnife");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("Compass");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("WaterBottle");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("Barrel_Green");itemBs = ItemBase.Cast(itemEnt);
break;
case 5:
// Cop
player.GetInventory().CreateInInventory("PoliceJacket");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("PolicePants");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("CombatBoots_Grey");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("Flashlight");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("Battery9V");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("PersonalRadio");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("Apple");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("Barrel_Green");itemBs = ItemBase.Cast(itemEnt);
break;
case 6:
// Lumberjack
player.GetInventory().CreateInInventory("Shirt_RedCheck");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("Jeans_Blue");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("WoodAxe");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("WorkingBoots_Brown");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("KitchenKnife");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("Ushanka_Green");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("Barrel_Green");itemBs = ItemBase.Cast(itemEnt);
break;
case 7:
// Hood
player.GetInventory().CreateInInventory("TrackSuitPants_Black");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("TrackSuitJacket_Black");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("AthleticShoes_Black");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("KitchenKnife");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("SodaCan_Kvass");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("Barrel_Green");itemBs = ItemBase.Cast(itemEnt);
break;
case 8:
// Fireman
player.GetInventory().CreateInInventory("FirefighterJacket_Beige");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("FirefightersPants_Beige");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("FirefightersHelmet_White");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("WorkingBoots_Yellow");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("KitchenKnife");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("FirefighterAxe");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("Barrel_Green");itemBs = ItemBase.Cast(itemEnt);
break;
case 9:
// Kacknoob
player.GetInventory().CreateInInventory("MiniDress_BlueChecker");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("Skirt_Blue");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("MedicalScrubsHat_Blue");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("Ballerinas_Blue");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("DryBag_Blue");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("FirefighterAxe");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("Barrel_Green");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("FNX45");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd");itemBs = ItemBase.Cast(itemEnt);    
player.GetInventory().CreateInInventory("PistolOptic");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("PistolSuppressor");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("AmmoBox_45ACP_25rnd");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("Rice");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("WaterBottle");itemBs = ItemBase.Cast(itemEnt);
break;
case 10:
// Ritter
player.GetInventory().CreateInInventory("FurImprovisedBag");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("GreatHelm");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("LeatherJacket_Natural");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("LeatherPants_Natural");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("LeatherMoccasinsShoes_Natural");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("Sword");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("Ammo_ArrowBoned");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("Ammo_ArrowBoned");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("Ammo_ArrowBoned");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("Ammo_ArrowBoned");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("Ammo_ArrowBoned");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("RecurveBow");itemBs = ItemBase.Cast(itemEnt);

break;
}
// Give universal gear
itemEnt = player.GetInventory().CreateInInventory("Rag");
itemBs = ItemBase.Cast(itemEnt);
itemBs.SetQuantity(4);
// SetRandomHealth(itemEnt);
// player.GetInventory().CreateInInventory("HuntingKnife");
}
};
Mission CreateCustomMission(string path)
{
return new CustomMission();
}                         
                   

 

greetings

Edited by CaptainFist
correction
  • Like 1

Share this post


Link to post
Share on other sites

Well to start off i wouldnt try to use unused items at alll, i tried many different weapons, they usually dont work, and i think barrel will not fit in players gear. Just use the script from this forum and dont change to much, you can add mp5, mosin and a pistol as your spawn classes, but would be best to leave them as is in script.

 

Share this post


Link to post
Share on other sites

you understand my Question?

The Barrels are only for testing...  the stuff that i spawn for private testing purpose doesn´t matter.

I want to know how to spawn the choosen Character...

 

you joined here to post this ???? Really???

Edited by CaptainFist
edit

Share this post


Link to post
Share on other sites

It appears to be working for me? I spawned as "Office worker", then respawned as "Fireman", then "Paramedic"

Edited by smasht

Share this post


Link to post
Share on other sites

Ok, i think it´s a Bug in the Client.

If you have multiple Steam Accounts you use in one Windows User Account the Charaktermenue gone Wild.....

I edited multiple Time the Name to CaptainFist, every time i log into a server i was again SURVIVOR ???

*when use only one Steam Acc it don´t Happend... *

Quote

It appears to be working for me? I spawned as "Office worker", then respawned as "Fireman", then "Paramedic"

Only for understanding, i mean not the Lootout, e.g. choosen a Black Female Charakter and spawn as a White Male, next time as White Female.... totally random...

Edited by CaptainFist

Share this post


Link to post
Share on other sites
18 hours ago, CaptainFist said:

Ok, i think it´s a Bug in the Client.

If you have multiple Steam Accounts you use in one Windows User Account the Charaktermenue gone Wild.....

I edited multiple Time the Name to CaptainFist, every time i log into a server i was again SURVIVOR ???

*when use only one Steam Acc it don´t Happend... *

Only for understanding, i mean not the Lootout, e.g. choosen a Black Female Charakter and spawn as a White Male, next time as White Female.... totally random...

I think it is bugged atm, this post looks to be trying to do something similar?

 

 

Edited by smasht

Share this post


Link to post
Share on other sites

Wrong:

player.GetInventory().CreateInInventory("...");itemBs = ItemBase.Cast(itemEnt);

Correct:

itemEnt = player.GetInventory().CreateInInventory("...");itemBs = ItemBase.Cast(itemEnt);

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×