YesNoOk
avatar

selfstate questions. (Read 8319 times)

Started by inktrebuchet, July 12, 2017, 04:18:14 pm
Share this topic:
selfstate questions.
#1  July 12, 2017, 04:18:14 pm
  • ****
    • USA
    • twitter.com/inktrebuchet
I am putting an enemy in a custom state for 1 tick, just long enough to spawn a helper then I have them selfstate. An important detail is that this custom state doesn't hurt the enemy in anyway so there is no hit animation/state or anything like that.

The problem:
If the enemy is jumping or doing anything at all, besides being idol the self state will cause them to have a "hick-up" mid state. Is there a way to avoid this? I am wanting them to be in and out of the custom state as quickly as possible but also for it to look as if it never happened.

This is what I thought would work,but it doesn't...
Code:
[state test]
type = SelfState
trigger = time = 1
value = prevstateno
ctrl = 1
Last Edit: July 17, 2017, 12:47:30 am by ink
Re: selfstate questions.
#2  July 12, 2017, 04:48:44 pm
  • ****
  • Robotics Engineer
    • USA
    • altoiddealer@gmail.com
You'll be sending them back into a state so they will always begin at time = 0 in that state.  Anims will reset, etc.

Offhand, I'm not sure if anything in the custom state's StateDef alters the "type"... I know movetype and physics can be "U" (unchanged")

I haven't tested but PrevStateNo might not be getting P2's previous stateno?  You might need to obtain that info and log it as a Var (?)
 see my post here which covers how to redirect triggers from a custom state to P1.

Also, you might be returning them to a state that is intended to be Ctrl = 0 ---- set from a previous state they were in, but not declared in the StateDef they were in when you hit them (ctrl carries over from previous state).  Your ctrl parameter might even override the one found in their StateDef (I don't know offhand)

Re: selfstate questions.
#3  July 12, 2017, 05:43:11 pm
  • ****
    • USA
    • twitter.com/inktrebuchet
Thanks for the quick reply altoiddealer!

You'll be sending them back into a state so they will always begin at time = 0 in that state.  Anims will reset, etc.
I understand that, thats the biggest issue. Is there anyway around that really?

PrevStateNo actually doesn't do what you would expect at all. I will set up a couple Vars to fix that and the ctrl too.

A little more info on this project. I'm making a universal projectile reflector, that only needs coded in the one character. Everything is working great except this one selfstate bit... That hick-up is killing me. lol

Last Edit: July 12, 2017, 05:47:18 pm by ink
Re: selfstate questions.
#4  July 12, 2017, 06:33:57 pm
  • ******
    • www.justnopoint.com/
Re: selfstate questions.
#5  July 12, 2017, 07:56:22 pm
  • ****
    • USA
    • twitter.com/inktrebuchet
Thanks JNP! I'll experiment with that once I get home.

I am aware of Vans version, it's done really well but I wanted to see if I could get everything coded in one character. But still use the projectile of the enemy as the reflected projectile.
Re: selfstate questions.
#6  July 12, 2017, 10:39:14 pm
  • ******
  • Hedgehog Whisperer
  • Red Bull addict
    • Spain
    • xgargoyle.mgbr.net
I came up with this solution, for attacks like Babidi's sticky bomb. The bomb attaches to the enemy, and for this, the enemy has to be placed in a custom state for a single tick, and then reverse to the original state without the "hiccup" animation or featuring a gethit state:
Quote
;Sticky Bomb Dummy State for P2
[Statedef 2405]
type = U
movetype = I
physics = U
ctrl = 0

[State 0, ChangeAnim2] ;This replicates the same animation and frame the enemy was when the bomb made contact with him
type = ChangeAnim
triggerall = NumEnemy
triggerall = enemy,name = "Babidi Z2"
trigger1 = !time
value = anim
elem = animelemno(0)
ignorehitpause = 1
;persistent =

[State 2405, ChangeState] ;this goes back to enemy's state once the current animation is finished
type = SelfState
triggerall = NumEnemy
triggerall = enemy,name = "Babidi Z2"
trigger1 =  !animtime
trigger2 = enemy,var(41)=0 && !time  ;stand idle fix. Var(41) in Babidi tracks the enemy state
trigger3 = statetype=A && !time  ;jump fix
value = 0 + 11*(statetype=C) + (statetype=A)*(enemy,var(41))
ctrl = 1

XGargoyle: Battle posing since 1979
http://xgargoyle.mgbr.net
http://www.pandorabots.com/pandora/talk?botid=e71c0d43fe35093a  <-- Please click that link
http://paypal.me/XGargoyle  <-- Donations welcome!
Re: selfstate questions.
#7  July 12, 2017, 11:31:17 pm
  • ****
    • USA
    • twitter.com/inktrebuchet
Thanks XGargoyle

I ended up with this. It seems to be the best solution I could find considering how it works. In the case of this reflector if I don't selfstate them right away,  the player on the other end will be pissed when they realize they didn't have ctrl randomly during the last animation.

Code:
[State 202, end]
type = SelfState
trigger1 = Time = 0
value = cond(statetype = C , 11, cond(statetype = A, 50 , cond(statetype = L, 5000, 0)))         
ctrl = cond(statetype = L, 0, 1)
ignorehitpause =1

If any of you guys who commented here would like a working copy of the reflector I'm working on please PM me. I'd love to get some fresh eyes on it and hear your opinions.
Re: selfstate questions.
#8  July 13, 2017, 12:35:55 am
  • *****
  • Shame on you!
    • USA
As for the 1 tic hiccup, You might be able to tell what animelem it's on and switch to that. But then it may totally mess up P2. Like some people use time AND animelem triggers. One being off could mess up the state completely.

One question, Could you set the selfstate attack up at any time, and still have it work? Do the attributes you get from the hit matter for that exact instant?
 I'm imagining a slow fireball, Ken jumps away, then it's reflected. So P1 isn't looking for the exact moment P2 tried the attack.
If that's the case, Instant attack him as the round opens. Attack when he's statedef 0 and animelem = 2 or something. Attack him on your first attack? Just get it done sneaky and you'll be more than good.
Set up a monitor to see if the attack's connected, if any of those 3 attributes happen, BAM!
vVv Ryuko718 Updated 10/31/22 vVv
Re: selfstate questions.
#9  July 13, 2017, 01:54:37 am
  • ****
    • USA
    • twitter.com/inktrebuchet
I see what you're saying. I think it does have to be at the moment the enemy's projectile hits the reflector. At that moment I put the enemy in a custom state and use a helper to spawn their projectile but going towards them this time.



Re: selfstate questions.
#10  July 13, 2017, 08:04:34 am
  • *****
  • Shame on you!
    • USA
Couldn't you use altoiddealer's method of using the environment shake to get the values you need from the random hit to save them as vars?
I'm not sure what you couldn't find out earlier, that you could at the moment of reflection. Especially since it seems like it's 1 helper transferring info to another helper? It seems like you're just kinda piggy-backing the target. But if you record all that target info permanently, it should still work. No?
 
vVv Ryuko718 Updated 10/31/22 vVv
Re: selfstate questions.
#11  July 13, 2017, 02:52:05 pm
  • ****
    • USA
    • twitter.com/inktrebuchet
There is no way for me to know what projectile they are using until they use it. There is a small window of time there but the closer they are the less time I have.

The custom state is used to have the enemy throw the projectile from my character's position. That way I can use their sprites and their projectile helper.
Last Edit: July 13, 2017, 02:57:58 pm by ink
Re: selfstate questions.
#12  July 13, 2017, 03:55:08 pm
  • *****
  • Shame on you!
    • USA
What if you made a permanent helper that gets active on the random hit. Then it sits under the map, and spawns the P2helper.
If I wasn't sick I'd take a look. Right now I'm just good enough to read a few forum posts and reply. :|
vVv Ryuko718 Updated 10/31/22 vVv
Re: selfstate questions.
#13  July 13, 2017, 04:12:26 pm
  • ****
  • Robotics Engineer
    • USA
    • altoiddealer@gmail.com
So I think what ODB is suggesting is that you use a fullscreen invisible helper to send the enemy briefly into a custom state at the very beginning of the round - long enough to spawn a helper which remains active throughout the remainder of the match.

I haven't put much thought into it but it sounds like it might work?

Re: selfstate questions.
#14  July 13, 2017, 11:19:13 pm
  • ****
    • USA
    • twitter.com/inktrebuchet
Ohhhh! I think that could work, I'll give that one a try. Thanks guys
Re: selfstate questions.
#15  July 17, 2017, 09:46:56 pm
  • ****
  • Robotics Engineer
    • USA
    • altoiddealer@gmail.com
Ohhhh! I think that could work, I'll give that one a try. Thanks guys
Curious to know if it does work, please post if it did or didn't once you try it out :)

Re: selfstate questions.
#16  July 18, 2017, 06:15:32 pm
  • ****
    • USA
    • twitter.com/inktrebuchet
Okay, so I did try that. I ended up rewriting what I had because I thought that could work pretty well. Unfortunately, that did not work the way I was hoping.

Here is what happened...
-I put p2 in a custom state at roundstate = 2
-The custom state was written to spawn a helper that would stick with P2.
-When P2 uses a projectile, projectile's PlayerID is recorded. If P1 uses the reflect move, on contact the helper(the one we attached to P2) was to spawn another helper.
-The new helper (using: PlayerID(X), prevstateno) was P2's projectiles that just made contact. This time starting at P1 and turned.

So after working with this I found it works fine for mirror matches but not for any other matches.

My mistake was assuming helpers work the same while in custom states and/or after. but it seems they can not access their states, debug message says "switched to invalid state."

Let me know if I am wrong on this conclusion but it looks like back to the drawing board...
Last Edit: July 18, 2017, 06:21:40 pm by ink
Re: selfstate questions.
#17  July 19, 2017, 02:48:26 pm
  • ****
  • Robotics Engineer
    • USA
    • altoiddealer@gmail.com
Hmm you could maybe SelfState the helper?  Problem is, that only works 1 time

Re: selfstate questions.
#18  July 19, 2017, 03:20:56 pm
  • ****
    • USA
    • twitter.com/inktrebuchet
After messing with this all of yesterday I realized you can not have P2 spawn a helper with P1's states, even during a custom state.

The only helpers that work during custom states use P2's states. Which means there is no way to selfstate a helper, it never gets to P1's state that would tell it to do so. Instead it just spawns a clone of P2.
Re: selfstate questions.
#19  July 22, 2017, 10:55:19 am
  • ******
  • Hedgehog Whisperer
  • Red Bull addict
    • Spain
    • xgargoyle.mgbr.net
XGargoyle: Battle posing since 1979
http://xgargoyle.mgbr.net
http://www.pandorabots.com/pandora/talk?botid=e71c0d43fe35093a  <-- Please click that link
http://paypal.me/XGargoyle  <-- Donations welcome!