Author Topic: [Kit] Fancy Damage Systems (OSP)  (Read 14081 times)

0 Members and 1 Guest are viewing this topic.

dunde

  • Grandmaster Knight
  • *
  • Curious Coder of The Vision
    • View Profile
  • Faction: Swadian
  • WB
Re: Fancy Damage Systems (OSP)
« Reply #30 on: January 01, 2011, 12:22:14 PM »
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
  • *
    • View Profile
  • Faction: Neutral
Re: Fancy Damage Systems (OSP)
« Reply #31 on: January 01, 2011, 02:29:38 PM »
Quote
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

  • Grandmaster Knight
  • *
  • Curious Coder of The Vision
    • View Profile
  • Faction: Swadian
  • WB
Re: Fancy Damage Systems (OSP)
« Reply #32 on: January 01, 2011, 02:36:40 PM »
Quote
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
  • *
    • View Profile
  • Faction: Neutral
  • MP nick: Urist
  • M&BWB
Re: Fancy Damage Systems (OSP)
« Reply #33 on: January 01, 2011, 03:00:45 PM »
Yeah, but checking if the damage dealer is mounted or a horse is easy.

xenoargh

  • Grandmaster Knight
  • *
    • View Profile
  • Faction: Neutral
Re: Fancy Damage Systems (OSP)
« Reply #34 on: January 01, 2011, 03:01:25 PM »
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

  • Sergeant at Arms
  • *
    • View Profile
  • Faction: Vaegir
Re: Fancy Damage Systems (OSP)
« Reply #35 on: January 02, 2011, 04:58:30 PM »
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 :D

HULKSMASH

  • Grandmaster Knight
  • *
    • Skype - spencerglenn2
    • Steam - hulkTW
    • View Profile
  • Faction: Bandit
  • MP nick: HULKSMASH
  • M&BWBNWWF&S
Re: Fancy Damage Systems (OSP)
« Reply #36 on: January 02, 2011, 05:53:36 PM »
That's awesome.
My mod's coder needs to use this, and build on it.



After I'm dead, I'd rather people ask why I have no monument than why I have one.

MadocComadrin

  • Water-Borne Annelid
  • Grandmaster Knight
  • *
  • My legend begins in the 12th Century...
    • Steam - MadocComadrin
    • View Profile
  • Faction: Neutral
  • MP nick: TMW_Guard_Madoc
  • M&BWBWF&S
Re: Fancy Damage Systems (OSP)
« Reply #37 on: January 02, 2011, 09:28:30 PM »
You speak as if I'm not here...watching...waiting...learning..becoming more sentient...err, wait, wrong movie.
(⊙︿⊙✿)

Theoris

  • Guest
Re: Fancy Damage Systems (OSP)
« Reply #38 on: January 02, 2011, 09:38:09 PM »
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: [Select]
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"),
]),
« Last Edit: January 02, 2011, 09:49:26 PM by Theoris »

Urist

  • Master Knight
  • *
    • View Profile
  • Faction: Neutral
  • MP nick: Urist
  • M&BWB
Re: Fancy Damage Systems (OSP)
« Reply #39 on: January 02, 2011, 10:24:47 PM »
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: [Select]
(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).
« Last Edit: January 02, 2011, 10:40:41 PM by Urist »

Caba`drin

  • Administrator
  • *
  • It's time to toss the dice.
    • View Profile
  • Faction: Nord
  • MP nick: Caba_drin
  • M&BWBWF&SNW
Re: Fancy Damage Systems (OSP)
« Reply #40 on: January 02, 2011, 10:33:31 PM »
From what I gather from above, depending on the way the damage - reduction is calculated,
(ge, ":damage", ":hp"),
might not actually mean that the hit agent gets wounded/killed, does it?

You might need an extra step where, in this trigger you set a "decapitate" slot for the agent, and then in an ti_on_agent_killed_or_wounded trigger, this slot is checked for and the agent is decapitated as desired and coded to ensure that the agent is actually killed and not wounded.

But, perhaps that is unnecessary.


Also, xenoargh, are you planning on putting up here your Pike tweak that you worked on with Blood and Steel?



Urist

  • Master Knight
  • *
    • View Profile
  • Faction: Neutral
  • MP nick: Urist
  • M&BWB
Re: Fancy Damage Systems (OSP)
« Reply #41 on: January 02, 2011, 10:36:34 PM »
Well, that means a better glancing hit with 1 or 2 points of damage would decapitate too an already heavily wounded victim. I think only strong hits should do that.

Theoris

  • Guest
Re: Fancy Damage Systems (OSP)
« Reply #42 on: January 02, 2011, 10:43:24 PM »
Hmm. I modified the code a bit.

Code: [Select]
theoris_decapitation = (
    ti_on_agent_hit, 0, 0, [],
    [
    (store_trigger_param_1, ":agent"),
(agent_is_human, ":agent"),
    (store_trigger_param_3, ":damage"),
(ge, ":damage", 30), #strong blow
(store_agent_hit_points, ":hp", ":agent", 1),
(val_sub, ":hp", 5),
(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"),
]),

xenoargh

  • Grandmaster Knight
  • *
    • View Profile
  • Faction: Neutral
Re: Fancy Damage Systems (OSP)
« Reply #43 on: January 02, 2011, 11:56:55 PM »
Quote
xenoargh, are you planning on putting up here your Pike tweak that you worked on with Blood and Steel?
Sure.  Here's my current build of code.  Bear in mind, I'm already starting to broaden this out into a ruleset that's specific to gameplay, i.e., you may want to remove / tweak sections, and some of it refers to Skills that aren't in Native (again, sorry, but I'm already diverging a lot).

Anyhow, here's some code with the human/horse split after "universal" events have happened.

Code: [Select]
common_damage_system = (ti_on_agent_hit, 0, 0, [],
[
(store_trigger_param_1, ":agent"),
(store_trigger_param_2, ":attacker"),
(store_trigger_param_3, ":damage"),
(store_trigger_param_3, ":orig_damage"),
(agent_get_troop_id, ":troop", ":agent"),
(agent_get_troop_id, ":attacker_troop", ":attacker"),

#EVERYBODY#
#Critical hits for missiles
(try_begin),
(is_between, reg0, "itm_missile_weapons_start", "itm_missile_weapons_end"),#special def in Blood and Steel source
(store_random_in_range, ":random_no", 1, 100),
(try_begin),
(le, ":random_no", 5),
(val_min, ":damage", 20),
(try_end),
(try_end),

#Random critical hits, 3% per point of Combat Training (formerly Tactics)
(try_begin),
(store_skill_level, ":combat_training",  "skl_combat_training", ":attacker_troop"),
(val_mul, ":combat_training", 3),#3 percent chance per level, per hit
(store_random_in_range, ":random", 1, 100),
(try_begin),
(le, ":random", ":combat_training"),
(neg|agent_is_ally,":agent"),#don't critically hit non-allies
(val_max, ":damage", 1),
(val_mul, ":damage", 3),
(try_end),
(try_end),

#Damage is increased by 2 points for every point of Heroism, 3 if heroes.  Army-based skill!
(agent_get_party_id, ":attacker_party_id", ":attacker"),
(party_get_skill_level, ":heroism",  ":attacker_party_id", "skl_heroism"),
(try_begin),
(gt, ":heroism", 0),
(try_begin),
(troop_is_hero, ":attacker_troop"),
(val_mul, ":heroism", 3),
(val_add, ":damage", ":heroism"),
(else_try),
(val_mul, ":heroism", 2),
(val_add, ":damage", ":heroism"),
(try_end),
(try_end),

#HUMANS
(try_begin),
(agent_is_human, ":agent"),#branch if not human

#DEFENSIVE SKILLS
#Damage is lowered 5% per point of Toughness (formerly Ironflesh).
(try_begin),
(store_skill_level, ":toughness",  "skl_toughness", ":troop"),
(gt, ":toughness", 0),
(val_mul, ":toughness", 5),
(assign, ":mod_damage", ":damage"),
(val_mul, ":mod_damage", ":toughness"),
(val_div, ":mod_damage", 100),#Rounded here, but whatever.
(val_sub, ":damage", ":mod_damage"),
(try_end),

#Damage is avoided 5% per point of Reflexes(formerly Athletics)
(try_begin),
(store_skill_level, ":reflexes",  "skl_reflexes", ":troop"),
(gt, ":reflexes", 0),
(val_mul, ":reflexes", 5),
(store_random_in_range, ":random_no", 1, 100),
(try_begin),
(le, ":random_no", ":reflexes"),
(assign, ":damage", 0),
(try_begin),
(eq, ":troop", "trp_player"),
(display_message, "@You dodge the attack!"),
(else_try),
(eq, ":attacker_troop", "trp_player"),
(display_message, "@They dodge the attack!"),
(try_end),
(try_end),
(try_end),

#HORSE DAMAGE
(else_try),
#Pike special rules
(try_begin),
(is_between, reg0, "itm_pikes_start", "itm_pikes_end"),#special def in Blood and Steel source
(val_min, ":damage", 100),
(try_end),

#Horses randomly rear if they take damage
(store_random_in_range, ":random_no", 1, 100),
(try_begin),
(gt, ":damage", 5),
(le, ":random_no", 10),
(agent_set_animation, ":agent","anim_horse_rear"),
(try_end),
(try_end),

(store_sub, ":diff_damage", ":damage", ":orig_damage"),
(val_mul, ":diff_damage", -1),
(store_agent_hit_points, ":hitpoints" , ":agent", 1),
(val_add, ":hitpoints", ":diff_damage"),
(agent_set_hit_points,":agent",":hitpoints",1),
])

Idibil

  • Grandmaster Knight
  • *
    • View Profile
    • Nova Regula
  • Faction: Nord
  • MP nick: CeltíberoIdibil
Re: Fancy Damage Systems (OSP)
« Reply #44 on: January 04, 2011, 10:29:08 AM »
Sure.  Here's my current build of code.  Bear in mind, I'm already starting to broaden this out into a ruleset that's specific to gameplay, i.e., you may want to remove / tweak sections, and some of it refers to Skills that aren't in Native (again, sorry, but I'm already diverging a lot).

Anyhow, here's some code with the human/horse split after "universal" events have happened.


   #Random critical hits, 3% per point of Combat Training (formerly Tactics)
   (try_begin),
      (store_skill_level, ":combat_training",  "skl_combat_training", ":attacker_troop"),
      (val_mul, ":combat_training", 3),#3 percent chance per level, per hit
      (store_random_in_range, ":random", 1, 100),
      (try_begin),
         (le, ":random", ":combat_training"),     
         (neg|agent_is_ally,":agent"),#don't critically hit non-allies
         (val_max, ":damage", 1),
         (val_mul, ":damage", 3),
      (try_end),
   (try_end), 

Looking at this, I was thinking the opposite: the blunders (I dont know if it is right word in English, I am talk about slips, lost weapons in combat, injury friend ...)

The idea would be when the player has bad luck in his hit, random blunders occur, with message including.

When brytenwalda 1.33 is update, I like look this.
Thank you Xenoargh!