Page 1 of 1

Mana Sphere Crashes Editor

PostPosted: Sat Nov 11, 2023 1:15 am
by Prickett
I want the mana sphere to not be used if you are full mana, which would be a nice quality of life update. Here's the code I'm trying, which compiles, but crashes the editor when I click on the sphere. Any ideas?

if(evtuse())
{
if(Player.getsp()<Player.getmaxsp())
{
if(getday()>=getstate())
{
message("You touch the sphere and feel mentally refreshed.");
player.setfullsp();
setstate(getday()+7);
}
else
message("You touch the sphere but nothing happens.");
}
if(Player.getsp()>=Player.getmaxsp())
{
message("There's no need to use this, your mana is full.")
}
}
else
default();

Re: Mana Sphere Crashes Editor

PostPosted: Sat Nov 11, 2023 10:00 am
by Elendil / Redshift
Try this:
Code: Select all
if(evtuse())
{
  if(player.getsp()<player.getmaxsp())
  {
    if(getday()>=getstate())
    {
      message("You touch the sphere and feel mentally refreshed.");
      player.setfullsp();
      setstate(getday()+7);
    }
    else
        message("You touch the sphere but nothing happens.");
  }
  else
    message("There's no need to use this, your mana is full.")
}
else
  default();

(I replaced "Player" with "player" (I'm not sure about it but maybe "player" is case sensitive.)
And replaced the second check of the player's mana with an "else" (this is just better, the original shouldn't crash, except maybe the "Player" part).)

Re: Mana Sphere Crashes Editor

PostPosted: Sun Nov 12, 2023 7:36 am
by Prickett
Thanks, Elendil! I’ll let you know how it goes when I get a chance to try it on my PC.