Question about checking for a "weapon" attribute?

Hello,
I’m setting up a very simple combat scenario to play around with that's mostly based on the "How to use commands" page (only using the GUI editor, not entirely ready to dive into the coding part yet). I don't understand the expression player.weapon=null (forgive my post formatting if that's incorrect), mainly because I don't understand what allows an object to apply to it as a weapon. Is it attribute-related?


Gng

Hey
You can create an object that serves as a weapon (called sword) and then create the weapon attribute in the player object, click the drop down and select "object" then from the drop down below it select sword. Or you could just type player.weapon = sword. Just like that the sword equals player.weapon. What you want to do with that is up to you. You can for example check if the player.weapon equals sword to see if the player can cut tree branches in the forest to clear a path.

Player.weapon = null just says that the player has no weapon or have not equipped it, so they can't it.

Also the code view simplifies everything more than you think. It made everything easier for me as soon as I figured it out.

Feel free to reply if you didn't get your answer.


Log in to post a reply.

Support

Forums