How do I get the name of a party template?

Users who are viewing this thread

Mordachai

Squire
I'm trying to report to the player how many of what type of troop was garrisoned (this is a mod/enhancement of SOD) - and I can't seem to get that info...

          (str_store_troop_name, s2, "pt_sod_noble_1"),
          (str_store_party_name, s2, "pt_sod_noble_1"),

both produce bizzare results!  And I can't find a "str_store_party_template_name"...

So there must be a way to access the troop ID associated with a template ID...

Help?! :???:

D'OH - okay, so I see that party templates are a one->many relationship... so why, I wonder, did SOD even bother with party templates for garrisoning units?  They could have just specified the troop ID.

...or now I don't see any way to add a given troop type to a given party... only by way of a party template.  Is there one?
 
well you can get the name of the troop, but I'm not sure if you can get the name of the template itself, since that's not really used in the game.

do a try_for_parties
eq the party template
val_add to a variable
store the party name of the party (as opposed to the template, amounts to the same thing in the end)

report that there are x unts of troopname on the map.

copy paste from one of my simple triggers:

(try_for_parties, ":cur_party"),
(party_get_template_id,":cur_party_template",":cur_party"),
(eq, ":cur_party_template", "pt_independent_traders"),

then use str_store_party_name for that
 
Mordachai said:
I'm trying to report to the player how many of what type of troop was garrisoned (this is a mod/enhancement of SOD) - and I can't seem to get that info...

          (str_store_troop_name, s2, "pt_sod_noble_1"),
          (str_store_party_name, s2, "pt_sod_noble_1"),

both produce bizzare results!  And I can't find a "str_store_party_template_name"...

So there must be a way to access the troop ID associated with a template ID...

Help?! :???:

D'OH - okay, so I see that party templates are a one->many relationship... so why, I wonder, did SOD even bother with party templates for garrisoning units?  They could have just specified the troop ID.

...or now I don't see any way to add a given troop type to a given party... only by way of a party template.  Is there one?

that operation works on parties not party templates.  I think the party templates are for spawning parties.  Think of the bandits that get spawned.  They are all the same, and there could be dozens of them, but there is only one party entry.
 
Since party templates are in fact for spawning parties (although you can ask for the template which spawned a given part), and since they have a one->many relationship (one template specifies one or more troop types and a range of possibilities to spawn for those troops), I solved my problem with manually coding the relationship from template to troop_id in my code.

UGLY, and rigid.

However, I don't see any way to get the list of troop IDs associated with a party template except perhaps to spawn a new party, look at its contents, and then destroy the party!  (even UGLIER, and problematic in its own ways).
 
I don't really understand your problem.

Either a. you want to know parties belonging to a party template in which case my method works. Just search for parties matching that template, then you go through their party stacks counting individual unit types and numbers, or you count all the companions and report that.

or b, you want to know how many units are garissoned in a party (town/castle) in which case you can do a check for all parties beloning to the player, and count the units in those.

There is no reason to get a troop ids identified with a party template since that doesn't help much.. once they spawn, gain xp and take on new units, they will look different anyway.

The only reason I can think is if you want to report how many units of a certain type the player would be getting if he spawns a reinforcement party in which case you can just hardcode it since the party templates are coded in the module system. But there is still no way of knowing exactly how many units of a certain type will spawn unless you have no ranges defined (i.e. trp_whatever, 5, 5 will always spawn five)
 
MartinF said:
I don't really understand your problem.
<snip>
The only reason I can think is if you want to report how many units of a certain type the player would be getting if he spawns a reinforcement party in which case you can just hardcode it since the party templates are coded in the module system. But there is still no way of knowing exactly how many units of a certain type will spawn unless you have no ranges defined (i.e. trp_whatever, 5, 5 will always spawn five)
That was indeed the reason I wished to know.  And my solution was to hard code the troop IDs into the dialog.py file.  Its adequate, if not elegant. :wink:
 
Back
Top Bottom