Jump to content
  • 0

(Help) Moving NPC with GM list


dragonbautista

Question


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  11
  • Reputation:   0
  • Joined:  04/14/15
  • Last Seen:  


izlude,128,106,4 script GM Online Lists 811,{

mes "Staffs Online Lists : ^FF0000"+getarraysize( .GM_Name$ )+"^000000 Staffs";

mes "^0000FF_____________________________^000000";

for( set .@i,0; .@i < getarraysize( .GM_Name$ ) ; set .@i,.@i + 1 ){

getmapxy( .Map$,.x,.y,0,.GM_Name$[.@i] );

mes "[ Lv ^63D1F4"+.GM_Level[.@i]+"^000000 ] ^FF0000@ ^0000FF"+.GM_Name$[.@i]+"^000000";

mes "Location : ^0000FF"+.Map$+"^000000";

mes "^0000FF_____________________________^000000";

}

close;

OnInit:

set .MinGMLevel,40; // Min. GM Level to Show in Online Lists

end;

OnPCLoginEvent:

if( getgmlevel() < .MinGMLevel ) end;

set .GM_Name$[ getarraysize( .GM_Name$ ) ],strcharinfo(0);

set .GM_Level[ getarraysize( .GM_Level ) ],getgmlevel();

end;

OnPCLogoutEvent:

if( getgmlevel() < .MinGMLevel ) end;

for( set .@i,0; .@i < getarraysize( .GM_Name$ ) ; set .@i,.@i + 1 ){

if( strcharinfo(0) != .GM_Name$[.@i] ) continue;

deletearray .GM_Name$[.@i],1;

deletearray .GM_Level[.@i],1;

end;

}

end;

}

Edited by Emistry
codebox.
Link to comment
Share on other sites

10 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  513
  • Reputation:   83
  • Joined:  08/11/12
  • Last Seen:  

Tested and working. Made the NPC walk towards the coordinates every 6 seconds. Just change the OnTimerXXXXXX to suit your needs.

izlude,128,106,4	script	GM Online Lists	811,{
mes "Staffs Online Lists : ^FF0000"+getarraysize( .GM_Name$ )+"^000000 Staffs";
mes "^0000FF_____________________________^000000";
for( set .@i,0; .@i < getarraysize( .GM_Name$ ) ; set .@i,.@i + 1 ){
    getmapxy( .Map$,.x,.y,0,.GM_Name$[.@i] );
    mes "[ Lv ^63D1F4"+.GM_Level[.@i]+"^000000 ] ^FF0000@ ^0000FF"+.GM_Name$[.@i]+"^000000";
    mes "Location : ^0000FF"+.Map$+"^000000";
    mes "^0000FF_____________________________^000000";
    }
close;

OnPCLoginEvent:
if( getgmlevel() < .MinGMLevel ) end;
set .GM_Name$[ getarraysize( .GM_Name$ ) ],strcharinfo(0);
set .GM_Level[ getarraysize( .GM_Level ) ],getgmlevel();
end;

OnPCLogoutEvent:
if( getgmlevel() < .MinGMLevel ) end;
for( set .@i,0; .@i < getarraysize( .GM_Name$ ) ; set .@i,.@i + 1 ){
    if( strcharinfo(0) != .GM_Name$[.@i] ) continue;
    deletearray .GM_Name$[.@i],1;
    deletearray .GM_Level[.@i],1;
    end;
    }
end;

OnInit:
set .MinGMLevel,40;        // Min. GM Level to Show in Online Lists
set .pos, 1; // starting at position 1
initnpctimer;
end;

OnTimer6000: //number of milliseconds that this NPC will stay at certain coordinate
	Switch(.pos){
		case 1:
			npcwalkto 128,106;
			set .pos, 2;
			break;
		case 2:
			npcwalkto 115,114;
			set .pos, 3;
			break;
		case 3:
			npcwalkto 128,117;
			set .pos, 4;
			break;
		case 4:
			npcwalkto 139,114;
			set .pos, 5;
			break;
		case 5:
			npcwalkto 128,106;
			set .pos, 1;
			break;
	}
	initnpctimer;
	end;
}

unitwalk

 

yeah thought of that but used npcwalkto instead. thakns for the suggestion :)

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  513
  • Reputation:   83
  • Joined:  08/11/12
  • Last Seen:  

How do you exactly want it to "move"?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  11
  • Reputation:   0
  • Joined:  04/14/15
  • Last Seen:  

Walking npc in our main town

Edited by dragonbautista
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  513
  • Reputation:   83
  • Joined:  08/11/12
  • Last Seen:  

For that I will be needing a set of coordinates where you want this NPC to be standing at.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  513
  • Reputation:   83
  • Joined:  08/11/12
  • Last Seen:  

Please give this a try. Compiled but not tested.

izlude,128,106,4	script	GM Online Lists	811,{
mes "Staffs Online Lists : ^FF0000"+getarraysize( .GM_Name$ )+"^000000 Staffs";
mes "^0000FF_____________________________^000000";
for( set .@i,0; .@i < getarraysize( .GM_Name$ ) ; set .@i,.@i + 1 ){
    getmapxy( .Map$,.x,.y,0,.GM_Name$[.@i] );
    mes "[ Lv ^63D1F4"+.GM_Level[.@i]+"^000000 ] ^FF0000@ ^0000FF"+.GM_Name$[.@i]+"^000000";
    mes "Location : ^0000FF"+.Map$+"^000000";
    mes "^0000FF_____________________________^000000";
    }
close;

OnPCLoginEvent:
if( getgmlevel() < .MinGMLevel ) end;
set .GM_Name$[ getarraysize( .GM_Name$ ) ],strcharinfo(0);
set .GM_Level[ getarraysize( .GM_Level ) ],getgmlevel();
end;

OnPCLogoutEvent:
if( getgmlevel() < .MinGMLevel ) end;
for( set .@i,0; .@i < getarraysize( .GM_Name$ ) ; set .@i,.@i + 1 ){
    if( strcharinfo(0) != .GM_Name$[.@i] ) continue;
    deletearray .GM_Name$[.@i],1;
    deletearray .GM_Level[.@i],1;
    end;
    }
end;

OnInit:
set .MinGMLevel,40;        // Min. GM Level to Show in Online Lists
set .pos, 1; // starting at position 1
initnpctimer;
end;

OnTimer600000: //number of milliseconds that this NPC will stay at certain coordinate
	Switch(.pos){
		case 1:
			movenpc "GM Online Lists",128,106;
			set .pos, 2;
			break;
		case 2:
			movenpc "GM Online Lists",115,114;
			set .pos, 3;
			break;
		case 3:
			movenpc "GM Online Lists",128,117;
			set .pos, 4;
			break;
		case 4:
			movenpc "GM Online Lists",139,114;
			set .pos, 5;
			break;
		case 5:
			movenpc "GM Online Lists",128,106;
			set .pos, 1;
			break;
	}
	initnpctimer;
	end;
}
Edited by jezznar
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  513
  • Reputation:   83
  • Joined:  08/11/12
  • Last Seen:  

Posted · Hidden by Emistry, September 30, 2015 - No reason given
Hidden by Emistry, September 30, 2015 - No reason given

Its working now! Thanks

 

You're welcome. Please mark this thread as solved from the solution I gave. Thanks :)

Link to comment

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.

×
×
  • Create New...