Jump to content
Sign in to follow this  
kmiles1990

Spawning new objects

Recommended Posts

How can I create like a crate at a certain location and add food to that crate, or something large that I can put lots of food in that will always spawn there? Can someone show me an example?

Share this post


Link to post
Share on other sites

PlayerBase boxf_target;
                if(count == 2) {
                    boxf_target = GetPlayer(tokens[1]);
                    if(boxf_target == NULL) {
                        SendMessageToPlayer(player, "[boxf] Can't find player called: '"+tokens[1]+"'");
                    } else {
                        SendMessageToPlayer(player, "[boxf] You boxf " + boxf_target.GetIdentity().GetName());
                    }
                } else {
                    boxf_target = player;
                    SendMessageToPlayer(player, "[boxf] You boxf yourself");
                }
                if(boxf_target != NULL) { 
                    ItemBase boxf_fnx; 
                    EntityAI boxf;               
                    boxf = EntityAI.Cast(GetGame().CreateObject( "AmmoBox", boxf_target.GetPosition(), false, true ));        

                    EntityAI ttaka = boxf.GetInventory().CreateInInventory("FNX45");
                    ttaka.GetInventory().CreateAttachment("PistolSuppressor");
                    ttaka.GetInventory().CreateAttachment("FNP45_MRDSOptic");
                    ttaka.GetInventory().CreateAttachment("UniversalLight");

                    boxf.GetInventory().CreateInInventory("AmmoBox_45ACP_25rnd");
                    boxf.GetInventory().CreateInInventory("AmmoBox_45ACP_25rnd");
                    boxf.GetInventory().CreateInInventory("AmmoBox_762x54_20Rnd");
                    boxf.GetInventory().CreateInInventory("AmmoBox_762x54_20Rnd");
                    boxf.GetInventory().CreateInInventory("Mag_FNX45_15Rnd");
                    boxf.GetInventory().CreateInInventory("Mag_FNX45_15Rnd");
                    boxf.GetInventory().CreateInInventory("Mag_SVD_10Rnd");
                    boxf.GetInventory().CreateInInventory("Mag_SVD_10Rnd");
                    boxf.GetInventory().CreateInInventory("Mag_SVD_10Rnd");
                    boxf.GetInventory().CreateInInventory("Mag_SVD_10Rnd");    
                    boxf_fnx = ItemBase.Cast(boxf);    
                }

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
Sign in to follow this  

×