Post Pacific

Post Pacific (https://postpacific.loc-online.com/index.php)
-   Темы без сохранившегося раздела (https://postpacific.loc-online.com/forumdisplay.php?f=10001)
-   -   [Share]Global Teleporter (https://postpacific.loc-online.com/showthread.php?t=5036)

Frozen 03.07.2006 06:20

[Share]Global Teleporter
 
Not sure if many people would find this usefull, it's my first "big" project in AI. I don't think I don't need to go over it much.. It's just a global gk that charges 2k adena for each port. And if you have a certain item, it lets your teleport free. Also checks if your a GM to use the GM teleports. And there is a Karma Check, if you have any karma, you can't teleport. I'm sure you can tweak it a bit to how you like it.
~Frozen

Edit : I'd also like to thanks Fabian and Kenster for helping me get started with NASC. Thanks again guys ^^

Вложения из исходного сообщения (сами файлы в копии отсутствуют):
global_teleporter_108.rar — 12628 байт

HF 03.07.2006 07:23

interested, but... where it can use? GM use bookmarks or not have access to summon this npc. Add this to standart class?
class teleporter : globalteleporter
?

next. Your code very bigger. You must find way for optimise this. Example, first sample

Code:

                if (ask == 1 && reply == 5) { //Talking Island
                        if (i1 > 0) {
                                InstantTeleport(talker, -84318, 244579, -3730);
                        }
                        else if (i1 == 0) {
                                DeleteItem1(talker, @adena, 2000);
                                InstantTeleport(talker, -84318, 244579, -3730);
                        }
                }

to

Code:

        if (ask == 1 && reply == 5)
                  { //Talking Island
                        if (i1 == 0)
                          {
                                DeleteItem1(talker, @adena, 2000);
                          }

                        InstantTeleport(talker, -84318, 244579, -3730);
                }


zcold 03.07.2006 08:16

I think this code need "heavy" optimization ;)
Look, you take 2k adena every time for teleports, if player haven't item @chrono_campana.

And you check every time for that item, if player haven't that item - you delete 2k adena and teleport him.

1. You haven't check, if player have 2k adena. You just delete it.
2. You have check for item @chrono_campana in every teleport.
More optimized will be:
Code:

EventHandler MENU_SELECTED(ask, reply, talker, i0, i1) {
i1 = OwnItemCount(talker, @chrono_campana);

if (ask == 1 && reply > 0)
{

if (OwnItemCount(talker, @adena)<2000 && i1==0)
                      ShowPage(talker, "not_enough_adena.htm");
else
{
if (i1 == 0)
                      DeleteItem1(talker, @adena, 2000);

select(reply)
{
case 1        :
{                                       
InstantTeleport(talker, 46934, 51467, -2977);
break;
}
case 2        :
{                                       
InstantTeleport(talker, 9745, 15606, -4574);
break;
}
case 3        :
{                                       
InstantTeleport(talker, -44836, -112524, -235);
break;
}
..........................and so on
}
}

}

}

I hope you got idea ;)

Frozen 03.07.2006 09:01

Well like I said.. first big project like that, still learnin NASC. Thanks for the help guys :)

RetaL 03.07.2006 10:23

I've tested it,mainland places doesn't work O.o

HF 03.07.2006 10:50

Quote:

Originally Posted by RetaL
I've tested it,mainland places doesn't work O.o

Ah, what to mountain.

Frozen 03.07.2006 20:07

Ooh yeah, gotta resave the mainland.htm into unicode.. sorry bout that one :X

LoVeRSaMa 04.07.2006 16:48

Not bad work Frozen :)
I kinda sead befor that i wanted 2 try make a VIP/Hero type of gatekeeper and shop :P

pleassse Share some shops >.<

<3 ^^

silence_ 06.07.2006 20:34

Good job thanks a lot man.. Even compiled AI. gg :D Btw, has any of you compiled the subclass.txt from the attachments file? (subclass_663.rar)


All times are GMT. The time now is 15:48.