JadeKnightblazer Posted February 4, 2015 Share Posted February 4, 2015 Looking for a way to Equip a character with an item from the very start, unlike the starting inventory which places items in the inventory. Also is it possible to lock a item in an equippment slot and can never be removed? Link to comment Share on other sites More sharing options...
seronis Posted February 4, 2015 Share Posted February 4, 2015 Since we know characters who have this situation, like abigails flower, you should just look in the appropriate characters prefab for how it is done.scripts/prefabs/wendy.lua Link to comment Share on other sites More sharing options...
JadeKnightblazer Posted February 4, 2015 Author Share Posted February 4, 2015 wrong type of starting inventory... That is the normal which most characters use. What I am asking is upon character creation / each time it loads, Inventory:Equipslot --EQUIPSLOTS.BODY, EQUIPSLOTS.HEAD The point is to start the character with an item(s) equipped from the get go, not in their inventory item slots. Link to comment Share on other sites More sharing options...
Auth Posted February 4, 2015 Share Posted February 4, 2015 wrong type of starting inventory... That is the normal which most characters use. What I am asking is upon character creation / each time it loads, Inventory:Equipslot --EQUIPSLOTS.BODY, EQUIPSLOTS.HEAD The point is to start the character with an item(s) equipped from the get go, not in their inventory item slots. why not just make them already have it appear to be on their sprite, and buff the character to have these traits instead? Link to comment Share on other sites More sharing options...
Corrosive Posted February 6, 2015 Share Posted February 6, 2015 why not just make them already have it appear to be on their sprite, and buff the character to have these traits instead? I would imagine because that is a completely different concept O.o Presumably they want the option to unequip or replace as necessary, or to block other items from being equipped simultaneously. Having to re-animate all of the item animations is a bit of a pain as well. In any case, you can pretty much do it as shown in wendy.lua as seronis mentioned. The only difference for you is that inside the DoTaskInTime's callback function just after:if not found then inst.components.inventory:GuaranteeItems(prefabs)endYou'll want to search for the items in your character's inventory again(just in case none were found and they were given new ones, GuaranteeItems doesn't return a reference to the newly spawned items), check equippable.isequipped on them, and if that's false, equip them. (You can use either the equip method on the item's equippable component or preferably the equip method on your character's inventory component.) To prevent people from duping the items, you might want to add tags to the prefabs and then search for those before deciding to give them a new copy. If you don't care about duping, then you might want to make sure that the function to check for instances of the prefabs in your character's inventory only return one instance of them, or you'll rapidly cycle through equipping all of them on load. Link to comment Share on other sites More sharing options...
Zackreaver Posted February 6, 2015 Share Posted February 6, 2015 I get what Wierdobob is saying. The OP wants to make a character that starts the game with essentially a preset body armor and headgear, that can never be taken off and replaced. What wierdobob is saying is, since he essentially wants the character to wear the same thing at all times, why not do what the "Pyro Mod" did and essentially have these items be attached to the sprite directly and just block equipping of all items in thsoe slots. That saves the hassle of dealing with character death and the items dropping on the floor along with recreating the items when the character is respawned. Wierdobob is essentially saying by having the characters built in traits mirror what they would have been from wearing the items in the first place you never have to worry about these other details and simply have to make it so the player can't change headgear or chest gear. That is unless the OP has something else in mind, but thats what it appears to be what the initial goal is. Wierdobob is simply suggesting have the effects from the headgear and chest piece tied directly to the character, instead of on the items, and adjust the sprite to have the gear appear to be equipped at all times. Link to comment Share on other sites More sharing options...
Corrosive Posted February 6, 2015 Share Posted February 6, 2015 My bad-- apparently I didn't read the second sentence of the OP <.< Link to comment Share on other sites More sharing options...
JadeKnightblazer Posted February 7, 2015 Author Share Posted February 7, 2015 No worries, figured it out Link to comment Share on other sites More sharing options...
fsp98 Posted February 24, 2015 Share Posted February 24, 2015 Hey guys, I didn't wanted to create another topic so: Can you please send me the code used for the regular starting inventory? I didn't seem to find it anywhere. Thanks Link to comment Share on other sites More sharing options...
Blueberrys Posted February 24, 2015 Share Posted February 24, 2015 @filipsperllocal start_inv = { "item_prefab",}-- Where inst refers to the player's instanceinst.components.inventory:GuaranteeItems(start_inv) Link to comment Share on other sites More sharing options...
fsp98 Posted February 25, 2015 Share Posted February 25, 2015 Please, can someone give me an example ? Link to comment Share on other sites More sharing options...
Corrosive Posted February 25, 2015 Share Posted February 25, 2015 Please, can someone give me an example ? They just gave you an example. See willow.lua lines 17-20 and line 47. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.