Criboo Posted June 8, 2018 Share Posted June 8, 2018 Hi all I'm writing a script which requires the player to attack an NPC and lure it to a safespot. Doing so involves my player leaving the safespot to find the monster, attacking it, running to a certain place then running to the safespot. There are several of this NPC in my general fight area, and I am trying to ensure that once I attack it it becomes my NPC (rather than just a NPC) which I lure and attack. This is to avoid attacking an NPC, running to my first spot then attempting to fight another one. Is there a way I can segregate an NPC which I attack, but am then subsequently not fighting (or necessarily being attacked by as I run away) so that my script keeps focus on that NPC? Thanks in advance Chris Quote Link to comment Share on other sites More sharing options...
Explv Posted June 8, 2018 Share Posted June 8, 2018 4 hours ago, Criboo said: Hi all I'm writing a script which requires the player to attack an NPC and lure it to a safespot. Doing so involves my player leaving the safespot to find the monster, attacking it, running to a certain place then running to the safespot. There are several of this NPC in my general fight area, and I am trying to ensure that once I attack it it becomes my NPC (rather than just a NPC) which I lure and attack. This is to avoid attacking an NPC, running to my first spot then attempting to fight another one. Is there a way I can segregate an NPC which I attack, but am then subsequently not fighting (or necessarily being attacked by as I run away) so that my script keeps focus on that NPC? Thanks in advance Chris Just store the NPC as a global variable so you can access it later. 1 Quote Link to comment Share on other sites More sharing options...
billyboy420 Posted June 10, 2018 Share Posted June 10, 2018 When you select your npc just save it in a variable like Explv said then interact with it after you move to the safe spot NPC npcToSafeSpot = getNpcs().closest("NPC NAME"); getWalking().webWalk(SafeSpot); npcToSafeSpot.interact("Attack"); Quote Link to comment Share on other sites More sharing options...
HeyImJamie Posted June 11, 2018 Share Posted June 11, 2018 (edited) 18 hours ago, billyboy420 said: When you select your npc just save it in a variable like Explv said then interact with it after you move to the safe spot NPC npcToSafeSpot = getNpcs().closest("NPC NAME"); getWalking().webWalk(SafeSpot); npcToSafeSpot.interact("Attack"); It would need to be a global variable. So something like this: private NPC npc; npc = getNpcs().closest("NPC"); if (safespot does not contain our player) { if (getWalking().webWalk(safespot) // sleep until whatever } else { if (npc != null) { // attack npc } } Edited June 11, 2018 by HeyImJamie 1 Quote Link to comment Share on other sites More sharing options...
aftabdear Posted June 11, 2018 Share Posted June 11, 2018 If this is for Callisto gl Quote Link to comment Share on other sites More sharing options...
HeyImJamie Posted June 11, 2018 Share Posted June 11, 2018 23 minutes ago, aftabdear said: If this is for Callisto gl On 6/8/2018 at 2:09 PM, Criboo said: There are several of this NPC in my general fight area Quote Link to comment Share on other sites More sharing options...
Criboo Posted June 11, 2018 Author Share Posted June 11, 2018 Thanks all for the help. Problem solved. Chris Quote Link to comment Share on other sites More sharing options...