Jump to content
  • 0

Walkable and talkable NPC


Question

Posted

Hi,

Its a request, can any one make me a script which can walk in prontera and randomly speak??

i m using eathena r15200 .

client version 2010

its a request please help!!

13 answers to this question

Recommended Posts

  • 1
Posted

@Joseph script is closest, but not optimized enough

prontera,156,177,5    script    kdjfhkshf2    100,{
   end;
OnInit:
   .@interval = 5;
   .@step = 5;
   while (1) {
       sleep .@interval * 1000;
       getmapxy .@map$, .@x, .@y, 1;
       while ( checkcell( .@map$, .@npc_x = .@x + rand( -.@step, .@step ), .@npc_y = .@y + rand( -.@step, .@step ), cell_chknopass ) );
       npcwalkto .@npc_x, .@npc_y;
       npctalk callfunc( "F_RandMes", 2,
           "I'm talking.", // 1
           "Hello!" // 2
           );
   }
   end; // doesn't read
}

F_RandMes is 1 of the global function inside our svn

its much cleaner than setting an array with getarraysize

also much cleaner than switch( rand(x) ) { case 1: ... break; case2: .... break; }

our crappy script engine parse switch, case and break very ugly

F_RandMes is also consider 1 of the unique function only to *athena script language

  • Upvote 1
Posted

Hah. Thanks for pointing out the existence of those functions.

I agree some of the script commands are ugly parsed, but the thing is you still have to use them (it's all over the trunk/npc folder).

Posted
also much cleaner than switch( rand(x) ) { case 1: ... break; case2: .... break; }

our crappy script engine parse switch, case and break very ugly

Not really. It's the exact copy of a switch in IPLs. it's perfectly functional and way better than a gettarraysize if not in some dynamic cases.

And since long ago, npcwalkto was a bit broken, better use unitwalk tho.

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.

  • Recently Browsing   0 members

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