[FSoD] Conditional Behaviors

Posts 1–14 of 14 · Page 1 of 1
[FSoD] Conditional Behaviors
Why did I make this?

Since I started remaking all the dungeons on my private server to be 100% prodlike, I needed certain behaviors to only happen when the enemy has a certain condition effect (Limon and Paralyze). Not sure how many people already have this, but since it was fairly simple to create, I decided it wouldn't cause any harm to release.

How do I add this to my private server?


Adding this to your private server is fairly simple. First create a new item in /wServer/logic/behaviors and name it "ConditionalBehavior.cs".




After that, replace that entire file with this code.


Code:
using wServer.realm;

namespace wServer.logic.behaviors
{
    public class ConditionalBehavior : Behavior
    {
        private readonly ConditionEffectIndex effect;
        private readonly Behavior behavior;

        public ConditionalBehavior(ConditionEffectIndex effect, Behavior behavior)
        {
            this.effect = effect;
            this.behavior = behavior;
        }

        protected override void OnStateEntry(Entity host, RealmTime time, ref object state)
        {
            behavior.OnStateEntry(host, time);
        }

        protected override void TickCore(Entity host, RealmTime time, ref object state)
        {
            if (host.HasConditionEffect(effect))
                behavior.Tick(host, time);
        }
    }
}


How do I use this?



Example

Behavior used





This is a very basic behavior, but tons of very cool bosses/enemies can be made because of it! If this was released already, my apologies. I would love to see the cool bosses made with this so if you make something neat, upload a video on it and pm the video (if you can)

Credits

OmegaBM
Quote Originally Posted by OmegaBM View Post
Why did I make this?

Since I started remaking all the dungeons on my private server to be 100% prodlike, I needed certain behaviors to only happen when the enemy has a certain condition effect (Limon and Paralyze). Not sure how many people already have this, but since it was fairly simple to create, I decided it wouldn't cause any harm to release.

How do I add this to my private server?


Adding this to your private server is fairly simple. First create a new item in /wServer/logic/behaviors and name it "ConditionalBehavior.cs".




After that, replace that entire file with this code.


Code:
using wServer.realm;

namespace wServer.logic.behaviors
{
    public class ConditionalBehavior : Behavior
    {
        private readonly ConditionEffectIndex effect;
        private readonly Behavior behavior;

        public ConditionalBehavior(ConditionEffectIndex effect, Behavior behavior)
        {
            this.effect = effect;
            this.behavior = behavior;
        }

        protected override void OnStateEntry(Entity host, RealmTime time, ref object state)
        {
            behavior.OnStateEntry(host, time);
        }

        protected override void TickCore(Entity host, RealmTime time, ref object state)
        {
            if (host.HasConditionEffect(effect))
                behavior.Tick(host, time);
        }
    }
}


How do I use this?



Example

Behavior used





This is a very basic behavior, but tons of very cool bosses/enemies can be made because of it! If this was released already, my apologies. I would love to see the cool bosses made with this so if you make something neat, upload a video on it and pm the video (if you can)

Credits

OmegaBM
This is actually really nice, thanks alot for the release.
Quote Originally Posted by OmegaBM View Post
Why did I make this?

Since I started remaking all the dungeons on my private server to be 100% prodlike, I needed certain behaviors to only happen when the enemy has a certain condition effect (Limon and Paralyze). Not sure how many people already have this, but since it was fairly simple to create, I decided it wouldn't cause any harm to release.

How do I add this to my private server?


Adding this to your private server is fairly simple. First create a new item in /wServer/logic/behaviors and name it "ConditionalBehavior.cs".




After that, replace that entire file with this code.


Code:
using wServer.realm;

namespace wServer.logic.behaviors
{
    public class ConditionalBehavior : Behavior
    {
        private readonly ConditionEffectIndex effect;
        private readonly Behavior behavior;

        public ConditionalBehavior(ConditionEffectIndex effect, Behavior behavior)
        {
            this.effect = effect;
            this.behavior = behavior;
        }

        protected override void OnStateEntry(Entity host, RealmTime time, ref object state)
        {
            behavior.OnStateEntry(host, time);
        }

        protected override void TickCore(Entity host, RealmTime time, ref object state)
        {
            if (host.HasConditionEffect(effect))
                behavior.Tick(host, time);
        }
    }
}


How do I use this?



Example

Behavior used





This is a very basic behavior, but tons of very cool bosses/enemies can be made because of it! If this was released already, my apologies. I would love to see the cool bosses made with this so if you make something neat, upload a video on it and pm the video (if you can)

Credits

OmegaBM
this isnt needed to make behaviors
Quote Originally Posted by Slendergo View Post
Quote Originally Posted by OmegaBM View Post
Why did I make this?

Since I started remaking all the dungeons on my private server to be 100% prodlike, I needed certain behaviors to only happen when the enemy has a certain condition effect (Limon and Paralyze). Not sure how many people already have this, but since it was fairly simple to create, I decided it wouldn't cause any harm to release.

How do I add this to my private server?


Adding this to your private server is fairly simple. First create a new item in /wServer/logic/behaviors and name it "ConditionalBehavior.cs".




After that, replace that entire file with this code.


Code:
using wServer.realm;

namespace wServer.logic.behaviors
{
    public class ConditionalBehavior : Behavior
    {
        private readonly ConditionEffectIndex effect;
        private readonly Behavior behavior;

        public ConditionalBehavior(ConditionEffectIndex effect, Behavior behavior)
        {
            this.effect = effect;
            this.behavior = behavior;
        }

        protected override void OnStateEntry(Entity host, RealmTime time, ref object state)
        {
            behavior.OnStateEntry(host, time);
        }

        protected override void TickCore(Entity host, RealmTime time, ref object state)
        {
            if (host.HasConditionEffect(effect))
                behavior.Tick(host, time);
        }
    }
}


How do I use this?



Example

Behavior used





This is a very basic behavior, but tons of very cool bosses/enemies can be made because of it! If this was released already, my apologies. I would love to see the cool bosses made with this so if you make something neat, upload a video on it and pm the video (if you can)

Credits

OmegaBM
this isnt needed to make behaviors
Why do you quote the entire post ._.
Quote Originally Posted by Slendergo View Post
this isnt needed to make behaviors
I mean, the sprite world boss could use this i guess. Cant really think of any other boss/mob that uses this.
Quote Originally Posted by Slendergo View Post
this isnt needed to make behaviors
sort of is, on prod, when Limon is paralyzed, he does a certain behavior, and a few other enemies do the same but with different effects and etc.
Quote Originally Posted by Riigged View Post
sort of is, on prod, when Limon is paralyzed, he does a certain behavior, and a few other enemies do the same but with different effects and etc.
When Limon is paralyzed, he shoots 2 shots at you constantly and shoots all out 360
Quote Originally Posted by Desire View Post
When Limon is paralyzed, he shoots 2 shots at you constantly and shoots all out 360
i know xD he does same thing when you are cloaked
Quote Originally Posted by Riigged View Post
i know xD he does same thing when you are cloaked
Shaitan the Advisor with Armor Broken too.
This is very nice, you can make some really nice dungeons with this, I'm not only talking about production ones, this does allow you to create some super cool and unique things.
This could also be the fix for "dazed" on enemies.
Quote Originally Posted by MikeRaarupBirk View Post
This could also be the fix for "dazed" on enemies.
It's very easy to fix dazed on enemies. This behavior is not for that, and either wouldn't work, or be very tedious.
Quote Originally Posted by Invader_Zim View Post
It's very easy to fix dazed on enemies. This behavior is not for that, and either wouldn't work, or be very tedious.
halp me fix dazed xd
Posts 1–14 of 14 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?