change opponent's vars on hit.

Started by Momotaro, March 10, 2017, 08:59:30 PM

Previous topic - Next topic

Momotaro

Might have been asked before, but I'm rusty.
Particularly with 1.0 (and more)

In full game environement, how can I change opponent's vars on hit.

Exemples :

Light punch hits P2.
P2's var10 gain 1
P2's var11 gain 1

Medium punch hits P2.
P2's var10 gain 2
P2's var11 gain 3

I think it can be done with custom gethit state anim.
But Is there another way? Something more effective, using statedef -2 or other...

Thanks

Memo

Quote from: Nedflandeurse on March 10, 2017, 08:59:30 PM
Might have been asked before, but I'm rusty.
Particularly with 1.0 (and more)

In full game environement, how can I change opponent's vars on hit.

Exemples :

Light punch hits P2.
P2's var10 gain 1
P2's var11 gain 1

Medium punch hits P2.
P2's var10 gain 2
P2's var11 gain 3

I think it can be done with custom gethit anim.
But Is there another way? Something more effective, using statedef -2 or other...

Thanks

maybe by putting them in statedef 5000, every hit I believe goes thru that state I'm not
100% sure on it, it would be similar to how you would code a guard crush technique.
I would take a look at a char with guard crush and see how the vars work on get hit

JustNoPoint

In a full game environment the char getting hit can be programmed to know exactly which attack hits it and change his own var from that.

Odb718

Cant you use a custom state and use statedef -2 or -3 to write the var? When P2 is in the custom state any variable written is the character's. Heck you might be able to do it inside the custom state.
vVv Gouken718 vVv SabreTooth718 vVv


JustNoPoint

Yes but every attack would have to send P2 to a custom state.

Momotaro

Thanks guys,
There is some possibilitie as you said.
and I would prefer to avoid using custom gethit states

Quote from: Just No Point on March 10, 2017, 09:09:35 PM
In a full game environment the char getting hit can be programmed to know exactly which attack hits it and change his own var from that.

Yes, I would like to know more about how the "victim" can detect which attack is hitting him.
Simply using some p2stateno would be too approximative, right?

Any exemple?
Thanks

Memo

Well if its for a full game and all chars use the same statedef numbers for the same
Attack types, that's a start. Var activates with p2 prevstateno = 210 and movetype = H
or something like that. just ideas I'm not sure how a script like that would be coded I've
never done something Like that but the full game route sounds the easiest. Sounds
Interesting what ever your trying to do, ill be watching this topic so I can learn something
New myself

Cyanide

No need to get complicated to any great extent. Gethitvar takes care of a lot of this

type: Returns the type of the hit: 0 for none, 1 for high, 2 for low, 3 for trip (ground only).
animtype: Returns the animation type of the hit. (0 for light, 1 for medium, 2 for hard, 3 for back, 4 for up, 5 for diag-up)

Use gethitvar on both of these and you can detect what you've been hit by. Combine them with enemy, hitdefattr (won't work so well in simul or on helpers) and you can check hyper attacks as well. If it's a full game it's possible detecting specials, supers and hypers is better managed via state ranges, you should be setting the same stuff in the same ranges. So

type = varadd
triggerall = time = 0 && (stateno = 5000 || stateno = 5010)
trigger1 = enemy, stateno = [1000,1999]
trigger1 = gethitvar(type) = 2 && gethitvar(animtype) = 2
var(0) = 5

That will add 5 to var 0 when you enter either state 5000 or 5010 if the opponent is in what OUGHT to be a special attack, and is using a low attack that has a hard animtype.


In M.U.G.E.N there is no magic button

They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance.

Odb718

Could you do math to make it simple?

type = varadd
triggerall = time = 0 && (stateno = 5000 || stateno = 5010)
trigger1 = enemy, stateno = [1000,1999]
;trigger1 = gethitvar(type) = 2 && gethitvar(animtype) = 2
var(0) = floor(gethitvar(type)*gethitvar(animtype)) ;= 2;5


This example  would pump out a value of 4, instead of 5 for the same type and animtype, right?
vVv Gouken718 vVv SabreTooth718 vVv


Cyanide

Entirely dependant on how granular you want to be. I pulled the number 5 out of my ass. If he wants a giant range or a small one or a variety of numbers it's completely up to him.

Might get awkward with multi hit attacks or multiple low damage hits.


In M.U.G.E.N there is no magic button

They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance.

Odb718

I guess it'd be better your way because 1*2 is different than 2*1 but my method you only get 1 answer.
vVv Gouken718 vVv SabreTooth718 vVv


Momotaro

Thanks a lot for the code suggestions. Impressive!
It seems to be what I need.

Some precisions about my needs.

My game will be one a 1 on 1 VS (no simul, turns...)
1 round only
All characters will have the same moves type (same var change for all statedef 200, same var change for all statedef 2010 etc.)

As I'm thinking of it, could it be possible to create a variant of this code adding or substracting the value of damge of the hit received? Same for blocked attack?

Odb718

What's the overall end-game here? Like what's the purpose?
I'm pretty sure there's a way to find the "system value" of the attack's damage and all that. But why are you trying to use this info? There might be a simple solution instead of taking a round-about way to get there.
There's ways of finding out how much damage the last attack caused.
If anything you could just use Life right? Just check your current health?
Are you trying to convert how much damage you took into a different special meter??
vVv Gouken718 vVv SabreTooth718 vVv


Momotaro

#13
Actually I'm trying to update some of my "game system" to allow "realistic visual damage."
Somthing like Art of fighting 1 and 2, but far more advanced. (using different damage variables based on attack type and other elements)
Mixed up with body damage in some wrestling games.
The result will be on sprites + "dynamic" palette change using CS. and stance "0" variation + limitations.
At this moment, I'm trying to understand if it will be possible to switch to it or not.
I think I have some elements to start updating it now.

Also, I cannot just check life level, because there will be no actual life level.
I mean, all attacks have kill = 0
So most of the fight will be with life level to 0 (kill will be triggered with another conditions - very similar to wrestling games system)

But I'll switch to it step by step.

Sorry to have sounded kind of "mysterious" not explaining exactly what I need, but this is hard to explain well in english to me. :)

Cyanide

gethitvar is going to be your friend. Go read about it, it takes just about every feature of your opponents hitdef so when you are hit you can know the animtype, damage, velocities, fall, fall vels, pretty much everything.

You can't detect guard damage though, that one is impossible.


In M.U.G.E.N there is no magic button

They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance.

Odb718

Even if he made a life monitor variable?
I know his system is going to probably be at 0 life for most of the round. But I'd think you'd be able to make a set of variables to monitor life. Then every other tic see if it's the same value n all that.
vVv Gouken718 vVv SabreTooth718 vVv


Cyanide

If everything has a life value of 1 and all attacks are set at kill = 0 then you can't monitor life as it's a boolean. It's either "you are alive" or "you are dead" In normal circumstances you could check your life at the start and end of a guard state and find out how much damage you took, but you can't do it when you have 1 life. And if you did have 1000 at the start, at the end you would have 1, and would still be waiting on the kill flag being set so it would stop working.


In M.U.G.E.N there is no magic button

They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance.

Momotaro

Thanks again for the feedback

Quote from: Cyanide on March 11, 2017, 11:51:23 PM
gethitvar is going to be your friend. Go read about it, it takes just about every feature of your opponents hitdef so when you are hit you can know the animtype, damage, velocities, fall, fall vels, pretty much everything.

You can't detect guard damage though, that one is impossible.

Thanks, I'll check all gethitvar elements.
About guard damage, I might just add the same value every time any attack is guarded.
Even if it's less precise, it would be OK.

JustNoPoint

You can do simple things to still know what var you should acquire from blocked attacks.

2 examples:
P1 attacks
Moveguarded triggers a varset in p1
P2 enemy, var(x)=x

Or
P1 attacks
Moveguarded triggers an explod in p1
P2 enemy, numexplod(x)

Momotaro

Good! I will use it as well.
I think trigger a varset is the best choice to me.
Thanks