OSP Kit Combat Fancy Damage Systems

WookieWarlord

Master Knight
WBNW
Best answers
0
When you say critical hits, you must mean a random chance of doing extra damage, not actually hitting an enemy in a critical spot for extra damage.
Because we can't find out what body part we hit, right?
 

dunde

Count
WB
Best answers
0
WookieWarlord said:
When you say critical hits, you must mean a random chance of doing extra damage, not actually hitting an enemy in a critical spot for extra damage.
Because we can't find out what body part we hit, right?
Yes, we can. Not so precisely but we can use pos0 to determine what body part hit. I'm doing test on it with this code :
Code:
test_on_hit = (
  ti_on_agent_hit, 0, 0, [], [
   (store_trigger_param_1, ":agent"),
   (store_trigger_param_2, ":attacker"),	
   (store_trigger_param_3, ":damage"),
   (agent_get_troop_id, ":troop", ":agent"),
   (agent_get_troop_id, ":troop_attacker", ":attacker"),
   (str_store_troop_name, s1,":troop"),
   (str_store_troop_name, s2,":troop_attacker"),
   (try_begin),
      (ge, reg0, 0),
      (str_store_item_name, s3, reg0),
   (else_try),
       (str_store_string, s3, '@NO ITEM'),	
   (try_end),
   (set_fixed_point_multiplier, 100),
   (position_get_x, reg2, pos0),
   (position_get_y, reg3, pos0),
   (position_get_z, reg4, pos0),
   (assign, reg18, ":damage"),
   (position_get_rotation_around_x, reg5, pos0),
   (position_get_rotation_around_y, reg6, pos0),
   (position_get_rotation_around_z, reg7, pos0),
   (display_message, "@{s1}'s hit by {s2} using {s3} on ({reg2}, {reg3}, {reg4}) angle ({reg5}, {reg6}, {reg7}) resulting {reg18} damage"),	
   (agent_get_position,pos1,":agent"),
   (position_transform_position_to_local, pos3, pos1, pos0),	
   (position_get_x, reg2, pos3),
   (position_get_y, reg3, pos3),
   (position_get_z, reg4, pos3),
   (position_get_rotation_around_x, reg5, pos3),
   (position_get_rotation_around_y, reg6, pos3),
   (position_get_rotation_around_z, reg7, pos3),
   (display_message, "@transforming to local  ({reg2}, {reg3}, {reg4}) angle ({reg5}, {reg6}, {reg7})"),	
])
Hoping anybody help me to find the pos3 relation with bodypart. As body and head dont not move so much  compared to hand, then I think we can easily detect chest and head hit somehow.
 

Somebody

Code Pope
Baron
WBWF&S
Best answers
1
Use position_get_distance_to_ground_level, which should return a reliable height between 0 and 175?
I was already trying to get dual-wielding to work with agent_un/equip_item, but that didn't work well due to the slots filling up, etc. I already have a rudimentary blunderbuss (sort of) working, and unique weapons which track damage and amount of kills (playing particle effects with burst strength depending on amount of overkill), which can probably be made upgradeable or something. Also working on a lance breaking script, now that agent_get_speed is also available.
 

rabican

Knight at Arms
WB
Best answers
0
agent_deliver_damage_to_Agent
triggers on_agent_hit  trigger.
if you use agent_deliver_damage_to_agent  in on_agent_hit it will deal exactly same damage as the original hit. it will also crash the game if you don't do anythjinga about the endless loop it would create

agent_set_hit_points operation will actually kill the agent properly if used in on_agent_hit  trigger. if hps are set to 0 that is. usually  it wont kill but it will kill in this  trigger


on_agent_hit param 3(damge) seems to call damage delivered, not damage received.damage before it got reduced by armor.


suprising things i found out while testing m&b module system  on new years eve.
 

Somebody

Code Pope
Baron
WBWF&S
Best answers
1
We already found most of those out. The reason using agent_set_hit_points to 0 will work in this trigger is because it fires and intercepts the hit before any damage is inflicted by the game engine to the agent. However, we cannot influence the results via set_trigger_result or manipulating the values of reg0/pos0. If you output parameter three, it will display before the hardcoded damage notification (albeit the value is truncated instead of rounded).
 

dunde

Count
WB
Best answers
0
Somebody said:
it will display before the hardcoded damage notification (albeit the value is truncated instead of rounded).
Yes, you're right. It's not about armor nor speed bonus. It's just about truncated and rounded things. The hardcoded damage display is always the same or 1 above the 3rd trigger parameter.
 

rabican

Knight at Arms
WB
Best answers
0
ah sorry, my english isn't too good, and i didn't understand what you said about hardcoded  damage notifaction. could you rephrase that in idiot-talk (sorry). edit: ah yeah srry, upon further testing i sort of get it now! yeah nothing to do with armor values, i stupidly assumed because the hardcoded damage display didn't match the param 3 1:1 . thanks for correcting

i wish there was some more indepth descriptions about the triggers/operations somewhere in these forums(or somwhere, i'm pretty blind so i probaly just missed them posts ) . i just spent ~5 hours testing these things :smile:    (

Somebody said:
The reason using agent_set_hit_points to 0 will work in this trigger is because it fires and intercepts the hit before any damage is inflicted by the game engine to the agent.
Humm... this means that i could use it to  sort of increase agent hit points beyond the normal limits pretty easily, right? With 1 agent slot, and agent_set_hit_points..  would agent still die if it died in one hit? don't think there is way to negate the damage done even with this? 

sorry for not being  coherent
 

MadocComadrin

Water-Borne Annelid
Count
M&BWBWF&S
Best answers
0
rabican said:
i wish there was some more indepth descriptions about the triggers/operations somewhere in these forums(or somwhere, i'm pretty blind so i probaly just missed them posts ) . i just spent ~5 hours testing these things :smile:    (
I agree, we could use a collective community documentation of the system. Unfortunately, people have made wikis before and all of them have flopped. We could also use some more developer documentation.
 

Lumos

Section Moderator
WBWF&SNWM&BVC
Best answers
0
MadocComadrin said:
I agree, we could use a collective community documentation of the system. Unfortunately, people have made wikis before and all of them have flopped. We could also use some more developer documentation.
I've been thinking about a wiki for a while now... We have a lot of modders (as we can see from this single thread) that are able to contribute, but still it'll require maintenance, etc. = free time, which I believe that few of us have to spare. It'd be awesome if we had one, though. :smile:

About dual wielding I've always had ideas, and now this trigger presents the possiblity... My Old Tzardom's Dual Swordsmen would behave like they should.

Somebody said:
Use position_get_distance_to_ground_level, which should return a reliable height between 0 and 175?
Why only to 175 and what happens when the agent is underwater? We could also make water soften hits (the lack of this is one thing I hate in Warband) when you're not falling on it from 15 m or something.
 

Urist

Master Knight
M&BWB
Best answers
0
With comparing the hit location/rotation with the victim's location/rotation one can even make a (guess based) script that finds out which body part was hit. Probably useful for critical hits, allowing to bring damage simulation one step closer to the level of Dwarf Fortress.

In my crappy test script every hit higher than 1.5m was declared as a head hit.

Code:
####  Start of On-hit trigger test
      (ti_on_agent_hit, 0, 0, [],
      [
      #First store the involved agents and damage .
        (store_trigger_param_1, ":victim"), 
        (store_trigger_param_2, ":inflictor"), 
        (store_trigger_param_3, ":damage"),       

      #Assign to registers for output.
        (assign,reg1,":victim"),
        (assign,reg2,":inflictor"),
        (assign,reg3,":damage"),
        (display_message, "@{reg1}  was hit by {reg2} for {reg3} damage.",0x6495ed),

      #Following stuff only on human targets.
      (agent_is_human,":victim"),
      (try_begin),
      #store hit position for output
        (position_get_x, ":xposition", pos0),
        (assign,reg4,":xposition"),
        (position_get_y, ":yposition", pos0),
        (assign,reg5,":yposition"),
        (position_get_z, ":zposition", pos0),
        (assign,reg6,":zposition"),
        #(display_message, "@Item {reg0}  hit at absolute positions {reg4}x | {reg5}y | {reg6}z.",0xFF95ed),

      #Calculate relative position of the blow on victim and put it on screen.

        (agent_get_position, pos1,":victim"),
        (position_get_x, ":xposition_victim", pos1),
        (val_sub,":xposition",":xposition_victim"),
        (assign,reg4,":xposition"),
        (position_get_y, ":yposition_victim", pos1),
        (val_sub,":yposition",":yposition_victim"),
        (assign,reg5,":yposition"),
        (position_get_z, ":zposition_victim", pos1),
        (val_sub,":zposition",":zposition_victim"),
        (assign,reg6,":zposition"),
        (display_message, "@Item {reg0}  hit at relative positions {reg4}x | {reg5}y | {reg6}z.",0x1015ed),

      #Show absolute rotation of the blow.
        (position_get_rotation_around_x, ":xrotation", pos0),
        (assign,reg4,":xrotation"),
        (position_get_rotation_around_y, ":yrotation", pos0),
        (assign,reg5,":yrotation"),
        (position_get_rotation_around_z, ":zrotation", pos0),
        (assign,reg6,":zrotation"),  
        #(display_message, "@Absolute direction of the blow is {reg4}x | {reg5}y | {reg6}z.",0x00FFed),  
     
      #Calculate relative rotation of the blow compared with  victim.
        (agent_get_position, pos1,":victim"),
        (position_get_rotation_around_x, ":xrotation_victim", pos1),
        (val_sub,":xrotation",":xrotation_victim"),
        (assign,reg4,":xrotation"),
        (position_get_rotation_around_y, ":yrotation_victim", pos1),
        (val_sub,":yrotation",":yrotation_victim"),
        (assign,reg5,":yrotation"),
        (position_get_rotation_around_z, ":zrotation_victim", pos1),
        (val_sub,":zrotation",":zrotation_victim"),
        (assign,reg6,":zrotation"),
        (display_message, "@Relative direction of the blow is  {reg4}x | {reg5}y | {reg6}z.",0x0055ed),


        #Heal victim. 
	(agent_set_hit_points,":victim",100 ,1), 

        #Slow victim down
        #(agent_set_speed_limit,":victim",0.01),

        #Guess if head was hit.
        (try_begin),
          (gt, ":zposition", 150),
          (try_begin),
            (display_message, "@The head was hit!",0x3315ed),   
            #(agent_set_look_target_agent, ":victim", ":inflictor"),           
          (try_end),
        (try_end),

        #Guess if front was hit
        (try_begin),
          (is_between,":zrotation",90,180),
          (try_begin),
            (display_message, "@The front was hit.",0x3344ed),
          (try_end), 
        (try_end), 



       (try_end),
         ]),
#### End of On-hit trigger test


MadocComadrin said:
Do you know what we can finally do with this? Two words-GAUNTLET WEAPONS! Yes, all those wrist blades, patas, brass knuckles and more can all be done now with two simple item checks!
The problem is that kicks and punches have the same source number: -1. So punches and kicks can't be discerned easily. Maybe checking the inflictor's current animation (if possible) may help here though.
 

dunde

Count
WB
Best answers
0
Lumos said:
Why only to 175 and what happens when the agent is underwater? We could also make water soften hits (the lack of this is one thing I hate in Warband) when you're not falling on it from 15 m or something.
And when the agent mount a horse or do jumping, the hit position calculation will be different.
 

xenoargh

Grandmaster Knight
Best answers
0
The problem is that kicks and punches have the same source number: -1. So punches and kicks can't be discerned easily. Maybe checking the inflictor's current animation (if possible) may help here though.
Yeah, should work, I'll look at the problem.
 

dunde

Count
WB
Best answers
0
xenoargh said:
The problem is that kicks and punches have the same source number: -1. So punches and kicks can't be discerned easily. Maybe checking the inflictor's current animation (if possible) may help here though.
Yeah, should work, I'll look at the problem.
and don't forget horse charging is -1 too.
 

Urist

Master Knight
M&BWB
Best answers
0
Yeah, but checking if the damage dealer is mounted or a horse is easy.
 

xenoargh

Grandmaster Knight
Best answers
0
No fear; I've already split humans / horses up into two branches.  I want to make horses occasionally rear, take extra damage from pointy things, etc., so it was time to make the code marginally more efficient anyhow.
 

Zarthas

Squire
Best answers
0
This is really cool actually, nicely done xenoargh.  I think I'll be bastardizing it a bit for using torches to make animals rear or rout even :grin:
 

MadocComadrin

Water-Borne Annelid
Count
M&BWBWF&S
Best answers
0
You speak as if I'm not here...watching...waiting...learning..becoming more sentient...err, wait, wrong movie.
 

Theoris

Decapitations are possible now. Get the distance from agent position who's hit (agent_get_position should return the position between cohones and near the feet) and compare the distance to absolute hit position.

If distance is between ~160-180 then it means the blow is to the head/neck. Could unequip the current helmet item (if there is any) and equip another helmet item with an invisible mesh and the awesome itp_covers_head flag. Oh, almost forgot.. loads of blaaaaaad!

Edit.
Something like this, perhaps..
Code:
theoris_decapitation = (
    ti_on_agent_hit, 0, 0, [],
    [
    	(store_trigger_param_1, ":agent"),
		(agent_is_human, ":agent"),
    	(store_trigger_param_3, ":damage"),
		(store_agent_hit_points, ":hp", ":agent", 1),
		(ge, ":damage", ":hp"),
		(agent_get_position, pos1, ":agent"),
		(get_distance_between_positions, ":distance", pos1, pos0),
		(is_between, ":distance", 160, 176), # *zing*
		(agent_get_item_slot, ":item", ":agent", 4), #head slot
		(try_begin),
		    (ge, ":item", 1),
			(agent_unequip_item, ":agent", ":item"),
		(try_end),
		(agent_equip_item, ":agent", "itm_invisible_head"),
		(particle_system_burst, "psys_game_blood_2", pos1, 125), #Yeah..
		#(set_spawn_position, pos1),
		#(spawn_scene_prop, "spr_physics_head"),
	]),
 

Urist

Master Knight
M&BWB
Best answers
0
Yeah, I had the same idea yesterday. If you check the damage dealers animation(agent_get_attack_action)+weapon you can also make sure that it only happens with side swings of proper blades. Probably only hits with damage > 20 should trigger decaps or it would be wierd to have 1 dam glancing blows removing heads.

Code:
(store_agent_hit_points, ":hp", ":agent", 1),
(ge, ":damage", ":hp"),
Hmm, I think this is not neccessary because damage substraction is done independlybefore the trigger fires imo. So checking if victim's hp is not greater than 0 should be enough(speculation, didn't test).