Jump to content

Recommended Posts

Posted

Еще раз здравствуйте все.

Вы наверное уже от меня устали :D

В общем например такой скрипт:

location,100,100,1 script Example::ex 90,{
if(.speak == 1) goto sorry;
set .speak,1;
set .name$,strcharinfo(0);
mes "[Example]";
mes "Part of this NPC is free, you can talk to him.";
next;
mes "[Example]";
mes "The first player is in conversation with the NPC.";
next;
mes "[Example]";
mes "The first player finishes a conversation with the NPC.";
set .speak,0;
close;

sorry:
mes "";
mes "Sorry. Currently, "+.name$+" is talking to the NPC..";
close;
}

Вроде бы все работает.

Но.

Если добавить меню.

location,100,100,1 script Example::ex 90,{
if(.speak == 1) goto sorry;
set .speak,1;
set .name$,strcharinfo(0);
mes "[Example]";
mes "Part of this NPC is free, you can talk to him.";
next;
mes "[Example]";
mes "The first player was invited to the menu.";
next;
switch(select("The first menu item:The second menu item:The third menu item") {
case 1:
mes "[Example]";
mes "The first player selected first menu item.";
set .speak,0;
close;
case 2:
mes "[Example]";
mes "The first player selected the second menu item.";
set .speak,0;
close;
case 3:
mes "[Example]";
mes "The first player has chosen the third element of the menu.";
set .speak,0;
close;
sorry:
mes "";
mes "Sorry. Currently, "+.name$+" is talking to the NPC..";
close;
}

Сам по себе образуется баг - когда НПС выдает меню и если не выбирать какой то элемент меню, а выйти из диалога, то переменная .спек не обнулится и никто не сможет больше с этим НПС поговорить. Может кто нибудь сможет придумать как обойти эту проблему?

Заранее Спасибо.

Posted (edited)
location,100,100,1 script Example::ex 90,{
if(.speak == 1) goto sorry;
set .speak,1;
set .name$,strcharinfo(0);
mes "[Example]";
mes "Part of this NPC is free, you can talk to him.";
next;
mes "[Example]";
mes "The first player was invited to the menu.";
next;
switch(select("The first menu item:The second menu item:The third menu item") {
case 1:
mes "[Example]";
mes "The first player selected first menu item.";
set .speak,0;
break;
case 2:
mes "[Example]";
mes "The first player selected the second menu item.";
set .speak,0;
break;
case 3:
mes "[Example]";
mes "The first player has chosen the third element of the menu.";
set .speak,0;
break;
}
close;
sorry:
mes "";
mes "Sorry. Currently, "+.name$+" is talking to the NPC..";
break;
}

Edited by Lilith
Posted (edited)

Спасибо, но не помогло(

d0b9edca79373c4d9c3ff059aa5790cc.jpg

Нажимаешь отмена, и все. Крындец =(

При нажатии Отмена же нельзя по идее действия выбрать и обнулить переменную при выходе через кнопку отмена(

Edited by Sparrow
Posted (edited)
location,100,100,1 script Example::ex 90,{
if(.speak == 1) goto sorry;
set .speak,1;
set .name$,strcharinfo(0);
mes "[Example]";
mes "Part of this NPC is free, you can talk to him.";
next;
mes "[Example]";
mes "The first player was invited to the menu.";
next;
switch(prompt("The first menu item:The second menu item:The third menu item")) {
case 1:
mes "[Example]";
mes "The first player selected first menu item.";
set .speak,0;
break;
case 2:
mes "[Example]";
mes "The first player selected the second menu item.";
set .speak,0;
break;
case 3:
mes "[Example]";
mes "The first player has chosen the third element of the menu.";
set .speak,0;
break;
default:
set .speak,0;
break;
}
close;
sorry:
mes "";
mes "Sorry. Currently, "+.name$+" is talking to the NPC..";
break;
}

Edited by Lilith

Join the conversation

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

Guest
Reply to this topic...

×   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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...