ArcEmu: Error In Getcreaturenearestcoords ? - ArcEmu

Jump to content

Toggle shoutbox Lastest Announcements

dfighter  : (07 December 2014 - 12:06 PM) Arcemu is in hibernation mode, please read http://arcemu.org/fo...showtopic=26903
dfighter  : (01 January 2013 - 05:56 PM) Arcemu wishes you all a happy new year!
Hasbro  : (12 September 2012 - 10:01 AM) Please excuse our outage from the web! Our web host had a major malfunction!
dfighter  : (01 September 2012 - 04:05 PM) Since the spam bots just don't want to stop, I've enabled admin verification when registering.
dfighter  : (23 January 2012 - 09:56 PM) Please note that from now on you will need to confirm your email on the wiki in order to edit it!
Hasbro  : (31 December 2011 - 12:50 PM) Happy New Years all!
Navid  : (26 December 2011 - 04:09 AM) Merry Christmas !!!!!! Happy holidays all :)
WAmadeus  : (24 December 2011 - 03:54 PM) Merry Christmas to all!
dfighter  : (24 December 2011 - 11:05 AM) The Arcemu team wishes y'all a Merry Christmukkah!
Hasbro  : (05 October 2011 - 12:53 PM) Looking for web designers for upcoming web related project. If you're interested in designing user interfaces contact me
dfighter  : (02 September 2011 - 03:47 PM) So who here wants vehicles in Arcemu? :P http://arcemu.org/fo...showtopic=25440
Hasbro  : (14 August 2011 - 03:25 PM) Join us on irc, grab an irc client and connect to irc.freenode.net join channel #arcemu /server irc.freenode.net:6667 /join #arcemu
jackpoz  : (03 August 2011 - 05:33 AM) to all Lua Engine (old one) users: please check http://arcemu.org/fo...showtopic=25274
Hasbro  : (20 May 2011 - 05:27 PM) Looking for people experienced with CMake configuration and setup! Contact me asap
Hasbro  : (15 May 2011 - 05:03 PM) ArcEmu is recruiting C++ programmers, contact Hasbro if interested.
paroxysm  : (03 May 2011 - 06:26 PM) Updated luabridge gossip example to describe the whole gossip creation process rather than just how to create menu. Gossip tutorial
paroxysm  : (23 April 2011 - 11:35 AM) Lua writers can refer to the Luabridge Tutorials section in the Wiki to learn how to write gossip code correctly.
Hasbro  : (20 April 2011 - 05:22 PM) Thank you for your continuous contribution of bug reports, we are working on them.
Hasbro  : (17 April 2011 - 03:20 AM) Please consider donating to support our bills. Donations can be sent using PayPal to donations@arcemu.org - Thank you for your support.
paroxysm  : (10 April 2011 - 12:43 AM) Refer to the Luabridge Tutorials section in the Wiki to learn the new syntax of luabridge.
Resize Shouts Area

Developing

Interesting in developing with us? Join us on IRC: irc.emulationnetwork.com:6667 #arcemu
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Error In Getcreaturenearestcoords ?

#1 User is offline   MesoX 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 296
  • Joined: 15-June 08
  • Gender:Male
  • Location:Czech Republic
  • Interests:pc & girls & parties

Posted 25 November 2011 - 08:25 AM

Hey, I've recently started scripting ebon hold area (Dk starting zone), and there are few creatures kneeling around in a "prison". Yes I am refering ot this quest: http://www.wowhead.com/quest=12848 . Way, how are these "chains" handled is that prisoned creature itself casts that body lock around him, and those 3 chains (wievable on second screen at that quest on wowhead) are channeled from invisible creature spawned on almost same coords where that object is, so it looks like object casts it. That npc is this one: http://www.wowhead.com/npc=29521 . The way I am handling it is this one:

Creature * anchor = _unit->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(_unit->GetPositionX(), _unit->GetPositionY(), 0.0f, NPC_ANCHOR);

if( anchor )
{
	anchor->SetChannelSpellTargetGUID( _unit->GetGUID() );
	anchor->SetChannelSpellId( SPELL_CHAINED_PESANT_BREATH );
	anchor->CastSpell(_unit, SPELL_CHAINED_PESANT_BREATH, false);
}

_unit->CastSpell(_unit, SPELL_CHAINED_PESANT_CHEST, false);


While macro for NPC_ANCHOR is 29521 (his entry id) and others are spell ids.

Issue I've found is that for some creatures it obviously works and for some creatures it's not, which is driving me mad.

Here are some screens of both working creature and non working creatures:

Posted Image

Posted Image

Posted Image

Posted Image

Before you ask me - yes those Unworthy Initiate Anchors are spawned at each prison GO (that skull-looking GO on the wall) - I've checked it many times in database and even tried spawning new one by hand.

So why the hell core can't find some these NPC?

Even I've tried this:

Creature * anchor = _unit->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(_unit->GetPositionX(), _unit->GetPositionY(), 0.0f, NPC_ANCHOR);
if( !anchor )
{
	if( _unit->GetSQL_id() == 122610 )
	{
		anchor = _unit->GetMapMgr()->GetSqlIdCreature(122622);
	}
}


anchor was still NULL in this case, even I've checked twice those SQL ids in both game and database.
Posted Image
0

#2 User is offline   jackpoz 

  • ArcEmu Lemon Priest
  • PipPipPipPipPipPipPipPip
  • Group: Developers
  • Posts: 2,153
  • Joined: 19-June 08
  • Gender:Male
  • Location:Italy
  • Server OS:Windows

Posted 25 November 2011 - 10:46 AM

tried to use
nearest = Unit:GetCreatureNearestCoords( player:GetX(), player:GetY(), 0, 29521)
Unit:SendChatMessage(12, 0, "Nearest Creature: " .. nearest:GetName(), 0)
player:GossipComplete()

in a Lua gossip script and the result is
Posted Image
could you please post the whole script so that we can spot what's wrong in your code?
Posted Image We develop dreams. Your dreams ;)
Posted ImagePosted Image
0

#3 User is offline   MesoX 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 296
  • Joined: 15-June 08
  • Gender:Male
  • Location:Czech Republic
  • Interests:pc & girls & parties

Posted 25 November 2011 - 04:01 PM

Well, there are 12 of them spawned (one on each bone), but it fails only for some of them (as you can see on my screenshots). I am able to select them via .npc select command, but I can't get pointer to them by any of those 2 methods I've tried and posted above. You can take a look on script in my branch on github (direct link).
Posted Image
0

#4 User is offline   jackpoz 

  • ArcEmu Lemon Priest
  • PipPipPipPipPipPipPipPip
  • Group: Developers
  • Posts: 2,153
  • Joined: 19-June 08
  • Gender:Male
  • Location:Italy
  • Server OS:Windows

Posted 25 November 2011 - 06:03 PM

You are trying to find the Anchor in the OnLoad() method, which is called when Initiate is pushed to world, but there's no way to know if the Anchor is already in world. This issue was there in some old ArcScripts, probably because the scripters didn't fully know when the script hooks were (and still are) called.
Posted Image We develop dreams. Your dreams ;)
Posted ImagePosted Image
0

#5 User is offline   MesoX 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 296
  • Joined: 15-June 08
  • Gender:Male
  • Location:Czech Republic
  • Interests:pc & girls & parties

Posted 26 November 2011 - 04:18 AM

Aha, thanks for the explanation. Now I wonder where to call it, I guess I can do it in AIUpdate(), like about a second after adding to world? And I've truly never though about this, most probably because I've seen it in other scripts before :( . Anyway thanks.


Btw. I was wondering about something else not related to this, but I don't wanna make new topic because of it. Ebon hold area itself is now created as continent, but on retail, it's instance, because horde players are separated from alliance players. Do you think it will require so much changes in core to make it instanced, but without kicking out players when they are out of group, making it possible to start game there too (because if it's now instanced, you are automatically ported out) and some other things.
Posted Image
0

#6 User is offline   jackpoz 

  • ArcEmu Lemon Priest
  • PipPipPipPipPipPipPipPip
  • Group: Developers
  • Posts: 2,153
  • Joined: 19-June 08
  • Gender:Male
  • Location:Italy
  • Server OS:Windows

Posted 26 November 2011 - 04:30 AM

You could queue an event from the OnLoad() method, or you could try to find the anchor in OnLoad() and if it's not found, queue the event. It would be separated from AIUpdate(), so you can use this other method for something else (unless you don't need it for anything, then even AIUpdate() is good.

Can't ally and horde just be on 2 phases, with npcs on both phases?
Posted Image We develop dreams. Your dreams ;)
Posted ImagePosted Image
0

#7 User is offline   MesoX 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 296
  • Joined: 15-June 08
  • Gender:Male
  • Location:Czech Republic
  • Interests:pc & girls & parties

Posted 26 November 2011 - 04:38 AM

I was thinking the same but it means doubling all ebon hold spawns, changing their phase and creating some spell scripts for spells, which are changing actuall phases.
Posted Image
0

#8 User is offline   jackpoz 

  • ArcEmu Lemon Priest
  • PipPipPipPipPipPipPipPip
  • Group: Developers
  • Posts: 2,153
  • Joined: 19-June 08
  • Gender:Male
  • Location:Italy
  • Server OS:Windows

Posted 26 November 2011 - 06:07 AM

with "with npcs on both phases" I meant:
- horde players are on phase 1
- alliance players are on phase 2
- npcs are on phase (1 | 2) = 3, seen by both horde and alliance.

so the npcs will be spawned only once. But due to the spells changing phase then maybe it's better to implement it in the instance way.
Posted Image We develop dreams. Your dreams ;)
Posted ImagePosted Image
0

#9 User is offline   MesoX 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 296
  • Joined: 15-June 08
  • Gender:Male
  • Location:Czech Republic
  • Interests:pc & girls & parties

Posted 26 November 2011 - 10:19 AM

I think it's better if somebody else then me will do it, as I've never touched anything in Instance system. I think I am able to do it your way, but that's all from my side.
Posted Image
0

#10 User is offline   jackpoz 

  • ArcEmu Lemon Priest
  • PipPipPipPipPipPipPipPip
  • Group: Developers
  • Posts: 2,153
  • Joined: 19-June 08
  • Gender:Male
  • Location:Italy
  • Server OS:Windows

Posted 26 November 2011 - 02:11 PM

then for now alliance and horde characters will be fixed, till we fix it.
Posted Image We develop dreams. Your dreams ;)
Posted ImagePosted Image
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users