Results 1 to 7 of 7
  1. #1
    Lunati's Avatar
    Join Date
    Apr 2013
    Gender
    male
    Posts
    265
    Reputation
    66
    Thanks
    1,545
    My Mood
    Amused

    Post TossEnemyAtPlayer Behavior

    I'm not quite sure why this wasn't added yet, but I need it for thessal's corral bombs, so I put it together quickly.

    This behavior lets a monster toss an enemy at a player instead of only at the angle and distance specified.

    Code:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using wServer.realm;
    using wServer.realm.entities;
    using wServer.svrPackets;
    
    namespace wServer.logic.attack
    {
        class TossEnemyAtPlayer : Behavior
        {
            float range;
            short objType;
    
            private TossEnemyAtPlayer(float range, short objType)
            {
                this.range = range;
                this.objType = objType;
            }
            
            static readonly Dictionary<Tuple<float, short>, TossEnemyAtPlayer> instances = new Dictionary<Tuple<float, short>, TossEnemyAtPlayer>();
            public static TossEnemyAtPlayer Instance(float range, short objType)
            {
                var key = new Tuple<float, short>(range, objType);
                TossEnemyAtPlayer ret;
                if (!instances.TryGetValue(key, out ret))
                    ret = instances[key] = new TossEnemyAtPlayer(range, objType);
                return ret;
            }
    
            Random rand = new Random();
            protected override bool TickCore(RealmTime time)
            {
                float dist = range;
                Entity player = GetNearestEntity(ref dist, null);
                if (player != null)
                {
                    var chr = Host as Character;
                    Position target = new Position()
                    {
                        X = player.X,
                        Y = player.Y
                    };
                    
                    chr.Owner.BroadcastPacket(new ShowEffectPacket()
                    {
                        EffectType = EffectType.Throw,
                        Color = new ARGB(0xffffbf00),
                        TargetId = Host.Self.Id,
                        PosA = target
                    }, null);
                    
                    chr.Owner.Timers.Add(new WorldTimer(1500, (world, t) =>
                    {
                        Entity entity = Entity.Resolve(objType);
                        entity.Move(target.X, target.Y);
                        (entity as Enemy).Terrain = (chr as Enemy).Terrain;
                        world.EnterWorld(entity);
                    }));
                } return true;
            }
        }
    }
    To add this, open up your solution, and navigate to wserver > logic > Attack in the solution explorer.

    Right click on the attack folder > add > new item

    Name it TossEnemyAtPlayer.cs, then click add

    Then, just replace the entire contents of your newly created TossEnemyAtPlayer.cs with the once I posted up there.

    Usage:
    Code:
    TossEnemyAtPlayer.Instance(RANGE, MONSTERID)
    For example:

    Code:
    TossEnemyAtPlayer.Instance(10, 0x1702)
    If the player is within the specified range (first number) it will toss the enemy. Otherwise it will do nothing. The MONSTERID is the id of the monster you want it to toss.

  2. The Following 4 Users Say Thank You to Lunati For This Useful Post:

    CrazyJani (08-08-2013),RaymondW (08-04-2013),sage232 (08-08-2013),Zasx (08-04-2013)

  3. #2
    Zasx's Avatar
    Join Date
    Mar 2013
    Gender
    male
    Location
    Northern Italy
    Posts
    1,379
    Reputation
    10
    Thanks
    442
    My Mood
    Yeehaw
    Holey shet. Pure and plain holey shet.

    The possibilities... Bandit Leaders tossing other Bandit Leaders that toss more Bandit Leader while throwing even more Bandit Leaders.
    TREMBLE BEFORE MY NOOBISH ARMY.

    No wait... Bandit Leaders don't toss anything... crap, my evil plan went apeshit.
    Last edited by Zasx; 08-04-2013 at 01:40 PM.

  4. The Following 3 Users Say Thank You to Zasx For This Useful Post:

    BlackRayquaza (08-24-2013),Lunati (08-04-2013),Tachyonic (08-04-2013)

  5. #3
    sparzinrotmg's Avatar
    Join Date
    Apr 2013
    Gender
    male
    Posts
    107
    Reputation
    10
    Thanks
    1,026
    My Mood
    Amused
    Just one word... AWESOME
    Finnaly i can complete my DrTerrible Script

  6. #4
    rangewolf5's Avatar
    Join Date
    Jun 2013
    Gender
    male
    Posts
    31
    Reputation
    10
    Thanks
    3
    My Mood
    Bored
    do you have the Green Bottle Behavior? cause i need it to compete mine.

  7. #5
    Lunati's Avatar
    Join Date
    Apr 2013
    Gender
    male
    Posts
    265
    Reputation
    66
    Thanks
    1,545
    My Mood
    Amused
    Quote Originally Posted by rangewolf5 View Post
    do you have the Green Bottle Behavior? cause i need it to compete mine.
    Just use this in combination with a ringattack, and despawn after a while?

  8. #6
    L̋̾̈́͑ͥͨͨ͞Ò̴ͫͪ͛͋̉͛Lͥ̔̓ ͨ͛ͬ ͩ̀͢
    Premium Member
    C453's Avatar
    Join Date
    Jul 2012
    Gender
    male
    Location
    /dev/null
    Posts
    574
    Reputation
    44
    Thanks
    2,535
    My Mood
    Aggressive
    Quote Originally Posted by Lunati View Post
    Just use this in combination with a ringattack, and despawn after a while?
    Code:
    Cooldown.Instance(3000, Ringattack.Instance(6, 6, projectileindex:0),
    Cooldown.Instance(3010, Die.Instance)
    no references so don't copy+paste
    cant have shit in detroit

  9. #7
    rangewolf5's Avatar
    Join Date
    Jun 2013
    Gender
    male
    Posts
    31
    Reputation
    10
    Thanks
    3
    My Mood
    Bored
    Quote Originally Posted by C453 View Post
    Code:
    Cooldown.Instance(3000, Ringattack.Instance(6, 6, projectileindex:0),
    Cooldown.Instance(3010, Die.Instance)
    no references so don't copy+paste
    omfg thank you so much. ily <3

Similar Threads

  1. Rude behavior directed towards me
    By Lehsyrus in forum Suggestions, Requests & General Help
    Replies: 3
    Last Post: 09-29-2011, 03:17 PM
  2. [Unity Scripts]Simple AI Behavioral script
    By OBrozz in forum Unity / UDK / GameStudio / CryEngine Development
    Replies: 6
    Last Post: 07-17-2011, 01:33 PM
  3. Mouse_Event strange behavior.
    By VirtualDUDE in forum C++/C Programming
    Replies: 20
    Last Post: 05-13-2011, 06:59 AM
  4. WDF?! SHAMELESS BEHAVIOR?!
    By Unicow in forum Flaming & Rage
    Replies: 9
    Last Post: 02-01-2011, 05:15 AM
  5. abnormal behavior
    By naughtynurse in forum Gunz General
    Replies: 5
    Last Post: 03-29-2006, 08:48 PM