What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal

'Click an area' spells

Nightskine

Member
Joined
Oct 30, 2010
Messages
150
Reaction score
1
Alright, its me again ...
Working on my CC I've come across another issue - how do I work around spells where I have to click an area ?
In my case, to use trap launchers for hunters you have to click the spell "Trap Laucher" then the trap and then click an area on the ground. I tried the following but had no luck - WoW jus keeps showing the error invalid target so I'm not even sure what's happening ....

After a 100 tries I've reached the following code which doesn't work :confused::confused:

Code:
	if(SpellManager.CanCast("Explosive Trap") && Me.CurrentTarget.Distance >=10 && !Me.HasAura("Trap Launcher"))
	{
	 
	SpellManager.Cast("Trap Launcher");
    slog(Color.Red, "Trap Launcher ");
    }
        
    if(Me.HasAura("Trap Launcher"))
    {
        SpellManager.Cast("Explosive Trap");

        LegacySpellManager.ClickRemoteLocation(Me.CurrentTarget.WorldLocation);
        slog(Color.Red, "Explosive Trap");
    }

I've been working on this for a while --- looked into a lot of CC's for Hunter's Warlocks and Mages - (rain of fire and mage pet freeze has same logic) but I couldnt come up with anything...
Please help :(:(:(
 
Alright, its me again ...
Working on my CC I've come across another issue - how do I work around spells where I have to click an area ?
In my case, to use trap launchers for hunters you have to click the spell "Trap Laucher" then the trap and then click an area on the ground. I tried the following but had no luck - WoW jus keeps showing the error invalid target so I'm not even sure what's happening ....

After a 100 tries I've reached the following code which doesn't work :confused::confused:

Code:
	if(SpellManager.CanCast("Explosive Trap") && Me.CurrentTarget.Distance >=10 && !Me.HasAura("Trap Launcher"))
	{
	 
	SpellManager.Cast("Trap Launcher");
    slog(Color.Red, "Trap Launcher ");
    }
        
    if(Me.HasAura("Trap Launcher"))
    {
        SpellManager.Cast("Explosive Trap");

        LegacySpellManager.ClickRemoteLocation(Me.CurrentTarget.WorldLocation);
        slog(Color.Red, "Explosive Trap");
    }

I've been working on this for a while --- looked into a lot of CC's for Hunter's Warlocks and Mages - (rain of fire and mage pet freeze has same logic) but I couldnt come up with anything...
Please help :(:(:(
SpellManager.Cast("Flamestrike");
Thread.Sleep(500);
LegacySpellManager.ClickRemoteLocation(Me.CurrentTarget.Location);

the location is WoWUnitLocation not world location and a sleep is needed between the spellcast and the click.
 
:'( Still stood there saying invalid target ... heres what I got :(

Code:
	if(SpellManager.CanCast("Explosive Trap") && !Me.HasAura("Trap Launcher"))
	{
	 
     SpellManager.Cast("Trap Launcher");
    slog(Color.Red, "Trap Launcher");
    }
        
    if(Me.HasAura("Trap Launcher"))
    {
        SpellManager.Cast("Explosive Trap");
    Thread.Sleep(500);
    LegacySpellManager.ClickRemoteLocation(Me.CurrentTarget.Location);
        slog(Color.Red, "Explosive Trap");
    }


Aaaargh I'm at that point where frustration is creeping up on me .... any ideas why? I've attached a log if that helps ---- thanks for trying mate
 

Attachments

Last edited:
FPSware hunter uses launchers. Have a look in the "class specific\BT\Combat.cs" and look for 'public class TrapLauncher' . Might be something useful there for you.
 
tried that .... thanks anyway. I've spent soo many hours on this now ... I'm sure someone knows the code for this. ....
 
As Crowly said, have a look at my Hunter CC it uses trap launcher successfully.

There is a qwirk with Trap Launcher, it - for lack of better term - modifys the trap spells. So simply casting the trap will give you can error. You have to do an LUA "cast" in order for it to work properly. Any other odrinay AOE spell will work using that code, but trap launcher and the subsequent traps are handled differently.

Here is the code I used in my hunter CC.


string spellName = "Trap Launcher";WoWPoint trapLocation = Movement.PointFromTarget(1);
bool result = Spell.Cast(spellName);
Utils.LagSleep();
Lua.DoString(String.Format("CastSpellByName(\"{0}\")", Settings.TrapLauncher));
LegacySpellManager.ClickRemoteLocation(trapLocation);

Utils.Log(string.Format("Using {0} with Trap Launcher", Settings.TrapLauncher));
 
Last edited:
Hey thanks for replying FPS ... this was starting to eat at me pretty bad lol ...
so would this code work?

Code:
	if(SpellManager.CanCast("Explosive Trap") && !Me.HasAura("Trap Launcher"))
	{
	 
     SpellManager.Cast("Trap Launcher");
    slog(Color.Red, "Trap Launcher");
    }
        
    if(Me.HasAura("Trap Launcher"))
    {
Lua.DoString("CastSpellByName(\"Explosive Trap\")");
StyxWoW.SleepForLagDuration();    
    LegacySpellManager.ClickRemoteLocation(Me.CurrentTarget.Location);
        slog(Color.Red, "Explosive Trap");
    }

I've never worked with Lua so I dont know the codes for that - would I have to set up a region for what CastSpellByName is or is that an already established argument in the Lua.DoString function? I know you have Movement and WoW traplocation setup in different files so I'm trying to avoid that - is this right though?

Really appreciate the help man! VIVA HB! ... lol
 
Last edited:
I lovez you all ... I'm so glad its a slow day at work and I have time to be here on the forums.
I understand what you're saying now FPS - you can't simply cast Explosive trap with the Trap Launcher active .... Stupid bl***a*d
So could we bypass this with a keyboard press?
say perhaps if I bind the explosive trap to j - and I use
KeyboardManager.PressKey(j);

Not sure if that's how you use it but in case the Lua doesn't work maybe this might? thoughts...ideas? .... Im starting to feel like I might lick this yet ...muahahaha!

Happy Easter to everyone celebrating!
Happy long weekend to everybody who's got it!
And happy play-offs for all the other NBA Fans!
booo Miami!
 
Last edited:
WOOOHOOO!!!!! IT WORKED !!!! MY CODE STOPS AFTER IT CASTS IT BUT WHO CARES I GOT THE TRAP LAUNCHER TO WORK .... I LOVE YOU FPS ... LOVE YOU !!!!

For anyone interested Lua worked :

Code:
Lua.DoString("CastSpellByName('Explosive Trap');");
 
WOOOHOOO!!!!! IT WORKED !!!! MY CODE STOPS AFTER IT CASTS IT BUT WHO CARES I GOT THE TRAP LAUNCHER TO WORK .... I LOVE YOU FPS ... LOVE YOU !!!!

For anyone interested Lua worked :

Code:
Lua.DoString("CastSpellByName('Explosive Trap');");
ive never had a problem, with the spellmanager doing it, but mind you that was with Hawkeye2 and before cataclysm, so maybe they changed it
 
SpellManager.Cast("Flamestrike");
Thread.Sleep(500);
LegacySpellManager.ClickRemoteLocation(Me.CurrentTarget.Location);

the location is WoWUnitLocation not world location and a sleep is needed between the spellcast and the click.


FYI, WorldLocation is the same as Location.
 
Sorry to bump this but if you want the Trap to land 3yards infront of target in PvP as it approaches caster ?
 
The name "LegacySpellManager" makes me think it's there just for legacy reasons - is there an equivalent solution using the official "supported" new way?
 
LegacySpellManager.ClickRemoteLocation(Me.CurrentTarget.Location)

there you go.
there is no "non-Legacy" equivalent since it still works perfectly fine.
 
I have it like that mate.

The downside is it gets thrown behind target sometimes.
 
I have it like that mate.

The downside is it gets thrown behind target sometimes.
then instead of using WoWUnit.Location

you need something like this.
Code:
       public static WoWPoint NavMe
        {
            get
            {
                if (Me.CurrentTarget != null)
                {
                    double Distance = Me.CurrentTarget.Distance + 10;
                    return WoWMathHelper.CalculatePointFrom(Me.Location, Me.CurrentTarget.Location, (float)Distance);
                }
                return Me.Location;
            }
        }
or this
Code:
WoWMovement.ClickToMove(WoWMathHelper.CalculatePointBehind(Me.Location, Me.RotationDegrees, 10));

theres ways to generate WoWLocations without using the actuil unit location.
 
LegacySpellManager.ClickRemoteLocation(Me.CurrentTarget.Location)

there you go.
there is no "non-Legacy" equivalent since it still works perfectly fine.

That's ok, I know it works, but why the meaning of "Legacy" then? Couldn't the *new* SpellManager perform this? If not, why? Maybe it's not warden-safe, or something else? (HB developer reply involved here)
 
That's ok, I know it works, but why the meaning of "Legacy" then? Couldn't the *new* SpellManager perform this? If not, why? Maybe it's not warden-safe, or something else? (HB developer reply involved here)
a while back as we where transitoning over from honor buddy 1 to honorbuddy 2, apoc decided to re-write the spellmanager class. he renamed the old one LagacySpellManager since at the time there was some functions that only the old one could handle. every thing in the API is warden safe.
the function for ClickRemoteLocation is and always has been solid so there was no reason to move it or make a new one when he re-wrote everything.

i remember the change well, because it broke EVERY CC and all of them needed to be updated to still use the old spellmanager untill proper re-writes could be done to work with the new one.
 
Back
Top