HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: combat stance  (Read 2723 times)

Thazager

  • General Accounts
  • *
  • Posts: 1160
  • Never stop learning
    • View Profile
combat stance
« on: May 19, 17, 08:02:54 PM »

This has probably been noticed by others, and some might have it working. We have it partially working.

When the player character loads in, and some of the other NPCs seem to be in a combat stance, instead of idle. There is a small section that sets this.

in client script E_ACCControlerClassMethods, in method _onPreAnimUpdate() look for:

Code: [Select]
    if GetAnimInput(mychar, "BaseMode") != "Combat"
      SetAnimInput(mychar, "BaseMode", "Combat")
    .

This sets the combat stance. Here is what we have changed it to make it the idle stance. We added a field to the E_CommonCharacter class as Boolean that we could set as the player and NPC entered combat.

First we check if that is "combat" or not, then we set the stance based on its value. Now when the player loads and the NPCs all start in idle stance. When a player attacks the NPCs (monkeytoks), the NPCs change to combat stance. However, the player stays in idle stance, even though its field is changed like the NPCs.

Code: [Select]
  inCombat as Boolean
  where mychar is kindof E_CommonCharacter
    inCombat = mychar.E_InCombat
    println("mychar "+mychar.name+"  combat? "+mychar.E_InCombat)  // info 1
  .
  if inCombat = true
    where mychar is kindof E_CommonCharacter
      println("mychar "+mychar.name+"  combat? "+mychar.E_InCombat)  // info 2
    .
    if GetAnimInput(mychar, "BaseMode") != "Combat"
      SetAnimInput(mychar, "BaseMode", "Combat")
    .
  else
    if GetAnimInput(mychar, "BaseMode") != "Normal"
      SetAnimInput(mychar, "BaseMode", "Normal")
    .
  .

I can see the player character value and the NPC value both set to true, but only the NPC will change to combat stance. Forcing the player to combat by removing the check, I can see the player in combat, so the anim does exist.

adding some code to show info:
Info 1 will show all NPC names, not the player.
Info 2 will show only those effected by the combat stance change.

My thoughts:
Info 1 lets me know the player is either not using this function, or the player character is not a Common Character. Yet, changing the code here to show idle anim, also makes the player character show idle anim. In the DOM, the player character has Common character as a parent, so it has that class. And it changes like the NPCs change, so it is using this function.

I'm missing something to make it work, ideas?
Logged
Lead scripter for EO, Repop helper.
HSL Video tutorials:
https://community.heroengine.com/forums/index.php/topic,1719.msg36858.html#msg3685

nocake

  • General Accounts
  • *
  • Posts: 404
    • View Profile
    • BlightMMO
Re: combat stance
« Reply #1 on: May 20, 17, 12:02:58 AM »

I believe I brought up a similar issue that was never addressed by any HE staff even with video proof :(

https://community.heroengine.com/forums/index.php/topic,6038.msg34038.html#msg34038

GlorianLanTarini

  • General Accounts
  • *
  • Posts: 148
    • View Profile
Re: combat stance
« Reply #2 on: May 20, 17, 01:14:50 AM »

Hi, Thazager.

Basic _playerCharacter class don't using E_CommonCharacter class as parent, but only _commonCharacter. So, you should check - has your_playerCharacter class E_commonCharacter as parent or not? I know it's sound very silly, but sometimes this sort of things get lost from view.
Logged

Thazager

  • General Accounts
  • *
  • Posts: 1160
  • Never stop learning
    • View Profile
Re: combat stance
« Reply #3 on: May 20, 17, 01:37:02 PM »

nocake, yes, it seems there might be a few bugs still in places we cant quite fix ourselves, source code.


GlorianLanTarini, right, the _playerCharacter class only uses _commonCharacter. But then we use E_PlayerCharacter, which does use E_CommonCharacter. We started with the base E_ scripts, made a few new using our HaV_ but mostly use the E_ . But I will check to see if that makes and changes, thanks.

Update: Using _commonCharacter without the new field added creates error.
  Not going to change any fields in the _commonCharacter, as it has no prefix its part of base engine code.
« Last Edit: May 20, 17, 01:46:17 PM by Thazager »
Logged
Lead scripter for EO, Repop helper.
HSL Video tutorials:
https://community.heroengine.com/forums/index.php/topic,1719.msg36858.html#msg3685

ToY-Krun

  • General Accounts
  • *
  • Posts: 677
  • Support Volunteer
    • View Profile
Re: combat stance
« Reply #4 on: May 21, 17, 07:58:10 PM »

this is not a "bug" but simply due to the limited default controller and npc classes. which should be rewritten mostly by the designer of the game.

(i saw you mention a change to the controller but im not assuming its the one im referring too, if it appears it is, thats cool, skip and read on)
to solve this you should look at the E_NonPlayerCharacter class (or your custom class) and using the _onReplicationGroupAdded()  function(among several that will work), capture the npc node as it is loaded.   simply run a check to ensure the npc's animation state is set to idle (not "READY" which would be combat)

If that doesnt get you far enough, let me know.

HE's controller code is from HJ (the demo) and is designed for HJ's models, AND animations.  if you are using custom models then you WILL NEED to alter the controller script so that it does NOT place the char in combat by default (which it DOES by default).

not sure about the "bug" mentioned here but what ive described above is the issue Thaz is having.

Edit:
  The controller will force every char into combat stance every frame, so its not okay to check only once.  That code itself has to be altered (in the controller).  If you're still using the HJ models however (or their animations etc) this will break them though as its the way they're designed to work.

If you've already made these edits and still have problems, let me know.
There shouldn't be any issues, if so theres probably a typo problem somewhere either in the .asq, .aas, or script.

personally i removed that block of code altogether and i check for field updates(and thus the animation used) via the player or nonPlayer char classes (onReplicationFieldUpdated())  rather than the controller as its getting run every frame, which if i read what you have correctly, would toss your char (or npc) into a loop of going from normal to combat, to normal, to combat etc.  At least it would in the controller script, as again, those methods/functions are getting run every frame on every char on your screen.

Also one other thing, if you're not changing the value of your field (e.incombat) it will continuously call SetAnimInput() which can also cause issues.  By checking it in the player/nonPlayer class using onReplicationFieldsUpdated() you can change the animation without worrying about multiple calls as it will only get called once, when the client receives a change to the field.  Hope that makes sense
« Last Edit: May 21, 17, 08:18:21 PM by ToY-Krun »
Logged

ToY-Krun

  • General Accounts
  • *
  • Posts: 677
  • Support Volunteer
    • View Profile
Re: combat stance
« Reply #5 on: May 21, 17, 08:30:36 PM »

@nocake:

Quote
I believe I brought up a similar issue that was never addressed by any HE staff even with video proof :(

https://community.heroengine.com/forums/index.php/topic,6038.msg34038.html#msg34038


in the other thread you had problems using the following for setting inputs if i read correctly,

Quote
$Behave._DoBehave(acct, "input BasePosture Dead")

That command would immediately be overwritten by the controller if the current animation does not match with the input value stored, as it issues new behave commands based on controller field values every frame.  to accomplish what this line appears to be intended to do, you would simply set the animation input to dead (SetAnimInput(charNode, "Idle", "Dead") )  and the animation script would take care of the rest.  unless you used a different name etc for the inputs in your custom .aas script.  Assuming that you havent completely replaced the controller script with a new one of your own design that is!

Thazager

  • General Accounts
  • *
  • Posts: 1160
  • Never stop learning
    • View Profile
Re: combat stance
« Reply #6 on: May 21, 17, 09:59:45 PM »

Currently, the monkeytok is used for the NPC, so we don't have our own NPC in just yet. The field is set incombat = true when the player attacks with ability, and not changed until mob/player is dead. It should remain in combat, yet shows idle anim for player only.

The field is diff for each NPC/player, not used by all as a group. The monkeytok being attacked changes just fine, while the rest remain idle, not the player character.

I will look into setting the field using onReplicationFieldUpdated() thanks.

If A, then B. If B, then C. If A, then C? One might believe it should be.
Logged
Lead scripter for EO, Repop helper.
HSL Video tutorials:
https://community.heroengine.com/forums/index.php/topic,1719.msg36858.html#msg3685