Adding troops to an NPC party...

Users who are viewing this thread

Deus Ex

Sergeant Knight at Arms
Hello all

Perhaps one of you might be able to help me..

Is there a way to assign a troop or troops to a NPC party?

In the file "header_operations.py" there is an op for adding members to a 'party':

party_add_members = 10610 #party_id, troop_id, number

and there are a couple examples where I found it used in the code...

However, I would like to add troops to an NPC - and when I tried substituting the NPC's "trp_" identifier - it complained -

[party_add_members, trp_captain, trp_guard, 10]

It complained - it wants a party ID ("P_") for the first arg -

(and there is no corresponding function like TRP_ADD_MEMBERS)

So I don't know if I should muck around trying to (re)define my NPC as a party, or give up. I tried using the Tavern keeper functions - but that results in a dialog....

Any help here would be greatly appreciated!!

thanks

DE
 
You can't add a troop to a troop, you need a party template. If you make a party template named the same as trp_captain (without the trp_, obviously) with the only member being trp_captain, it might work, depending on what exactly you're trying to do and from where.

Rapturously,
Winter
 
Look in module_triggers.py for the code that refreshes troops for the taverkeepers. It apparently has to be defined as a party for it to work. You definitely don't need any dialog in order to get it to add troops though, and no dialog is involved in the troop refreshing triggers.
 
GREAT - thanks.

Winter, that is where I was headed next, Fisheye and I were talking about how to make the captain also look like a party. I'm going to muck with that a bit now.

Janus, I see what you are saying, once I have my NPC properly set up as party, I can use the trigger code, I don't need to use a dialog. nice.

Big help guys, many thanks, I appreciate it!! - I was getting a flat spot on my forehead...

DE
 
Janus said:
Look in module_triggers.py for the code that refreshes troops for the taverkeepers. It apparently has to be defined as a party for it to work. You definitely don't need any dialog in order to get it to add troops though, and no dialog is involved in the troop refreshing triggers.

Well it turns out that the trigger code (which I had looked at before) only adds the troops to the group "p_zendar_mercs" or whatever other merc party it is processing. In turn, the party "p_zendar_mercs" is set to the variable $tavernkeeper_party. ok fine, however, $tavernkeeper_party is used as input to a function called "set_mercenary_source_party" which is used in the buying troops dialog called from "change_screen_buy_mercenaries" - so those troops set that way must be purchased, and do not actually go into the "party" of the tavern keeper....

I am messing around with party definitions etc as Winter suggested - and I have defined both parties and party templates. When I put code in that does the "party_add_member" function, I do not get an error - and I imagine there is a party somewhere that has the members in it - but there does not seem to be any way to "connect" it to the NPC - after I have assigned members to the "captain" group - and I tried doing it using the party_add_member as well as putting them in the initial declaration (in parties and parties_templates) in all cases when I have the NPC join me there do not appear to be any troops with him.

Now I am still working on getting the "change_screen_exchange_members" to work, as that is the easiest way to check if the troops made it into the party - even if there are no troops with the unit I should be able to get it to open the dialog (unless there is an undocumented restriction that causes that not to run in a "town"...


Any other suggestions would be more than welcome - my head is starting to hurt *grin*

Thanks for the try though...

DE
 
Deus Ex said:
I am messing around with party definitions etc as Winter suggested - and I have defined both parties and party templates. When I put code in that does the "party_add_member" function, I do not get an error - and I imagine there is a party somewhere that has the members in it - but there does not seem to be any way to "connect" it to the NPC - after I have assigned members to the "captain" group - and I tried doing it using the party_add_member as well as putting them in the initial declaration (in parties and parties_templates) in all cases when I have the NPC join me there do not appear to be any troops with him.
Ah, you didn't say this was a companion NPC! That changes things.

The first thing you need to tell us is when exactly you're trying to add these troops. In a map encounter, the solution could potentially be very simple; do a [store_encountered_party,reg(0)], and then add the troops to reg(0). You can't do that in a trigger, obviously, so I can't offer you any help with that. Let me know if this works.

Polytonally,
Winter
 
Winter said:
Deus Ex said:
I am messing around with party definitions etc as Winter suggested - and I have defined both parties and party templates. When I put code in that does the "party_add_member" function, I do not get an error - and I imagine there is a party somewhere that has the members in it - but there does not seem to be any way to "connect" it to the NPC - after I have assigned members to the "captain" group - and I tried doing it using the party_add_member as well as putting them in the initial declaration (in parties and parties_templates) in all cases when I have the NPC join me there do not appear to be any troops with him.
Ah, you didn't say this was a companion NPC! That changes things.

The first thing you need to tell us is when exactly you're trying to add these troops. In a map encounter, the solution could potentially be very simple; do a [store_encountered_party,reg(0)], and then add the troops to reg(0). You can't do that in a trigger, obviously, so I can't offer you any help with that. Let me know if this works.

Winter

hmmm companion eh? I remember seeing that word in the code in a few places, but never took the time to figure out what it was for - still don't know *grin*.

So what is different about companions, and how do define them?

In any event, I see several applications for this - for npcs that may join your group, for other npc's that may be placed static and used for some purpose. I can see it being used in town and on the world map - so I would like to be able to do it ALL *BIG GRIN*

So far, I am testing using an npc modeled on one of the npc's like marnid, or borcha or one of the others. This captain has an spawn point in a tavern - and I have everything working for him to talk about himself, and join your group - he will leave on the world map and either wait, or return to the tavern.

I was testing to see if I could have him start with, or get some troops. Then I was going to use the "change_screen_exchange_members" call and see if he actually had the party members and also try to transfer them to the party.

But I am also interested in playing around with creating a party lead by an NPC to do things on the world map - to learn more about missions and triggers and such - thinking what it would be like to be able to have certain NPC lead parties static spawn, maybe patrol, have them able to join the player party even - or use them to set up encounters or battles.

So world map stuff and getting an NPC led party to spawn, and then be able to join (so I guess I gotta figure out this companion bit eh?).

If there is a write up on this somewhere, please link me - don't want to take up valuable time answering questions that are basic or obvious, or already answered. - I would also be happy to take it to PM or email if that would be preferred...

I am going to go back and make sure I can call "change_screen_exchange_members" succesfully with "captain" even when he has no troops - THEN I will worry about getting him some troops to play with.

So any information about how to use campanions to assign troops - or how to do it without using companions - in towns and out on the world map - would be appreciated - that's not asking too much, is it?? :wink:

Once again, many thanks for all the help so far.

DE

If it would be helpful I can post or email code - but I don't know if that is needed really at this point.

EDIT: Ok it is really starting to look like the "change_screen_exchange_members" function only works on the world map. I am still relatively certain that the captain is not getting any troops in his group because when he joins me, they do not show up in my group
 
Deus Ex said:
I was testing to see if I could have him start with, or get some troops. Then I was going to use the "change_screen_exchange_members" call and see if he actually had the party members and also try to transfer them to the party.
If this captain starts out sitting in a tavern, why are you trying to do this the hard (read: impossible) way? Just add the troops to your player party as a consequence when the captain joins you. Then, if you copy-pasted all the code from Marnid and filed off the serial numbers, you'll be able to separate from the captain and exchange members with him on the map.

As far as other NPC-led parties go, that's easy; just put the NPC and troops in a new party template and spawn that template somewhere.

Diabolically,
Winter
 
Winter said:
Deus Ex said:
I was testing to see if I could have him start with, or get some troops. Then I was going to use the "change_screen_exchange_members" call and see if he actually had the party members and also try to transfer them to the party.
If this captain starts out sitting in a tavern, why are you trying to do this the hard (read: impossible) way? Just add the troops to your player party as a consequence when the captain joins you. Then, if you copy-pasted all the code from Marnid and filed off the serial numbers, you'll be able to separate from the captain and exchange members with him on the map.

As far as other NPC-led parties go, that's easy; just put the NPC and troops in a new party template and spawn that template somewhere.

Diabolically,
Winter

LOL - I'm sorry - I tend to ramble all over. Let me attempt to be less verbose and more precise. As of my most recent testing just now, it seems to be limitations inside towns...

1. In some cases, yes I want to have an NPC and his party join my party - so I understand that the easy way is to do that directly - I had not thought of that approach - thanks.

2. I would like to have an NPC similar to a tavern keeper - in that the party could obtain troops from this NPC, and in fact, I would like them to be able to exchange troops - exactly the way the "change_screen_exchange_members" works on the world map (I don't want to have to use the tavernkeeper code that would charge for the troops) - so by talking to this NPC - you could exchange troops with him.

It is not required that he be able to join the party - but having that option too would be nice (I believe that ATM I can do all of #2 here on the world map - but apparently not as easily indoors).

3. I would like to be able to define a party - some troops lead by an NPC - and have it spawn on the map - and use certain behaviors and perhaps missions. I have not spent much time looking at this yet - but as you said, use the tempate and spawn them - so I am fairly comfortable that I can probably figure it out.

4. Identical to #3 except that NPC can join your group (along with whatever troops). I bet there is something different I need to do to make THAT work.

5. Be able to give an NPC and his group a Mission.. Well Never Mind, LOL, that's enough for now I think. *grin*

As I said, it now looks as if the exchange members only works on the world map - so that makes #2 much more difficult.

If there is another approach I can use for #2 I would be interested - and is #4 possible?

many thanks

DE
 
Deus Ex said:
2. I would like to have an NPC similar to a tavern keeper - in that the party could obtain troops from this NPC, and in fact, I would like them to be able to exchange troops - exactly the way the "change_screen_exchange_members" works on the world map (I don't want to have to use the tavernkeeper code that would charge for the troops) - so by talking to this NPC - you could exchange troops with him.
If you can't use exchange_members inside, then it's not currently possible. The tavernkeeper's screen is actually a completely different one (screen_buy_mercenaries as opposed to screen_exchange_members).

3. I would like to be able to define a party - some troops lead by an NPC - and have it spawn on the map - and use certain behaviors and perhaps missions. I have not spent much time looking at this yet - but as you said, use the tempate and spawn them - so I am fairly comfortable that I can probably figure it out.
Like I said, you can do this with party templates. You set an AI behaviour for a party upon spawning, so within the limits of the behaviours provided, you're good.

4. Identical to #3 except that NPC can join your group (along with whatever troops). I bet there is something different I need to do to make THAT work.
This is easy, just make a conversation which ends in a party_join operation. That's what party_join is for.

5. Be able to give an NPC and his group a Mission.. Well Never Mind, LOL, that's enough for now I think. *grin*
Don't want much, do you? :wink:

As I said, it now looks as if the exchange members only works on the world map - so that makes #2 much more difficult.

If there is another approach I can use for #2 I would be interested - and is #4 possible?

many thanks

DE
Glad to help.

Interlinearly,
Winter
 
Back
Top Bottom