MI53RE Posted February 15, 2012 Group: Members Topic Count: 3 Topics Per Day: 0.00 Content Count: 12 Reputation: 0 Joined: 01/14/12 Last Seen: May 8, 2016 Share Posted February 15, 2012 (edited) Hi, So here is my project, to create moving npc using the class sprites in order to make the city more animated (like patroles in WoW for example) but I don't really see how to do it :/ I did read lot of topic and basicly understand the logic behind making a npc but it is only about make them moving that I cannot see what to do :/ if someone already attempted to do it let me know Thank in advance^^!! Edited February 23, 2012 by MI53RE Quote Link to comment Share on other sites More sharing options...
0 ittiphol Posted June 18, 2019 Group: Members Topic Count: 27 Topics Per Day: 0.01 Content Count: 115 Reputation: 7 Joined: 05/09/19 Last Seen: May 20, 2021 Share Posted June 18, 2019 It's not walk but slide no foot step Quote Link to comment Share on other sites More sharing options...
0 botka4aet Posted June 18, 2019 Group: Members Topic Count: 5 Topics Per Day: 0.00 Content Count: 211 Reputation: 17 Joined: 12/23/11 Last Seen: June 11, 2024 Share Posted June 18, 2019 46 minutes ago, ittiphol said: It's not walk but slide no foot step If NO animation in sprite - yes Quote Link to comment Share on other sites More sharing options...
0 ittiphol Posted June 18, 2019 Group: Members Topic Count: 27 Topics Per Day: 0.01 Content Count: 115 Reputation: 7 Joined: 05/09/19 Last Seen: May 20, 2021 Share Posted June 18, 2019 Just now, botka4aet said: If NO animation in sprite - yes yeah maybe not or what the NPC number sprites and where to download animation in sprite Thank you Quote Link to comment Share on other sites More sharing options...
0 ittiphol Posted June 22, 2019 Group: Members Topic Count: 27 Topics Per Day: 0.01 Content Count: 115 Reputation: 7 Joined: 05/09/19 Last Seen: May 20, 2021 Share Posted June 22, 2019 On 2/16/2012 at 6:05 AM, Gepard said: Try this script: prontera,160,182,5 script Test NPC 123,{ npctalk "Hi there!"; end; OnInit: startnpctimer; npcspeed 200; end; OnTimer5000: npcwalkto 160,160; end; OnTimer15000: npcwalkto 160,182; end; OnTimer20000: stopnpctimer; initnpctimer; end; } You can have a clickable moving NPC, no problem with that. But if you want it to look like a player (and probably you do, because regular NPC sprites are not animated, so they won't walk, just slide), it can only be clicked with shift pressed. But like I said before, currently it is not possible to assign a player sprite to NPC. You need to modify source code to allow that. Then it looks really cool. I like it Code used to make this screenshot is just for testing purposes, so it's not usable in a real server, sorry. i need this npc walk can you upload for me Quote Link to comment Share on other sites More sharing options...
Emistry Posted February 15, 2012 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2369 Joined: 10/28/11 Last Seen: 13 hours ago Share Posted February 15, 2012 you can use these command *npcspeed <speed value>; *npcwalkto <x>,<y>; *npcstop; beside...if you want..you can try this way to make it "more animated" spam Player Evil Clone.... >.< it will walk randomly in the town but dont open PVP or GVG.... and..this is a terrible idea..xD Quote Link to comment Share on other sites More sharing options...
MI53RE Posted February 15, 2012 Group: Members Topic Count: 3 Topics Per Day: 0.00 Content Count: 12 Reputation: 0 Joined: 01/14/12 Last Seen: May 8, 2016 Author Share Posted February 15, 2012 in fact when I spam evil clone they attack players so they cannot protect themself unless I set GVG or PVP on xD I did it with supportive clone but they do not last when I disconnect and wear the same name as player :/ anyway I'll try what you give me and let you know if it's working^^ before I forget if I want them to walk randomly is that possible or only pre-calculated (?) path is working? (sorry if my english was not clear enough^^') Quote Link to comment Share on other sites More sharing options...
Gepard Posted February 15, 2012 Group: Members Topic Count: 22 Topics Per Day: 0.00 Content Count: 392 Reputation: 285 Joined: 12/19/11 Last Seen: January 23, 2022 Share Posted February 15, 2012 It's not currently possible. You need to modify NPC-related source code to allow user-defined view (display) data. That's what I'd do. Then extend setnpcdisplay script function to allow more params than just class id (also headgear, hair, clothes color etc), and do smth like OnInit: setncpdisplay strnpcinfo(0), 4011, ... ; // ... would be additional params Movement can be scripted with commands mentioned by Emistry. EDIT: Unfortunately it's not as cool as it looks, cause you can't really display NPCs with player sprites as NPCs, you have to fake them as players, which means they won't be clickable like normal NPCs, and their name will not be blue. You could probably make a workaround by copying player sprite to npc sprites folder (possibly with some renaming/sprite editing) in grf. OH! They're clickable with shift! Quote Link to comment Share on other sites More sharing options...
MI53RE Posted February 15, 2012 Group: Members Topic Count: 3 Topics Per Day: 0.00 Content Count: 12 Reputation: 0 Joined: 01/14/12 Last Seen: May 8, 2016 Author Share Posted February 15, 2012 Hi again @Emistry I did try to use the command that you gave me but it doesn't seem to work the way I did it could you told me what I did wrong please? //===== eAthena Script ======================================= //= Test walking NPC //===== By: ================================================== //= MI53RE //===== Current Version: ===================================== //= 1.0 //===== Compatible With: ===================================== //= rathena 15542 (+?) //===== Description: ========================================= //= a walking npc //===== Additional Comments: ================================= //= 1.0 First Release //============================================================ prontera,160,187,3 script Test Npc 1001,{ npcspeed 150; npcwalkto 160,187; npcwalkto 160,177; npcwalkto 170,187; npcwalkto 160,187; npcwalkto 160,177; npcwalkto 170,187; npcwalkto 160,187; npcwalkto 160,187; npcwalkto 160,177; npcwalkto 170,187; npcwalkto 160,187; npcstop; mes "[Test Npc]"; mes "HI "+strcharinfo(0)+" !"; close; } the dialogue's working but the npc's not moving :/ also no error message on me mapserver window when loading script... Thank you again =) @Gepard, I'm not sure if I correctly understand: it is not possible to have speaking moving npc? and about the sprite for them do you have a more detailled tutorial please? I ask because I'm not that good at scripting and I don't want to mess arround with no clue of what I'm doing yet (even more if it touch to the src files^^') Thank you in advance =) Quote Link to comment Share on other sites More sharing options...
Gepard Posted February 15, 2012 Group: Members Topic Count: 22 Topics Per Day: 0.00 Content Count: 392 Reputation: 285 Joined: 12/19/11 Last Seen: January 23, 2022 Share Posted February 15, 2012 Try this script: prontera,160,182,5 script Test NPC 123,{ npctalk "Hi there!"; end; OnInit: startnpctimer; npcspeed 200; end; OnTimer5000: npcwalkto 160,160; end; OnTimer15000: npcwalkto 160,182; end; OnTimer20000: stopnpctimer; initnpctimer; end; } You can have a clickable moving NPC, no problem with that. But if you want it to look like a player (and probably you do, because regular NPC sprites are not animated, so they won't walk, just slide), it can only be clicked with shift pressed. But like I said before, currently it is not possible to assign a player sprite to NPC. You need to modify source code to allow that. Then it looks really cool. I like it Code used to make this screenshot is just for testing purposes, so it's not usable in a real server, sorry. Quote Link to comment Share on other sites More sharing options...
MI53RE Posted February 16, 2012 Group: Members Topic Count: 3 Topics Per Day: 0.00 Content Count: 12 Reputation: 0 Joined: 01/14/12 Last Seen: May 8, 2016 Author Share Posted February 16, 2012 Thanks a lot for your help I managed to do it!!( okay you did it and I just arranged the code you gave me^^') for the sprite I used monster sprite (in the script it is the one for Armeyer Dinze so she look practicly like if it was a normal player) prontera,160,187,3 script Alicia 1660,{ mes "[Alicia]"; mes "HI "+strcharinfo(0)+" !"; close; end; OnInit: startnpctimer; npcspeed 200; end; OnTimer3000: npcwalkto 160,187; end; OnTimer8000: npcwalkto 160,177; end; OnTimer13000: npcwalkto 170,187; end; OnTimer17000: npcwalkto 160,187; end; OnTimer20000: stopnpctimer; initnpctimer; end; } therefore if a make custom monster with normal sprite player it should work right? by the way there is no need for shift+clic here clic is enough =) thank you a lot for your help! now another question: how could I make the npc stop when the player is talking to him? (and eventually, if that possible, look a him/her)? I know that I need to use "if" "else" and "when" but how should I write it then? =) once again thank you^^ Quote Link to comment Share on other sites More sharing options...
Gepard Posted February 16, 2012 Group: Members Topic Count: 22 Topics Per Day: 0.00 Content Count: 392 Reputation: 285 Joined: 12/19/11 Last Seen: January 23, 2022 Share Posted February 16, 2012 If you want NPC to stop moving, you have to stopnpctimer when it's clicked, and restart it with startnpctimer somewhere later. You could restart the timer when player has finished talking to NPC, but there are also issues with multiple players clicking the same NPC (do you want it to start walking again as soon as any player finished his dialog with NPC, or only if ALL players have finished?) and with players not finishing talking with NPC properly (eg logging out in the middle of dialog) which make NPC not movable until somebody else talks to it. But with some help of timers and npcvariables everything can be solved It sounds complex, but really isn't. Quote Link to comment Share on other sites More sharing options...
MI53RE Posted February 16, 2012 Group: Members Topic Count: 3 Topics Per Day: 0.00 Content Count: 12 Reputation: 0 Joined: 01/14/12 Last Seen: May 8, 2016 Author Share Posted February 16, 2012 (edited) Hello guys =) so I attempted to use the startnpctimer and stopnpctimer but my problem still that if the npc effectively stop but does not walk anymore even after closing properly the "close" button :/ so I did try with the goto command but doesn't work etheir so here is the code (i did add random movement to make it more realistic , also add a second npc for performance evaluation(doesn't seem to have issues with that for now ) //===== eAthena Script ======================================= //= Test walking NPC //===== By: ================================================== //= MI53RE //===== Current Version: ===================================== //= 1.0 //===== Compatible With: ===================================== //= rathena 15542 (+?) //===== Description: ========================================= //= a walking npc //===== Additional Comments: ================================= //= 1.O First Release //= 1.1 Moving and talking in animated sprite //= 1.2 Random walk, two npc active //============================================================ prontera,160,187,3 script Alicia 1660,{ stopnpctimer; mes "[Alicia]"; mes "HI "+strcharinfo(0)+" !"; close; goto OnInit; end; OnInit: startnpctimer; npcspeed 200; end; OnTimer2000: set .@random, rand(3); if (.@random == 0) { npcwalkto 163,179; npctalk "1a"; } if (.@random == 1) { npcwalkto 155,187; npctalk "1b"; } if (.@random == 2) { npcwalkto 158,180; npctalk "1c"; } end; OnTimer6000: set .@random, rand(3); if (.@random == 0) { npcwalkto 155,177; npctalk "2a"; } if (.@random == 1) { npcwalkto 160,177; npctalk "2b"; } if (.@random == 2) { npcwalkto 158,174; npctalk "2c"; } end; OnTimer13000: set .@random, rand(3); if (.@random == 0) { npcwalkto 165,182; npctalk "3a"; } if (.@random == 1) { npcwalkto 150,167; npctalk "3b"; } if (.@random == 2) { npcwalkto 170,187; npctalk "3c"; } end; OnTimer18000: npcwalkto 160,187; end; OnTimer21000: stopnpctimer; initnpctimer; end; } prontera,143,178,3 script Martial 1661,{ stopnpctimer; mes "[Martial]"; mes "Yo "+strcharinfo(0)+" !"; close; goto OnInit; end; OnInit: startnpctimer; npcspeed 200; end; OnTimer2000: set .@random, rand(3); if (.@random == 0) { npcwalkto 153,179; npctalk "1a"; } if (.@random == 1) { npcwalkto 147,162; npctalk "1b"; } if (.@random == 2) { npcwalkto 127,177; npctalk "1c"; } end; OnTimer7000: set .@random, rand(3); if (.@random == 0) { npcwalkto 155,167; npctalk "2a"; } if (.@random == 1) { npcwalkto 160,178; npctalk "2b"; } if (.@random == 2) { npcwalkto 148,174; npctalk "2c"; } end; OnTimer15000: set .@random, rand(3); if (.@random == 0) { npcwalkto 163,180; npctalk "3a"; } if (.@random == 1) { npcwalkto 152,167; npctalk "3b"; } if (.@random == 2) { npcwalkto 175,183; npctalk "3c"; } end; OnTimer20000: npcwalkto 143,178; end; OnTimer24000: stopnpctimer; initnpctimer; end; } Thank you very much (asking so much help... I'll get kicked off someday xD!) Edited February 16, 2012 by Arcenciel Codeboxed Quote Link to comment Share on other sites More sharing options...
Gepard Posted February 16, 2012 Group: Members Topic Count: 22 Topics Per Day: 0.00 Content Count: 392 Reputation: 285 Joined: 12/19/11 Last Seen: January 23, 2022 Share Posted February 16, 2012 close ends script execution, just like end. If you want script to continue after close button was pressed, use close2; Quote Link to comment Share on other sites More sharing options...
MI53RE Posted February 22, 2012 Group: Members Topic Count: 3 Topics Per Day: 0.00 Content Count: 12 Reputation: 0 Joined: 01/14/12 Last Seen: May 8, 2016 Author Share Posted February 22, 2012 (edited) thank you for helping me so much =) I did try put the class sprite into the npc (and renamed them) but I dont get why, when I connect my character, I got a headless slipping npc at first. Then, when I move around and that the npc come on my sight BY ITSELF (very important information I think)it look like a normal moving character (with head on the right place this time)? And now I do effectively need to press shift to make them clickable ^^' by the way: why I don't have any problem with current mob sprite whose are not into my sprite\npc\ folder? I do talk about the mob from bio lab lv4 that look like ghost player :/ also your were talking about editing npc related source files could you tell me more about it please? =) thank you =) [EDIT:] ou need to modify NPC-related source code to allow user-defined view (display) data. That's what I'd do. Then extend setnpcdisplay script function to allow more params than just class id (also headgear, hair, clothes color etc), and do smth likeOnInit: setncpdisplay strnpcinfo(0), 4011, ... ; // ... would be additional params were you talking about editing script.c ? actually I don't uderstand this line :/ I did try to understand setnpcdisplay and strnpcinfo but it result that I'm more confused ^^'. On your example 4011 is Job_id? (whitesmith) or the mob_id that is used? __CODEBOX_0__ when you were talking about extend did that mean somth like that: /// setnpcdisplay("<npc name>", "<new display name>", <new class id>, <new size>, <new headgear id>, <new hair id>) -> <int> thank you again Gepard =) A little bump because even after trying by myself I still not understand the last part of my previous message^^' Edited February 22, 2012 by Arcenciel Quote Link to comment Share on other sites More sharing options...
Gepard Posted February 23, 2012 Group: Members Topic Count: 22 Topics Per Day: 0.00 Content Count: 392 Reputation: 285 Joined: 12/19/11 Last Seen: January 23, 2022 Share Posted February 23, 2012 I did try put the class sprite into the npc (and renamed them) but I dont get why, when I connect my character, I got a headless slipping npc at first. Then, when I move around and that the npc come on my sight BY ITSELF (very important information I think)it look like a normal moving character (with head on the right place this time)? This is because player sprites consist of two parts: head with hairstyle and everything below head. I don't know how to change it, you should ask in a separate question how to turn a player sprite into NPC sprite. /// setnpcdisplay("<npc name>", "<new display name>", <new class id>, <new size>, <new headgear id>, <new hair id>) -> <int> That's exactly what I meant. It's rather complex change that would require changes in script.c, status.c, and clif.c at least. Quote Link to comment Share on other sites More sharing options...
MI53RE Posted February 23, 2012 Group: Members Topic Count: 3 Topics Per Day: 0.00 Content Count: 12 Reputation: 0 Joined: 01/14/12 Last Seen: May 8, 2016 Author Share Posted February 23, 2012 I might follow your advice the. For now I edited Bio Lab mvp sprite since they use player sprite and that the head is directly in the sme folder but it is annoying since you cannot change palette as easily that directly using player sprite info... anyway problem solved for now Thank for everything I'll create a new topic later about npc with player sprite Quote Link to comment Share on other sites More sharing options...
karazu Posted March 31, 2012 Group: Members Topic Count: 57 Topics Per Day: 0.01 Content Count: 374 Reputation: 5 Joined: 03/09/12 Last Seen: June 19, 2018 Share Posted March 31, 2012 (edited) what if i will use the Mercenaries sprite? do u guys know the mob number? or NPC number? get them. 0~45 and 4001~4046 is job ID of character 6001~6008 is homunculus 6017~6046 is mercenary And now I do effectively need to press shift to make them clickable ^^' any solution? Edited March 31, 2012 by karazu Quote Link to comment Share on other sites More sharing options...
Question
MI53RE
Hi,
So here is my project, to create moving npc using the class sprites in order to make the city more animated
(like patroles in WoW for example) but I don't really see how to do it :/
I did read lot of topic and basicly understand the logic behind making a npc but it is only about make them moving that I cannot see what to do :/
if someone already attempted to do it let me know
Thank in advance^^!!
Edited by MI53RELink to comment
Share on other sites
17 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.