MrCakehat Posted July 26, 2013 Share Posted July 26, 2013 Hey all, I am wondering how I would go about spawning an object, say for example a box or a barrel or whatever, when the player fires a specific weapon?What I'm thinking of is just messing around with something the player can equip, which will "Auto-create" something else, maybe a box, or another weapon or something, when the equipped weapon is fired, how would I go about starting to do something like that? Link to comment Share on other sites More sharing options...
RoboMat Posted July 26, 2013 Share Posted July 26, 2013 It depends on what "spawning" means to you. If you want a new item in the inventory after the weapon is fired then you could use the "OnWeaponHitCharacter" event and "AddItem" to spawn stuff in the player's inventory when he hits something. If you want it to happen when he uses the weapon the event "OnWeaponSwing" would be your friend. For more events check out the event reference on pz-mods.net. If you want to spawn a world object ... then well you should look at some of the carpentry code Link to comment Share on other sites More sharing options...
MrCakehat Posted July 28, 2013 Author Share Posted July 28, 2013 Ah thank you that helps a lot, I'll have a good look at the references, see what I can do.And yeah I was thinking of a world object, something that would appear where the player is standing Link to comment Share on other sites More sharing options...
RoboMat Posted July 28, 2013 Share Posted July 28, 2013 I just updated my tutorial and included a small part on how to use events. There should be a method to drop items directly on the ground (what's used when cutting down a tree for example) but I'm not sure which one it is right now. I'll see if I can find out later P.S.: May I make a guess? Will your mod spawn empty shells on the ground when shooting a pistol? Link to comment Share on other sites More sharing options...
MrCakehat Posted July 29, 2013 Author Share Posted July 29, 2013 Thanks for that, It's a bit better to understandhaha yeah something like that, and also the objects, or shells or whatever would also have a life time and be removed. I was just going to use this as a practice mod for myself, then expand it use it on an idea I've got 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