How To Create a Poison/Bleed/DoT Effect (Read 512 times)

Started by naanvilence, January 28, 2018, 09:27:44 pm
Share this topic:
How To Create a Poison/Bleed/DoT Effect
#1  January 28, 2018, 09:27:44 pm
  • avatar
    • USA
Good afternoon,

I'm aware that I am new, and this post might frustrate people if I haven't posted it in the proper area, plese let me know and I will delete this post and take my question to the proper channel.

Anyhow, I am aware that if you want P2 (the opponent) to enter a certain state that is not normally in the game, you have to program a custom state for player 2, correct? Stuff like that would include a wall bounce like kung fu man, right?

So if I wanted player 2 to lose a small amount of health every second after I hit them with a dagger-type move, for example, I would need to make a DoT custom state I think.

So if I wanted to do that, does that require a variable system of some kind? So l want them to take 3 damage every second for 5 seconds when they enter this state, but I need to refresh the timer if they get hit with the move again before the original time runs out.

If someone could explain how I would set up this state and how to use variables I would appreciate it. I am pretty new to Mugen, and can code simple attack states, but variables and custom states are still a bit tricky for me.

Help would be appreciated:

TLDR: how would i code a custom state where P2 would take damage every second for a duration, and have that duration refresh when struck by that same move before the original time ends?
Last Edit: January 29, 2018, 08:19:01 pm by naanvilence
Re: How To Create a Poison/Bleed/DoT Effect
#2  January 28, 2018, 09:49:14 pm
  • *****
  • Shame on you!
    • USA
You are correct about custom states. I kinda think of them as "throws". Because P1 is controlling how P2 looks and acts.

The damage over time could be used in a custom state. But while in the custom state P2 isn't in control. Reading that you intend to be able to hit P2 multiple times leads me to think P2 should be able to get out of the custom state and start fighting again. For this type you'd want to
P2 after the initial attack, but still have something being able to hurt it at specific times.

So here's the real question.
Do you want P2 to get a hit reaction every second? Like the DoT is stunning him? OR
Do you want P2's health to slowly drain without interfering with P2's fighting?

Mugen Class should become extremely useful to you. You'll want to look over The MUGEN Docs Master Thread also. It's going to have the stuff you want to know about variables. You may want to look at the link at the bottom of the Var page. It's pretty good at explaining what variables are and do.
vVv Wheat Stage Released vVv
Last Edit: January 28, 2018, 09:56:40 pm by Odb718
Re: How To Create a Poison/Bleed/DoT Effect
#3  January 28, 2018, 09:51:27 pm
  • avatar
    • USA
I want them to still be able to fight.

I just want them to take DOT damage after the move ends, but just refresh the dot if they are struck with the move again before the original duration ends


I just want their health to slowly drain without interfering with P2's fighting.

Also I'm sorry to take up so much of your time.

oh ok I will read through that
Last Edit: January 28, 2018, 10:06:49 pm by naanvilence
Re: How To Create a Poison/Bleed/DoT Effect
#4  January 28, 2018, 10:14:42 pm
  • *****
  • Shame on you!
    • USA
It's no trouble at all. Feel free to ask all the questions you want. Just try and see if they've been answered with a quick search of this board. Trust me, people ask the same question a thousand different ways. We always try to help out.

So I've actually modified a move that does this exact thing. It's in my Samus, in the Metroid Ultra. The metroid comes out and latches onto P2 and slowly drains it's health. P2 can still fight the entire time.

The main chunk of code you're looking for is,
[State 0, TargetLifeAdd]
type = TargetLifeAdd
trigger1 = time%2=0  ;;Youre going to want to change this to your timing!
value = -1
kill = 0
absolute = 1

You're also going to want to add a TriggerAll which looks out for your variable.
Something like
TriggerAll = var(18) >=1

Then in your original move, when it hit's P2, Var(18) is set to something like 5 for 5 seconds, OR you can set it to 300 because each second is 60 tics. 60tics X 5seconds = 300.
Then you'd have something set up in statedef -2 to reduce var(18) every tic, or every second using a VarAdd. (even though it's subtraction).

This is a more complex type of attack. It's guaranteed you wont get it working 100% perfect the first time you get it to do anything.

The above code is going to be in a Helper that's spawned in P1's state AFTER P1 hits P2. You'll use P1StateNo =  in the hitdef to switch the states. There's a better way to do this but for now use it.

Look up KoopaKoot's "Shiki". I believe Statedef 9020 has the Evil Skull of Death in it.

Also, just watch double posting. Just use the Modify button on your post when you need to add something new and no one's replied.
Seems you've figured that out while I was typing lol.
vVv Wheat Stage Released vVv
Re: How To Create a Poison/Bleed/DoT Effect
#5  January 28, 2018, 10:20:05 pm
  • avatar
    • USA
Thank you for putting up with me.

I read through the variable FAQs/threads and I understand how they are used now, thank you for your help.

Labeled this thread as solved.

Re: How To Create a Poison/Bleed/DoT Effect
#6  January 28, 2018, 10:35:10 pm
  • *****
  • Shame on you!
    • USA
Maybe not completely solved.  You can leave it unsolved until you get your move working. Sometimes people wont read a thread if it's a green check mark. Perhaps someone else knows a better suggestion than me.
But if you got it, you got it.

Feel free to keep posting in here if you run into trouble with this question. If you come up with a different problem you can make another thread so it gets the attention it needs.
vVv Wheat Stage Released vVv
Re: How To Create a Poison/Bleed/DoT Effect
#7  January 30, 2018, 12:27:30 am
  • avatar
    • USA
Alright so I took a look at Shiki's DoT skill move with the posion skull. It looks like the only part of that move that does the DoT is the helper, so I made a helper that performed the same function as hers without using any variables.

; Helm Splitter
[Statedef 1430]
type     = S
movetype = A
physics  = S
juggle   = 0
poweradd = floor(4*fvar(8))
velset   = 0,0
anim     = 1430
ctrl     = 0
sprpriority = 1
facep2 = 1

[State 0, Helper]                    ;this would summon a helper that would stick to P2 and deal damage;
type = Helper
trigger1 = animelem = 10
helpertype = normal ;player
name = "Bleeding"
ID = 11020
stateno = 11020
pos = 32,-52
postype = p2    ;p2,front,back,left,right
facing = 1
keyctrl = 0
ownpal = 1
supermovetime = 0
pausemovetime = 0

; rest of the state code ;

[Statedef 11020]
type = A
movetype = A
physics = N
ctrl = 0
velset = 0, 0
ownpal = 1
anim = 6005
sprpriority = 4

[State 200, Punch Attempt Sound]
type = Playsnd
trigger1= time = 1
value = 1000,3   

[state 0, ReversalDef]
type = ReversalDef
trigger1 = time = 0
reversal.attr = A,NA
sparkno = -1
sparkxy = 0,0
pausetime = 0,0
hitsound = -1
numhits = 0

[State 0, StateTypeSet]
type = StateTypeSet
trigger1 = time = 3
movetype = I

[State 0, HitAdd]
type = HitAdd
trigger1 = 1
value = -1

[State 0, TargetLifeAdd]              ;this is supposed to deal damage to P2, but it is not;
type = TargetLifeAdd
trigger1 = time%2=0
value = -1
kill = 0
absolute = 1

[State 0, PosSet]
type = PosSet
trigger1 = 1
x = enemynear, pos x
y = enemynear, Const(size.head.pos.y)+(enemynear,pos y)
ignorehitpause = 1

[State 7001, Assert]
type = AssertSpecial
trigger1 = 1
flag = noshadow
ignorehitpause = 1

[State 10002, DestroySelf]
type = DestroySelf
trigger1 = Parent,Movetype = H && (parent, stateno != [120,160])
trigger2 = time = 350
trigger3 = enemynear, alive = 0
trigger4 = enemynear, life <= 20

The problem is, even though the helper is summoned, my opponent isn't taking any damage from the TargetLifeAdd. It summons properly, lasts for the set duration, and disappears when it is supposed to, but it is not actually dealing damage.

I'm not sure what I'm doing wrong.

Re: How To Create a Poison/Bleed/DoT Effect
#8  January 30, 2018, 01:36:09 pm
  • *****
  • Shame on you!
    • USA
So in my attack, P2 gets hit. I send P1 to a state that spawns the helper, and I send P2 to a hit reaction state.
P2's hit actually has an attack box in it and a hitdef.
P1's helper has a ReversalDef so P2's attack can be countered.

Without the helper "hitting" P2 it can't find out who to hurt. It has to hit some how. See if you're missing that.
vVv Wheat Stage Released vVv