i need some idea about change npc spot

09/29/2012 15:54 asdalhog#1
hello guys
i try to make some think
in npcs
but every time i miss
i need npc to change his spot
like when i talk to him
and get buy some think he move and go another spot

see my code

Code:
new Conquer_Online_Server.Database.MySqlCommand(Conquer_Online_Server.Database.MySqlCommandType.UPDATE)
                               .Update("sobnpcs").Set("cellx",433 ).Set("celly", 387).Where("id", 74125)
but this code need to restart server
to reload database
so i make code to reload
only table "sobnpcs"
but npc he never change spot
must restart
anyway
can anyone help me in this
or some one give me idea
:handsdown:

sorry i add this in wrong section
can pleas moved to
CO2 PServer - Discussions / Questions
09/29/2012 16:57 go for it#2
i can't really understand your problem
your problem is with changing a value in the database ?
or your problem is that you want this to take effect without restarting the server ?
if you suffer from the first problem try the next piece of code i made it for the same reason
Code:
                                    MySqlCommand cmd = new MySqlCommand(MySqlCommandType.UPDATE);
                                    cmd.Update("npcs").Set("mapid", Npc_Map).Set("cellx", Npc_X).Set("celly", Npc_Y).Where("id", npctochangeid).Execute();
if you suffer from the second problem then i think you need to respawen all npcs again so he move to his new coords

well there is an advanced way to do that which it's used at the bluemouse quest which ill check now cuz i was working on something similar to that

if i found something useful ill edit this post
but tell me if your problem was the first case i mentioned above
09/29/2012 17:56 JohnHeatz#3
#Moved to the right section
09/29/2012 18:53 pro4never#4
You're already moving it in the database

now you need to move them in the server memory


to do that just look up the npc in memory and update its location (alternatively just re-load all the npcs but that's a horrible way of handling it)
10/01/2012 16:35 asdalhog#5
Quote:
Originally Posted by go for it View Post
i can't really understand your problem
your problem is with changing a value in the database ?
or your problem is that you want this to take effect without restarting the server ?
if you suffer from the first problem try the next piece of code i made it for the same reason
Code:
                                    MySqlCommand cmd = new MySqlCommand(MySqlCommandType.UPDATE);
                                    cmd.Update("npcs").Set("mapid", Npc_Map).Set("cellx", Npc_X).Set("celly", Npc_Y).Where("id", npctochangeid).Execute();
if you suffer from the second problem then i think you need to respawen all npcs again so he move to his new coords

well there is an advanced way to do that which it's used at the bluemouse quest which ill check now cuz i was working on something similar to that

if i found something useful ill edit this post
but tell me if your problem was the first case i mentioned above
its second problem and i try to respawen all npcs nothink done
and i try to reload all database no think happen
must restart so what i can do if u have some think can help me ?

Quote:
Originally Posted by pro4never View Post
You're already moving it in the database

now you need to move them in the server memory


to do that just look up the npc in memory and update its location (alternatively just re-load all the npcs but that's a horrible way of handling it)
i reload all memory of server and no think happen
must restart
10/01/2012 17:40 shadowman123#6
well i understood what do u mean or what do u want to do u would like to change the cords of the npc when sm1 click on it like ctf or blue mouse quest anyways its peice of cake .. first u should remove the npc from the clicker screen and any other players in the same screen distance .. then u should send npc spawn packet 2030 to every1 in the screen nearby the new npc cords then u should update this on the database so that when restarting server it become in the last location it was at and dont forget to add the npc in client's screen
10/01/2012 22:16 asdalhog#7
Quote:
Originally Posted by shadowman123 View Post
well i understood what do u mean or what do u want to do u would like to change the cords of the npc when sm1 click on it like ctf or blue mouse quest anyways its peice of cake .. first u should remove the npc from the clicker screen and any other players in the same screen distance .. then u should send npc spawn packet 2030 to every1 in the screen nearby the new npc cords then u should update this on the database so that when restarting server it become in the last location it was at and dont forget to add the npc in client's screen
okay i understand what u need to say
but if it peice of cake like u say
tell me cuz am beginner in .net
so tell me how i can remove the npc from the clicker screen and any other players in the same screen distance
or give me the path to be followed:handsdown:
10/01/2012 22:48 shadowman123#8
well to be Honest as a beginer u cant do smthing like that cuz u are going too deep for these stuffs .. u need to know how things go inside the source then ask question about the concept
10/04/2012 01:06 go for it#9
npc spawn packet 2030
[Only registered and activated users can see links. Click Here To Register...]
try sending the same id with different coords and it should remove the old and show the new
but this is really poor way of doing it
personally i couldn't get to a decent way to get it done
and couldn't change it in memory then send a packet updating it's coords

cuz here
when you update it's coords now for players in the range , if you gone out range the back to the range it will be on the old coords which is in the memory which it got it from the database

im trying the method pro4never mentioned , didn't give it a try yet but personally i think it's the best way to get it done
10/04/2012 01:19 shadowman123#10
Quote:
Originally Posted by go for it View Post
npc spawn packet 2030
[Only registered and activated users can see links. Click Here To Register...]
try sending the same id with different coords and it should remove the old and show the new
but this is really poor way of doing it
personally i couldn't get to a decent way to get it done
and couldn't change it in memory then send a packet updating it's coords

cuz here
when you update it's coords now for players in the range , if you gone out range the back to the range it will be on the old coords
thats y i said you should work on screen part with adding / removing npcs / entities
10/04/2012 01:32 go for it#11
so you mean that everytime player try to access it you will send another 2030 packet with a "Fake location" then save this location to the database
not a proper way , right ?
10/06/2012 16:20 asdalhog#12
Quote:
Originally Posted by shadowman123 View Post
well to be Honest as a beginer u cant do smthing like that cuz u are going too deep for these stuffs .. u need to know how things go inside the source then ask question about the concept

why u say that
programming language never end
so we all beginer everything possible to do
If there insistence u will do any think
and my npc is done
and appear for all ppls
in screen

"go for it"
he help from his heart
thanks go for it
For your interest in the Topic

this my npc video

[Only registered and activated users can see links. Click Here To Register...]
10/07/2012 11:25 shadowman123#13
Quote:
Originally Posted by asdalhog View Post
why u say that
programming language never end
so we all beginer everything possible to do
If there insistence u will do any think
and my npc is done
and appear for all ppls
in screen
your npc is done cuz of our help and no it isnt about just Programming its about understanding stuffs in sources to be able to add / remove / update systems
10/07/2012 11:34 go for it#14
Quote:
why u say that
programming language never end
so we all beginer everything possible to do
If there insistence u will do any think
and my npc is done
and appear for all ppls
in screen

"go for it"
he help from his heart
thanks go for it
For your interest in the Topic

this my npc video

BigBoS EveNT Drop Cps 5639 - YouTube
aww happy it worked :D now pm me the code source for this npc i want to try it out jajajja XD XD XD