Trying to make a ranged weapon use condition

Started by ImNotFun on

Topic category: Help with MCreator software

Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Trying to make a ranged weapon use condition

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

Joined Nov 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • 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.

Joined Jun 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • 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.

Joined Dec 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
hey i know this is old but,…
Fri, 12/11/2020 - 23:25

hey i know this is old but, how did you do that "get xp level of"? trying to make a procedure that if you have exp levels, it will take away 1 xp level and give you  a piece of diamond. if you don't, it will give nothing

Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
@DestroyerOFC3 Code block…
Sat, 12/12/2020 - 18:35

@DestroyerOFC3 Code block procedure builder has search bar at the top in newer versions you can use. Otherwise it should be in the 'Player procedures' tab