Walking NPC (Random coordinates.)

karazu

New member
Messages
1,115
Points
0
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? 

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

try  Annie's script

Code:
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;}
 
Last edited by a moderator:
Code:
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;}
 
Oh sorry for my code. Misunderstood your request. I thought moving npc
default_tongue.png


 
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?

 
Last edited by a moderator:
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

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

 

 
Last edited by a moderator:
This

Code:
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;}
 
 
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..

Code:
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;}
 
Hi!

How to implement forward movement? Like NPC must walk from left cornet to the right cornet of the city.

 
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
default_tongue.png
.

 
 
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

 
 
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]

 
[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

Code:
- npctalk callfunc("F_RandMes", 2, "I'm talking.","Hello!");+ npctalk callfunc("F_Rand","I'm talking.","Hello!");
 
How can i make this one use the "walk animation" instead of "sliding"???

Code:
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;}
 
How can i make this one use the "walk animation" instead of "sliding"???

Code:
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.
 
Back
Top