Gekido2802 Posted January 19, 2015 Share Posted January 19, 2015 My friend and I used a mod, I gave him an item from the mod but even if he got the mod activated , he can't see the item, he can't use it but it still there and he got problem with the slot the item is in. So is there a command I can use to remove an Item from his slot? Thanks for future reply! Link to comment https://forums.kleientertainment.com/forums/topic/49378-console-command/ Share on other sites More sharing options...
Kzisor Posted January 19, 2015 Share Posted January 19, 2015 @Gekido2802, in your custom item make sure you have inst.entity:AddNetwork() otherwise it won't show up on the clients side properly. Link to comment https://forums.kleientertainment.com/forums/topic/49378-console-command/#findComment-603598 Share on other sites More sharing options...
Zillvr Posted January 19, 2015 Share Posted January 19, 2015 I think this needs more info. What specific Item? Mod name? Was the item spawned in by host or by a client? etc. Link to comment https://forums.kleientertainment.com/forums/topic/49378-console-command/#findComment-603599 Share on other sites More sharing options...
Gekido2802 Posted January 19, 2015 Author Share Posted January 19, 2015 @Gekido2802, in your custom item make sure you have inst.entity:AddNetwork() otherwise it won't show up on the clients side properly. Well thanks for the info ^^ but my question was more if there was a command I could enter into the command console to remove an item from someone slot? Link to comment https://forums.kleientertainment.com/forums/topic/49378-console-command/#findComment-603605 Share on other sites More sharing options...
Kzisor Posted January 19, 2015 Share Posted January 19, 2015 @Gekido2802, you can try the following in the console. for _,v in ipairs(AllPlayers) do v.components.inventory:RemoveItem("PREFAB NAME HERE") end This will remove all the items of that prefab's name from all players. Alternatively you could simply disable the mod. Link to comment https://forums.kleientertainment.com/forums/topic/49378-console-command/#findComment-603606 Share on other sites More sharing options...
Gekido2802 Posted January 20, 2015 Author Share Posted January 20, 2015 I added the inst.entity:AddNetwork() into the fn function, idk if there was a specific place to put it, well tell me if I'm wrong.Now my friend's client show a "attemp to index field "inventoryitem" (a nil value)" error message Link to comment https://forums.kleientertainment.com/forums/topic/49378-console-command/#findComment-603962 Share on other sites More sharing options...
Kzisor Posted January 20, 2015 Share Posted January 20, 2015 @Gekido2802, without seeing the code, many people wouldn't be able to help you. It sounds like you need the following code before any component though. if not TheWorld.ismastersim then return instend Link to comment https://forums.kleientertainment.com/forums/topic/49378-console-command/#findComment-603972 Share on other sites More sharing options...
rezecib Posted January 20, 2015 Share Posted January 20, 2015 @Gekido2802, Can you show us the prefab file? That suggests that the positioning of code around "if not TheWorld.ismastersim then return inst end" is wrong. Link to comment https://forums.kleientertainment.com/forums/topic/49378-console-command/#findComment-603973 Share on other sites More sharing options...
Kzisor Posted January 20, 2015 Share Posted January 20, 2015 @rezecib, or it's missing entirely. It seems that the tutorials new modders are using does not have that in them. Link to comment https://forums.kleientertainment.com/forums/topic/49378-console-command/#findComment-603977 Share on other sites More sharing options...
Gekido2802 Posted January 20, 2015 Author Share Posted January 20, 2015 @rezecib, or it's missing entirely. It seems that the tutorials new modders are using does not have that in them. You're right I don't have it cuase I didn't find any tutorial with that :/ Where do I put the if not TheWorld.ismastersim then return instend and what does it do? Thanks for future reply! ^^ Link to comment https://forums.kleientertainment.com/forums/topic/49378-console-command/#findComment-603996 Share on other sites More sharing options...
rezecib Posted January 20, 2015 Share Posted January 20, 2015 (edited) @Gekido2802, Well, whenever you're making anything for a mod, you should always start by copying over the most similar thing from the game's files. So if you're making an equippable item, start by copying over spear.lua or something. That way you don't have to worry so much about missing crucial stuff like if not TheWorld.ismastersim. Edit: I talked about this approach in my guide, which is pinned at the top of this subforum. But I'm editing it right now to make sure it's clearer and I cover the new things in prefabs specifically. Edited January 20, 2015 by rezecib Link to comment https://forums.kleientertainment.com/forums/topic/49378-console-command/#findComment-604013 Share on other sites More sharing options...
Gekido2802 Posted January 22, 2015 Author Share Posted January 22, 2015 (edited) Thanks guys. I fixed the problem adding : inst.entity:AddNetwork() if not TheWorld.ismastersim then return instend and some other things that was in the game files but not in mine @rezecib, your tutorial is very well explained , it helped me a lots. Thanks @Kzisor, for the command to remove an item from a player slot I used : for k,v in ipairs(AllPlayers) do if v.name == "PLAYER NAME HERE" then v.components.inventory:RemoveItemBySlot("SLOT NUMBER HERE") endend Thanks a lot for the help! Edited January 22, 2015 by Gekido2802 Link to comment https://forums.kleientertainment.com/forums/topic/49378-console-command/#findComment-604897 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