Where is the code where it finds out if the player is beside the NPC so he is able to attack. Im adding something where you click a NPC and it brings up a form, but where I had it I could click anywhere it would bring up the form.
So wheres this code so I can place it in there and it will only bring up the Form when I click the NPC and im right beside him.
Search the server side code for this:
Your target is now
and that should find you the right stuff. You'll then need to send a packet to the client to bring the form up
its in playersearch i think..the packet s:
"search" (server side) thats where a player or npc is been targetted, so you need to add:
if getplayerx(index) = MapNpc(Player bla bla target code thingy).x - 1 or
getplayerx(index) = MapNpc(Player bla bla target code thingy).x +1 and
getplayery(index) = MapNpc(Player bla bla target code thingy)y. -1 or
getplayery(index) = MapNpc(Player bla bla target code thingy)y. +1 then
your code
thats just out of my midn..i am really tiered right now, if you cant find it or need some help just post it here
bye
I'm not sure what you're trying to do. I assume, you are sending a packet to the server to start a battle, and when the server recieves that packet, trying to open the form client side, by calling the function server side?
If so, just send a packet back to the client, and send a variable with a value, and do an if check or something, that if the parse = 1 then frmbattle.visible = true
If that's what you're trying to do, I don't really understand your posts all that much, sorry if I'm wrong. ^_^
well I added a code where you right click a npc and you attack it. I want it where when you click the npc that you open up a form.
I had it working but it would open the form when I click anywhere thats why I wanted to know about just when I click npc
Posts: 30
Threads: 0
Joined: Nov 2021
Reputation:
0
Do it all client side.. but only open the form if there is an NPC on that tile.
Yeah I was trying to find where it targets the npc and I was lead to the server side. Which I did find it but when I put that in it said the form wasnt there.
I think grim wrote a really good tutorial for clicking, and i think theres also a good tutorial on npc name on hover.. Have you tried looking at those?
Put that in handle data, I believe, where all the other packets are. It should work then.
oh my bad I put it in the gameloop thought it would have to go there guess im wrong
EDIT:
well I still had to fix some more stuff but I got it working. Thanks for all the help. If anyone wants the working code for some reason let me know and I will post.
Well, a packet was added, therefore, handle data would be the choice place.
Congrats on getting it to work. ^_^