Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Lumos said:
SnRolls said:
Is there a way to not add manually 255 troops to module_troops?
I need to make 255 player troops because each player will have unique items,stats etc...
So the question is can i use loops like try_for_range and somehow make 255 troops automaticly without having to copy and paste 255 times?
Thanks.
You could use python:
Code:
# troops, troops, troops...
] +
for i in range(0, 255):
     ["player_" + str(i),"Player " + str(i),"None",tf_hero,0,0,0,[],str_4|agi_4|int_4|cha_4,wp(15),0,0],
+ [
# more troops
Note that I wrote this basically without references, and my experience with Python is equal to five minutes, so... you know... something along these lines, but definitely not this. Sort of.
Lots of errors :/
I suck at python so might need someone who understands it better mayb idk
Something with invalid syntax on the +
 
maybe
Code:
troops= [
# troops, troops, troops...
]
for i in range(0, 255):
      troops += ["player_" + str(i),"Player " + str(i),"None",tf_hero,0,0,0,[],str_4|agi_4|int_4|cha_4,wp(15),0,0]
# more troops

I think this would work

or maybe =+ cant remember
 
And here's a proper Pythonesque version. :smile:
Code:
troops= [
# troops, troops, troops...
]
troops.extend(["player_%d" % i, "Player %d" % i, "None", tf_hero, 0, 0, 0, [], str_4|agi_4|int_4|cha_4, wp(15), 0, 0] for i in xrange(255))
Same as Ikaguia's version, will add records from "trp_player_0" to "trp_player_254", for a total of 255.
 
Lav said:
And here's a proper Pythonesque version. :smile:
Code:
troops= [
# troops, troops, troops...
]
troops.extend(["player_%d" % i, "Player %d" % i, "None", tf_hero, 0, 0, 0, [], str_4|agi_4|int_4|cha_4, wp(15), 0, 0] for i in xrange(255))
Same as Ikaguia's version, will add records from "trp_player_0" to "trp_player_254", for a total of 255.
unexpected indent :X
nvm
added "," at the end.
now for example, im gonna get the player id when he joins, then i wanna like give him the troop of "trp_player_(here player id)" in the code.
how do i do that? "trp_player_%d" % ":player_id" ?
 
SnRolls said:
now for example, im gonna get the player id when he joins, then i wanna like give him the troop of "trp_player_(here player id)" in the code.
how do i do that? "trp_player_%d" % ":player_id" ?

Code:
(store_add, ":troop_id", "trp_player_0", ":player_no")
 
The_dragon said:
SnRolls said:
now for example, im gonna get the player id when he joins, then i wanna like give him the troop of "trp_player_(here player id)" in the code.
how do i do that? "trp_player_%d" % ":player_id" ?

Code:
(store_add, ":troop_id", "trp_player_0", ":player_no")
Thank you :smile:
 
I have a specific issue that wouldn't usually ever be encountered, so I'm not optimistic that anyone can help me, but this is my problem -

I'm spawning players into a multiplayer mission by spawning an agent of a certain troop type, and then using player_control _agent. These troops have different 'skins', with different scales etc. This works perfectly except for the following scenario:
When a player joins a server after there are already players spawned in, the new player will see all other players as agent instances of the player troop, as in, they see them as using the default male/female skin, and with the face key of that players profile. So what I believe is happening, is that when a player joins, any agent that is being controlled by the player is assumed to be of the player troop, rather than the appropriate troop with the correct skin.

So there is a discrepancy between the server side agents of the spawned players, and the new players client side agents of the spawned players. A very short player, appearing to look like a human, will still have the correct short hitbox etc, the only difference is appearance.

If, after the new player joined, one of the players that was already there respawns, the new player will see them correctly. So a 'solution' would be to force respawn everyone every time a player joins the server, but that is HORRIBLE (even if i saved position and animation state etc, still bad).


edit: If I could detach player control from agents before they're loaded for the joining player (and then reattach), it would probably fix it, but I believe that after 'ti_on_player_join' is called, it would already be too late.

Ideas?
 
Could it be possible to make an animation mod that modifies polearms so that:

1) spears used in one hand have regular thrust AND overthrust

2) pikes have also regular thrust and overthrust

3) halberds and glavies have overSWING instead of overthrust


Could this be possible? I would add something like this to every single mod out there.
 
Unless you're prepared to sacrifice 2h stabbing, 3) is not possible without extremely inefficient hackery.
1) and 2) are perfectly compatible though; all that's needed is to replace the overswing with a stab for both.



Two questions, one small and one kinda big.

1. Despite using str_clear in a script that generates titles for battles (called at the end of the operation block of  mnu_simple_encounter), the game still dredges up strings from all over the game seemingly at random. I've tried dozens of string numbers, but they all result in unpredictable overwrites. I've looked at the location of many of the scripts, and as far as I know, a lot of them aren't even called before I open the menu.

Here's the script:

#script_generate_battle_name
#creates a preamble for battles, i.e. "Skirmish at Praven Farm" or "The Sea Battle of Reyvadin"
#input:none
#output:string 33
#input:none
("generate_battle_name",
[
(party_get_current_terrain, ":terrain", "p_main_party"),

#clear strings
(str_clear, s29),
(str_clear, s30),
(str_clear, s32),
(str_clear, s33),

(try_begin),
(call_script, "script_party_count_members_with_full_health", "$g_encountered_party"),
(ge, reg0, 50),
(call_script, "script_party_count_members_with_full_health", "$g_encountered_party_2"),
(ge, reg0, 50),
(try_begin),
(eq, ":terrain", rt_bridge),
(str_store_string, s29, "@The Battle of"),
(else_try),
(str_store_string, s29, "@The Naval Battle of"),
(try_end),
(else_try),
(str_store_string, s29, "@Skirmish at"),
(try_end),

(call_script, "script_get_closest_center", "p_main_party"),
(str_store_string, s30, reg0),

(try_begin),
(this_or_next|eq, ":terrain", rt_snow_forest),
(this_or_next|eq, ":terrain", rt_steppe_forest),
(eq, ":terrain", rt_forest),
(str_store_string, s32, "@ Forest."),
(else_try),
(eq, ":terrain", rt_plain),
(str_store_string, s32, "@ Field."),
(else_try),
(str_store_string, s32, "@."),
(try_end),

(str_store_string, s33, "@{s30} {s31}{s32}"),
]),



2. Sorry to bring this up for the nth time, but it's been an annoying issue for almost a year, and nothing I've done so far has been able to fix it.

Banner icons on the world map aren't showing up, be they for Lord parties or towns. I see a pole and nothing else. The tableau material is definitely working, since I've seen the default flags appearing correctly every now and again. The normal banners you see in battles and beside lord portraits are working too. However I'm at a loss as to what's gone wrong.

I'm using code from Lav's FISH OSP:

Code:
    ("get_banner_mesh_for_party",
        [
            (store_script_param_1, ":party_id"),
            (assign, ":lord_id", -1),
            (try_begin),
                (this_or_next|party_slot_eq, ":party_id", slot_party_type, spt_castle),
                (party_slot_eq, ":party_id", slot_party_type, spt_town),
                (party_get_slot, ":lord_id", ":party_id", slot_town_lord),
            (else_try),
                (eq, ":party_id", "p_main_party"),
                (assign, ":lord_id", "trp_player"),
            (else_try),
                (party_slot_eq, ":party_id", slot_party_type, spt_kingdom_hero_party),
                (party_get_num_companion_stacks, ":stacks", ":party_id"),
                (gt, ":stacks", 0),
                (party_stack_get_troop_id, ":lord_id", ":party_id", 0),
            (try_end),

            (try_begin),
                (this_or_next|eq, ":lord_id", "trp_player"),
                (is_between, ":lord_id", active_npcs_begin, active_npcs_end),
                (troop_get_slot, reg0, ":lord_id", slot_troop_banner_scene_prop),
                (val_sub, reg0, banner_scene_props_begin),
                (val_add, reg0, banner_scene_props_end),
            (else_try),
                (assign, reg0, "mesh_banners_default_a"),
            (try_end),
        ]
    ),

module_scene_props.py looks like this:

Code:
 ("banner_1_01",0,"banner_1_01","0", []),
 ("banner_1_02",0,"banner_1_02","0", []),
(...)
 ("banner_10_19",0,"banner_10_19","0", []),
 ("banner_10_20",0,"banner_10_20","0", []),

 ("banner_kingdom_1", 0, "banner_kingdom_1", "0", []),
 ("banner_kingdom_2", 0, "banner_kingdom_2", "0", []),
(...)
 ("banner_kingdom_10", 0, "banner_kingdom_10", "0", []),

 ("banners_end",0,"0","0", []),

 ("arms_1_01",0,"banner_1_01","0", []),
 ("arms_1_02",0,"banner_1_02","0", []),
(...)
 ("arms_10_19",0,"banner_10_19","0", []),
 ("arms_10_20",0,"banner_10_20","0", []),

 ("arms_kingdom_1", 0, "banner_kingdom_1", "0", []),
 ("arms_kingdom_2", 0, "banner_kingdom_2", "0", []),
(...)
 ("arms_kingdom_10", 0, "banner_kingdom_10", "0", []),

Banner meshes in module_meshes.py are ordered the same as above (i get that around half of these would be superfluous, but I'm covering all my bases).

Here are the constants, which I am guessing is what is causing the issue. Be aware that due to my setting banners manually, none of the offset constants are used.

Code:
banner_meshes_begin = "mesh_banner_1_01"
banner_meshes_end_minus_one = "mesh_banner_10_20"

arms_meshes_begin = "mesh_arms_1_01"
arms_meshes_end_minus_one = "mesh_arms_10_20"

banner_scene_props_begin = "spr_banner_1_01"
banner_scene_props_end_minus_one = "spr_banner_10_20"
banner_scene_props_end = "spr_banners_end"

And my banners are assigned like this:

Code:
(faction_set_slot, "fac_kingdom_1", slot_faction_banner, "mesh_banner_kingdom_1"), #factions
(troop_set_slot, "trp_knight_1_1", slot_troop_banner_scene_prop, "spr_banner_1_01"),#lords

Here's what the banners look like in .brfs:

8MGTB.png

If anybody could help me out with this I'd be very grateful. Warband's strange banner mechanics are beyond me.
 
jacobhinds said:
Here's the script:
[list type=decimal]
[*]script_get_closest_center in Native at least returns a center, you're using str_store_string instead of str_store_party_name
[*]Replace banner_scene_props_end with arms_meshes_begin, or whichever version of the arm/banner that isn't clipped
[/list]
 
WookieWarlord said:
I have a specific issue that wouldn't usually ever be encountered, so I'm not optimistic that anyone can help me, but this is my problem -

I'm spawning players into a multiplayer mission by spawning an agent of a certain troop type, and then using player_control _agent. These troops have different 'skins', with different scales etc. This works perfectly except for the following scenario:
When a player joins a server after there are already players spawned in, the new player will see all other players as agent instances of the player troop, as in, they see them as using the default male/female skin, and with the face key of that players profile. So what I believe is happening, is that when a player joins, any agent that is being controlled by the player is assumed to be of the player troop, rather than the appropriate troop with the correct skin.

So there is a discrepancy between the server side agents of the spawned players, and the new players client side agents of the spawned players. A very short player, appearing to look like a human, will still have the correct short hitbox etc, the only difference is appearance.

If, after the new player joined, one of the players that was already there respawns, the new player will see them correctly. So a 'solution' would be to force respawn everyone every time a player joins the server, but that is HORRIBLE (even if i saved position and animation state etc, still bad).


edit: If I could detach player control from agents before they're loaded for the joining player (and then reattach), it would probably fix it, but I believe that after 'ti_on_player_join' is called, it would already be too late.

Ideas?


Furthermore, any equipment given to these player controlled agents (via equip_item), will cause them to assume that players profile face (but not the default male/female skin - so the size of the agent remains unchanged)... so for example if you equip a female agent controlled by a player with any weapon or armour, they will suddenly have a mans face, if their player profile is male.

Seems to be an oversight in the engine, where every time it looks at a player controlled agent upon joining the server, it assumes it is using the player troop and face, and when equipping a player controlled agent it assumes it should have your profile face.

elp.
 
jacobhinds said:
1. Despite using str_clear in a script that generates titles for battles (called at the end of the operation block of  mnu_simple_encounter), the game still dredges up strings from all over the game seemingly at random. I've tried dozens of string numbers, but they all result in unpredictable overwrites. I've looked at the location of many of the scripts, and as far as I know, a lot of them aren't even called before I open the menu.
Erm... You're clearing registers s29, s30, s32 and s33 but in the last line you use s31 and do not use s29.

jacobhinds said:
2. Sorry to bring this up for the nth time, but it's been an annoying issue for almost a year, and nothing I've done so far has been able to fix it.

Banner icons on the world map aren't showing up, be they for Lord parties or towns. I see a pole and nothing else. The tableau material is definitely working, since I've seen the default flags appearing correctly every now and again. The normal banners you see in battles and beside lord portraits are working too. However I'm at a loss as to what's gone wrong.

I'm using code from Lav's FISH OSP.
Actually, if you check the FISH thread, you'll see that the heraldic map icons code has ceased working at an indeterminate point in the past. I suspect one of the patches changed something in the engine which caused this but haven't yet had time on my hands to track down the issue and fix it.

Tableaus have always been tricky in Warband and their implementation is apparently not reliable at all. I have experienced issues with the same code working if it was in a script called from tableau material, but refusing to work for no obvious reason if it was in a script called from a script called from the same tableau, and there were a couple other weird issues as well.
 
Although I still need help on my main issue, I have another question.

The two methods I know of to get rid of unwanted agents from a multiplayer mission are agent_fade_out, and remove_agent(or deliver damage). Both seem undesirable to me as the first one takes too long to disappear and the collision stays there until it's gone (so when I 'respawn' an agent in the same spot, they get stuck on each other while it's fading). This wouldn't be so bad if I merely moved the fading agent out of the way first, except that if you call agent_fade_out too soon after trying to set it's position, it fades out on the spot and doesn't move. The second makes a visible and audible death effect, which is not ideal.

Is there another option or a way to mitigate these unwanted effects?

Edit: To be clear, I'm trying to get rid of the agent as inconspicuously as possible
 
1. Thanks, it's working now.

2. @Lav That's quite annoying. But again I don't think it's the tableau that's gone wrong -- I'm experimenting with Somebody's suggestion and I've been seeing other meshes appearing on flags (custom and default banners). hopefully that can point me in the right direction.
 
Status
Not open for further replies.
Back
Top Bottom