Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
You could probably do it in line 30 of process_items instead so you don't need another function. If they release another patch, the bit value for itp_no_blur might also get overloaded, so check it later.
 
I'm starting to pull my hair out with this and I was wondering if anyone had any tips about tinkering with the kingdom_reinforcement_a,_b,_c, party_templates.

I want an evenly distributed party favoring one unit, depending on the factions strength. i.e., cav, inf, arch.

I understand how to put in the values to make the unit appear, but I'm getting a weird distribution of the troops among the parties.

As there are 2 types of reinforcement templates, castle/town and hero_troop_party. In the scripts_py.

I was wondering if I ### out the _a and _b values of the hero_troop and made the lt_value 101 for c_, (because its random 1-100; or make it le_)  I could insert into reinforcement_c a distribution like such:

[(trp_cav, 6,9),(trp_arch, 4,7),(trp_inf,4,7),(trp_cav2,2,4),(trp_arch2,2,4),(trp_inf2,2,4),(trp_recruit,1,2)],

Do you think this will work to give me a relatively balanced army favoring cavalry, this factions hypothetical strength?

Also, I was wondering if anyone knew how I can have a specific lord spawn with a specific special unit type. 

Would I have to create a unique party template for this lord?

Thanks for any feedback.
 
The_dragon said:
and another problem....
i am trying to get the vertical pitch of the camera(up-down),the actual angle of it,by doing this:
Code:
(agent_get_look_position, pos1, ":agent_id"),
(agent_get_position,pos2,":agent_id"),
(get_angle_between_positions, ":vert_rot", pos1, pos2),
but it doesen't seems to work,because most of the time it return the value 0...enyone have eny ideea why?
as far as i know,the agent position doesen't have the rotations around x and y axis(they are 0),only arownd z axis.
please a little help with the thing quoted...i really need it...
 
The_dragon said:
as far as i know,the agent position doesn't have the rotations around x and y axis (they are 0), only around z axis.
Might be wrong here, but I'm pretty certain that agents' position should have rotations around X and Y. Scratch that, the agents' positions do not have rotations around X or Y as The_dragon clarified in the post below. In the flying framework I've created, the SP version uses agent positions to make the player (or enemies) fly. However, it's just that the engine doesn't seem to support tilting of the agents, so while their position will be slanted, the agent himself will not.
About your problem however. Here's what Lav says about the operation you used in his great documented header_operations:
Code:
get_angle_between_positions                 =  705  # (get_angle_between_positions, <destination_fixed_point>, <position_no_1>, <position_no_2>),
                                                    # Calculates angle between positions, using positions as vectors. Only rotation around Z axis is used. In other words, the function returns the difference between Z rotations of both positions.
The difference between Z rotations. I don't think that this is what you want. So let's see what you really want:
The_dragon said:
i am trying to get the vertical pitch of the camera(up-down),the actual angle of it
So, if I'm right, you need the α angle on this ****ty picture below:
26HUVBE.png
So. How do we get the angle? I think that some trusty trigonometry would do the trick. Let's see.
Let's have pos1 be our player's position and pos2 be the look position.
The cathetus on the left is long abs(pos2.Z - pos1.Z);
Then we've got the hypotenuse, which might just be (get_distance_between_positions, pos1, pos2),
Now that we know the two sides we need, we know that sinα = cathetus/hypotenuse => sinα = abs(pos2.Z - pos1.Z)/(get_distance_between_positions, pos1, pos2),

How do you get an angle from a sine value though? Now, we aren't there yet at school, but I'm nearly completely certain that you need to use arcsin(α), which, in M&B terms, would be
Code:
store_asin
. Seems to be very simple, doesn't it...

But please, everyone reading! If I've made a horrible mistake around here (likely), please correct me. Thank you.
 
as far as i tested(by spawning item on the positions),the player's position x,y,z are the same as the look position x,y,z,the only difference between them is that the look position have rotations around every axis,since player's pos have rotations only around z axis.so the cathetus and the hypotenuse would be 0 in our case.

Might be wrong here, but I'm pretty certain that agents' position should have rotations around X and Y. In the flying framework I've created, the SP version uses agent positions to make the player (or enemies) fly. However, it's just that the engine doesn't seem to support tilting of the agents, so while their position will be slanted, the agent himself will not.

if you get the agent's position,and then set_spawn_pos to the agent pos,and then spawn an item(preferable spears or something long),the item will spawn without x and y rotations(it is paralel with the horizontal ground)

but if you spawn the item at the look view pos,it will be slanted.
 
The_dragon said:
if you get the agent's position,and then set_spawn_pos to the agent pos,and then spawn an item(preferable spears or something long),the item will spawn without x and y rotations(it is paralel with the horizontal ground)
Ah, well, thanks for clarifying that then. Fixed my incorrect statement above.
 
I don't see any reason we can't use position_get_rotation_around_x to get the pitch.
Code:
(agent_get_look_position, pos1, ":agent_id"),
(position_get_rotation_around_x, ":pitch", pos1),
 
dunde said:
I don't see any reason we can't use position_get_rotation_around_x to get the pitch.
Code:
(agent_get_look_position, pos1, ":agent_id"),
(position_get_rotation_around_x, ":pitch", pos1),

"position_get_rotation_around_x" will return rotation around x reffering to the global xyz.

the z rotation is the horizontal pitch(left-right),but a combination of x rotation and y rotation would give the vertical pitch(up-down)
 
My mistake  :oops:. In that case than we can use position_transform_position_to_local
Code:
(agent_get_look_position, pos1, ":agent_id"),
(agent_get_position,pos2,":agent_id"),
(position_transform_position_to_local, pos3,pos2,pos1),
(position_get_rotation_around_x, ":pitch", pos3), [code]
 
I've figured out how to have the NPC lords party spawn with the proper distribution of troop types, but I'm still at a loss for how to assign a specific troop type to a specific lord.

I really would appreciate some feedback on how to implement this please.
 
dunde said:
My mistake  :oops:. In that case than we can use position_transform_position_to_local
Code:
(agent_get_look_position, pos1, ":agent_id"),
(agent_get_position,pos2,":agent_id"),
(position_transform_position_to_local, pos3,pos2,pos1),
(position_get_rotation_around_x, ":pitch", pos3), [code]
But... but... trigonometry! Nooooo!
 
Please excuse my double-post, but I've got a bit of a noobish question here.
I set an agent's animation to something, and then I want, on a certain condition (i.e. a keypress), to stop that animation. However, I don't seem to be able to do that.  The anymation is cyclic, so it will repeat endlessly until I stop it, and I can't so it keeps playing even when it shouldn't. Do I have to set the agent's animation to stand_man or something else? No idea here, really, help would be much appreciated.
 
is there eny way to make the ghost camera move(set to a custom position)?or it is hardcoded into game?(the multiplayer camera when you are dead or spectator)

i wanna make something like a movie scene when a new scene or round or what i want begin.

ps:ty dunde for helping me with the pitch
 
I have made a party_template and inserted this script into script_cf_reinforce_party:

    (else_try),
(eq, ":party_type", spt_kingdom_hero_party),
        (eq, ":leader","trp_kingdom_6_lord"),
(try_begin),
      (lt, ":rand", 50),
  (assign, ":party_template", "pt_kingdom_6_special_reinforcements_a"),
        (else_try),
          (lt, ":rand", 70),
  (assign, ":party_template", "pt_kingdom_6_special_reinforcements_b"),
    (else_try),
  (assign, ":party_template", "pt_kingdom_6_special_reinforcements_c"),
    (else_try),
(try_end),

      (try_begin),
        (gt, ":party_template", 0),
        (party_add_template, ":party_no", ":party_template"),
      (try_end),
  ]),

Every post about this says to add a section similar to this in the script.

I'm unsure how to write the condition to make it select the troop I want.

I've tried a couple different local variables not just this one ":leader".

sorry for continuing to bring this up.
 
Hi all,
when i try to import some helmets, a forehead of my character is out of helmet. This problem do not exist when i set female character.
It is connected with lot of generally available helmets f.e. from AD1257 and other.
Błażej :wink:
 
Did you overwrite the normal lord reinforcement by your special lord? Bad idea, if so.
":leader" is the right variable, but you need to understand why, don't guess.
 
":leader"  is the variable troop_id from the line:

    (try_begin),
        (eq, ":party_type", spt_kingdom_hero_party),
        (party_stack_get_troop_id, ":leader", ":party_no"),
        (troop_get_slot, ":party_faction",  ":leader", slot_troop_original_faction),
      (try_end),

which should be "trp_kingdom_6_lord".

right?

this is a new (else_try) below the standard
(else_try),
        (eq, ":party_type", spt_kingdom_hero_party),
        (try_begin),
          (lt, ":rand", 50),
          (assign, ":party_template", ":party_template_a"),
        (else_try),
          (lt, ":rand", 70),
          (assign, ":party_template", ":party_template_b"),
        (else_try),
  (assign, ":party_template", ":party_template_c"),
        (else_try),
    (try_end),
 
So, what was your question? Should you do it that way? Well, does it work? Test it.

This works:
      (else_try),
        (eq, ":party_type", spt_kingdom_hero_party),
        (try_begin),
          (lt, ":rand", 50),
          (assign, ":party_template", ":party_template_a"),
        (else_try),
          (lt, ":rand", 75),
          (assign, ":party_template", ":party_template_b"),
        (else_try),
          (assign, ":party_template", ":party_template_c"),
        (try_end),
        (try_begin),
          (eq, ":leader", "trp_snowflake"),
          (try_begin),
          (lt, ":rand", 50),
          (assign, ":party_template", "pt_kingdom_6_special_reinforcements_a"),
          (else_try),
          (lt, ":rand", 70),
          (assign, ":party_template", "pt_kingdom_6_special_reinforcements_b"),
          (else_try),
          (assign, ":party_template", "pt_kingdom_6_special_reinforcements_c"),     
          (try_end),
        (try_end),
      (else_try),
      (try_end),


      (try_begin),
        (gt, ":party_template", 0),
        (party_add_template, ":party_no", ":party_template"),
      (try_end),
 
Status
Not open for further replies.
Back
Top Bottom