* *
Welcome, Guest. Please login or register.
Did you miss your activation email?
September 25, 2017, 02:39:21 PM

Login with username, password and session length

Training Lessons

  • 32 Replies
  • 607 Views
*

Offline dantedevil

  • Hero Member
  • *****
  • 1385
  • Dante
Training Lessons
« on: September 12, 2017, 10:25:16 AM »
I have the idea of ​​doing a lesson-based training. In order to advance to the next lesson you must fulfill a goal. Like they had some fighting games in training.
To make this possible, I think you would need a script that gives the enemy immunity to all attack animations, except one that we can specify.
I need this script to give the enemy immunity against attack animations and not against certain attacks, since there are many animations that share the same type of attack.
So this way the lesson only can advance when you connect the attack animation.
Dantedevil

*

Offline O Ilusionista

  • Global Moderator
  • Hero Member
  • *****
  • 4820
  • >> I WILL BE AWAY FOR SOME TIME <<
    • BMT - Brazil Mugen Team
Re: Training Lessons
« Reply #1 on: September 12, 2017, 11:02:13 AM »
I don't think you need to set an immunity to all the other attacks. You can use a variable for that on a didhitscript.
If that move hits, triggers an variable and then you do your logic.

*

Offline Damon Caskey

  • Administrator
  • Hero Member
  • *****
  • 1736
    • DC Current
Re: Training Lessons
« Reply #2 on: September 12, 2017, 11:03:36 AM »
I was thinking of this myself. It's a tedious concept though. Technically very easy to do, but just a lot of tracking to put up with.

To work it like you describe is where the doattack event comes into play. You can use it to make entities react however you feel like, or not at all, to an incoming hit.

Honestly you'd probably find it easier to just record what happened, heal the target, and tell the player they failed. You'll find this simpler to code than making them invincible to everything else.

Example:

Lesson 1 - Use Scorpions Spear Whip.

- Player uses a jump kick. The target takes damage normally, and you record the move they used on impact. Your script heals the target and looks for the specific move animation player used, which obviously it isn't there. FAIL! Try again!

- "Get over here!" Same as above, except SUCCESS and on to next lesson.

DC
« Last Edit: September 12, 2017, 11:25:09 AM by Damon Caskey »
Projects in progress are now available here: https://github.com/DCurrent

*

Offline dantedevil

  • Hero Member
  • *****
  • 1385
  • Dante
Re: Training Lessons
« Reply #3 on: September 12, 2017, 11:23:13 AM »
Thanks both my friends!

Apparently the solution of Damon is the most suitable for me, but the problem is that I have no knowledge about the "doattack". I was looking for information on this, but there are only cases where they talk about their properties, but there is no manual to start from the beginning.
So it's not easy for me.
Dantedevil

*

Offline O Ilusionista

  • Global Moderator
  • Hero Member
  • *****
  • 4820
  • >> I WILL BE AWAY FOR SOME TIME <<
    • BMT - Brazil Mugen Team
Re: Training Lessons
« Reply #4 on: September 12, 2017, 11:26:40 AM »
Quote
but there is no manual to start from the beginning.
So 'doattack' is not on the manual (I´ve cheked right now and its not documented)? I will search for infomation and add it once I can.

EDIT: here http://www.chronocrash.com/forum/index.php?topic=1976.msg26639#msg26639
« Last Edit: September 12, 2017, 11:28:23 AM by O Ilusionista »

*

Offline Damon Caskey

  • Administrator
  • Hero Member
  • *****
  • 1736
    • DC Current
Re: Training Lessons
« Reply #5 on: September 12, 2017, 11:31:11 AM »
Quote
but there is no manual to start from the beginning.
So 'doattack' is not on the manual (I´ve cheked right now and its not documented)? I will search for infomation and add it once I can.

Engine confirms an attack hit. Runs on both Attacker AND Defender (Defender is called first, then Attacker). Takes place after engine performs hit confirmation, but before hit handling (pain, blocking, etc.) takes place. By setting variant lasthitc to 0, you can cancel engine's hit handling.
self: Caller.
other: When called on attacker, this recipient of attack. When called on defender, this is the attacker.
damage: attack damage.
drop: knockdown power.
attacktype: attack type, see 'openborconstant'.
noblock: block break force of attack.
guardcost: Guardcost of attack.
jugglecost: Jugglecost of attack.
pauseadd: Pause value of attack.
which:
    0 = Caller is defender.
    1 = Caller is attacker.

attackid: Current attack ID.

Projects in progress are now available here: https://github.com/DCurrent

*

Offline dantedevil

  • Hero Member
  • *****
  • 1385
  • Dante
Re: Training Lessons
« Reply #6 on: September 12, 2017, 11:33:39 AM »
Thanks, I'll see what I can do.
Dantedevil

*

Offline O Ilusionista

  • Global Moderator
  • Hero Member
  • *****
  • 4820
  • >> I WILL BE AWAY FOR SOME TIME <<
    • BMT - Brazil Mugen Team
Re: Training Lessons
« Reply #7 on: September 12, 2017, 12:05:33 PM »
Thanks, I will added to the manuals

*

Offline Bloodbane

  • Hero Member
  • *****
  • 3109
  • Dark Dragon
Re: Training Lessons
« Reply #8 on: September 13, 2017, 02:26:15 AM »
Quote from: dantedevil
I need this script to give the enemy immunity against attack animations and not against certain attacks,

 Hmmm... will the enemy play PAIN animation if attacked with incorrect attack?

By setting variant lasthitc to 0, you can cancel engine's hit handling.

 How to modify lasthitc? is that openbor variant or local variable?
« Last Edit: September 13, 2017, 03:31:45 AM by Bloodbane »

*

Offline maxman

  • Hero Member
  • *****
  • 1337
  • A.K.A. Ermax619
    • Atlas Productions - Cavern of Creativity
Re: Training Lessons
« Reply #9 on: September 13, 2017, 03:33:19 AM »
lasthitc is openborvariant. I think it is a hit confirmation, so setting 1 is for confirming the hit.
Projects in Progress:
Dragon Duo (on hold)
Captain Commando (CPS2/MVC style) (on hold)
Unelmia (on hold)
Secret project (on hold)
Double Dragon Remake (in progress)
Castlevania Rebirth (on hold)

Misc.:
Openbor Tutorials (to be resumed later on)

*

Offline Damon Caskey

  • Administrator
  • Hero Member
  • *****
  • 1736
    • DC Current
Re: Training Lessons
« Reply #10 on: September 13, 2017, 09:38:41 AM »
lasthitc is openborvariant. I think it is a hit confirmation, so setting 1 is for confirming the hit.

Correct. Here's the detail:

  • Collision system detects a hit.
  • lasthitc is set to TRUE.
  • doattack event fires (owner of body box).
  • doattack event fires (owner of attack box).
    • If lasthitc is TRUE, engine's default hit reaction (pain, blocking, damage, etc.) runs.
    • If lasthitc is FALSE, engine's default hit reaction is skipped. In game terms it's like the hit never happens - attack just passes through target.

So looking at that, you can see how doattack would allow you to customize what happens on a hit. You would set lasthitc to false in one of the doattack scripts based on whatever conditions suit your purpose, and then script your own reactions (if any) in its place.

HTH,
DC
« Last Edit: September 13, 2017, 09:43:17 AM by Damon Caskey »
Projects in progress are now available here: https://github.com/DCurrent

*

Offline dantedevil

  • Hero Member
  • *****
  • 1385
  • Dante
Re: Training Lessons
« Reply #11 on: September 13, 2017, 11:06:39 AM »
Quote from: dantedevil
I need this script to give the enemy immunity against attack animations and not against certain attacks,

 Hmmm... will the enemy play PAIN animation if attacked with incorrect

The behavior of the enemy will be normal. So if you connect the wrong attack, the enemy receives the attack normally, but everything should be restarted.
Example: On the screen, you will find the text LESSON 10 "Mortal Grab - press down, up, ATK (during Grab)".
So no matter what you do, if you connect any attack, Grab or special other than the one that you specific, everything should be restarted. In other words, the hero and the enemy return to the position of when each lesson begins.
If you can connect the "Mortal Grab", when the animation ends, the text "Perfect" appears, then the 2 characters re-start their position. Next begins the lesson 11 and the text LESSON 11 appear with the new move.
And so on until you finish all the lessons.
That would be my idea of this new training  ...
« Last Edit: September 13, 2017, 05:52:27 PM by dantedevil »
Dantedevil

*

Offline Bloodbane

  • Hero Member
  • *****
  • 3109
  • Dark Dragon
Re: Training Lessons
« Reply #12 on: September 15, 2017, 10:04:07 AM »
 dante, that system you want is kinda complex, I won't be able to describe all of it right now
 However, I can share you this takedamagescript:
Code: [Select]
void main()
{// Deny damage if attacked with wrong animation
    void self = getlocalvar("self"); //Get calling entity.
    int HP = getentityproperty(self, "health");
    void target = getentityproperty(self,"opponent");
    void TAnim = getentityproperty(target, "animationID");
    int Damage = getlocalvar("damage"); //Get received damage
    int Code = getindexedvar(2);

    if(Code==NULL()){
      Code = 0;
    }

    void LAnim = Lesson(Code);

    if(TAnim != LAnim){
      changeentityproperty(self, "health", HP + Damage);
    } else {
      setindexedvar(2, Code+1);
    }
}

void Lesson(int Code)
{// Selects animation constant based on defined code
    void Anim;

    if(Code>=3){
      Anim = openborconstant("ANI_RUNATTACK");
    } else if(Code==2){
      Anim = openborconstant("ANI_GRABATTACK2");
    } else if(Code==1){
      Anim = openborconstant("ANI_GRABATTACK");
    } else {
      Anim = openborconstant("ANI_JUMPATTACK");
    }

    return Anim;
}

 This script will deny damage taken by the entity if the attacker attacks with improper animation. This script also increments counter stored in indexed variable 2 (can be changed) if received attack is correct
 This indexed variable should be linked with other entities such as position resetter and dialogue display
« Last Edit: September 15, 2017, 10:09:29 AM by Bloodbane »

*

Offline dantedevil

  • Hero Member
  • *****
  • 1385
  • Dante
Re: Training Lessons
« Reply #13 on: September 15, 2017, 10:17:30 AM »
Wow that's really good my friend, thanks!
It's a great start, today I'll start doing some tests and see what I can do.
Thanks again!!!  ;D
Dantedevil

*

Offline dantedevil

  • Hero Member
  • *****
  • 1385
  • Dante
Re: Training Lessons
« Reply #14 on: September 15, 2017, 10:39:41 PM »
I have some questions Bloodbane, about how work this script.

First save your script in the file lessons.c in the scripts folder.
Then add the line in the enemy header txt "takedamagescrip data/scripts/leesons.c"
And here begins my doubts:
I guess I should call the script in an animation of the enemy, so the ...
Code: [Select]
anim pain
loop 0
delay 6
offset 84 175
bbox 61 77 38 99
      @cmd  Lesson (???)
sound   data/sounds/m5pain.wav
frame data/chars/bd2/pain.png
offset  80 175
frame data/chars/bd2/pain.png
offset  84 175
delay   45
frame data/chars/bd2/pain.png

void Lesson(int Code<-I do not understand exactly what I should put here.
If I understood correctly, I should put the allowed animations inside the script.
Code: [Select]
      Anim = openborconstant("ANI_RUNATTACK");
    } else if(Code==2){
      Anim = openborconstant("ANI_GRABATTACK2");
    } else if(Code==1){
      Anim = openborconstant("ANI_GRABATTACK");
    } else {
      Anim = openborconstant("ANI_JUMPATTACK");
So here I only can use 1, 2, or 3?
Example:   @cmd  Lesson 2   > Just a single number, you can enter it, right?

But if I need to use many animations, should I add them all to the script, then select them by the number?


And about this, I did not understand much how it works:
Quote
This script also increments counter stored in indexed variable 2 (can be changed) if received attack is correct
 This indexed variable should be linked with other entities such as position resetter and dialogue display

Perhaps an example would be very useful to understand better.
Thank you!
« Last Edit: September 15, 2017, 10:42:57 PM by dantedevil »
Dantedevil

 

Recent

Members
Stats
  • Total Posts: 46114
  • Total Topics: 3161
  • Online Today: 77
  • Online Ever: 316
  • (January 04, 2013, 09:43:02 AM)
Users Online
Users: 1
Guests: 63
Total: 64