Jump to content

Start a game with an already Equipped Item


Recommended Posts

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

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

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)end

You'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

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

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.

×
  • Create New...