Results 1 to 11 of 11
  1. #1
    Matrix1101's Avatar
    Join Date
    Oct 2015
    Gender
    male
    Posts
    169
    Reputation
    10
    Thanks
    172

    [Fabiano] Despawn Static Objects Behavior

    Hello MPGH,
    Some of you may have noticed that static objects and/or walls don't work with 'suicide()' or 'decay()'. I created a new behavior specifically for removing walls, which works for static objects.

    1. go to wserver>logic>behaviors

    2. create a new file called 'OpenGate.cs'

    3. copy and paste code
     
    Code:
    #region
    
    using System;
    using wServer.realm;
    using wServer.realm.entities;
    
    #endregion
    
    namespace wServer.logic.behaviors
    {
        public class OpenGate : Behavior
        {
            private int xMin;
            private int xMax;
            private int yMin;
            private int yMax;
    
            private string target;
            private int area;
    
            private bool usearea;
    
            public OpenGate(int xMin, int xMax, int yMin, int yMax)
            {
                this.xMin = xMin;
                this.xMax = xMax;
                this.yMin = yMin;
                this.yMax = yMax;
            }
    
            public OpenGate(string target, int area = 10)
            {
                this.target = target;
                this.area = area;
                this.usearea = true;
            }
    
            protected override void TickCore(Entity host, RealmTime time, ref object state)
            {
                if (usearea)
                {
                    for (int x = (int)host.X - area; x <= (int)host.X + area; x++)
                    {
                        for (int y = (int)host.Y - area; y <= (int)host.Y + area; y++)
                        {
                            WmapTile tile = host.Owner.Map[x, y];
                            if (tile.ObjType == host.Manager.GameData.IdToObjectType[target])
                            {
                                tile.ObjType = 0;
                                host.Owner.Map[x, y] = tile;
                            }
                        }
                    }
                }
                else
                {
                    for (int x = xMax; x <= xMax; x++)
                    {
                        for (int y = yMin; y <= yMax; y++)
                        {
                            WmapTile tile = host.Owner.Map[x, y];
                            tile.ObjType = 0;
                            host.Owner.Map[x, y] = tile;
                        }
                    }
                }
            }
        }
    }


    3. Run the behavior on switches or an invisible controller. (anything but the walls itself)

    Basically, the behavior can remove all static objects within a given rectangular area, or a set static objects within an area around the switch.
    I probably didn't explain this as well as I could have, so here are some examples:

     
    Code:
                        //All static objects in an area
                        new OpenGate(37, 37, 176, 180),
                        //Given static object in a radius around the switch
                        new OpenGate("White Wall", 10),


     
    Code:
                        //All static objects in an area
                        new OpenGate(int xmin, int xmax, int ymin, int ymax),
                        //Given static object in a radius around the switch
                        new OpenGate(string target, int area),


    Enjoy!

  2. The Following User Says Thank You to Matrix1101 For This Useful Post:

    Invader_Zim (05-12-2016)

  3. #2
    Desire's Avatar
    Join Date
    Sep 2013
    Gender
    male
    Location
    Insert Name Here
    Posts
    1,039
    Reputation
    58
    Thanks
    1,394
    My Mood
    Amused
    I Fixed this by editting the client xml to have static but the server xml not to have static. This works too
    im not really back nor will i ever get back into developing pservers
    though ill check once every month atleast


     

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

    Daemonmann (05-12-2016),HGAEHaeheadhetdhtertherh (05-13-2016)

  5. #3
    Riigged's Avatar
    Join Date
    Jan 2013
    Gender
    male
    Location
    no
    Posts
    3,846
    Reputation
    401
    Thanks
    10,254
    My Mood
    Devilish
    Thanks for this, this can be done other ways and I was just about to release a tutorial (I've done this a different way for my custom dungeons) actually but you beat me to it (I'm assuming you saw the same thread I did that made you think of this xD)

     








  6. #4
    Matrix1101's Avatar
    Join Date
    Oct 2015
    Gender
    male
    Posts
    169
    Reputation
    10
    Thanks
    172
    Quote Originally Posted by Bear View Post
    I Fixed this by editting the client xml to have static but the server xml not to have static. This works too
    Good idea, I probably overthought this (although this can still save time from cloning walls to despawn that will probably be only used once).
    Last edited by Matrix1101; 05-12-2016 at 09:31 PM.

  7. #5
    Desire's Avatar
    Join Date
    Sep 2013
    Gender
    male
    Location
    Insert Name Here
    Posts
    1,039
    Reputation
    58
    Thanks
    1,394
    My Mood
    Amused
    Quote Originally Posted by Matrix1101 View Post
    Good idea, I probably overthought this (although it can still save time from cloning walls to despawn that will probably be only used once).
    Although editting the xml in the client would be a bit more time consuming compared to having it do this
    im not really back nor will i ever get back into developing pservers
    though ill check once every month atleast


     

  8. #6
    Matrix1101's Avatar
    Join Date
    Oct 2015
    Gender
    male
    Posts
    169
    Reputation
    10
    Thanks
    172
    Quote Originally Posted by Riigged View Post
    Thanks for this, this can be done other ways and I was just about to release a tutorial (I've done this a different way for my custom dungeons) actually but you beat me to it (I'm assuming you saw the same thread I did that made you think of this xD)
    If it's a completely different method then you can still post it. (Probaly the same thread )

    - - - Updated - - -

    Quote Originally Posted by Bear View Post
    Although editting the xml in the client would be a bit more time consuming compared to having it do this
    true
    //10char
    Last edited by Matrix1101; 05-12-2016 at 09:34 PM.

  9. #7
    BlackRayquaza's Avatar
    Join Date
    Nov 2012
    Gender
    male
    Posts
    574
    Reputation
    10
    Thanks
    186
    My Mood
    In Love
    Quote Originally Posted by Bear View Post
    I Fixed this by editting the client xml to have static but the server xml not to have static. This works too
    Do you not know what static objects are?
    YEP cock

  10. #8
    Daemonmann's Avatar
    Join Date
    May 2015
    Gender
    male
    Location
    Santo André - SP
    Posts
    236
    Reputation
    10
    Thanks
    14
    My Mood
    Bored
    i do not understand how to use it..., can u make a better example (for noobs :P)


    | Welcome to My Signature |

    |Thanks Friends|



     


    !Thanks Skilly!



    !Thanks Skilly!



    !Thanks Skilly!




     



     









    | !Daemon Realms Resurrected! |




  11. #9
    Matrix1101's Avatar
    Join Date
    Oct 2015
    Gender
    male
    Posts
    169
    Reputation
    10
    Thanks
    172
    Quote Originally Posted by Daemonmann View Post
    i do not understand how to use it..., can u make a better example (for noobs :P)
    Its a behavior. Basically you want to make a new 'enemy' (switch) that runs the behavior when killed. Say you want to de-spawn the nexus white walls (they're called 'white wall'). Just make the switch, and put the behavior:

    new OpenGate("White Wall", 10),

    This will remove every white wall within 10 tiles.

    Just change the name and radius to whatever you want.

  12. The Following User Says Thank You to Matrix1101 For This Useful Post:

    Daemonmann (05-31-2016)

  13. #10
    Daemonmann's Avatar
    Join Date
    May 2015
    Gender
    male
    Location
    Santo André - SP
    Posts
    236
    Reputation
    10
    Thanks
    14
    My Mood
    Bored
    Quote Originally Posted by Matrix1101 View Post
    Its a behavior. Basically you want to make a new 'enemy' (switch) that runs the behavior when killed. Say you want to de-spawn the nexus white walls (they're called 'white wall'). Just make the switch, and put the behavior:

    new OpenGate("White Wall", 10),

    This will remove every white wall within 10 tiles.

    Just change the name and radius to whatever you want.
    Thanks Bro!


    | Welcome to My Signature |

    |Thanks Friends|



     


    !Thanks Skilly!



    !Thanks Skilly!



    !Thanks Skilly!




     



     









    | !Daemon Realms Resurrected! |




  14. #11
    Desire's Avatar
    Join Date
    Sep 2013
    Gender
    male
    Location
    Insert Name Here
    Posts
    1,039
    Reputation
    58
    Thanks
    1,394
    My Mood
    Amused
    Quote Originally Posted by Matrix1101 View Post
    I created a new behavior specifically for removing walls
    Just a bump, this apparently doesn't seem to work for me
    im not really back nor will i ever get back into developing pservers
    though ill check once every month atleast


     

  15. The Following User Says Thank You to Desire For This Useful Post:

    MikeRaarupBirk (09-08-2016)

Similar Threads

  1. [Solved] Fabiano's Source Shatters Behaviors?
    By Desire in forum Realm of the Mad God Private Servers Help
    Replies: 5
    Last Post: 05-14-2016, 03:09 PM
  2. D4NK B33R G0D BEHAVIOR (Fabiano Src)
    By Omniraptor in forum Realm of the Mad God Private Servers Tutorials/Source Code
    Replies: 11
    Last Post: 09-14-2015, 07:45 AM
  3. Fabiano Merchant Object
    By Riigged in forum Realm of the Mad God Private Servers Help
    Replies: 3
    Last Post: 07-28-2015, 12:12 PM
  4. [Help Request] Any Fabiano behaviors?
    By gunit99 in forum Realm of the Mad God Private Servers Help
    Replies: 4
    Last Post: 07-25-2015, 07:14 PM
  5. Fabiano Source Behaviors
    By Snorkaas in forum Realm of the Mad God Private Servers Tutorials/Source Code
    Replies: 1
    Last Post: 06-24-2015, 11:43 AM