Script and Analysis - Chel's Abilties Script.

Started by Jubal, May 18, 2008, 11:49:47 AM

Previous topic - Next topic

Jubal

Combat Abilities
When in battle you can periodically (every two-three minutes) activate combat abilities. They are

Rage (15 strength required, press J key)
+5 power strike, power draw, power throw, ironflesh.
+20 strength, +5 agility.

this costs 15 experience per level, and lasts for [twice strength level] seconds.
after that time the skills/stats return to normal.

Combat Focus (15 intelligence required, press H key)
+[ten times intelligence level] proficiency to all weapons.
+5 agility.

this costs 10 experience per level, and lasts for [twice intelligence level] seconds.
after that time the skills/stats return to normal.

Sprint (15 agility required, press K key)
+5 athletics.
+15 agility.

this costs 7 experience per level, and lasts for [agility level] seconds.
after that time the skills/stats return to normal.

The duration of combat abilities can be extended by 10 seconds by carrying an Endurance Charm.

Add to combat missions in mission_templates (random battle, siege, village raid);
Quote
##### rage NEW4

     (1, 0, ti_once, [], [

                (assign, reg19, 1),

         ]),

     (0, 0, 150, [(key_clicked, key_j), (store_attribute_level,reg4,"trp_player",0),(ge,reg4,15),(eq,reg19,1),(neg|main_hero_fallen)], [
                 (play_sound,"snd_player_heartbeat"),
                 (display_message,"@You rage in battle!"),                 
                 (reset_mission_timer_b),

                 (assign, reg19, 2),
                 (store_attribute_level,reg2,"trp_player",0),
                 (val_mul,reg2,2),
                (try_begin),
                     (player_has_item,"itm_charm_b"),
                     (val_add,reg2,10),
                     (display_message,"@Your endurance charm gets warm "),             
                (else_try),
                (try_end),

                 (store_skill_level,reg20,"skl_ironflesh","trp_player"),
                 (store_skill_level,reg21,"skl_power_strike","trp_player"),
                 (store_skill_level,reg22,"skl_power_draw","trp_player"),
                 (store_skill_level,reg23,"skl_power_throw","trp_player"),                 
                 
                 (troop_raise_skill,"trp_player","skl_power_strike",5),
                 (troop_raise_skill,"trp_player","skl_power_draw",5),
                 (troop_raise_skill,"trp_player","skl_ironflesh",5),
                 (troop_raise_skill,"trp_player","skl_power_throw",5),

                 (store_skill_level,reg24,"skl_ironflesh","trp_player"),
                 (store_skill_level,reg25,"skl_power_strike","trp_player"),
                 (store_skill_level,reg26,"skl_power_draw","trp_player"),
                 (store_skill_level,reg27,"skl_power_throw","trp_player"),                 
         
                 (troop_raise_attribute,"trp_player",0,20),
                 (troop_raise_attribute,"trp_player",1,5),

           
         ]),

     (1, 0, 0, [(store_mission_timer_b,reg10),(gt,reg10,reg2),(eq,reg19,2)], [

                 (val_sub,reg20,reg24),
                 (val_sub,reg21,reg25),
                 (val_sub,reg22,reg26),
                 (val_sub,reg23,reg27),             

                 (troop_raise_skill,"trp_player","skl_ironflesh",reg20),
                 (troop_raise_skill,"trp_player","skl_power_strike",reg21),
                 (troop_raise_skill,"trp_player","skl_power_draw",reg22),
                 (troop_raise_skill,"trp_player","skl_power_throw",reg23),

                 (troop_raise_attribute,"trp_player",0,-20),
                 (troop_raise_attribute,"trp_player",1,-5),                   

                 (display_message,"@Your rage dies down... (you lose some experience)"),
                 (call_script, "script_rage_exp_penalty"),       

                 (assign, reg19, 1),

         ]),


     (1, 0, 0, [(main_hero_fallen),(eq,reg19,2)], [

                 (val_sub,reg20,reg24),
                 (val_sub,reg21,reg25),
                 (val_sub,reg22,reg26),
                 (val_sub,reg23,reg27),             

                 (troop_raise_skill,"trp_player","skl_ironflesh",reg20),
                 (troop_raise_skill,"trp_player","skl_power_strike",reg21),
                 (troop_raise_skill,"trp_player","skl_power_draw",reg22),
                 (troop_raise_skill,"trp_player","skl_power_throw",reg23),

                 (troop_raise_attribute,"trp_player",0,-20),
                 (troop_raise_attribute,"trp_player",1,-5),                   

                 (display_message,"@Your rage dies down... (you lose some experience)"),
                 (call_script, "script_rage_exp_penalty"),       

                 (assign, reg19, 1),

         ]),     

     (ti_tab_pressed, 0, 0, [(eq,reg19,2)], [

                 (val_sub,reg20,reg24),
                 (val_sub,reg21,reg25),
                 (val_sub,reg22,reg26),
                 (val_sub,reg23,reg27),             

                 (troop_raise_skill,"trp_player","skl_ironflesh",reg20),
                 (troop_raise_skill,"trp_player","skl_power_strike",reg21),
                 (troop_raise_skill,"trp_player","skl_power_draw",reg22),
                 (troop_raise_skill,"trp_player","skl_power_throw",reg23),

                 (troop_raise_attribute,"trp_player",0,-20),
                 (troop_raise_attribute,"trp_player",1,-5),                   

                 (display_message,"@Your rage dies down... (you lose some experience)"),
                 (call_script, "script_rage_exp_penalty"),       

                 (assign, reg19, 1),

         ]),     



######### rage end     
     
##### sprint NEW5

     (0, 0, 100, [(key_clicked, key_k),(store_attribute_level,reg4,"trp_player",1),(ge,reg4,15),(eq,reg19,1),(neg|main_hero_fallen)], [
                 (play_sound,"snd_player_heartbeat"),
                 (display_message,"@You push yourself to the limit!"),                 
                 (reset_mission_timer_b),

                 (assign, reg19, 3),
                 (store_attribute_level,reg2,"trp_player",1),
#                 (val_mul,reg2,2),
                (try_begin),
                     (player_has_item,"itm_charm_b"),
                     (val_add,reg2,10),
                     (display_message,"@Your endurance charm gets warm "),             
                (else_try),
                (try_end),

                 (store_skill_level,reg20,"skl_athletics","trp_player"),

                 (troop_raise_skill,"trp_player","skl_athletics",5),         
                 (troop_raise_attribute,"trp_player",1,15),

                 (store_skill_level,reg24,"skl_athletics","trp_player"),                 



           
         ]),

     (1, 0, 0, [(store_mission_timer_b,reg10),(gt,reg10,reg2),(eq,reg19,3)], [

                 (val_sub,reg20,reg24),

                 (troop_raise_skill,"trp_player","skl_athletics",reg20),

                 (troop_raise_attribute,"trp_player",1,-15),                   

                 (display_message,"@You are out of breath.. (you lose some experience)"),
                 (call_script, "script_sprint_exp_penalty"),       

                 (assign, reg19, 1),

         ]),

     (1, 0, 0, [(main_hero_fallen),(eq,reg19,3)], [

                 (val_sub,reg20,reg24),

                 (troop_raise_skill,"trp_player","skl_athletics",reg20),

                 (troop_raise_attribute,"trp_player",1,-15),                   

                 (display_message,"@You are out of breath... (you lose some experience)"),
                 (call_script, "script_sprint_exp_penalty"),       


                 (assign, reg19, 1),
         ]),     

     (ti_tab_pressed, 0, 0, [(eq,reg19,3)], [

                 (val_sub,reg20,reg24),

                 (troop_raise_skill,"trp_player","skl_athletics",reg20),

                 (troop_raise_attribute,"trp_player",1,-15),                   

                 (display_message,"@You are out of breath... (you lose some experience)"),
                 (call_script, "script_sprint_exp_penalty"),       


                 (assign, reg19, 1),
         ]),     


######### sprint end

##### focus NEW4

     (0, 0, 150, [(key_clicked, key_h),(store_attribute_level,reg4,"trp_player",2),(ge,reg4,15),(eq,reg19,1),(neg|main_hero_fallen)], [
                 (play_sound,"snd_player_heartbeat"),
                 (display_message,"@You focus on your weapon completely!"),                 
                 (reset_mission_timer_b),

                 (assign, reg19, 4),
                 (store_attribute_level,reg2,"trp_player",2),
                 (store_attribute_level,reg20,"trp_player",2),

                 (val_mul,reg20,10),                 
                 (val_mul,reg2,2),
                (try_begin),
                     (player_has_item,"itm_charm_b"),
                     (val_add,reg2,10),
                     (display_message,"@Your endurance charm gets warm "),             
                (else_try),
                (try_end),

                (troop_raise_proficiency_linear,"trp_player",0,reg20),
                (troop_raise_proficiency_linear,"trp_player",1,reg20),
                (troop_raise_proficiency_linear,"trp_player",2,reg20),
                (troop_raise_proficiency_linear,"trp_player",3,reg20),
                (troop_raise_proficiency_linear,"trp_player",4,reg20),
                (troop_raise_proficiency_linear,"trp_player",5,reg20),                         

                 (troop_raise_attribute,"trp_player",1,5),

           
         ]),

     (1, 0, 0, [(store_mission_timer_b,reg10),(gt,reg10,reg2),(eq,reg19,4)], [

                 (val_mul,reg20,-1),

                (troop_raise_proficiency_linear,"trp_player",0,reg20),
                (troop_raise_proficiency_linear,"trp_player",1,reg20),
                (troop_raise_proficiency_linear,"trp_player",2,reg20),
                (troop_raise_proficiency_linear,"trp_player",3,reg20),
                (troop_raise_proficiency_linear,"trp_player",4,reg20),
                (troop_raise_proficiency_linear,"trp_player",5,reg20),           

                 (troop_raise_attribute,"trp_player",1,-5),                   

                 (display_message,"@Your lose your focus... (you lose some experience)"),
                 (call_script, "script_focus_exp_penalty"),       

                 (assign, reg19, 1),

         ]),

      (1, 0, 0, [(main_hero_fallen),(eq,reg19,4)], [

  (val_mul,reg20,-1),

                (troop_raise_proficiency_linear,"trp_player",0,reg20),
                (troop_raise_proficiency_linear,"trp_player",1,reg20),
                (troop_raise_proficiency_linear,"trp_player",2,reg20),
                (troop_raise_proficiency_linear,"trp_player",3,reg20),
                (troop_raise_proficiency_linear,"trp_player",4,reg20),
                (troop_raise_proficiency_linear,"trp_player",5,reg20),           

                 (troop_raise_attribute,"trp_player",1,-5),                   

                 (display_message,"@Your lose your focus... (you lose some experience)"),
                 (call_script, "script_focus_exp_penalty"),       

                 (assign, reg19, 1),
         ]),     

     (ti_tab_pressed, 0, 0, [(eq,reg19,4)], [

                 (val_mul,reg20,-1),

                (troop_raise_proficiency_linear,"trp_player",0,reg20),
                (troop_raise_proficiency_linear,"trp_player",1,reg20),
                (troop_raise_proficiency_linear,"trp_player",2,reg20),
                (troop_raise_proficiency_linear,"trp_player",3,reg20),
                (troop_raise_proficiency_linear,"trp_player",4,reg20),
                (troop_raise_proficiency_linear,"trp_player",5,reg20),           

                 (troop_raise_attribute,"trp_player",1,-5),                   

                 (display_message,"@Your lose your focus... (you lose some experience)"),
                 (call_script, "script_focus_exp_penalty"),       

                 (assign, reg19, 1),


         ]),     

######### focus end     
Add to scripts;
Quote
  ("rage_exp_penalty",
    [(store_character_level,":level","trp_player"),
     (val_mul,":level",-15),
     (add_xp_to_troop,":level","trp_player"),
     ]),

    ("sprint_exp_penalty",
    [(store_character_level,":level","trp_player"),
     (val_mul,":level",-7),
     (add_xp_to_troop,":level","trp_player"),
     ]),

    ("focus_exp_penalty",
    [(store_character_level,":level","trp_player"),
     (val_mul,":level",-10),
     (add_xp_to_troop,":level","trp_player"),
     ]),


These scripts are really handy to add some interest into a mod, particulalry fo rspecialist things (jooining a guild for example).

Notes;

Quote(try_begin),
                     (player_has_item,"itm_charm_b"),
                     (val_add,reg2,10),
                     (display_message,"@Your endurance charm gets warm "),             
                (else_try),
                (try_end),

This section, appaering in each ability, requires the endurance charm item and so can be removed in the majority of mods.
-----------------------------------------------------------------------
Quote(0, 0, 150, [(key_clicked, key_h),(store_attribute_level,reg4,"trp_player",2),(ge,reg4,15),(eq,reg19,1),(neg|main_hero_fallen)],

One nice easy trick for this section is to add a conditional as foollows;

Quote(0, 0, 150, [(eq, "$player_is_assassin", 1)(key_clicked, key_h),(store_attribute_level,reg4,"trp_player",2),(ge,reg4,15),(eq,reg19,1),(neg|main_hero_fallen)],

This lets you enable the abilities after the player has done a quest or suchlike.
-----------------------------------------------------------------------
Quote(0, 0, 150, [(key_clicked, key_h),(store_attribute_level,reg4,"trp_player",2),(ge,reg4,15),(eq,reg19,1),(neg|main_hero_fallen)],

The highlighted section gives the conditional that the player must havbe 15 in an attribute to do the skill. You can remove this quickly by setting the number to 0.
-----------------------------------------------------------------------
The duke, the wanderer, the philosopher, the mariner, the warrior, the strategist, the storyteller, the wizard, the wayfarer...