Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
No, but in that sector I know what I am doing. I am playing very heavily modified version, worked by myself. I have changed nearly every aspect in battles and world map travel. I have only two mission_templates in use. lead_charge for field battles (where that horse slowdown trigger is, and sure in right place) and castle_attack_walls_ladder for sieges where is no horses.

What I have done so far is ~45000 lines of own code in scripts, 5200 random numbers runs world map parties and their development + other things, ~200 self made simple_triggers, ~200 triggers. Installed 495 own made custom troops and 630 new items for those troops.
It works perfectly.

Currently I am working for wind system for AI and own ships, slows down them or boosts in game_get_party_speed_multiplier.
What I am editing and what currently affects player party speed is in big editing process, becouse I have to pass those when ship icons are in use. Example land speed for player party affects:>
Terrain type.
Party morale.
Number of party members.
Wounded members.
Number of prisoners.
Number of horses.
How many food units party gets.
And last 7 triggers calculates 7 cities or castles distance to player  party under distance of 25 units.Then it checks are those cities or castles friendly or enemies for player. Boosts speed if friendly city/castle is under range and slows down if enemy.

In some point I start releasing parts of program code I have made. One is "arrow pool". Arrow fillment place for AI archers.

And after all cant get simplest piece of code to working.  :facepalm:
I have to install some display messages in that horse slowdown and watch what numbers it prints in screen.



 
I have more complicated script limiting normal agent speeds with agent_set_speed_modifier, and it works very well. Propably trying to change next day agent_set_horse_speed_factor -> agent_set_speed_modifier and try couple of battles.
 
if some one could help me, how to prevent player wearing certain armor or item, like TLD does. player can't wear armor that is not fit to the skin.
I try to learn from their code, but it is too complex for my bad scripting skill.
 
Stan233 said:
u768 said:
I'll have to try out the code and see the problem, but probably gonna post a reply tomorrow.

I tested it separately with, agent_set_horse_speed_factor, agent_set_speed_limit and agent_set_speed_modifier. Fail, no reduced speed for player or AI horses  :ohdear:

Checked too header_operations.py from 1.154 MS and 1.166. There is no changes between those versions for those operations.
 
u768 said:
Stan233 said:
u768 said:
I'll have to try out the code and see the problem, but probably gonna post a reply tomorrow.

I tested it separately with, agent_set_horse_speed_factor, agent_set_speed_limit and agent_set_speed_modifier. Fail, no reduced speed for player or AI horses  :ohdear:

Checked too header_operations.py from 1.154 MS and 1.166. There is no changes between those versions for those operations.

Yeah, no luck for me either... Tried both as you said earlier and didn't manage to find the solution or the problem for that matter... Maybe someone a bit more experienced codder might help.
 
Last test is that I try to run it from scripts.

Edit: no success. I did search in 1.166 native MS about agent_set_horse_speed_factor and it is used 5 times in different places. Wondering if it is working there at all.
My cookie box is now empty for this matter. I hope that like Stan said some more experienced can solve this thing.
 
Where is the best submod for adding new NPCs/companions?
I am looking one with available source code so I can integrate it into Brytenwalda for some player requests.
 
Is there any way to overide the weather in map? example: I want fog in first week in august, the fog should last for 3 days. can I do that??
 
or just give me a way a way to get curent game month,
i found these operation "store_current_hours" and "store_current_day", but no "store_curent_month"..
any help would be appreciated..
 
gdwitt said:
Where is the best submod for adding new NPCs/companions?
I am looking one with available source code so I can integrate it into Brytenwalda for some player requests.

Tutorial:
Here

Submod:
Here


PS.: Try searching around the forum first before posting questions, please.

@Antoni
I have done it by declaring a simple trigger that triggers every 24 hours and checks if the day is for example the 3rd of August. So how you do that, you go in-game check the date the game spawns you in, calculate how many days you are from your wished date and do something like this:

Code:
(24,
  [
    (store_current_day, ":cur_day"),
    (store_sub, ":delta", 35, ":cur_day"), #35 is your calculated and desired date. Say you want to spawn the fog 3 days after you spawn in game you will put 3 insted of 35.

#Then do something like:

    (try_begin),
         (eq, ":delta", 0),
         .
          . # Enter Fog Effect Code Here
           .
    (try_end),

NOTE: This is probably wrong, there are probably better ways of doing this! Just trying to help for now, untill someone more experienced takes over hopefully...
 
u768 said:
Last test is that I try to run it from scripts.

Edit: no success. I did search in 1.166 native MS about agent_set_horse_speed_factor and it is used 5 times in different places. Wondering if it is working there at all.
My cookie box is now empty for this matter. I hope that like Stan said some more experienced can solve this thing.

it is simple guys, just read what Lav's included on his operations.py:

Code:
agent_set_horse_speed_factor             = 1734  # (agent_set_horse_speed_factor, <agent_id>, <speed_multiplier-in-1/100>),
                                                 # Multiplies agent's horse speed (and maneuverability?) by the specified percentile value (using 100 will make the horse). Note that this is called on the rider, not on the horse! Supposedly will persist even if the agent changes horses. 4research.

You need to use the rider (like the player's) ID, not the horse

Code:
(get_player_agent_no, ":player"),
(agent_set_horse_speed_factor, ":player", ":speed"), #0 to 100
 
kalarhan said:
# Multiplies agent's horse speed (and maneuverability?) by the specified percentile value (using 100 will make the horse). Note that this is called on the rider, not on the horse! Supposedly will persist even if the agent changes horses. 4research.

Is this from Lav's enhanced new module system? I'm still working in 1.153(my mod is in this kind of module) and didn't saw description like this in the operations...

PS.: Thanks for the replay, cleared things out for me!
 
Stan233 said:
@Antoni
I have done it by declaring a simple trigger that triggers every 24 hours and checks if the day is for example the 3rd of August. So how you do that, you go in-game check the date the game spawns you in, calculate how many days you are from your wished date and do something like this:

Code:
(24,
  [
    (store_current_day, ":cur_day"),
    (store_sub, ":delta", 35, ":cur_day"), #35 is your calculated and desired date. Say you want to spawn the fog 3 days after you spawn in game you will put 3 insted of 35.

#Then do something like:

    (try_begin),
         (eq, ":delta", 0),
         .
          . # Enter Fog Effect Code Here
           .
    (try_end),

NOTE: This is probably wrong, there are probably better ways of doing this! Just trying to help for now, untill someone more experienced takes over hopefully...

Thank you stan, i'll try it as soon as posible.
 
Stan233 said:
kalarhan said:
# Multiplies agent's horse speed (and maneuverability?) by the specified percentile value (using 100 will make the horse). Note that this is called on the rider, not on the horse! Supposedly will persist even if the agent changes horses. 4research.

Is this from Lav's enhanced new module system? I'm still working in 1.153(my mod is in this kind of module) and didn't saw description like this in the operations...

PS.: Thanks for the replay, cleared things out for me!

Stan: I am personally using 1.153 or 1.154 ( do not remember) module system, and I have not seen any problem with 1.168 game version.

kalarhan: thank you very much.

Changed the code little bit.

Code:
(3.2, 0, 0, [(store_mission_timer_a,":mission_time"),(ge,":mission_time",4),],
[
  (try_for_agents, ":agent_no"),
        (agent_is_alive, ":agent_no"),
        (agent_get_horse,":agent_no_horse",":agent_no"),
        (ge, ":agent_no_horse", 0),
        (store_agent_hit_points, ":horse_hp",":agent_no_horse"),
    (try_begin),
        (lt, ":horse_hp", 100),
        (gt, ":horse_hp", 20),
        (agent_set_horse_speed_factor, ":agent_no", ":horse_hp"),
    (try_end),
      (try_begin),
        (le, ":horse_hp", 20),
        (agent_set_horse_speed_factor, ":agent_no", 20),
      (try_end),
  (try_end),
]),

And after little bit of testing, code seems to slow down player horse and should do same for AI horses. I have to test further to see AI horse slowdowns.

Edit: there seems to be no problem with horse animations.
 
u768 said:
Stan233 said:
kalarhan said:
# Multiplies agent's horse speed (and maneuverability?) by the specified percentile value (using 100 will make the horse). Note that this is called on the rider, not on the horse! Supposedly will persist even if the agent changes horses. 4research.

Is this from Lav's enhanced new module system? I'm still working in 1.153(my mod is in this kind of module) and didn't saw description like this in the operations...

PS.: Thanks for the replay, cleared things out for me!

Stan: I am personally using 1.153 or 1.154 ( do not remember) module system, and I have not seen any problem with 1.168 game version.

kalarhan: thank you very much.

Changed the code little bit.

Code:
(3.2, 0, 0, [(store_mission_timer_a,":mission_time"),(ge,":mission_time",4),],
[
  (try_for_agents, ":agent_no"),
        (agent_is_alive, ":agent_no"),
        (agent_get_horse,":agent_no_horse",":agent_no"),
        (ge, ":agent_no_horse", 0),
        (store_agent_hit_points, ":horse_hp",":agent_no_horse"),
    (try_begin),
        (lt, ":horse_hp", 100),
        (gt, ":horse_hp", 20),
        (agent_set_horse_speed_factor, ":agent_no", ":horse_hp"),
    (try_end),
      (try_begin),
        (le, ":horse_hp", 20),
        (agent_set_horse_speed_factor, ":agent_no", 20),
      (try_end),
  (try_end),
]),

And after little bit of testing, code seems to slow down player horse and should do same for AI horses. I have to test further to see AI horse slowdowns.

Edit: there seems to be no problem with horse animations.

I would add this as a hit trigger on horse, less chance of impacting performance (lag) that way. Food for thought if you have FPS issues

Code:
ti_on_agent_hit               = -28.0 # Agent has been damaged with a weapon attack. Does not fire on client side in multiplayer missions.
    # trigger param 1 = damage inflicted agent_id
    # trigger param 2 = attacker agent_id
    # trigger param 3 = inflicted damage
    # trigger param 4 = hit bone
    # trigger param 5 = item_id of missile used to attack (if attack was with a ranged weapon)
    # reg0            = weapon item_id
    # pos0            = position of the hit area, rotation fields contain the direction of the blow
    # If (set_trigger_result) is used in the code with operation parameter equal or greater than zero, it will override the inflicted damage.


ti_on_agent_mount             = -55.0 # An agent has mounted a horse
    # trigger param 1 = agent_id
    # trigger param 2 = horse agent_id

agent_mount trigger to update speed if you exchange horses
 
Propably something like this. If I remember right damage is dealt before that code is run. For me it is new information that ti_on_agent_hit deals damage with horses too, I have not thought about that.

Code:
common_horse_slow = (ti_on_agent_hit, 0, 0, [],
[
(store_trigger_param_1, ":agent"),

                (agent_get_horse,":agent_horse",":agent"),
		(ge, ":agent_horse", 0),
		(store_agent_hit_points, ":horse_hp",":agent_horse"),
    (try_begin),
                (lt, ":horse_hp", 100),
                (gt, ":horse_hp", 20),
                (agent_set_horse_speed_factor, ":agent", ":horse_hp"),
    (try_end),
      (try_begin),
               (le, ":horse_hp", 20),
               (agent_set_horse_speed_factor, ":agent", 20),
      (try_end),
      
])


Now I am figuring out what I am going to do with ti_on_agent_mount. No big deal for me really, I am not using horses and AI is not swapping them.
 
u768 said:
Propably something like this. If I remember right damage is dealt before that code is run. For me it is new information that ti_on_agent_hit deals damage with horses too, I have not thought about that.
Code:
common_horse_slow = (ti_on_agent_hit, 0, 0, [],
[
(store_trigger_param_1, ":agent"),

                (agent_get_horse,":agent_horse",":agent"),
		(ge, ":agent_horse", 0),
		(store_agent_hit_points, ":horse_hp",":agent_horse"),
    (try_begin),
                (lt, ":horse_hp", 100),
                (gt, ":horse_hp", 20),
                (agent_set_horse_speed_factor, ":agent", ":horse_hp"),
    (try_end),
      (try_begin),
               (le, ":horse_hp", 20),
               (agent_set_horse_speed_factor, ":agent", 20),
      (try_end),
      
])

Now I am figuring out what I am going to do with ti_on_agent_mount. No big deal for me really, I am not using horses and AI is not swapping them.

I don't think you understood my comment. The trigger is called on the agent that took a hit. In your case the agent is the horse, as the animal takes a hit it will lose HP based off the damage registered. Again just a suggestion for better FPS.
 
kalarhan said:
I don't think you understood my comment. The trigger is called on the agent that took a hit. In your case the agent is the horse, as the animal takes a hit it will lose HP based off the damage registered. Again just a suggestion for better FPS.

I did not understand. And still dont, little bit lost in space. But horse slowdown now works for AI too.  :iamamoron:
 
u768 said:
kalarhan said:
I don't think you understood my comment. The trigger is called on the agent that took a hit. In your case the agent is the horse, as the animal takes a hit it will lose HP based off the damage registered. Again just a suggestion for better FPS.

I did not understand. And still dont, little bit lost in space. But horse slowdown now works for AI too.  :iamamoron:

hehe OK

Just as a note for other cases you will need to code:
Code:
trigger param 1 = damage inflicted agent_id
This parameter is the ID of the agent that took a hit.
Horses are agents too.
If you aim a arrow at a horse and hit the poor animal, the trigger will fire and the parameter will be the horse ID, not the rider. As you are doing damage to the horse...

Pay close attention to the operation description and use Lav's version for reference (better documentation).
 
Status
Not open for further replies.
Back
Top Bottom