Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Switching weapon when un-equipped [read for details] [Resolved]

Is there a way to make it so that when the player un-equips a weapon, it will then insert a different weapon into the empty weapon slot untill it is switched out with another weapon that player chooses.

For example: If a player has a bronze sword equipped, then they un-equip it without putting in a new weapon. A weapon named fists will appear in that empty slot untill a new weapon is in the weapon slot, then fists would be remove.

Reason for needing this: I have a battle system that only works as long as you have a weapon equipped. So if the player doesn't know this and just so happens to have no weapon equipped, then they would keep getting an error each time they enter battle.

(I tried to make this as clear as possible, so please help if you can, also I didn't think this would be considered scripting, so I'm sorry if this is in the wrong forum)
 
Well, you could go through a bunch of conditional branches checking if each player has a weapon equipped, but that would take forever if you have a lot of weapons and the changes wouldn't take effect in the menu.  I'd say it would be easier to do with a script.
 
Lycosa":3uloj4ch said:
I can`t script, but I know that this
Code:
if @actor.weapon_id == 0
lets you check if an actor has no weapon equipped (if the ID is 0, nothing is equipped).

Wait... how do we specify which actor has it? (actor.id = where do I put id number?)
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top