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

    Post RandomDo Behavior

    This is completely made by @pLolz I'm just posting it.

    Just a simple little code to run a behavior with a random chance.

    Code:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using wServer.cliPackets;
    using wServer.svrPackets;
    using wServer.realm.setpieces;
    using db;
    using wServer.realm;
    using wServer.realm.entities;
    using wServer.logic;
    
    namespace wServer.logic
    {
        public class RandomDo : Behavior
        {
            int percent;
            Behavior result;
            public RandomDo(int percent, Behavior result)
            {
                this.result = result;
                this.percent = percent;
            }
            protected override bool TickCore(RealmTime time)
            {
                var enemy = Host as Enemy;
                if (new Random().Next(1, 100) <= percent)
                    return result.Tick(Host, time);
    
                return false;
            }
        }
    }
    Add it to wServer>Logic

    Usage: new RandomDo(Chance, Behavior)
    For Example: new RandomDo(10, new Setkey (-1, 1))
    Last edited by Lunati; 08-07-2013 at 06:37 PM.

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

    CrazyJani (08-08-2013),RaymondW (08-07-2013),Tachyonic (08-07-2013),Zasx (08-07-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
    I can see this beign useful in some odd and weird way.

    As usual thanks. If it wasn't for you I would not be able to break my server by doing stupid stuff.

  4. The Following User Says Thank You to Zasx For This Useful Post:

    BlackRayquaza (02-25-2014)

  5. #3
    Drowlys's Avatar
    Join Date
    Aug 2012
    Gender
    male
    Location
    The Crawling Depths
    Posts
    196
    Reputation
    10
    Thanks
    2,675
    Nice with this Dying Thessal is possible

  6. #4
    Lunati's Avatar
    Join Date
    Apr 2013
    Gender
    male
    Posts
    265
    Reputation
    66
    Thanks
    1,545
    My Mood
    Amused
    Quote Originally Posted by Drowlys View Post
    Nice with this Dying Thessal is possible
    Well, this together with my readchat thingy :P

    Edit: Noticed that part of the code wasn't showing in the code tags. Thanks to @RaymondW for notifying me!
    Last edited by Lunati; 08-07-2013 at 06:39 PM.

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