Mana Sphere Crashes Editor

This forum is for discussing anything related to The Quest editor.

Mana Sphere Crashes Editor

Postby Prickett » Sat Nov 11, 2023 1:15 am

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();
Prickett
 
Posts: 650
Joined: Mon Jul 22, 2013 2:39 am
Location: Georgia, USA

Re: Mana Sphere Crashes Editor

Postby Elendil / Redshift » Sat Nov 11, 2023 10:00 am

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).)
User avatar
Elendil / Redshift
Site Admin
 
Posts: 942
Joined: Sun Oct 09, 2011 11:35 am

Re: Mana Sphere Crashes Editor

Postby Prickett » Sun Nov 12, 2023 7:36 am

Thanks, Elendil! I’ll let you know how it goes when I get a chance to try it on my PC.
Prickett
 
Posts: 650
Joined: Mon Jul 22, 2013 2:39 am
Location: Georgia, USA


Return to Editor

Who is online

Users browsing this forum: No registered users and 37 guests

cron