borg333 0 Posted January 14, 2017 Share Posted January 14, 2017 Hi, whether there is a way to cast any spell to object with out target? For example: I have list of enemy players and i want to doting everyone who don't have my dots: WoWPlayer unit = listPlayersResult.OrderBy(u => u.HealthPercent).FirstOrDefault(u => u.GetDistance <= 39); if (dot conditions) string tarname = unit.Name.ToString(); and then cast on object Lua.LuaDoString("CastSpellByName(GetSpellInfo(48463), \"" + tarname + "\")"); I know that tarname must be player, target, raid1 e.t.c and name of target in my party, but i want to cast spells on targets wich not in my party and dont target them. Link to comment https://wrobot.eu/forums/topic/4745-cast-on-object/ Share on other sites More sharing options...
iMod 99 Posted January 14, 2017 Share Posted January 14, 2017 2 hours ago, borg333 said: Hi, whether there is a way to cast any spell to object with out target? For example: I have list of enemy players and i want to doting everyone who don't have my dots: WoWPlayer unit = listPlayersResult.OrderBy(u => u.HealthPercent).FirstOrDefault(u => u.GetDistance <= 39); if (dot conditions) string tarname = unit.Name.ToString(); and then cast on object Lua.LuaDoString("CastSpellByName(GetSpellInfo(48463), \"" + tarname + "\")"); I know that tarname must be player, target, raid1 e.t.c and name of target in my party, but i want to cast spells on targets wich not in my party and dont target them. Hello, // Get target WoWUnit target = .... // Get Spell Spell spell = new Spell("SpellName"); // Cast on target Lua.LuaDoString($"CastSpellByID({spell.Id}, \"{target.Name}\")"); Hope that helps. Link to comment https://wrobot.eu/forums/topic/4745-cast-on-object/#findComment-21965 Share on other sites More sharing options...
borg333 0 Posted January 14, 2017 Author Share Posted January 14, 2017 Lua.LuaDoString($"CastSpellByID({spell.Id}, \"{target.Name}\")"); has told me that unexpected symbol $. Perhaps because I use version 3.3.5? Link to comment https://wrobot.eu/forums/topic/4745-cast-on-object/#findComment-21967 Share on other sites More sharing options...
iMod 99 Posted January 14, 2017 Share Posted January 14, 2017 24 minutes ago, borg333 said: Lua.LuaDoString($"CastSpellByID({spell.Id}, \"{target.Name}\")"); has told me that unexpected symbol $. Perhaps because I use version 3.3.5? Has nothing todo with the game it self. You need .net framework 4.6 i think. If you don't want to install it you can replace the line with // Cast on target Lua.LuaDoString(String.Format("CastSpellByID({0}, \"{0}\")", spell.Id, target.Name)); Link to comment https://wrobot.eu/forums/topic/4745-cast-on-object/#findComment-21970 Share on other sites More sharing options...
borg333 0 Posted January 14, 2017 Author Share Posted January 14, 2017 I have .net framework 4.6.01586. Trying to do this: #region DotList test public bool DotListtest() { Spell spell = new Spell("Moonfire"); List<WoWPlayer> listPlayersResult = new List<WoWPlayer>(); List<WoWPlayer> allPlayers = ObjectManager.GetObjectWoWPlayer(); foreach (var player in allPlayers) { if (UnitCanAttack.CanAttack(player.GetBaseAddress, ObjectManager.Me.GetBaseAddress) && player.IsValid && player.IsAlive && CheckBS(player) && !TraceLine.TraceLineGo(player.Position) && (ObjectManager.Me.Guid != player.BuffCastedBy(spell.Name))) listPlayersResult.Add(player); } WoWPlayer unit1 = listPlayersResult.OrderBy(u => u.HealthPercent).FirstOrDefault(u => u.GetDistance <= 39); if (unit1 != null && ObjectManager.Me.Guid != unit1.BuffCastedBy(spell.Name)) { WoWUnit target = unit1; Lua.LuaDoString(String.Format("CastSpellByID({0}, \"{0}\")", spell.Id, target.Name)); } return false; } #endregion and nothing happens and no errors. Link to comment https://wrobot.eu/forums/topic/4745-cast-on-object/#findComment-21975 Share on other sites More sharing options...
Pasterke 98 Posted January 14, 2017 Share Posted January 14, 2017 Use WoWUnit instead of WoWPlayer, then it can be used on both, enemy players or mobs. Remove the unit.IsValid => gives problems What is CheckBS(player) ? Missing a return true statement in your if (unit1 != null .... Don't make new spells all the time, define it global. private Spell moonfire = new Spell("Moonfire"); private Spell sunfire = new Spell("Sunfire"); Then call your bool with : public bool DotListTest(Spell spell) //DoListTest(moonfire); { } remove the line Spell spell = new Spell("Moonfire"); That way you can use it for any check ex Sunfire Link to comment https://wrobot.eu/forums/topic/4745-cast-on-object/#findComment-21976 Share on other sites More sharing options...
borg333 0 Posted January 14, 2017 Author Share Posted January 14, 2017 If i use WoWUnit and trying to add in list players -> Implicit conversion of type "System.Collections.Generic.List<wManager.Wow.ObjectManager.WoWPlayer>" in "System.Collections.Generic.List<wManager.Wow.ObjectManager.WoWUnit>" impossible and i tryed to use WoWUnit unit = ObjectManager.GetWoWUnitHostile().OrderBy(u => u.HealthPercent).FirstOrDefault(u => u.GetDistance <= 39); and it returns only mobs CheckBS is my bool condition. i remove CheckBS and unit.IsValid conditions Link to comment https://wrobot.eu/forums/topic/4745-cast-on-object/#findComment-21980 Share on other sites More sharing options...
borg333 0 Posted January 14, 2017 Author Share Posted January 14, 2017 it was example and return true does not exists coz of testing, needs to work all the time, when it will work, i add return true. ok, i post func that works by targetting valid unit and dotting by the target: _StarFire = new Spell(48465); _Swarm = new Spell(48468); #region DotList no shield public bool DotList() { List<WoWPlayer> listPlayersResult = new List<WoWPlayer>(); List<WoWPlayer> allPlayers = ObjectManager.GetObjectWoWPlayer(); foreach (var player in allPlayers) { if (UnitCanAttack.CanAttack(player.GetBaseAddress, ObjectManager.Me.GetBaseAddress) && player.IsAlive && !TraceLine.TraceLineGo(player.Position) && (ObjectManager.Me.Guid != player.BuffCastedBy(_MoonFire.Name) || ObjectManager.Me.Guid != player.BuffCastedBy(_Swarm.Name))) listPlayersResult.Add(player); } WoWPlayer unit1 = listPlayersResult.OrderBy(u => u.HealthPercent).FirstOrDefault(u => u.GetDistance <= 39); if (unit1 != null && ObjectManager.Me.Guid != unit1.BuffCastedBy(_MoonFire.Name)) { string unitName = unit1.Name.ToString(); Lua.LuaDoString("TargetUnit(\"" + unitName + "\")"); _MoonFire.Launch(); } if (unit1 != null && ObjectManager.Me.Guid != unit1.BuffCastedBy(_Swarm.Name)) { string unitName = unit1.Name.ToString(); Lua.LuaDoString("TargetUnit(\"" + unitName + "\")"); _Swarm.Launch(); } return false; } #endregion Yes, i dont use Interact.InteractGameObject(unit1.GetBaseAddress); it useless in pvp. This DotList() works but i dont want to target unit1, i want to cast spells on unit1 like on game object. Tryed Lua.LuaDoString("CastSpellByName( GetSpellInfo(48468), \"" + unitName + "\")"); and Lua.LuaDoString(String.Format("CastSpellByID({0}, \"{0}\")", _Swarm.Id, unit1.Name)); not working Link to comment https://wrobot.eu/forums/topic/4745-cast-on-object/#findComment-21983 Share on other sites More sharing options...
Droidz 2738 Posted January 15, 2017 Share Posted January 15, 2017 Hello, try wManager.Wow.Helpers.Interact.InteractGameObject(unit1.GetBaseAddress, true); if (wManager.Wow.ObjectManager.ObjectManager.Me.Target == unit1.Guid) { Lua.LuaDoString(String.Format("CastSpellByID({0}, 'target')", _Swarm.Id)); } or wManager.Wow.ObjectManager.ObjectManager.Me.FocusGuid = unit1.Guid; if (wManager.Wow.ObjectManager.ObjectManager.Me.FocusGuid == unit1.Guid) { Lua.LuaDoString(String.Format("CastSpellByID({0}, 'focus')", _Swarm.Id)); } or wManager.Wow.Helpers.Interact.InteractGameObject(unit1.GetBaseAddress, true); if (wManager.Wow.ObjectManager.ObjectManager.Me.Target == unit1.Guid) { wManager.Wow.Helpers.SpellManager.CastSpellByNameOn(_StarFire.NameInGame, "target"); } or wManager.Wow.ObjectManager.ObjectManager.Me.FocusGuid = unit1.Guid; if (wManager.Wow.ObjectManager.ObjectManager.Me.FocusGuid == unit1.Guid) { wManager.Wow.Helpers.SpellManager.CastSpellByNameOn(_StarFire.NameInGame, "focus"); } Link to comment https://wrobot.eu/forums/topic/4745-cast-on-object/#findComment-21993 Share on other sites More sharing options...
borg333 0 Posted January 15, 2017 Author Share Posted January 15, 2017 If i do InteractGameObject(unit1.GetBaseAddress, true) i will target unit1 in frame, but i want cast on enemy as focus/party1.../raid1.../ arena1... etc, without target them in frame. I know that i can focusing enemy end cast on focus but it is not a way out Link to comment https://wrobot.eu/forums/topic/4745-cast-on-object/#findComment-21994 Share on other sites More sharing options...
Droidz 2738 Posted January 15, 2017 Share Posted January 15, 2017 Try to use this code wManager.Wow.ObjectManager.ObjectManager.Me.FocusGuid = unit1.Guid; if (wManager.Wow.ObjectManager.ObjectManager.Me.FocusGuid == unit1.Guid) { wManager.Wow.Helpers.SpellManager.CastSpellByNameOn(_StarFire.NameInGame, "focus"); } Link to comment https://wrobot.eu/forums/topic/4745-cast-on-object/#findComment-21996 Share on other sites More sharing options...
borg333 0 Posted January 15, 2017 Author Share Posted January 15, 2017 My focus is not empty, therefore i cant use focus to target valid unit1, and thats why i ask about cast on units without target them in frame. Tell me please, whether there is a way to cast an unit as an game object and if not whether this possibility in the future for 3.3.5? Link to comment https://wrobot.eu/forums/topic/4745-cast-on-object/#findComment-21997 Share on other sites More sharing options...
Droidz 2738 Posted January 17, 2017 Share Posted January 17, 2017 You cannot cast spell in select player/npc directly. Try this: var f = wManager.Wow.ObjectManager.ObjectManager.Me.FocusGuid; wManager.Wow.ObjectManager.ObjectManager.Me.FocusGuid = unit1.Guid; if (wManager.Wow.ObjectManager.ObjectManager.Me.FocusGuid == unit1.Guid) { wManager.Wow.Helpers.SpellManager.CastSpellByNameOn(_StarFire.NameInGame, "focus"); } System.Threading.Thread.Sleep(500); wManager.Wow.ObjectManager.ObjectManager.Me.FocusGuid = f; Link to comment https://wrobot.eu/forums/topic/4745-cast-on-object/#findComment-22023 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now