Mr BrycE Posted June 27, 2013 Group: Members Topic Count: 125 Topics Per Day: 0.03 Content Count: 595 Reputation: 24 Joined: 02/23/12 Last Seen: April 1, 2018 Share Posted June 27, 2013 hi, i would like to request a moving npc that, after passing through set of x,and y arrays the last set of x and y will hideoff the npc... like.. setarray .x[0],50,59,70,82,99,99,100,102,115,127,142,161,175,191,211,216,212,212; setarray .y[0],203,201,200,193,185,172,155,139,138,149,163,166,156,151,158,171,186,196; in the 212,196, the npc will hide... and also, if possible...in each passing array of x,y will put space for triggering some event... like.. in 50,203, monsterwill spawn, or enablenpc,hideoffnpc something like that...>.< Quote Link to comment Share on other sites More sharing options...
Skorm Posted June 27, 2013 Group: Forum Moderator Topic Count: 33 Topics Per Day: 0.01 Content Count: 1282 Reputation: 393 Joined: 02/03/12 Last Seen: April 11 Share Posted June 27, 2013 (edited) Alright I did some testing and I got it working really well... but your cords are still a little bit messedup when he trys to move past the wall. Just add some more when he goes through the gate... I've included my test cords if you'd like to see. prontera,37,207,3 script MovingNPC 1004,{ if( .b ){ npctalk "Go away I'm busy!"; end; } set .b, 1; for(set .a,0;.a<getarraysize(.x);set .a,.a+1) { npcwalkto .x[.a],.y[.a]; //Other commands go here... while( 1 ){ getmapxy(.map$,.x3,.y3,1); sleep 100; getmapxy(.map$,.x2,.y2,1); if(.x3==.x2&&.y3==.y2) if( .x2==.x[.a]&&.y2==.y[.a] ) break; } if(!.a) { monster strnpcinfo(4),.x[.a],.y[.a],"Poring",1002,1; //enablenpc strnpcinfo(0); } } npcstop; disablenpc strnpcinfo(0); set .b, 0; end; OnInit: npcspeed 200; setarray .x[0],50,59,70,82,99,99,100,102,115,127,142,161,175,191,211,216,212,212; setarray .y[0],203,201,200,193,185,172,155,139,138,149,163,166,156,151,158,171,186,196; //setarray .x[0], 47, 56, 65, 76, 86, 97, 103, 113, 126, 134, 138/*, 161, 175, 191, 211, 216, 212, 212*/; //setarray .y[0], 208, 207, 205, 204, 204, 204, 204, 204, 204, 204, 204/*, 166, 156, 151, 158, 171, 186, 196*/; }Keep in mind if the npc can't get to the cords you've put then it will loop forever and the ending bits won't be run. Edited June 27, 2013 by Skorm 1 Quote Link to comment Share on other sites More sharing options...
Skorm Posted June 27, 2013 Group: Forum Moderator Topic Count: 33 Topics Per Day: 0.01 Content Count: 1282 Reputation: 393 Joined: 02/03/12 Last Seen: April 11 Share Posted June 27, 2013 (edited) hi, i would like to request a moving npc that, after passing through set of x,and y arrays the last set of x and y will hideoff the npc... like.. setarray .x[0],50,59,70,82,99,99,100,102,115,127,142,161,175,191,211,216,212,212; setarray .y[0],203,201,200,193,185,172,155,139,138,149,163,166,156,151,158,171,186,196; in the 212,196, the npc will hide... and also, if possible...in each passing array of x,y will put space for triggering some event... like.. in 50,203, monsterwill spawn, or enablenpc,hideoffnpc something like that...>.< prontera,100,100,3 script MovingNPC 100,{ //Commands run when npc is clicked. end; OnInit: npcspeed 100; setarray .x[0],50,59,70,82,99,99,100,102,115,127,142,161,175,191,211,216,212,212; setarray .y[0],203,201,200,193,185,172,155,139,138,149,163,166,156,151,158,171,186,196; for(set .a,0;.a<getarraysize(.x);set .a,.a+1) { npcwalkto .x[.a],.y[.a]; //Other commands go here... if(!.a) { monster strnpcinfo(4),.x[.a],.y[.a],"Poring",1002,1; enablenpc strnpcinfo(0); } } npcstop; disablenpc strnpcinfo(0); }Untested... Edited June 27, 2013 by Skorm Quote Link to comment Share on other sites More sharing options...
Mr BrycE Posted June 27, 2013 Group: Members Topic Count: 125 Topics Per Day: 0.03 Content Count: 595 Reputation: 24 Joined: 02/23/12 Last Seen: April 1, 2018 Author Share Posted June 27, 2013 (edited) the monster is spawned right after i. @reloadscript, i didn't touch the npc , but when i do nothing is happening EDIT: doesn't walk either... EDIT 2: i have here.. pay_fild02,46,209,5 script Teemo#1 518,1,7,{ end; OnInit: disablenpc "Teemo#1"; initnpctimer; setarray .x[0],50,59,70,82,99,99,100,102,115,127,142,161,175,191,211,216,212,212; setarray .y[0],203,201,200,193,185,172,155,139,138,149,163,166,156,151,158,171,186,196; set .a,0; set .m$,"pay_fild02"; end; L_OkayLakad: getmapxy(.m$,.nowx,.nowy,1); if (.nowx != .x[.a] && .nowy != .y[.a] && .stop != 1) { npcwalkto .x[.a],.y[.a]; } else {set .a,.a+1; if (.a >= getarraysize(.x)) set .a,0; } initnpctimer; end; OnTouch: goto L_OkayLakad; set .stop,1; set .stop,0; goto L_OkayLakad; end; } but...i do not know where to put space for triggering an event....just like in my request...( i search about moving npc, its from nanakwitz. ) Edited June 27, 2013 by Mr BrycE Quote Link to comment Share on other sites More sharing options...
Skorm Posted June 27, 2013 Group: Forum Moderator Topic Count: 33 Topics Per Day: 0.01 Content Count: 1282 Reputation: 393 Joined: 02/03/12 Last Seen: April 11 Share Posted June 27, 2013 (edited) Ok so you want the npc to work when you click it???? prontera,100,100,3 script MovingNPC 100,{ if( .b ){ npctalk "Go away I'm busy!"; end; } set .b, 1; for(set .a,0;.a<getarraysize(.x);set .a,.a+1) { npcwalkto .x[.a],.y[.a]; //Other commands go here... while( .x2!=.x[.a]&&.y2!=.y[.a] ){ sleep 100; getmapxy(.map$,.x2,.y2,1); } if(!.a) { monster strnpcinfo(4),.x[.a],.y[.a],"Poring",1002,1; enablenpc strnpcinfo(0); } } npcstop; disablenpc strnpcinfo(0); set .b, 0; end; OnInit: npcspeed 100; setarray .x[0],50,59,70,82,99,99,100,102,115,127,142,161,175,191,211,216,212,212; setarray .y[0],203,201,200,193,185,172,155,139,138,149,163,166,156,151,158,171,186,196; }NPCs walking can be very tricky the cordinates need to be close together and in straight lines for it to work right. Edited June 27, 2013 by Skorm Quote Link to comment Share on other sites More sharing options...
Mr BrycE Posted June 27, 2013 Group: Members Topic Count: 125 Topics Per Day: 0.03 Content Count: 595 Reputation: 24 Joined: 02/23/12 Last Seen: April 1, 2018 Author Share Posted June 27, 2013 may i ask if there's a limit for the coordinates? i can't complete is route, ive adjusted it to smaller squares but it still doesnt complete its route... Quote Link to comment Share on other sites More sharing options...
Mr BrycE Posted June 27, 2013 Group: Members Topic Count: 125 Topics Per Day: 0.03 Content Count: 595 Reputation: 24 Joined: 02/23/12 Last Seen: April 1, 2018 Author Share Posted June 27, 2013 (edited) Thanks, Skorm!, anyways for my coords, its for map pay_fild02, i retype all the coords again...now working fine... as for triggering some events...ill try to work it out from your script..thanks! Edited June 27, 2013 by Mr BrycE Quote Link to comment Share on other sites More sharing options...
Skorm Posted June 27, 2013 Group: Forum Moderator Topic Count: 33 Topics Per Day: 0.01 Content Count: 1282 Reputation: 393 Joined: 02/03/12 Last Seen: April 11 Share Posted June 27, 2013 (edited) Thanks, Skorm!, anyways for my coords, its for map pay_fild02, i retype all the coords again...now working fine... as for triggering events some events...ill try to work it out from your script..thanks! No problem I do recommend you change the sleep value to something higher like 100 because it performs the same and decreases server load. If you have anymore questions you know where to find me. tytyty! Edited June 27, 2013 by Skorm Quote Link to comment Share on other sites More sharing options...
Question
Mr BrycE
hi, i would like to request a moving npc that, after passing through set of x,and y arrays the last set of x and y will hideoff the npc...
like..
and also, if possible...in each passing array of x,y will put space for triggering some event...
like..
in 50,203, monsterwill spawn, or enablenpc,hideoffnpc something like that...>.<
Link to comment
Share on other sites
7 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.