There's more than one way to do it, and I'm sure some others will make some suggestions or point you to the right topic (I did a search and quickly found there's a lot to dig through looking for a concise answer).
There are some
libraries in the wiki for "wearing clothes" that might be useful, but I haven't used them yet myself, and they may be more than you need. There are also some others in the
libraries sub-forum that may be useful, but again, they may do more than you want/need at the moment.
I'll tell you two ways I've done it before. I'm giving full details since I'm not sure
exactly how familiar you are with Quest currently.
EDIT: It has just occurred to me that this will be harder in the browser version, because it does not have the same access to adding attributes to the player (currently). You could still do it, but you'd have to use scripts to create the attributes in game. Most likely by putting them in the game's start script. I don't know what kind of computer or internet connection you have, but if you're main concern about downloading the desktop version is time, it actually shouldn't take too long. I don't recall it taking more a minute or two. In the meantime, bare in mind that what I'm about to suggest will require using scripts to add these attributes to the player, and probably the weapon as well.
My currently preferred method is to create an
object attribute on the player that points to the currently equipped weapon. This way, all you need to do when the user equips a new weapon is set the attribute to equal the new weapon.
• Step 1: make a base object for when the player has no weapon equipped (I call mine "bare hands", more on that in a moment)
• Step2: add an attribute to the player which will point to whatever object is equipped (let's call it "equipped_weapon")
• Step 3: set the attribute type to
ObjectNOTE: As far as I know, Quest will not let you set an attribute type to object, without selecting a specific object for the attribute. This is why you need to make the "bare hands" object first; the "equipped_weapon" attribute will need something to point to.
• Step 4: Create an "equip" verb for the weapon, with a script that sets the "equipped_weapon" attribute to equal the "sword" object. In code this would look like:
player.equipped_weapon = sword
//This is really the most important part, and in the online editor you may need to JUST use a script that does THIS.
//The gist of it is, set an attribute on the player that refers to an object (the weapon).
In the gui, you would choose the script command called "Set a variable or attribute",
then enter
player.equipped_weapon for "set variable"
and sword for "expression".
This way, anything you need to know about the currently equipped weapon can be accessed using the player attribute. So, for instance, if the "sword" object has an attribute called "damage" you can refer to it (once it is equipped) as "player.equipped_weapon.damage" just the same as "sword.damage".
The other way I've used in the past basically involves creating matching attributes on the player and the weapon and making all of the player's attributes equal the weapons attributes.
(starts like this)
sword.damage = 5
player.damage = 0
(then do this)
player.damage = sword.damage
(and end up with this)
sword.damage = 5
player.damage = 5
This is okay for
really simple weapons, but if you want weapons with a variety of attributes, you'd have to set the matching player attribute for each one when they equip it.