Need help please/following tutorial SOLVED!!!

I added the attribute weapon for player.weapon = null to my player so everything works so far except when i actually grab the stone ((Which i want it to be a weapon)) i made a code for the stone when i grab it: set variable player.weapon = expression true That didnt fix the null issue i get in-game which says: error running script: Error compiling expression 'player.weapon = null ': CompareElement: Operation 'Equal' is not defined for type 'Boolean' and 'Null'

I need help please i'm lost this error happens when i attack the snake not when i grab the stone... It happens when i hold the stone

I fixed it sorry for my bad english

You can't do if (player.weapon = null) {unless player.weapon is an object. The = expression can't compare different types of things.

If you want to compare different types of variables, you'd use if (Equal (player.weapon, null)) { instead - it does the same thing, but it doesn't give an error when you try to compare things.

However, in this case I suspect you'd just get another error. You've set player.weapon to true, which seems a pretty odd thing to do. Don't you want to set it to an object that's a weapon? If you're doing it in the script when you pick up the stone, then I think the expression that you set it to would normally be this (the stone) rather than true.

Thank you so much mrangel this helps me a lot =) hehe and I am new to this I will learn!!!!

Log in to post a reply.