Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
There is no agent_type as far as I know. Troop types refer to the bits under troop_type_mask, i.e. tf_male/female/undead.

groups are used exclusively in multiplayer - mostly for bots afaik. They are probably defined in some esoteric way.

classes are grc_infantry/cavalry/archer, which are usually defined at compilation time based on tf_guarantee flags.
divisions are the Warband alternative/replacement - including user-defined groupings from the party menu. I assume that the classes are still there for backward compatibility. Both of these cannot be modified via the operations available.

teams are the various sides in mission templates - they contain divisions which contain agents, etc. header_operations allow you to get/give orders to each "sub_class", which are just divisions containing the various agents friendly to eachother with a specific relation to agents on every other team.
 
Hi quick question. How do you put in a new chest in a scene? As I can't seem to find where the trigger for when you open it, you see items rather than just your inventory and the discard bit.
 
This has been bugging me for a while now and, based on what I've tried and seen in the module system, I haven't been able to figure it out on my own. :sad:
I also haven't been able to find anything that explains this type of thing in any guides.

How exactly do the equality tests get handled? I've seen some stuff in the module system that, based on my experience and knowledge, seems to suggest one thing but in fact works in an opposite manner.

Does a check, for instance (eq, ":foo", ":bar"), that evaluates to false mean that nothing below it in the same scope, within the same (try_begin) (try_end), or whatever, will work?
Code:
("example",
   [
      (eq, ":foo", ":bar"),                # assume evaluates to false
         ... bunch of stuff down here ...  # none of this gets looked at, regardless of what it is, because the check above was false?
   ]
),


Is it only the next check/instruction?
Code:
("example",
   [
      (eq, ":foo", ":bar"),                # assume evaluates to false
         ... do one thing here ...         # doesn't get done because above check is false
      ... bunch of stuff down here ...     # this does gets looked at, even though that initial check was false?
   ]
),

Also, what determines whether to use the (else_try) block in a (try_begin), (else_try), (try_end) setup? How does the engine decide when it's appropriate to jump out of the initial (try_begin) block and take a look in the (else_try)? Assuming the second example above is what is indeed happening.
 
First, thanks Somebody and Yoshiboy for clearing things up for me.

Second, Chris_B, equality tests work as you demonstrate in "Example Script 1."

So, the usefulness of try blocks is you can have an equality test with a set of things to be done depending on the result of the test, but then after the (try_end), the script will continue regardless of the test.

Code:
("example",
   [
      (agent_is_alive),                  # unless true, nothing below happens
      (try_begin),
          (eq, ":foo", ":bar"),                # assume evaluates to false
         ... bunch of stuff down here ...  # none of this gets looked at, regardless of what it is, because the check above was false.
      (try_end),
      ... bunch more stuff            # this does get looked at, regardless of the eq test of foo-bar, but only if the agent is alive
   ]
),
 
How can i edit quest text from the first scene in game?scene that say u are in prave/.... or other towns. I wana know how can i edit all the quest in game and with what tool.Tnx
 
First, rename the towns - then go to game_menus.
Code:
      ("town_6",[(eq, "$current_startup_quest_phase", 0),],"take a ship to L'Renouile, in the Imperial State.",
       [
         (assign, "$current_town", "p_town_19"),
         (assign, "$g_starting_town", "$current_town"),
         (assign, "$g_journey_string", "str_journey_to_lrenouile"),
...

Then proceed to module_strings and create a new string under/modify journey_to_(town name).
 
Chris_B said:
Also, what determines whether to use the (else_try) block in a (try_begin), (else_try), (try_end) setup? How does the engine decide when it's appropriate to jump out of the initial (try_begin) block and take a look in the (else_try)? Assuming the second example above is what is indeed happening.
Look at this code for an example:
Code:
("example", [
  (try_begin),
	(eq, 1, 0),    # False
	(call_script, "script_do_stuff"),
  (else_try),
	(eq, 1, 1),    # True
	(call_script, "script_do_other_stuff"),
  (else_try),
	(eq, 1, 1),    # True - the same check           # If I'm correct, the engine will not try this block
	(call_script, "script_do_more_stuff"),           #  when a previous one is the same. But I'm not really sure.
  (try_end),
 ]),
The engine tries the next block when a check fails, or when a successful block is finished.
 
Hello I looked around the forums and couldn´t find a solution to my problem. So maybe one of our Gurus can help me? ^^

I did create a new mesh and already put it into an BRF, aswell as the material and textures. Everything looks ok if I load the mesh in BRFEdit, but if I load the game, it says that there is too many variation on the mesh. What exactly does that mean and how could I fix this?

From the items_kinds1:

itm_Emmas_Armor Emmas 1  Emma_a 0  16777229 0 152 0 15.000000 100 0 20 6 0 0 0 0 0 0 0 0
0
 
Got a few questions this time. :smile:

I want to go through the players inventory, to include equipped items, and do some stuff with each one. Is there a way to simply iterate through the players inventory, get the item id for whatever is in each slot and do stuff? I really don't want to go through every item in the game each time and test whether the player has it with the player_has_item operation.

Does troop_remove_item destroy the item in question when it's removed from the troop? I want to move items from one troop to another but I don't want new ones, without the same modifiers, being created.

If the answer to the above is yes, how would I get any modifiers for the item that is there before I remove it? troop_get_inventory_slot_modifier? I'd really like my bastard sword to stay a Masterwork item if possible.

Finally, when iterating through a troops inventory, are equipped items part of that or will I need to do something special to handle those items?

Thanks in advance.


Edit:
Just noticed that troop_get_inventory_slot appears to return the item id of whatever is there and that troop_get_inventory_slot_modifier does return the modifier for that item while browsing through script_cf_player_has_item_without_modifier. Two questions down! :smile:
 
Paying it forward, so to speak...there are clearly others better equipped to answer and may have something to add, but here's what I've learned recently from messing with some code and asking similar questions...

Yes, there is a way to cycle the inventory for players and heroes by using the ek_ equipment slots, as seen in header_items.
Code:
(get_player_agent_no, ":player"),
(agent_get_troop_id, ":troop",":player"),    
(try_for_range, ":i", ek_item_0, ek_head), #these would be the weapon slots
    (troop_get_inventory_slot,":item",":troop",":i"), #now you have the item ID for that slot
    (troop_get_inventory_slot_modifier, ":modifier", ":troop", ":i"), #get the modifier
     //do stuff to it here, then loop to the next item
(try_end),
The above would work for NPCs, too, though you'd need to cycle through the Agents and try (troop_is_hero) to find them.

A few codes in progress have been messing a lot with going through player's and troops' inventories, it might serve you well to look over them: weapon break triggers and Lancers use the right weapon. Also, Custom Commander's source is open and it uses agent_slots to record weapons equipped on troops and their modifiers, so you can check out how it does that.

For non-hero, non-player troops, it's a bit different because the troop ID searches all items that the particular agent in the field, based on that troop ID (so the particular instance of a Rhodok Sharpshooter), MAY have as defined in the troops file. So yes, you'll need to do something different to check the equipped items.

Code:
(troop_get_inventory_capacity,":cap",":troop"),
(try_for_range, ":i", 0, ":cap"),#not sure if reg. troops have equipped items (slots < 10)
     (troop_get_inventory_slot,":item",":troop",":i"),
     (agent_has_item_equipped, ":agent", ":item"),#this step is essential,
	 (troop_get_inventory_slot_modifier, ":modifier", ":troop", ":i"),
     //do your stuff, as you would above
(try_end),
 
I don't particularly care about non-hero troops for what I'm doing. I'm working on a system to swap equipment between the player and another hero companion. Shouldn't actually need to use the agent operations because I know the id's for the troops I'll be dealing with.

Assuming I can get what I want working properly it should make purchasing equipment for companions much simpler because I'll swap the player's items, and skills as are applicable, over to trp_temp_troop, move the companions items over to player, and purchase items as usual. Then it's just a question of moving the items back to the companion in question, forcing them to equip stuff if necessary and moving everything from trp_temp_troop back to trp_player. (shrug)

Thanks for the info. Wasn't aware of the ek_* stuff.
 
Chris_B said:
Assuming I can get what I want working properly it should make purchasing equipment for companions much simpler because I'll swap the player's items, and skills as are applicable, over to trp_temp_troop, move the companions items over to player, and purchase items as usual.
Just swap the whole player troop instead :smile: Like in custom commander mod
 
Ummm. Yeah. I knew that...

Stupid good advice from smart people... (grumbles)

Guess I'll have to take a look at that then.

Thanks I guess? :smile:
 
Something which always annoyed me in native I'd like to change in my little mod: I want my villager and village_defenders to be of the same culture as the local walkers.

In native, when going into a Khergit village the walkers there are appropriately dressed as khergits, but running off bandits or fighting a battle in the same village and a gang of white dudes in coarse tunics and pitchforks show up.

Does anyone know a simple way to get the villagers to correspond in culture to the village like the walkers?
 
Status
Not open for further replies.
Back
Top Bottom