Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
ithilienranger said:
I would like to know how to use this op: (replace_scene_props, <old_scene_prop_id>,<new_scene_prop_id>),
Does it affect all props of a type or just the instance?
In MB it's done for all the instances of the specific prop at once, and done in ti_before_mission_start. In WB, since you can spawn scene props, it should be also possible to remove them on the fly, I just don't know WB that good, so somebody else can add to my answer here.
 
Actually, is there another way to remove props or prevent them from being checked? If I was to use this then the "scene_prop_get_num_instances" and "try_for_range" wouldn't work because the num_instances has changed, but not the IDs.
 
GetAssista said:
ithilienranger said:
I would like to know how to use this op: (replace_scene_props, <old_scene_prop_id>,<new_scene_prop_id>),
Does it affect all props of a type or just the instance?
In MB it's done for all the instances of the specific prop at once, and done in ti_before_mission_start. In WB, since you can spawn scene props, it should be also possible to remove them on the fly, I just don't know WB that good, so somebody else can add to my answer here.
In warband the operation doesn't work outside of ti_before_mission_start and maybe ti_after_mission_start as well, and it never will, according to the developers; so there is no way to remove a scene prop after the mission has started. Depending on what you want to do, items could be used instead: they can't have any triggers or bounding objects, but if you only need the object to be visible and optionally pickupable, and being automatically removed after a set time is ok...
 
You guys know how if you hold F1, that black flag pops up at the position you're looking at, and you can move it around till you let go? I need to do something similar, except with more conditions. It can't be a scene-prop since you can't delete them (the map will already be somewhat scene-prop heavy, and I can't risk it getting cluttered). Second, it needs to be manually rotatable. Third, it needs to support multiple meshes, ie, the mesh that will be moved around will be determined dynamically.

Anyone have any ideas for an approach? 
 
@Madoc

A presentation may be a workable option.
Be sure to use the prsntf_read_only flag so the mouse cursor doesn't appear. This will limit the type of input you can collect while the presentation runs, but will allow the player to freely control their toon's view, unlike what happens when the battle order display is up.
 
Aye, a presentation was my first attempt, but I'm not sure if you can rotate the mesh. Also, I'm not quite sure how agent_get_look_position works. Does it return the position you're looking at, or does it return the player-cameras rotation. If it's the latter, what's the best way to get the position the player is looking at?
 
MadocComadrin said:
Aye, a presentation was my first attempt, but I'm not sure if you can rotate the mesh. Also, I'm not quite sure how agent_get_look_position works. Does it return the position you're looking at, or does it return the player-cameras rotation. If it's the latter, what's the best way to get the position the player is looking at?

(overlay_set_mesh_rotation, <overlay_id>, <position_no>), #position's rotation values are used for rotations around x, y and z axis

This leads me to believe that rotation must be possible.

I'm fairly sure agent_get_look_position returns the position coordinates for whatever is in the middle of the screen. But I'm not positive.
 
Caba`drin said:
(overlay_set_mesh_rotation, <overlay_id>, <position_no>), #position's rotation values are used for rotations around x, y and z axis

This leads me to believe that rotation must be possible.

I'm fairly sure agent_get_look_position returns the position coordinates for whatever is in the middle of the screen. But I'm not positive.

Madoc = King of missing obvious things in header_operations after looking through it 3 times  :mad:. Thanks.

As for agent_get_look_position, I know some have used it in single-player mods to make magic staffs and the like, I just need to know how it works, and if it only returns the rotation, the best way to get the point on the ground the player is looking at.
 
MadocComadrin said:
It can't be a scene-prop since you can't delete them (the map will already be somewhat scene-prop heavy, and I can't risk it getting cluttered).
Why, you need only a single scene prop for this, and can hide it underground when done, then shift back up when needed again.
MadocComadrin said:
Also, I'm not quite sure how agent_get_look_position works.
...
or does it return the player-cameras rotation.
correct
MadocComadrin said:
If it's the latter, what's the best way to get the position the player is looking at?
There is no single "position the player is looking at", LOS is the whole Y axis, and you get it from agent_get_look_position just fine
 
I know that, I'm asking if anyone know the fastest method to get the first intersection along that axis. I'd rather avoid too much math as I have a feeling it's kinda slow.
 
MadocComadrin said:
I know that,
your question indicated that you did not.
MadocComadrin said:
I'm asking if anyone know the fastest method to get the first intersection along that axis. I'd rather avoid too much math as I have a feeling it's kinda slow.
Move position along the LOS in small increments and see when it intersects with some prop/ground. If many props in a scene, can be laggy. If only ground, it's quick
 
A few questions:

1:  I enabled hair under some helms, but it sticks out of the back.  No matter how I rig it, I can't get it to work for all hairstyles.  Am I doing something wrong?  Or do I just have to use the no hair flag?

2:  Where can I change the main menu text?  (I've seen it in other mods.)

3:  Where can I change the "loading textures" text that shows up when loading the game? 

Thanks!
 
Does position_get_distance_to_ground_level return a negative value when something is underground or is it always a positive distance?

What does position_get_distance_to_terrain measure?
 
Bolkonsky said:
A few questions:

1:  I enabled hair under some helms, but it sticks out of the back.  No matter how I rig it, I can't get it to work for all hairstyles.  Am I doing something wrong?  Or do I just have to use the no hair flag?

2:  Where can I change the main menu text?  (I've seen it in other mods.)

3:  Where can I change the "loading textures" text that shows up when loading the game? 

Thanks!
language/en/ui.csv

ithilienranger said:
Does position_get_distance_to_ground_level return a negative value when something is underground or is it always a positive distance?

What does position_get_distance_to_terrain measure?
There are three ways to measure distance - the two you mentioned and making a copy of that position and setting it to ground level, and measuring the distance from there to your original position. Make a trigger to display those values when you press a key and find out. I assume terrain is the generated base, while ground_level can be at the top of collision meshes (i.e. on castle walls)?
 
I asked via the Bug Tracker a while ago for the formula used to calculate the number of agents a player gets at a battle's start and Daegoth responded with the following

number_to_use = round(1.25f + 4.0f * battle_size * clamp(((15.0f + advantage) / 15.0f), 0.2f, 2.5f) * number)

where battle size is taken from options, advantage is obvious, and number is (own + allied) army size. you can learn about battle_size values from config file (under My Documents).

He further specified that
This is what is done in store_enemy_count and store_friend_count.

I was told by cmpxchg8b that 'f' indicated these were single precision floating-point numbers.
I'm now thinking I don't know what that means...as I cannot figure out how to convert his to module system code and get any value that makes a lick of sense. So, begin amateur hour questions in an attempt to avoid bugging the Devs:

Ignoring the 'f's and doing 1.25 + 4 * BattleSize * ((15+Advantage)/15) * FriendlyPartySize doesn't work at all. Even after clamping the ((15+Advantage)/15) between 0.2 and 2.5, the number being multipled by the number of friendlies is much larger than 1, greatly inflating the result, rather than scaling it down. 

How do I convert the 'f' values to integers/real numbers than I can use to calculate this? What am I missing?
 
Somebody said:
ithilienranger said:
Does position_get_distance_to_ground_level return a negative value when something is underground or is it always a positive distance?

What does position_get_distance_to_terrain measure?
There are three ways to measure distance - the two you mentioned and making a copy of that position and setting it to ground level, and measuring the distance from there to your original position. Make a trigger to display those values when you press a key and find out. I assume terrain is the generated base, while ground_level can be at the top of collision meshes (i.e. on castle walls)?
I checked the position_get_distance_to_ground_level and position_get_distance_to_terrain by outputting the distance as the object moved slowly. I was correct about the negative values when something is underground. The difference between the two values was negligible; one is probably for the terrain mesh and one is for the collision mesh.
 
Caba`drin said:
number_to_use = round(1.25f + 4.0f * battle_size * clamp(((15.0f + advantage) / 15.0f), 0.2f, 2.5f) * number)

where battle size is taken from options, advantage is obvious, and number is (own + allied) army size. you can learn about battle_size values from config file (under My Documents).

Ignoring the 'f's and doing 1.25 + 4 * BattleSize * ((15+Advantage)/15) * FriendlyPartySize doesn't work at all. Even after clamping the ((15+Advantage)/15) between 0.2 and 2.5, the number being multipled by the number of friendlies is much larger than 1, greatly inflating the result, rather than scaling it down. 

How do I convert the 'f' values to integers/real numbers than I can use to calculate this? What am I missing?

I tried calculating this out by hand, and the formula seems to be bogus. I'm getting results > 40 thousand (with a battle_size of 150, a friendly count of 75 and an advantage of 0)

Edit: Should battle_size and number be normalized values?
 
MadocComadrin said:
Caba`drin said:
number_to_use = round(1.25f + 4.0f * battle_size * clamp(((15.0f + advantage) / 15.0f), 0.2f, 2.5f) * number)

where battle size is taken from options, advantage is obvious, and number is (own + allied) army size. you can learn about battle_size values from config file (under My Documents).

Ignoring the 'f's and doing 1.25 + 4 * BattleSize * ((15+Advantage)/15) * FriendlyPartySize doesn't work at all. Even after clamping the ((15+Advantage)/15) between 0.2 and 2.5, the number being multipled by the number of friendlies is much larger than 1, greatly inflating the result, rather than scaling it down. 

How do I convert the 'f' values to integers/real numbers than I can use to calculate this? What am I missing?

I tried calculating this out by hand, and the formula seems to be bogus. I'm getting results > 40 thousand (with a battle_size of 150, a friendly count of 75 and an advantage of 0)

Edit: Should battle_size and number be normalized values?

*shrugs* I've tried calculating by hand, by Excel spread sheet, by the mod system...floating decimals in different places, but I can't get it to work. Which is why I assumed I missed some "magic" that was denoted by the 'f'. But, perhaps further questions to Daegoth will be necessary.
 
No, the f's don't matter. I think the formula is bogus, since if you have a battle advantage of zero, and a 'number' that is half your battle_size, you won't get 'number' back as your answer, like you should.
 
Status
Not open for further replies.
Back
Top Bottom