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 04:16, 4. Dec 2021
Joined Sep 2019
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:49, 3. Nov 2021
Joined Nov 2018
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 20:09, 7. Dec 2021
Joined Jun 2020
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.

Last seen on 18:29, 14. Jan 2021
Joined Dec 2020
Points:

User statistics:

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

Last seen on 07:01, 1. Dec 2021
Joined Oct 2020
Points:

User statistics:

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