[C++] Grab Object between two NPCs menu

User Tag List

Results 1 to 2 of 2
  1. #1
    blukkiee's Avatar Active Member
    Reputation
    18
    Join Date
    Jun 2007
    Posts
    141
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [C++] Grab Object between two NPCs

    Sup!
    I'm currently developing my own server and I'm not releasing it before I've got my Karazhan and Gruul scripts close-to-blizzlike.

    Now I'm stuck on my last boss, which is Netherspite.
    If you don't know the fight:

    There are 3 portals in the room which cast a beam on Netherspite.
    If there is a player in between the Portal and Netherspite, then the beam is cast on the Player instead.

    Now I've got it partially working, but it's far from perfect.

    This is the script:
    Code:
    Unit* u_netherspite = netherspite[_unit->GetInstanceID()];
    		
    		float PI = 3.14159265f;
    		float nethX = u_netherspite->GetPositionX();
    		float nethY = u_netherspite->GetPositionY();
    		float minAngle = _unit->calcAngle(_unit->GetPositionX(), _unit->GetPositionY(), nethX, nethY) - (PI/16);
    		float maxAngle = _unit->calcAngle(_unit->GetPositionX(), _unit->GetPositionY(), nethX, nethY) + (PI/16);
    		float distance = _unit->GetDistance2dSq(u_netherspite);
    		//Unit* target = u_netherspite;
    		Unit* target = NULL;
    
    		set<Object*>::iterator itr;
    		for(itr = _unit->GetInRangeSetBegin(); itr != _unit->GetInRangeSetEnd(); ++itr)
    		{
    			if ( (*itr)->GetTypeId() != TYPEID_UNIT && (*itr)->GetTypeId() != TYPEID_PLAYER )
    				continue;
    			
    			float getAngle = _unit->calcAngle(_unit->GetPositionX(), _unit->GetPositionY(), (*itr)->GetPositionX(), (*itr)->GetPositionY());
    			
    			if (getAngle > minAngle && 
    			    getAngle < maxAngle && 
    				_unit->GetDistance2dSq((*itr)) < distance)
    			{
    				// needs more checks
    				distance = _unit->GetDistance2dSq((*itr));
    				target = static_cast<Unit*>((*itr));
    				break;
    			}
    			else
    				target = u_netherspite;
    		}
    Now what happens is he will always cast it on Netherspite untill a player gets REALLY CLOSE to Netherspite, then it MIGHT target the player (moving an inch can change it back to Netherspite)

    Now my question is: Anyone knows what I'm doing wrong or knows how to fix it?

    [C++] Grab Object between two NPCs
  2. #2
    blukkiee's Avatar Active Member
    Reputation
    18
    Join Date
    Jun 2007
    Posts
    141
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nevermind. Got it working!

Similar Threads

  1. Onyxia vs. Alexstrasza | Episode 1: A Duel Between Two Brothers IRL!
    By DiEMOnd in forum Hearthstone: Heroes of Warcraft
    Replies: 3
    Last Post: 12-27-2013, 02:34 PM
  2. Hey what is a safe way to transfer gold between two accounts?
    By Rogozjin in forum World of Warcraft General
    Replies: 4
    Last Post: 11-01-2013, 10:05 PM
  3. [Trinity] conect object and some npc
    By paff in forum WoW EMU Questions & Requests
    Replies: 5
    Last Post: 04-22-2011, 10:58 AM
  4. Two NPC Questions
    By WowUltimate in forum WoW EMU Questions & Requests
    Replies: 3
    Last Post: 03-03-2009, 12:09 PM
  5. [question] Transfer between two accounts
    By Skizzilini in forum World of Warcraft General
    Replies: 3
    Last Post: 12-14-2007, 03:47 PM
All times are GMT -5. The time now is 08:36 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search