Trying to make a ranged weapon use condition

Started by ImNotFun on Mon, 09/07/2020 - 09:57

Topic category: Help with MCreator software

Last seen on 07:49, 14. Oct 2020
Joined Sep 2019
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Trying to make a ranged weapon use condition
Mon, 09/07/2020 - 09:57

So i'm trying to make a magic-type weapon that will use and only work if the player has above a certain amount of exp.

Code

This is what i've got so far, but of course it doesn't work. The exact error code is Procedure that uses return value must use a valid return block. I've tried the other two return blocks but neither of them connect with the true block

Last seen on 19:12, 21. Oct 2020
Joined Nov 2018
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
The error is simple. The…
Tue, 09/08/2020 - 20:12

The error is simple. The return statement should be outside the statement. Make a logic variable set that to true inside the if statement.

Add an else statement setting that to false.

Return the logic variable.

 

If I help you please say thank you because, after I help, most people just leave.

Last seen on 14:02, 14. Oct 2020
Joined Jun 2020
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Another way to do this is to…
Tue, 09/08/2020 - 23:50

Another way to do this is to place another return statement outside of the if statement. Here's how it works: what your code does is it returns true if the target's xp is greater than 5, but it forgets to return false if not. You simply need to add a return statement that is set to false after the if statement, so that the program can figure out what to do if the xp level is less than 5.