Jump to content
radar1029

Bambi spawn load out help

Recommended Posts

I'm trying to get new spawns to load out with the following items, and need some help with the code...Can't get the gun or backpack to spawn.

TTSKO pants/Jacket

Improvised bag

combat boots

FNX45 w/ magazine

In the inventory i Want rags, water bottle, combat knife, ammo box and a suppressor and random piece of fruit...

 

I'm also waiting for my GSP to give me access back to my init.c file so I can test.

 

 

player.RemoveAllItems();

        player.GetInventory().CreateInInventory("TTSKOPants");
        player.GetInventory().CreateInInventory("TTsKOJacket_Camo");
        player.GetInventory().CreateInInventory("ImprovisedBag");
        player.GetInventory().CreateInInventory("CombatBoots_Black");

        EntityAI gun = player.GetInventory().CreateInInventory("FNX45");
        EntityAI magazine = player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd");
*/
        EntityAI itemTop;
        EntityAI itemEnt;
        ItemBase itemBs;
        float rand;
        
        itemTop = player.FindAttachmentBySlotName("Body");
        
        if ( itemTop )
        {
            itemEnt = itemTop.GetInventory().CreateInInventory("Rag");
            if ( Class.CastTo(itemBs, itemEnt ) )
            itemBs.SetQuantity(4);

            SetRandomHealth(itemEnt);
            
            itemEnt = itemTop.GetInventory().CreateInInventory("CombatKnife");
            SetRandomHealth(itemEnt);
        
            itemEnt = itemTop.GetInventory().CreateInInventory("Matchbox");
            if ( Class.CastTo(itemBs, itemEnt ) )
            itemBs.SetQuantity(10);

            SetRandomHealth(itemEnt);

            itemEnt = itemTop.GetInventory().CreateInInventory("WaterBottle");
            SetRandomHealth(itemEnt);

            itemEnt = itemTop.GetInventory().CreateInInventory("PistolSuppressor");
            SetRandomHealth(itemEnt);

            itemEnt = itemTop.GetInventory().CreateInInventory("AmmoBox_45ACP_25Rnd");
            SetRandomHealth(itemEnt);

        }

        rand = Math.RandomFloatInclusive(0.0, 1.0);
        if ( rand < 0.35 )
            itemEnt = player.GetInventory().CreateInInventory("Apple");
        else if ( rand > 0.65 )
            itemEnt = player.GetInventory().CreateInInventory("Pear");
        else
            itemEnt = player.GetInventory().CreateInInventory("Plum");
        
        SetRandomHealth(itemEnt);

Share this post


Link to post
Share on other sites
11 hours ago, radar1029 said:

I'm trying to get new spawns to load out with the following items, and need some help with the code...Can't get the gun or backpack to spawn.

TTSKO pants/Jacket

Improvised bag

combat boots

FNX45 w/ magazine

In the inventory i Want rags, water bottle, combat knife, ammo box and a suppressor and random piece of fruit...

 

I'm also waiting for my GSP to give me access back to my init.c file so I can test.

 

 

player.RemoveAllItems();

        player.GetInventory().CreateInInventory("TTSKOPants");
        player.GetInventory().CreateInInventory("TTsKOJacket_Camo");
        player.GetInventory().CreateInInventory("ImprovisedBag");
        player.GetInventory().CreateInInventory("CombatBoots_Black");

        EntityAI gun = player.GetInventory().CreateInInventory("FNX45");
        EntityAI magazine = player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd");
*/
        EntityAI itemTop;
        EntityAI itemEnt;
        ItemBase itemBs;
        float rand;
        
        itemTop = player.FindAttachmentBySlotName("Body");
        
        if ( itemTop )
        {
            itemEnt = itemTop.GetInventory().CreateInInventory("Rag");
            if ( Class.CastTo(itemBs, itemEnt ) )
            itemBs.SetQuantity(4);

            SetRandomHealth(itemEnt);
            
            itemEnt = itemTop.GetInventory().CreateInInventory("CombatKnife");
            SetRandomHealth(itemEnt);
        
            itemEnt = itemTop.GetInventory().CreateInInventory("Matchbox");
            if ( Class.CastTo(itemBs, itemEnt ) )
            itemBs.SetQuantity(10);

            SetRandomHealth(itemEnt);

            itemEnt = itemTop.GetInventory().CreateInInventory("WaterBottle");
            SetRandomHealth(itemEnt);

            itemEnt = itemTop.GetInventory().CreateInInventory("PistolSuppressor");
            SetRandomHealth(itemEnt);

            itemEnt = itemTop.GetInventory().CreateInInventory("AmmoBox_45ACP_25Rnd");
            SetRandomHealth(itemEnt);

        }

        rand = Math.RandomFloatInclusive(0.0, 1.0);
        if ( rand < 0.35 )
            itemEnt = player.GetInventory().CreateInInventory("Apple");
        else if ( rand > 0.65 )
            itemEnt = player.GetInventory().CreateInInventory("Pear");
        else
            itemEnt = player.GetInventory().CreateInInventory("Plum");
        
        SetRandomHealth(itemEnt);

override PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string characterName)
	{
		Entity playerEnt;
		playerEnt = GetGame().CreatePlayer(identity, characterName, pos, 0, "NONE");//Creates random player
		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, 0)) {
		
	case 0: 	
	// Player 1//
    player.GetInventory().CreateInInventory("TTSKOPants");itemBs = ItemBase.Cast(itemEnt);
    player.GetInventory().CreateInInventory("TTsKOJacket_Camo");itemBs = ItemBase.Cast(itemEnt);
    player.GetInventory().CreateInInventory("ImprovisedBag");itemBs = ItemBase.Cast(itemEnt);
	player.GetInventory().CreateInInventory("CombatBoots_Black");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("WaterBottle");itemBs = ItemBase.Cast(itemEnt);
	player.GetInventory().CreateInInventory("CombatKnife");itemBs = ItemBase.Cast(itemEnt);
	player.GetInventory().CreateInInventory("PistolSuppressor");itemBs = ItemBase.Cast(itemEnt);
	player.GetInventory().CreateInInventory("AmmoBox");itemBs = ItemBase.Cast(itemEnt);
	break;  
}
    // Give universal gear
    itemEnt = player.GetInventory().CreateInInventory("Rag");
    itemBs = ItemBase.Cast(itemEnt);
    itemBs.SetQuantity(6);
	}
};

 

  • Like 1

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

×