OSP Kit Combat Fancy Damage Systems

Users who are viewing this thread

And pos0 instead of pos1, yeah.

Star Wars Conquest is a singleplayer mod, though.. if he's working on that.
 
Here's the horse code.  More stuff (katars, fist weapons, etc.) when I'm happier with the entire thing.

Code:
	#Minimum damage for horse tramples
	(try_begin),
		(eq, reg0, -1),
		(troop_get_inventory_slot,":horse",":attacker_troop",ek_horse),
		(gt, ":horse", 0),
		(troop_has_item_equipped,":attacker_troop",":horse"),
		(try_begin),		
			(is_between, ":horse", "itm_light_horse_start", "itm_light_horse_end"),#special def in Blood and Steel source
			(val_max, ":damage", 25),
		(else_try),
			(is_between, ":horse", "itm_medium_horse_start", "itm_medium_horse_end"),#special def in Blood and Steel source
			(val_max, ":damage", 45),		
		(else_try),
			(val_max, ":damage", 65),#Pretty much insta-kill
		(try_end),
	(try_end),
 
So, even when the horse charge calls the trigger, it marks the human agent as the "attacker"/"damager" ?
Apparently, yeah.  Horses that don't have riders don't- they're apparently Agents armed with... themselves  :mrgreen:

I've decided not to worry about having them do extra damage, tho, since the AI ignores them.
 
xenoargh said:
Here's the horse code.

Code:
	#Minimum damage for horse tramples
	(try_begin),
		(eq, reg0, -1),
		(troop_get_inventory_slot,":horse",":attacker_troop",ek_horse),
		(gt, ":horse", 0),
		(troop_has_item_equipped,":attacker_troop",":horse"),
		(try_begin),		
			(is_between, ":horse", "itm_light_horse_start", "itm_light_horse_end"),#special def in Blood and Steel source
			(val_max, ":damage", 25),
		(else_try),
			(is_between, ":horse", "itm_medium_horse_start", "itm_medium_horse_end"),#special def in Blood and Steel source
			(val_max, ":damage", 45),		
		(else_try),
			(val_max, ":damage", 65),#Pretty much insta-kill
		(try_end),
	(try_end),
What if a mounted knight gets dismounted and punches someone? Wouldn't the above code execute (agent being dismounted doesn't change troop item slots)?
Isn't it easier (and less error prone) to do
Code:
(agent_get_horse, ":horse_agent", ":attacker"),
(ge, ":horse_agent", 0),
(agent_get_item_id, ":horse_item", ":horse_agent"),
 
What if a mounted knight gets dismounted and punches someone? Wouldn't the above code execute?
The code executes, but I was testing a split for fist weapons / katars, using that to branch with.  I guess I can just do a check on wielding 0 instead.  Your rewrite may be a smarter way to go on that, I'll check and make sure it still works.
 
SonKidd said:
if the attacker successfully blocks the attack, the on_agent_hit trigger isn't triggered right?
I think you mean the defender successfully blocks.....
If the agent parried or blocked the attack it won't fire the trigger.
 
xenoargh said:
So, even when the horse charge calls the trigger, it marks the human agent as the "attacker"/"damager" ?
Apparently, yeah.  Horses that don't have riders don't- they're apparently Agents armed with... themselves  :mrgreen:

From a few tests, the above trample code wasn't working. For me, the horse agent was marked as the ":attacker" when there was a charge/trample involved.

Code:
(neg|agent_is_human, ":attacker"),
(eq, reg0, -1),
(agent_get_item_id, ":horse", ":attacker"),
(ge, ":horse", 0),

The above seemed to identify horse charges/bumps/tramples quite well.
 
I do quite like this project  :smile:  I've been toying with a couple of ideas to try out using this method, namely creating a 'Wrestling' skill, which would detect if you made the hit unarmed, then increase your damage and provide a chance to knock-down or disarm.  If I get something going I'll be sure to post it here.
 
...another idea for improving the pike and trample buffs...
(agent_get_speed, pos0, ":horse"),
(position_get_y, ":forward_speed", pos0),
(convert_from_fixed_point, ":forward_speed"),

A character with 5 athletics and an encumbrance of 27.0 has a forward speed of 378.
That same character at full charge on a simple saddle horse has a forward speed of 870-ish.

Now...I think some fun can be had complexifying things a bit here. A horse coming full speed at a pikeman who is stopped should get more damage than a horse maneuvering in melee that gets stabbed, methinks. The speed values seem to work well for an
Extra Damage = (Speed/10) * 1.5       
....or some other similar scheme
 
Well, basically, the above is true (e = mc2 and all that) but what I mainly wanted to do with the horse buff was impose a minimum damage threshold, so that certain situations wouldn't happen. 

The way the engine works atm, it's charge factor * speed (in meters) * charge damage * some engine-side variable.  There's definitely some additional variable there, because a full-sized Percheron in full kit with a pretty giant charge number can knock an Agent over, but if the speed factor < some threshold, it does practically no damage.  A horse standing 16-17 hands high and carrying ~ 400 lbs. of weight (so, somewhere around 2300 lbs., or the weight of a small car) will definitely hurt you pretty badly if it steps on you, even if it's not moving very fast linearly, so that was the problem I wanted to correct there.

So I mainly wanted to correct that problem, by ensuring that getting stomped on would hurt, lol.  But I like the idea of using the velocity for something else entirely- working, functional pike charges :twisted:
 
I agree completely...my point was more about the damage that a pike gives could be based on the speed of the horse that runs into the pike, not the charge/trample damage. With pike-to-horse damage, the speed of the horse could something more to the minimum thresholds say.

In any case, I wanted to point out the functionality of this new operation--which I hadn't seen discussed elsewhere--for whatever may or may not be taken from it.
 
Got my little hand-to-hand add-on up and running.  Would be great for asian-themed mods and the like.  I'm sure you wouldn't want to use it, but I don't really know where else to put it  :???:
Code:
       #Wrestling Skill
        (store_skill_level, ":wrestling",  "skl_power_strike", ":attacker_troop"),#Temporarily serving as Wrestling
        (agent_get_wielded_item, ":wielded_weapon", ":attacker", 0),
            (try_begin),
            (eq, ":wielded_weapon",-1),#I assume this is unarmed
                (val_mul,":wrestling",3),#Each point is +3 unarmed damage
                (val_add,":damage",":wrestling"),
                (val_div,":wrestling",3),
                (val_mul,":wrestling",10),#Each point in Wrestling gives 10% chance to throw down
                (store_random_in_range, ":random_no", 1, 100),
                    (try_begin),
                    (le, ":random_no", ":wrestling"),
                    (agent_is_human,":agent"),
                    (agent_set_animation, ":agent","anim_rider_fall_roll",0),#Guy that got hit falls to ground
                        (try_begin),
                        (eq, ":troop", "trp_player"),
                        (display_message, "@You got thrown down!"),
                        (else_try),
                        (eq, ":attacker_troop", "trp_player"),
                        (display_message, "@Enemy got thrown down!"),
                        (try_end),
            (try_end),
Still needs the ability to disarm opponents, and make it use its own skill instead of a native one, but I like it.  It works for kicking while unarmed too.
 
Theoris said:
Hmm. I modified the code a bit.

Code:
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"),
	]),

Hi there,

Finally I get to compile this in mission templates after lots of errors. Tried it ingame and achieved lot of high damage 'headshots' (between 40 & 60) but no head has been chopped, then i started a new game but nothing.

I'm pretty new using the MS so any advice child-proof would be great.
 
you need 'neck shots'.

you can try to increase the range and test it again.
(is_between, ":distance", 140, 185),
If it works, it means your coding is OK, then you can reduce the values again. If it still doesn't work then it's something else.
 
Hi all,

just wanted to say thanks for all these wondrous bits of scripts, so usefull for beginning coders like me.

Cheers.
 
SonKidd said:
you need 'neck shots'.

you can try to increase the range and test it again.
(is_between, ":distance", 140, 185),
If it works, it means your coding is OK, then you can reduce the values again. If it still doesn't work then it's something else.

Thanks for the tip SonKidd. I modified those values to (is_between, ":distance", 90, 185),  but nothing happens. Maybe I'm very bad aiming at the neck. By the way, trying to understand what I'm doing, I'd like to know what the numbers in the code are, specially that ones:

->(ge, ":damage", 30), # i'm guess that is the minimum amount of damage.
->(val_sub, ":hp", 5), # That one I really don't have a clue. Is the minimum HP what the victim must have? Or what?

Also, here is the code as is in the file:
Code:
common_battle_mission_start = (
  ti_before_mission_start, 0, 0, [],
  [
    (team_set_relation, 0, 2, 1),
    (team_set_relation, 1, 3, 1),
    (call_script, "script_change_banners_and_chest"),
    ])

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", 90, 185), # *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", pos0, 125), #Yeah..
      #(set_spawn_position, pos1),
      #(spawn_scene_prop, "spr_physics_head"),
   ]),
   
common_battle_tab_press = (
  ti_tab_pressed, 0, 0, [],
  [
    (try_begin),
      (eq, "$g_battle_won", 1),
      (call_script, "script_count_mission_casualties_from_agents"),
      (finish_mission,0),
    (else_try),
      (call_script, "script_cf_check_enemies_nearby"),
      (question_box,"str_do_you_want_to_retreat"),
    (else_try),
      (display_message,"str_can_not_retreat"),
    (try_end),
    ])

Cheers.
 
Back
Top Bottom