Jump to content
  • 0

How to detect warps?


Seravy

Question


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  176
  • Reputation:   60
  • Joined:  01/11/19
  • Last Seen:  

I'm currently using

	struct npc_data *nd;
	nd = (TBL_NPC*)bl;
	if (nd->vd->class_!=45) // looks like a warp then it's a warp even if it's not type warp. Some warps are NPCTYPE_SCRIPT instead!
	if (nd->subtype != NPCTYPE_WARP)
		return 0; //Not a warp

for a while it worked fine but now I found a warp that causes a crash : the "vd" on it is NULL.

Edit : nevermind, it seems preventing the null pointer crash by adding "if ((nd->vd)"  worked. I guess vd does get filled with data eventually, just not immediately, so the warp does get detected properly.

Maybe not. It seems entirely random whether vd has data or not. Sometimes the code detects the warp, other times it doesn't until sometime happens, like another character passes through it. Maybe I need to call some function here to ensure vd has data in it?

Edited by Seravy
Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  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.

×
×
  • Create New...