YesNoOk
avatar

An attack that sticks to both players and helpers (Read 1717 times)

Started by darthbirdy3, July 20, 2022, 11:50:16 pm
Share this topic:
An attack that sticks to both players and helpers
#1  July 20, 2022, 11:50:16 pm
  • *
  • I feel old
  • Still using Mugen after this many years.
    • USA
    • www.twitch.tv/darthbirdy3
I have a sticky bomb helper attack for my Doomguy character that functions exactly as I want when sticking to player 2 on contact using this code:

[State 511, VarSet]
type = varset
trigger1 = movecontact
v = 34
value = p2dist y
ignorehitpause = 1
persistent = 0

[State 511, PosAdd]
type = PosAdd
triggerall = movecontact
trigger1 = p2dist x > 0
x = p2dist x
ignorehitpause = 1

[State 511, PosAdd]
type = PosAdd
triggerall = movecontact
trigger1 = p2dist x < 0
x = p2dist x
ignorehitpause = 1

[State 511, PosAdd]
type = PosAdd
triggerall = movecontact
trigger1 = p2dist y > 0
y = p2dist y - var(34)
ignorehitpause = 1

[State 511, PosAdd]
type = PosAdd
triggerall = movecontact
trigger1 = p2dist y <= 0
y = p2dist y - var(34)
ignorehitpause = 1

However, when coming into contact with p2's helpers it jumps to p2's body as if it had hit the player. Is there a way to add to or modify this to make it stick to the helper instead if that's what it hits first?

EDIT: I suppose a less desirable yet still acceptable solution is to make it so it can't hit helpers at all, so if you have an idea for that let me know too.
Still using Mugen after this many years.
Last Edit: July 21, 2022, 12:26:13 am by darthbirdy3
Re: An attack that sticks to both players and helpers
#2  July 21, 2022, 03:10:58 am
  • **
In theory, yes.  I'm sure someone's made something like this before, or similar. 

Firstly, the easy solution of making it miss helpers and only target the players can be done quite easily but isn't desirable.

The proper way for this to interact with both players and helpers is in theory, do-able.  Firstly you'd have to:

1. Make sure it detonates upon hit with an enemy helper projectile. Doesn't make sense otherwise.

2. Get the PlayerID of the non-projectile helper(s) and use it for trigger re-directions. This way, you have full control of the interactions.

Getting the PlayerID of helpers is actually the hard part, but luckily @inktrebuchet:  has created an enemy helper ID detection, which can be found here:
https://mugenguild.com/forum/topics/ai-detect-enemys-helper-projectile-system-179829.0.html

Have a read through.  Although his system is for projectile detection, it's base code is actually detecting the most recently spawned enemy helper ID.  You can use that and modify it so that it would detect non-projectiles.   A case where this system is useful outside of AI.
Last Edit: July 21, 2022, 03:15:02 am by SteelHammers
Re: An attack that sticks to both players and helpers
#3  July 21, 2022, 05:21:23 am
  • *
  • I feel old
  • Still using Mugen after this many years.
    • USA
    • www.twitch.tv/darthbirdy3
I think I have a basic grasp of the code and it can be easily modified to work at all times and not just for AI. I would have to copy a set of varset and posadds for the helpers and do something like the following, but I am having a bit of trouble coming up with a trigger to replace the placeholders in parentheses;

[State 511, PosAdd]
type = PosAdd
triggerall = movecontact
trigger1 = (hitplayer)
trigger1 = p2dist x > 0
x = p2dist x
ignorehitpause = 1

[State 511, PosAdd]
type = PosAdd
triggerall = movecontact
trigger1 = (hithelper)
trigger1 = PlayerIDExist(helper(33333333),var(3))
trigger1 = PlayerID(helper(33333333),var(3)), p2dist x > 0
x = PlayerID(helper(33333333),var(3)), p2dist x
ignorehitpause = 1
Still using Mugen after this many years.
Re: An attack that sticks to both players and helpers
#4  July 21, 2022, 09:09:38 am
  • **
Did a little testing for you and found that using the helper system to get the helperID for this type of attack is too unreliable, so will backtrack a little.  We won't be using it else it'll cause you endless headaches.

I'll start you off with another approach and see how you go. Not the best method but its a start. 

1. Set an ID in your helper's hitdef if you already haven't.  Since your helper is state 511, i'll use this as your ID as an e.g.

2. In your helper state, set a variable (any free variable not already used in your helper is fine). I'll use var(10) as and e.g.

This code will hopefully make your helper stick to the enemy or their helper when they're hit by it.
Put it in the helper's statedef after the hitdef sctrl. 
 
Note: This code would replace all your codes you posted for the position (PosAdd) of the bomb. You can null them out and see what happens.

;==========================
[State 511, VarSet]  ;------------->Get the ID number of the target it makes contact with
type = VarSet
trigger1 = movecontact=[1,2]
var(10) = target(1001),ID
ignorehitpause = 1

[State 511, PosSet] ;------------->Stick to the target (x/y position can be adjusted according to you)
type = PosSet
trigger1 = PlayerIDExist(var(10))
x = PlayerID(var(10)),pos X
y = PlayerID(var(10)),pos Y
ignorehitpause = 1
;==========================
Note this is an extememly simple code for standard characters.
You need to modify it to fit your need. 
I'd recommend turning putting in a statetypeset and setting movetype=I when the helper hits the target, since if a helper gets hit
and it sticks to that helper, the bomb will transfer to the player when he makes contact with it.
You also need hitoverride states for when it hits an enemy projectile.

I'm sure you'll figure it out. Else just post.



Last Edit: July 21, 2022, 09:16:01 am by SteelHammers
Re: An attack that sticks to both players and helpers
#5  July 21, 2022, 09:59:10 am
  • ******
    • Portugal
    • network.mugenguild.com/pots/
I think helpers generally won't become your target because they're loaded with Hitoverrides. If it's a sticky bomb you might as well just make it explode upon contact if it hits a helper.
You can help with Ikemen GO's development by trying out the latest development build and reporting any bugs on GitHub.
My Mugen and Ikemen content can also be found here.
Re: An attack that sticks to both players and helpers
#6  July 21, 2022, 10:23:31 am
  • *
  • I feel old
  • Still using Mugen after this many years.
    • USA
    • www.twitch.tv/darthbirdy3
SteelHammers:
As far as keeping the bomb from transferring I can just add hitonce = 1 to the hitdef. The code you provided is much cleaner and works great as far as the player goes. A helper getting hit also no longer transfers it to the player. However, it doesn't stick to the helpers yet, but this is indeed progress so thanks. I believe hitoverrides may hinder it from working with helper characters. I'll keep at it, and thanks again.

PotS:
I also thought about this as a solution, but I still have issues determining if the target was a helper for the changestate into the explosion. Is there a stupid simple trigger I'm just missing?
Still using Mugen after this many years.
Re: An attack that sticks to both players and helpers
#7  July 21, 2022, 02:19:28 pm
  • **
Ah. Forgot the target gets drop during hitoverrides.  In that case, it would be as Pots said, you'd have to make it expode when hitting a helper with hitoverride.

I'm late, you probably figured it out already but in case you haven't for the changestate,

Expanding on the code from before to incorporate changestate (reiterating the previous codes as well). Adjust to how you want.
;=================================
[State 511, VarSet]  ;------->Get Enemy ID &  Enemy HelperID (without hitoverrides)
type = VarSet
trigger1 = movecontact=[1,2]
var(10) = target(511),ID
ignorehitpause = 1

[State 511, VarAdd] ;------->Bomb Timer (if you don't already have one)
type = VarAdd
trigger1 = movecontact
var(11) = 1    ;---->use whatever variable
ignorehitpause = 1

[State 511, PosSet]  ;-------->Sticking to enemy
type = PosSet
trigger1 = PlayerIDExist(var(10))
x = PlayerID(var(10)),pos X
y = PlayerID(var(10)),pos Y
ignorehitpause=1

[State 511, ChangeState]
type = ChangeState
trigger1 = movecontact && !var(10)  ;--->Detonate upon enemy or helper hitoverrides
trigger2 = var(11)>=60 ;--------->Set time to detonate, Or use whatever trigger you have when bomb sticks.
value =   ;----------->Your exploding state
ctrl = 0

;=====================================

See how you go and expand on it. Let us know if there's any problems.
Re: An attack that sticks to both players and helpers
#8  July 21, 2022, 08:24:50 pm
  • *
  • I feel old
  • Still using Mugen after this many years.
    • USA
    • www.twitch.tv/darthbirdy3
It may not have been what I originally desired but I'm satisfied enough with how the move works now. I got it working where helpers just blow it up on impact and it explodes after 300 ticks when stuck to the ground or a player. Thanks for all the help.
Still using Mugen after this many years.