Jump to content
  • 0

How can i talk to a NPC via Python?


OnlyGood

Question

Hey, how can i talk to a specific NPC?
 

I know about

vid = player.GetTargetVID()
net.SendOnClickPacket(vid)

but with this, the NPC has to be marked.

 

The problem is, the vid of this specific NPC always changes if i teleport away.

 

Is there a way, how i can scan the vid of a specific NPC nearby and automatic talk to it, if im in x range?

Edited by OnlyGood (see edit history)
Link to post

1 answer to this question

Recommended Posts

  • 1

CPythonCharacterManager has functions like CharacterInstanceBegin and CharacterInstanceEnd so you can iterate over the characters nearby like:

TPixelPosition myPos;
CPythonPlayer::instance().NEW_GetMainActorPosition(&myPos);

CPythonCharacterManager& chrMgr = CPythonCharacterManager::instance();
for (auto it = chrMgr.CharacterInstanceBegin(); it != chrMgr.CharacterInstanceEnd(); ++it)
{
	if (CInstanceBase* ch = *it)
	{
		TPixelPosition otherPos;
		ch->NEW_GetPixelPosition(&otherPos);
		if(GetPixelPositionDistance(myPos, otherPos) <= SOME DISTANCE && some other thing to identify your npc)
		{
			CPythonNetworkStream::Instance().SendOnClickPacket(ch->GetVirtualID());
		}
	}
}

 

Edited by Distraught (see edit history)
  • Love 1

AxgtRfG.png
C++ programmer at Gameloft

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Activity

    1. 3

      DDos attacks

    2. 62

      Shop Ex Renewal

    3. 0

      [Problem] : System war between kingdoom

    4. 3

      DDos attacks

    5. 7

      Dynamic Weather

    6. 7

      How to avoid getting flooded in 2021

    7. 47

      Multiple Login Saver System

    8. 0

      BUG SKILL SURA

  • Recently Browsing

    No registered users viewing this page.

×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.