Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
I meant  ti_on_weapon_attack for the ranged weapons see
Code:
["long_bow", "long_bow", [("flintlock_pistol",0)], itp_type_pistol |itp_merchandise|itp_primary ,itcf_shoot_pistol|itcf_reload_pistol, 230 , weight(1.5)|difficulty(0)|spd_rtng(38) | shoot_speed(160) | thrust_damage(45 ,pierce)|max_ammo(1)|accuracy(65),imodbits_none,
 [(ti_on_weapon_attack, [(,2,300][i]give back damage on shields if hitted target is not a human or scene_prop][/i]"),(position_move_x, pos1,27),(position_move_y, pos1,36),(particle_system_burst, "psys_pistol_smoke", pos1, 15)])]],
That way it might be detectable anyhow or this is my hope.
 
Meneldur said:
I meant  ti_on_weapon_attack for the ranged weapons see
Code:
["long_bow", "long_bow", [("flintlock_pistol",0)], itp_type_pistol |itp_merchandise|itp_primary ,itcf_shoot_pistol|itcf_reload_pistol, 230 , weight(1.5)|difficulty(0)|spd_rtng(38) | shoot_speed(160) | thrust_damage(45 ,pierce)|max_ammo(1)|accuracy(65),imodbits_none,
 [(ti_on_weapon_attack, [(,2,300][i]give back damage on shields if hitted target is not a human or scene_prop][/i]"),(position_move_x, pos1,27),(position_move_y, pos1,36),(particle_system_burst, "psys_pistol_smoke", pos1, 15)])]],
That way it might be detectable anyhow or this is my hope.
On weapon attack fires when the attack begins, so this won't be of any help.
 
I was now experimenting the way the mission timers work, and integrating with my way of sprinting. Is there something wrong with either the way I store the timer once key is launched or the way I increase the speed of current agent? Because, none seems to be working.

Code:
belendor_sprint = (
0, 0, 60,    [(key_clicked, key_o),
                             
              (neg|main_hero_fallen)],

	 [ (store_mission_timer_a, ":timer4"),
            (get_player_agent_no, ":player"),
             (agent_is_alive, ":player"),
           
           (store_sub, ":timer2", ":timer4", ":time4"),
           (store_sub, ":timer3", 10, ":timer2"),
          (store_skill_level,":athleticslev","skl_athletics",":player"),
           (assign, ":agility", ca_agility),
          (store_attribute_level, ":agilitylev", ":player", ":agility"	),
            (ge, ":athleticslev", 0),
            (ge, ":agilitylev", 0),           
             (val_mul, ":athleticslev", 2),
             (val_mul, ":agilitylev", 2),
              (troop_raise_skill,":player","skl_athletics", ":athleticslev"),
               (display_message, "@You are sprinting.", 0x6495ed),
              (troop_raise_attribute,":player", ":agility", ":agilitylev"),
            (try_begin),
             (le, ":timer3", 0),
              (val_div, ":agilitylev", 2),
              (val_div, ":athleticslev", 2),
               (store_random_in_range, ":decrease", -5, -15),
                (troop_raise_skill, ":player", "skl_athletics", ":decrease"),
                (troop_raise_attribute, ":player", ":agility", ":decrease"),
               (display_message, "@You are tired of sprinting.", 0x6495ed),
            (try_end),
 
Troop != Agent
Your timer looks quite convoluted for what can be done just with the trigger intervals.
You can use ca_agility directly as a parameter, no need to make another local for it.
Somehow I don't think the player would appreciate their agility/athletics plunging to 0 after this trigger fires multiple times in a mission.
 
I've got mission template trigger timers explained in my syntax thread if you want to take a look, but your (0, 0, 60... for a key-press timer should be correct (key press timers need to have a check interval of 0 at least) so long as you want there to be a 1 minute delay between being able to press O and activating this ability again.

That said, it doesn't look like the trigger will do much of what you intend it to do.
Since the consequence block of code will ONLY fire when O is pressed, however, it will never slow you down when you "are tired of sprinting". You'd need a separate trigger for that, or to rework this trigger greatly.

Similarly,  there is no local variable ":time4"...so you have to be getting errors on compile here:
(store_sub, ":timer2", ":timer4", ":time4"),
and if you meant the second ":time4" to be ":timer4" then ":timer2" will always equal 0, which I don't think is what you intend, either.

Also, you might want to revisit the difference between agents and troops.

edit - Somebody with the ninja

 
Hm, I will try fixing. One thing, though, I don't see any way to raise skills of the agent.
 
Belendor said:
Hm, I will try fixing. One thing, though, I don't see any way to raise skills of the agent.
Because there isn't. Skills and attributes are troop-based, meaning all agents of the same troop template share the same skills and attributes. This isn't a problem for SP player sprinting, of course (for heroes--the player/companions), but for MP it means that, if you want sprinting, you'll need a separate troop template for each player on the server or to use the new 1.153 operation:
agent_set_speed_modifier              = 2093  # (agent_set_speed_modifier, <agent_id>, <value>), # value is in percentage, 100 is default, value can be between [0..1000]


The OSP sprinting code in the OSP Resources board and perhaps other sprint-related threads here in the Forge should discuss all of this, however, as it has been a frequently addressed topic.
 
Hmm, even thought I so wanted to write sprinting of my own, remembering the same has been done before, It is just waste of time, I presume. One more thing;

Code:
HYW_AI = (

0.1, 0, 0,
	[],
	[ (try_for_agents, ":agent"),
           (get_player_agent_no, ":player"),
            (agent_is_alive, ":agent"),     
            (agent_is_alive, ":player"),
            (neg|agent_is_ally, ":agent"),
             (agent_get_attack_action, ":player_act", ":player"),
             (agent_get_attack_action, ":agent_act", ":agent"),
             (agent_get_defend_action, ":player_def", ":player"),
             (agent_get_defend_action, ":agent_def", ":agent"),
             (agent_get_action_dir, ":attack_dir", ":player"),
             (store_agent_hit_points, ":player_hp", ":player"),
             (store_agent_hit_points, ":agent_hp", ":agent"),
             (store_enemy_count, ":enemy"),
             (store_ally_count, ":ally"),
             (agent_force_rethink, ":agent"),
            (try_begin), #AI Def
             (eq, ":player_act", 2),
             (eq, ":attack_dir", 0),
              (agent_set_defend_action, ":agent", 0),
              #(display_message, "@Down!"),
            (else_try),
             (eq, ":player_act", 2),
             (eq, ":attack_dir", 1),
              #(display_message, "@Right!"),
              (agent_set_defend_action, ":agent", 1),
            (else_try),
             (eq, ":player_act", 2),
             (eq, ":attack_dir", 2),
              #(display_message, "@Left!"),
              (agent_set_defend_action, ":agent", 2),
            (else_try),
             (eq, ":player_act", 2),
             (eq, ":attack_dir", 3),
              #(display_message, "@Up!"),
              (agent_set_defend_action, ":agent", 3),
            (try_end), #AI Def
            (try_begin), #AI Agressiveness
             (le, ":player_hp", 10),
              #(display_message, "@Player's HP is below 10..."),
              (agent_stop_running_away, ":agent"),
              (agent_ai_set_aggressiveness, ":agent", 199),
             (else_try),
              (gt, ":agent_hp", ":player_hp"),
               #(display_message, "@Agent's HP is higher than Player's HP..."),
               (agent_ai_set_aggressiveness, ":agent", 199),
             (else_try),
              (le, ":enemy", 5),
               #(display_message, "@Number of the enemy is below 5..."),
               (agent_start_running_away, ":agent"),
             (else_try),
              (gt, ":enemy", ":ally"),
               #(display_message, "@Enemy is more in count..."),
               (agent_ai_set_aggressiveness, ":agent", 99),
             (else_try),
              (le, ":agent_hp", 5),
               #(display_message, "@Agent's HP is below 5..."),
               (agent_start_running_away, ":agent"),
             (try_end),
             (try_begin),
              (eq, ":player_def", 2),
               #(display_message, "@Blocking..."),
               (agent_ai_set_aggressiveness, ":agent", 299),
               (agent_set_attack_action, ":agent", 0, 3),
             (try_end),      
               
              
	]
 )

That is a very basic template of a "possible" AI improvement. I am going through every possible combination in combat, if possible. Am I following the true way?
 
@Belendor:
At the most basic level, no where do you check that the player's enemy agent is actually fighting the player (by checking proximity or target), so this will apply to all enemy agents simultaneously.

Similarly, you don't need to get the player info during every iteration; get that before the agent loop, as it won't change throughout it.


Harpic said:
Im trying to learn how to make a mod and I followed the tutorials but it does not seem to save properly  :cry:
I'm guessing you mean you aren't getting the module system to compile correctly? What exactly goes wrong. We're going to need much more detail than "followed tutorials and it doesn't work" to be able to help at all.
 
guys i am a noob in modding but now i start to learn how to mod...
i have a problem.i wanna make the great bardiche to became a throwing weapon when i press "x",but i wanna spawn first with the bardiche melee and then to change it's mode to ranged.

my problem is when i wanna shoot it say "you don't have eny bolts"

here is my code:

Code:
["great_bardiche",         "Great Bardiche", [("two_handed_battle_axe_f",0)], itp_type_two_handed_wpn|itp_merchandise|itp_two_handed|itp_primary|itp_bonus_against_shield|itp_wooden_parry|itp_unbalanced|itp_next_item_as_melee, itc_nodachi|itcf_carry_axe_back,
 617 , weight(5.0)|difficulty(10)|spd_rtng(89) | weapon_length(116)|swing_damage(50 , cut) | thrust_damage(0 ,  pierce),imodbits_axe ],


["great_bardiche_thrown",         "Great Bardiche", [("two_handed_battle_axe_f",0)], itp_type_thrown|itp_primary, itcf_throw_axe|itcf_carry_axe_back,
 617 , weight(5.0)|difficulty(2)|spd_rtng(95) | weapon_length(116)|swing_damage(60 , cut) | thrust_damage(0 ,  pierce)|max_ammo(1),imodbits_thrown ],
 
It doesn't work that way. itp_next_item_as_melee means exactly what it says; you have to put the ranged weapon first with the flag on it and the melee weapon second.

I think you can mark the melee version as merchandise and not the thrown weapon, however, to get roughly the same outcome.
 
but if instead of itp_type_thrown i put itp_type_crossbow,it shoots but it shoots with some kind of arrows and the sound is as a crossbow...

is there eny way that i can obtain what i wanted?first melee and then ranged?
 
The_dragon said:
but if instead of itp_type_thrown i put itp_type_crossbow,it shoots but it shoots with some kind of arrows and the sound is as a crossbow...
...right...you want the thrown version to be itp_type_thrown, not crossbow. Why would you mark it as crossbow?

The itp_type_thrown|itp_next_item_as_melee item has to be listed first; the itp_type_two_handed_wpn|itp_merchandise item has to be listed second.
 
The_dragon said:
so first melee and then ranged is impossible? :sad:
Sigh.
Caba`drin said:
It doesn't work that way. itp_next_item_as_melee means exactly what it says; you have to put the ranged weapon first with the flag on it and the melee weapon second.

I think you can mark the melee version as merchandise and not the thrown weapon, however, to get roughly the same outcome.
 
Can I know the differences between;

Code:
(multiplayer_get_my_player, <destination>),

(get_player_agent_no,<destination>),

I simulated tests in some MP triggers and get_player_agent_no also works in MP just like in SP. What is other used for?
 
Status
Not open for further replies.
Back
Top Bottom