BombardmentPigs Posted April 17, 2022 Share Posted April 17, 2022 I wanted to give the player an item after firing a ranged weapon, but when I tried copying the code from another one of my mods (Which game the player an item after they eat a food) it crashes. I think it has something to do with defining who is receiving the item. Can somebody explain to me how it works? Any help would be greatly appreciated! __________.components.inventory:GiveItem(SpawnPrefab("prefab_name")) --blank space represents where I need help at, I need to know how to correctly define this part in multiple situations. Link to comment https://forums.kleientertainment.com/forums/topic/139280-solved-how-does-the-give-item-script-work/ Share on other sites More sharing options...
BombardmentPigs Posted April 17, 2022 Author Share Posted April 17, 2022 (edited) Also, can somebody specify to give the item to the "handheld" slot? This is just something I would like for the item to run smoothly. Thanks! Edited April 17, 2022 by BombardmentPigs Link to comment https://forums.kleientertainment.com/forums/topic/139280-solved-how-does-the-give-item-script-work/#findComment-1559657 Share on other sites More sharing options...
BombardmentPigs Posted April 18, 2022 Author Share Posted April 18, 2022 Well, I messed around with the code and managed to get it (sort-of) working. It is a bit finnicky but I now know just look for the variables set by the game's functions. Building new variables is still out of my range. Link to comment https://forums.kleientertainment.com/forums/topic/139280-solved-how-does-the-give-item-script-work/#findComment-1559780 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