Jump to content
  • 0

How to stop script if player dies during script ?


Auryn

Question


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  147
  • Reputation:   1
  • Joined:  01/26/12
  • Last Seen:  

Here is the councerned part of the script.

I would like the player get a chance to die with the final

heal -100,+0;

.

But when I try dying during the script, I get stuck and when i try do add a

break;

, I get an error.

mes "[Antitée]";
mes "Laisse nous evaluer tes forces.";
skilleffect 812,5000;
percentheal -1, -1;
sleep2 50;
percentheal -1, -1;
sleep2 50;
percentheal -1, -1;
sleep2 50;
percentheal -1, -1;
sleep2 50;
percentheal -1, -1;
sleep2 50;
percentheal -1, -1;
sleep2 50;
percentheal -1, -1;
sleep2 50;
percentheal -1, -1;
sleep2 50;
percentheal -1, -1;
sleep2 50;
percentheal -1, -1;
sleep2 50;
percentheal -1, -1;
sleep2 50;
percentheal -1, -1;
sleep2 50;
// repeating x100
percentheal -1, -1;
heal -100,+0;
next;
mes "[Antitée]";
mes "Très bien.";
next;
mes "[Antitée]";
mes "A présent, nous allons te poser quelques questions.";
next;

[...]

Edit : I have a secound question :

Can I make the script continue out of the NPC ?

Like :

mes "[Antitée]";
mes "Laisse nous evaluer tes forces.";
close;
// keep going
skilleffect 812,5000;
percentheal -1, -1;
sleep2 50;
percentheal -1, -1;
sleep2 50;
percentheal -1, -1;
sleep2 50;
percentheal -1, -1;

Edited by Auryn
Link to comment
Share on other sites

6 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  94
  • Topics Per Day:  0.02
  • Content Count:  2192
  • Reputation:   252
  • Joined:  11/11/11
  • Last Seen:  

close2;

// keep going

Edit : I have a secound question :

Can I make the script continue out of the NPC ?

To elaborate on what close2; is supposed to do:

---------------------------------------

*close2;

This command will create a 'close' button in the message window for the invoking

character. WARNING: If no window is currently on screen, the script execution will halt

indefinitely! See 'close'. There is one important difference, though - even though

the message box will have closed, the script execution will not stop, and commands after

'close2' will still run, meaning an 'end' has to be used to stop the script, unless you

make it stop in some other manner.

mes "[Woman]";

mes "I will warp you now";

close2;

warp "place",50,50;

end;

Don't expect things to run smoothly if you don't make your scripts 'end'.

---------------------------------------

And then the use of end; on why you need it after using close2;

*end;

This command will stop the execution for this particular script. The two

versions are perfectly equivalent. It is the normal way to end a script which

does not use 'mes'.

if (BaseLevel<=10) goto L_Lvl10;

if (BaseLevel<=20) goto L_Lvl20;

if (BaseLevel<=30) goto L_Lvl30;

if (BaseLevel<=40) goto L_Lvl40;

if (BaseLevel<=50) goto L_Lvl50;

if (BaseLevel<=60) goto L_Lvl60;

if (BaseLevel<=70) goto L_Lvl70;

L_Lvl10:

npctalk "Look at that you are still a n00b";

end;

L_Lvl20:

npctalk "Look at that you are getting better, but still a n00b";

end;

L_Lvl30:

npctalk "Look at that you are getting there, you are almost 2nd profession now right???";

end;

L_Lvl40:

npctalk "Look at that you are almost 2nd profession";

end;

Without the use if 'end' it would travel through the labels until the end of the

script. If you were lvl 10 or less, you would see all the speech lines, the use

of 'end' stops this, and ends the script.

--------------------------------------

https://rathena.svn.sourceforge.net/svnroot/rathena/trunk/doc/script_commands.txt

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2350
  • Joined:  10/28/11
  • Last Seen:  

try this

close2;
while( HP > 1 ){
percentheal -1,-1;
sleep2 50;
}
percentheal -100,-100;
end;

  • Upvote 2
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  147
  • Reputation:   1
  • Joined:  01/26/12
  • Last Seen:  

Thanks you all for your help, and thank you emistry for this exemple.

I have one more questions to add :

How can I temporary desactivate the teleport skill / use of fly wings/butterfly wings ?

Edited by Auryn
Link to comment
Share on other sites


  • Group:  Development Manager
  • Topic Count:  56
  • Topics Per Day:  0.01
  • Content Count:  732
  • Reputation:   525
  • Joined:  12/13/11
  • Last Seen:  

A dirty quick way, add this:

map[i].noteleport = 1; // disallow teleport
map[i].noreturn  = 1;  // disallow returns

Add that in map_flags_init() in src/map/map.c after the jexp mapflag. This will disallow teleporting and returns on every single map on server load. Remember to recompile!

Edited by Aleos
Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2350
  • Joined:  10/28/11
  • Last Seen:  

there is setmapflag and removemapflag

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...