buff script

asturia

Minion
This is a part of my buff script, but it fails when I do not have enough mp to cast it.
can anyone have a look at it and give me some recommandations on how to improve it?
Code:
while( have_effect( $effect[leash of linguini]) < my_adventures())
		{
			restoremp();
			int amountleft = my_adventures() - have_effect( $effect[leash of linguini]);
			int touse = (amountleft / 10) + 1;
			use_skill( touse, $skill[leash of linguini]);
		}
 

Nightmist

Member
Try adding a basic MP check. (Messy but just wrote it now.)
Code:
if( touse*12 < my_mp())
{
 use_skill( touse, $skill[leash of linguini]);
}
else
{
 if( my_mp() >= 12)
 {
  use_skill( my_mp()/12, $skill[leash of linguini]);
 }
}
Yeah it doesnt even try to account for buff turns increasing//mp decreasing items so that might be another thing to add.

You can also stick a check to see if your max MP is enough to even cast the skill once and then if yes then check if you need to restore MP.

You may also want to add some sort of leash before and leash after check and "break" the while if they end up the same at the end of the script.
 
Top