I'm really new to the whole module system thing, could you please explain it some more?xenoargh said:You may assign them to group 4, yes, either through troop_set_class or agent_set_division.
It's for a multiplayer mod, so setting it ingame is not an option.Caba`drin said:If you are talking just when you are playing, you do both through the Party Screen.
By code, and if you want it to apply always and to all parties, I'd recommend using troop_set_class somewhere outside of mission templates, for two reasons: first, troop_set_class will not affect agents already spawned within a mission template, and second, agent_set_division is a buggy/temperamental operation and agents whose divisions are changed dynamically with that operation will revert to their troop-class-based division any time that base division is given an order.
In order to maintain divisions changed by agent_set_division, you need to set an agent slot for each agent you change divisions and then use another trigger to check that slot and change the division back periodically.
Also, if we are talking through code, use (class_set_name, <sub_class>, <string_id>), to rename the class.
And a final, related note to remember: any time you adjust the division/class of a troop either in the party screen or by code, that class-assignment will apply to ALL agents based on that troop template, regardless of whether or not they belong to the player's party. This could cause problems with any more advanced AIs expecting agents to be in the three basic divisions, or certain types of troops to be in their basic division.
script_game_start would mean it would only apply to SP, right?xenoargh said:Well, you'd have to do something like:
(troop_set_class, "trp_my_nifty_guy", 4),
To set a given troop to class 4. Suggestion; do it as a script called during script_game_start in module_scripts, to get it done.
I do not know what happens if troop class assignments are changed by players during play; my guess is that changes that class assignment (in that savegame) permanently, and will affect things like AI usage of said troop. For AI purposes, using agent_set_division is quite a lot safer, if a wee bit more complicated to implement.
Basically, depending on what you want to do, this can be either something easy to learn Module System with, or a fairly complicated gamecode project. If you just want the Companions assigned to group 4, that's pretty easy.
Aye, it should fetch the guarantee_horse/ranged-set grc_infantry, grc_archers, grc_cavalry of the troop.Somebody said:agent_get_class is similar to agent_get_division except it fetches the original troop class?
Exactly. Whatever the player sets in the Party Window is like calling a troop_set_class operation for that troop type. As it changes the troop class, it will affect all agents spawned of that troop ID, regardless of party.xenoargh said:I do not know what happens if troop class assignments are changed by players during play; my guess is that changes that class assignment (in that savegame) permanently, and will affect things like AI usage of said troop. For AI purposes, using agent_set_division is quite a lot safer, if a wee bit more complicated to implement.
(ti_on_agent_spawn, 0, 0, [],
#This is called after agent_reassign_team, so can safely assume correct team is set
[(store_trigger_param_1, ":agent"),
(agent_set_slot, ":agent", slot_agent_new_division, -1),
(get_player_agent_no, ":player"),
(ge, ":player", 0),
(agent_is_human, ":agent"),
(agent_get_team, ":player_team", ":player"),
(agent_get_team, ":team", ":agent"),
(neq, ":team", ":player_team"),
(agent_get_troop_id, ":troop", ":agent"),
(try_begin),
(troop_is_guarantee_horse, ":troop"),
(assign, ":target_division", grc_cavalry),
(else_try),
(troop_is_guarantee_ranged, ":troop"),
(assign, ":target_division", grc_archers),
(else_try),
(assign, ":target_division", grc_infantry),
(try_end),
(agent_get_division, ":division", ":agent"),
(neq, ":division", ":target_division"),
(agent_set_division, ":agent", ":target_division"),
(agent_set_slot, ":agent", slot_agent_new_division, ":target_division"),
]),
(0.5, 0, 0, [(store_mission_timer_a, reg0),(gt, reg0, 4)],
[
(try_for_agents, ":agent"),
(agent_is_alive, ":agent"),
(agent_slot_ge, ":agent", slot_agent_new_division, 0),
(agent_get_division, ":division", ":agent"),
(neg|agent_slot_eq, ":agent", slot_agent_new_division, ":division"),
(agent_get_slot, ":new_div", ":agent", slot_agent_new_division),
(agent_set_division, ":agent", ":new_div"),
(try_end),
]),
This is definitely a multiplayer issue; I can't give any more information than that I know this doesn't happen in SP. Perhaps only the core 3 divisions work in MP?Scarf Ace said:OK, so xenoargh's solution has worked for the purposes I need. Thanks!
My problem now is that troops that have been assigned to one of the "unnamed" keys aren't selectable at all (not even when selecting everyone). The unnamed keys don't even make the player say "X, hear me!". I can change that somehow, right?
Is it a multiplayer issue?
That's what I'm thinking. Do you think there could be a way to make the other divisions work?Caba`drin said:This is definitely a multiplayer issue; I can't give any more information than that I know this doesn't happen in SP. Perhaps only the core 3 divisions work in MP?Scarf Ace said:OK, so xenoargh's solution has worked for the purposes I need. Thanks!
My problem now is that troops that have been assigned to one of the "unnamed" keys aren't selectable at all (not even when selecting everyone). The unnamed keys don't even make the player say "X, hear me!". I can change that somehow, right?
Is it a multiplayer issue?