[FYI]A list of combat states (incomplete)

Users who are viewing this thread

foxyman

Sergeant Knight
Hey guys.
It seems to me and some fellows here that things returned by agent_get_combat_state would be interesting and useful. So I've done some tests to try out some of the return values. Here's the list:
 
cs_free                                    = 0
cs_target_in_sight                    = 1    # ranged units
cs_guard                                  = 2    # no shield
cs_wield                                  = 3    # reach out weapon, preparing to strike, melee units
cs_fire                                    = 3    # ranged units
cs_swing                                  = 4    # cut / thrust, melee units
cs_load                                    = 4    # crossbow units
cs_still                                    = 7    # melee units, happens, not always (seems to have something to do with the part of body hit), when hit
cs_no_visible_targets                = 7    # ranged units
cs_target_on_right_hand_side    = 8    # horse archers

Add this list into your module_constants.py, and it can be good reference, I think.

It's reasonable to infer that there must be states numbered 5 and 6, but no matter how many times I tried, I could see no agent in any of these two states.

One more thing: this does not apply to player. It only returns 0 for player agent.
 
NaglFaar said:
I don't want to bother you with "Un-Knowledge" but...
What is this?

If you feel that you don't have time to answer, then don't.

Nagl

Agent_get_combat_state is an operation you can find in header_operations.py. But you won't find any explanation about its returned values or what they represent. At least I don't. So I did a test to find out those values. You can read this as a comment as those in header_operations.py.
 
And to put it simply (I hope I'm right), you can force agents to certain combat states with a script/trigger using these cs_ things..
 
cdvader said:
And to put it simply (I hope I'm right), you can force agents to certain combat states with a script/trigger using these cs_ things..
Well... I don't see things like agent_set_combat_state... Only this get one. So it comes as some information, but not operation in fact.
 
The benefit that I can see is to help you script AI actions.  In case you want to test what the AI is doing at a given time and script a result.  An example would be when he gets hit.  Maybe you want to then check his HP.  If it's below 10%, he turns and runs away if possible...

Wouldn't it be a better idea to add this to the header_mission_template.py file?  Really most of the stuff in the headers are constants, but I guess I wouldn't do that unless you know what other affects it would have.
 
sorry if its a stupid question but can I force my ranged units not to toogle to melee weapons if enemy agent comes near?

I had problems with that especially by let the AI using magic items in hand to hand combat.

It seems to be possible to script a spear-wall script also??
 
Meneldur said:
sorry if its a stupid question but can I force my ranged units not to toogle to melee weapons if enemy agent comes near?

I had problems with that especially by let the AI using magic items in hand to hand combat.

It seems to be possible to script a spear-wall script also??

a very rudimentary way of dealing with this would be to not give ranged units hand to hand weapons.
 
@dejawolf
sorry but no. AI takes even the fist if an enemy comes to near. At least this happens in my own scenes.

I had some struggle with that by creating boss-fights with dialoge and stuff.

After dialoge a monster with a mighty spell at hand attacked me with its fist as I was to near for the ranged-weapons-AI-check.

If I could avoid that however even for those who have a melee-weapon and an limited-uses spell or effect would set me free to create more powerful units.
 
A workaround would be to create spell effect melee weapons. Show a wand or have them invisible until the hit, then have the flash.

mfberg
 
Thanks mfberg.

sorry I would like to know if I get foxyman right:
one could use these cs_ agent_combat_states for example to create an key-clicked-order that makes your troops doing one certain action: load/reachout and so on.??!?
 
Meneldur said:
Thanks mfberg.

sorry I would like to know if I get foxyman right:
one could use these cs_ agent_combat_states for example to create an key-clicked-order that makes your troops doing one certain action: load/reachout and so on.??!?

Sorry but it's not what this thread is about. This is only a get operation, so you could only know what the ai is doing. You can not give orders to ai.
 
It would be nice if we could script AI target agents, as well as combat actions.  Such as (not a real operation) agent_set_target(<agent>,<target_agent>), as well as force_melee or force_ranged.  I think you might be able to script the targeting, but it would be a lot of geometry calcs.

Another thing you can do is to make a magic effect that throws enemy agents that are too close back, or put the boss in an unreachable place (such as on a tower).
 
foxyman said:
Hey guys.
It seems to me and some fellows here that things returned by agent_get_combat_state would be interesting and useful. So I've done some tests to try out some of the return values. Here's the list:
 
cs_free                                    = 0
cs_target_in_sight                    = 1    # ranged units
cs_guard                                  = 2    # no shield
cs_wield                                  = 3    # reach out weapon, preparing to strike, melee units
cs_fire                                    = 3    # ranged units
cs_swing                                  = 4    # cut / thrust, melee units
cs_load                                    = 4    # crossbow units
cs_still                                    = 7    # melee units, happens, not always (seems to have something to do with the part of body hit), when hit
cs_no_visible_targets                = 7    # ranged units
cs_target_on_right_hand_side    = 8    # horse archers

Add this list into your module_constants.py, and it can be good reference, I think.

It's reasonable to infer that there must be states numbered 5 and 6, but no matter how many times I tried, I could see no agent in any of these two states.

One more thing: this does not apply to player. It only returns 0 for player agent.

I'm sorry for necroing.. But, i'm curious to find out how to check if agent is blocking.
Foxyman, Thanks for the list. I'm eager to do the test too. BTW how do you make the test?
and any addition for the list yet?
 
cs_guard                                  = 2    # no shield
this is blocking.

The way I tested is to put only one or two agents on the battle field and use a trigger to output their combat state, while I observe what they are doing in real time.
 
I found another list by Jinnai :
Jinnai said:
So there's this little function in the Module System known as agent_get_combat_state and it's not documented in any way.  In fact it's only used once in the entire thing that I've found, and that's in sieges to reportedly determine if a ranged unit can see a target or not.

I've been wanting to do things in the mod I'm working on to make agents a little smarter.  So I started exploring this function.  And here's what I've discovered:

For the player or dead units it always returns 0.
But for living human agents here are some of the values it can return and what each seems to mean:
0 = nothing active
1 = firing ranged
3 = preparing and holding attack (either melee or ranged)
4 = swinging with melee
7 = recovering from being hit
8 = ranged equipped, no target in field of view

The agent actively blocking doesn't seem to change this value, nor does mounting or dismounting.

I can't seem to get any other returns than these.  Has anyone else explored this function?  Does anyone out there know anything about this function at all and would like to contribute to this?
 
I made a test on training ground. Here it is my trigger I put on "training_ground_trainer_training" mission template :
Code:
test_cs = ( 0, 0, 0, [], 
  [
    (try_for_agents, ":agent"),
       (get_player_agent_no, ":player"),
       (neq, ":player", ":agent"), 
       (agent_get_troop_id, ":troop_id", ":agent"),
       (lt, ":troop_id", "trp_tournament_master"), 
       (agent_get_combat_state, ":state",":agent"),
       (neq, ":state","$g_last_state"),
       (assign, "$g_last_state", ":state"),
       (assign, reg6, ":state"),
       (display_message,"@Combat State : {reg6}"),
    (try_end),
  ])
yeah, for melee fight only. I confirmed 3 and 4 are states when ai agent is about to attack (3) and when ai agent is swinging (4). Blocking without shield is 2 and with shield is 7.
When he's wielding no shield, I hit him several times til down and his cs never be 7. When he's wielding shield, some time his cs is 7.
Aaargh, confusing. No we have 3 versions of lists.
 
Back
Top Bottom