Jump to content

how to make fightclass move behind target?


Recommended Posts

Yes, i think you can do it by lua or moveto(i prefered on other bots to use lua if character was close enough to the target to strafe and set rotation). There must be also an movementevent that you can block which is set on the fightclass.

 

Here's an example to get the target's back vector:

    public Vector3 BackofVector3(Vector3 from, float radius)
    {
        if (from != null && from != Vector3.Empty)
        {
			//abit ugly
            float rotation = -robotManager.Helpful.Math.DegreeToRadian(robotManager.Helpful.Math.RadianToDegree(ObjectManager.Me.TargetObject.Rotation)+90);
            return new Vector3((System.Math.Sin(rotation)*radius) + from.X, (System.Math.Cos(rotation)*radius) + from.Y, from.Z);
        }
        return new Vector3(0, 0, 0);
    }

and to see the point where it is just add this in initialize method:

        Radar3D.OnDrawEvent += () =>
        {
            if (ObjectManager.Me.TargetObject != null)
            Radar3D.DrawCircle(BackofVector3(ObjectManager.Me.TargetObject.Position, 2f), 0.3f, Color.Blue);
        };

if you decide to use it, i recommend to also set your own rotation by atan2 to your target(it looks more smooth) and disable it on npcs because it looks awful when the bot is running around on its target indefinitely.

.

Link to comment
Share on other sites

1 hour ago, camelot10 said:

i dont want convert figthclass into C#, is there any possibility to run this code while in fight with xml?

type the code in where you add spells and set it to "not spell, is c# code" in the spell settings

Link to comment
Share on other sites

Yep you can also paste the code to the fightclass for e.g.

Gobehindtest.xml

as i wrote it in the last post, i prefer to use lua(but it's more difficult to code) else it looks abit jagged with moveto and by the way if you wanna see the point just enable 3dRadar.

 

Link to comment
Share on other sites

  • 4 months later...

None of the above is working for me, ayone got an aswer to this?

I've been trying to make a rogue fightclass and moving behind an enemy is just the thing i want it to do.

[F] 02:30:48 - [FightClass] Launch C# code: public Vector3 BackofVector3(Vector3 from, float radius)
    {
        if (from != null && from != Vector3.Empty)
        {
            //abit ugly
            float rotation = -robotManager.Helpful.Math.DegreeToRadian(robotManager.Helpful.Math.RadianToDegree(ObjectManager.Me.TargetObject.Rotation)+90);
            return new Vector3((System.Math.Sin(rotation)*radius) + from.X, (System.Math.Cos(rotation)*radius) + from.Y, from.Z);
        }
        return new Vector3(0, 0, 0);
    }
[E] 02:30:48 - Compilator Error :
c:\Users\Dean\AppData\Local\Temp\szwfbcwc.0.cs(20,5) : error CS1513: } expected
c:\Users\Dean\AppData\Local\Temp\szwfbcwc.0.cs(30,6) : error CS1597: Semicolon after method or accessor block is not valid
c:\Users\Dean\AppData\Local\Temp\szwfbcwc.0.cs(32,1) : error CS1022: Type or namespace definition, or end-of-file expected

 

Link to comment
Share on other sites

On 27/08/2017 at 2:36 AM, Trustjah said:

None of the above is working for me, ayone got an aswer to this?

I've been trying to make a rogue fightclass and moving behind an enemy is just the thing i want it to do.


[F] 02:30:48 - [FightClass] Launch C# code: public Vector3 BackofVector3(Vector3 from, float radius)
    {
        if (from != null && from != Vector3.Empty)
        {
            //abit ugly
            float rotation = -robotManager.Helpful.Math.DegreeToRadian(robotManager.Helpful.Math.RadianToDegree(ObjectManager.Me.TargetObject.Rotation)+90);
            return new Vector3((System.Math.Sin(rotation)*radius) + from.X, (System.Math.Cos(rotation)*radius) + from.Y, from.Z);
        }
        return new Vector3(0, 0, 0);
    }
[E] 02:30:48 - Compilator Error :
c:\Users\Dean\AppData\Local\Temp\szwfbcwc.0.cs(20,5) : error CS1513: } expected
c:\Users\Dean\AppData\Local\Temp\szwfbcwc.0.cs(30,6) : error CS1597: Semicolon after method or accessor block is not valid
c:\Users\Dean\AppData\Local\Temp\szwfbcwc.0.cs(32,1) : error CS1022: Type or namespace definition, or end-of-file expected

 

How(where) do you use this code?

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...