Jump to content
  • 0
karazu

Walking NPC (Random coordinates.)

Question

Is it possible now to make a walking/moving NPC that walks randomly in the MAP?

I know it exist today but i just dont like the idea that It will just walk to the Coordinate that you put.


is it possible? 

Share this post


Link to post
Share on other sites

21 answers to this question

Recommended Posts

  • 0

http://rathena.org/board/topic/74196-walkable-and-talkable-npc/?p=155955

 

try  Annie's script

 

 

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;}
Edited by Angelmelody

Share this post


Link to post
Share on other sites
  • 0
prontera,150,150,0	script	Sample	100,{	.@x = rand(100,500);	.@y = rand(100,500);	if ( checkcell( strnpcinfo(4), .@x, .@y, cell_chkpass ) )		 movenpc strnpcinfo(1), .@x, .@y;	end;}

Share this post


Link to post
Share on other sites
  • 0

 

http://rathena.org/board/topic/74196-walkable-and-talkable-npc/?p=155955

 

try  Annie's script

 

 

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;}

Using this now and its perfect.

 

 

How about if I will disable the talking?

 

because the NPC spams alot. XD could u teach me how to disable it please?

Edited by karazu

Share this post


Link to post
Share on other sites
  • 0

 

 

http://rathena.org/board/topic/74196-walkable-and-talkable-npc/?p=155955

 

try  Annie's script

 

 

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;}

Using this now and its perfect.

 

 

How about if I will disable the talking?

 

because the NPC spams alot. XD could u teach me how to disable it please?

 

 comment out  npctalk ....

    // npctalk callfunc( "F_RandMes", 2,

    // "I'm talking.", // 1

    // "Hello!" // 2

Share this post


Link to post
Share on other sites
  • 0
 

 

 

 

http://rathena.org/board/topic/74196-walkable-and-talkable-npc/?p=155955

 

try  Annie's script

 

 

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;
}

Using this now and its perfect.


How about if I will disable the talking?

because the NPC spams alot. XD could u teach me how to disable it please?

 

 comment out  npctalk ....

  // npctalk callfunc( "F_RandMes", 2,
  // "I'm talking.", // 1
  // "Hello!" // 2


The problem is it doesn't walk anymore..

 

Edited by karazu

Share this post


Link to post
Share on other sites
  • 0

This

prontera,150,150,5	script	Sample	100,{    end;OnInit:    while (1) {		do {			.@x = rand(100,500);			.@y = rand(100,500);		} while (!checkcell(strnpcinfo(4),.@x,.@y,cell_chkpass));		npcwalkto .@x, .@y;		sleep 500;    }    end;}

Share this post


Link to post
Share on other sites
  • 0

 

 

 

 

 

http://rathena.org/board/topic/74196-walkable-and-talkable-npc/?p=155955

 

try  Annie's script

 

 

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;

}

Using this now and its perfect.

 

 

How about if I will disable the talking?

 

because the NPC spams alot. XD could u teach me how to disable it please?

 

 comment out  npctalk ....

  // npctalk callfunc( "F_RandMes", 2,

  // "I'm talking.", // 1

  // "Hello!" // 2

 

The problem is it doesn't walk anymore..

 

 

 

 

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;    }    end;}

Share this post


Link to post
Share on other sites
  • 0

That's more complicated. You can do that on scripting, but it's quite a lot more challenging if you don't want the NPC to walk over unwalkable cells. As I said, quite a neat navigation problem that is even still being researched in real life :P .

Share this post


Link to post
Share on other sites
  • 0

 

 

 

 

 

 

 

http://rathena.org/board/topic/74196-walkable-and-talkable-npc/?p=155955

 

try  Annie's script

 

 

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;
}

Using this now and its perfect.


How about if I will disable the talking?

because the NPC spams alot. XD could u teach me how to disable it please?

 

 comment out  npctalk ....

  // npctalk callfunc( "F_RandMes", 2,
  // "I'm talking.", // 1
  // "Hello!" // 2


The problem is it doesn't walk anymore..

 

 

 

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;    }    end;}

[Error]: script:callfunc: function not found! [F_RandMes]

 

doesnt work on latest rev

Share this post


Link to post
Share on other sites
  • 0

 

 

 

 

 

 

 

 

 

 

 

http://rathena.org/board/topic/74196-walkable-and-talkable-npc/?p=155955

 

try  Annie's script

 

 

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;
}

Using this now and its perfect.


How about if I will disable the talking?

because the NPC spams alot. XD could u teach me how to disable it please?

 

 comment out  npctalk ....

  // npctalk callfunc( "F_RandMes", 2,
  // "I'm talking.", // 1
  // "Hello!" // 2


The problem is it doesn't walk anymore..

 

 

 

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;    }    end;}

[Error]: script:callfunc: function not found! [F_RandMes]

 

doesnt work on latest rev

 

 

 

 

Please note : 

 

 

//= 2.17 Renamed 'F_RandMes' to 'F_Rand'. [Euphy]

 

Share this post


Link to post
Share on other sites
  • 0

 

[Error]: script:callfunc: function not found! [F_RandMes]
 

F_RandMes is a global function found in npc/other/Global_Funtions.txt but it has been updated on latest revision from F_RandMes to F_Rand

- npctalk callfunc("F_RandMes", 2, "I'm talking.","Hello!");+ npctalk callfunc("F_Rand","I'm talking.","Hello!");

Share this post


Link to post
Share on other sites
  • 0

How can i make this one use the "walk animation" instead of "sliding"???

 

 

 

izlude,130,135,5	script	Payon Soldier	105,{	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;		}	end;}

 

 

 

Share this post


Link to post
Share on other sites
  • 0

How can i make this one use the "walk animation" instead of "sliding"???

 

 

 

 

izlude,130,135,5	script	Payon Soldier	105,{	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;		}	end;}
 

 

NPC don't have walk animation, use monster sprite ID , if you want walk animation.

Share this post


Link to post
Share on other sites
  • 0

ok i see,

brb testing



@Dastgir

 

yep its working with mob id, try it with new mob from the new episode

 

Hercules should increase #define MAX_NPC_CLASS

inside npc.h

as you see the lower limit is over 6K+ right now

Share this post


Link to post
Share on other sites
  • 0

ok i see,brb testing@Dastgir yep its working with mob id, try it with new mob from the new episode Hercules should increase #define MAX_NPC_CLASSinside npc.has you see the lower limit is over 6K+ right now

Theres some problem which either Haru or Ind needs to take step on,(specially the mob Id range), since those clashes with other ID range.

Share this post


Link to post
Share on other sites
  • 0

so what dev gonna do if they want to advance to the next episode?

------

ok that's different story,

is it possible instead making a passive moving NPC, i want to make them work like a real guard,

when there are monster attacking player, they will eliminate it?

Share this post


Link to post
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.   Restore formatting

  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.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.