Agent Spawning OSP WIP

Users who are viewing this thread

Agent Spawning OSP

This post is to show the progress I have made on my OSP and to hopefully get some additional help with some aspects.

The OSP allows users to place a Scene Prop that spawns an agent, by changing the scene props parameters you can,
Choose an Agent/Agents
Assign an Animation
And give them an item to wield/wear.

The OSP is contained to the scene props file so adding it to an existing mod is easy.

LCc3H2Z.jpg

This is an example of how you assign the parameters,

Var No: = Conditions = 2 = Only at Night

Scale X = Agent = 100 = sarranid_footman

Scale Y = Animation = 448 = pose_1

Scale Z = Item = 339 = sarranid_warrior_cap


How Conditions work
0- Always
1- Day
2- Night
3- Tournament (Only when joinable)
4- Siege (When under siege not the battle)
5- Feast
6- Low Prosperity (0-25)
7- High Prosperity (75-100)
8- Early (0-12)
9- Late (12-24)

You can assign 2 conditions in Var No: by simply assigning a second number, example.
26, 2 = Night and 6 = Low Prosperity, so you could have peasants sleeping in poor towns/villages at night.
or
27, 2 = Night and 7 = High Prosperity, so you could have guards with torches at night in rich towns/villages.

The combination system also allows you to break the day into 4,
28, 2= Night and 8 = Early, so the hours between 0-6
18, 1= Day and 8 = Early, so the hours between 6-12
19, 1= Day and 9 = Late, so the hours between 12-18
29, 2= Night and 9 = Late, so the hours between 18-24

The combinations are from 0-99 leaving 100-127 free for custom uses (hopefully to reference mission templates and quests)

Each scale also has a variable slot to have further control,

1.080100 the highlighted 0100 is where you assign the variable of choice for agent, animation and item.
1.080100 the highlighted 8 is for extra features related to the variable.
For instance 8 in this case will spawn 5 agents in a line to the right,
and 1.090100 will spawn 5 agents in a line behind.




Example of a non empty castle
GQa3lGS.jpg

A Sergeant addressing new recruits

lzVtdil.jpg

Crossbow Training

EIEji7Z.jpg

Recruits watching the training

XXPbLYW.jpg

Scouts returning, melee training in the back

AS3fTeB.jpg

Civilians talking

pppDI0x.jpg

Crossbowmen watch the pass

0mINShl.jpg

A belligerent drunk


Animations example using Slawomir of Aaarrghh tavern animation pack.
xtQlrXo.jpg

Two Soldiers sitting in the shade.

YKjGy8p.jpg

3 soldiers using the wedding animations, and a guy in the back using the staff defend up animation.

doddaho.jpg

All the different factions prison guards sitting together.


Conditions example for a Tournament.
FWDcDaw.jpg

Cbf8dz5.jpg


Extra crowds at the arena


9z69k4B.jpg


Some town Ladies admire the red teams Champion Fighter. (bodyguard on duty)

wQNnhpt.jpg


Some Blue team members checking out Sargoths wares.

4miZW7s.jpg


Green team fans meet up before the tournament

wXmpFC2.jpg


Waiting to get in the Arena, extra guards on duty for the event.


What I need help with/ have not yet implimented.
Using the agent Variable I wish to be able to duplicate or move the agent at an entry point, however I have come up short in referencing the agent at the position.

Also Using the agent Variable I'd like to spawn from the garrison so soldiers on the wall reflect the actual garrison.

Reference the mission template, I'd like to know what mission template is being used for additional conditions 100-127

Assign behaviours/override flags, mounted units spawn with horses and lords spawn with full armour, I'd like to be able to choose how they appear/ how they act (agents walking around castles)

Disable Talking / Assign conversation, Agents sometimes say out of context things so changing or disabling the conversation would be nice.

Stop agents from turning to face you, this sometimes breaks the animation as they turn/ can lead to clipping and oddities as the turn and change angle.

Set the frame of the scene prop, this way you can easily Identify the conditions of that scene prop.

And lastly and most importantly, lots of looping animations (if the animation doesn't loop and the agent is set to wield an item they play the animation once and revert to a normal pose)




Special Mention for helpers so far.
Lav
Somebody
Fire_and_Blood
Ikaguia
The_dragon




 
ShaunRemo said:
Using the agent Variable I wish to be able to duplicate or move the agent at an entry point, however I have come up short in referencing the agent at the position.

Can't help you here.

Also Using the agent Variable I'd like to spawn from the garrison so soldiers on the wall reflect the actual garrison.

Could be done in module system. Maybe could scan the garrison and force the prop to use agents currently in-garrison.

Reference the mission template, I'd like to know what mission template is being used for additional conditions 100-127

Make a separate Spawn_Agent prop for each. Ex. Spawn_Agent_Battle, Spawn_Agent_Town, Spawn_Agent_Village, etc.

Assign behaviours/override flags, mounted units spawn with horses and lords spawn with full armour, I'd like to be able to choose how they appear/ how they act (agents walking around castles)

It probably can be done, but I don't know. You could script the agent to act a certain way, not the prop.

Disable Talking / Assign conversation, Agents sometimes say out of context things so changing or disabling the conversation would be nice.


That could be done in the module system as well. There is a command in the mission templates to disable dialogue.


Stop agents from turning to face you, this sometimes breaks the animation as they turn/ can lead to clipping and oddities as the turn and change angle.

Unfortunately I heard this is impossible due to engine limits.  :sad:


Set the frame of the scene prop, this way you can easily Identify the conditions of that scene prop.

?

And lastly and most importantly, lots of looping animations (if the animation doesn't loop and the agent is set to wield an item they play the animation once and revert to a normal pose)

I'm sure the community will help you out  :grin:
 
ShaunRemo said:
Using the agent Variable I wish to be able to duplicate or move the agent at an entry point, however I have come up short in referencing the agent at the position.

Didn't quite understand what you meant, but you could always set a agent_slot when spawning for later referencing

Also Using the agent Variable I'd like to spawn from the garrison so soldiers on the wall reflect the actual garrison.

Could be done in module system. Maybe could scan the garrison and force the prop to use agents currently in-garrison.

Reference the mission template, I'd like to know what mission template is being used for additional conditions 100-127

Make a separate Spawn_Agent prop for each. Ex. Spawn_Agent_Battle, Spawn_Agent_Town, Spawn_Agent_Village, etc.  or just make a new trigger to run at first frame setting a global variable.
Assign behaviours/override flags, mounted units spawn with horses and lords spawn with full armour, I'd like to be able to choose how they appear/ how they act (agents walking around castles)

making them spawn with the armour would be easy with agent_equip_item operations and making them walk around you could set a agent slot and then add a check for that in the town_walkers scripts. to start mounted with a horse would be harder I think, cause there is no agent_mount_horse operation or sth similar, maybe if you add an item before spawning it might work.
Disable Talking / Assign conversation, Agents sometimes say out of context things so changing or disabling the conversation would be nice.

That could be done in the module system as well. There is a command in the mission templates to disable dialogue.

Stop agents from turning to face you, this sometimes breaks the animation as they turn/ can lead to clipping and oddities as the turn and change angle.

dunno about this, I guess if the dialogues were disabled...

Set the frame of the scene prop, this way you can easily Identify the conditions of that scene prop.

?

And lastly and most importantly, lots of looping animations (if the animation doesn't loop and the agent is set to wield an item they play the animation once and revert to a normal pose)

using sth like agent_set_slot, slot_agent_loop_animation and agent_set_slot, slot_agent_loop_anim_times then checking it in mission templates?
 
To clarify a few things,
referencing an agent at a scene point:
The tavern keeper always spawns at the same entry point, just say entry point 7, I'd like to be able to move the tavern keep to the spawn agent scene prop and can then assign items/animations as well as conditions. This way the tavern keeper appears to be actually doing something, so in the morning he can sweep, in the afternoon he can cook and at night he pours drinks. But! I need to be able to his agent_ID to move him where I want.

So I need to be able to reference the agent at an entry point.

Referencing the current mission template:
I simply want to check the current mission, is it a battle? Is it a prison break? Each mission template is numbered for easy reference.

Stoping an agent from turning: the archers in the tutorial do not turn to face you if you are close or even talking to them, so it's hopefully possible, looking into how they did that now.

Setting the frame of a scene prop, in BRF you can assign frames, frame 1 the scene prop might be red and frame 2 the scene prop might be green, however I can't seem to be able to set the scene props frame, the Idea is that the scene prop shows one of the conditions as an icon, therefore making it easier for the user to identify the spawn agent scene props conditions.
 
How about you move entry_point 7 to where you want it to be?

It could be something like this in module_mission_templates:
      (ti_before_mission_start, 0, 0, [], [
      (try_begin),
            (your check if it's morning goes here),
        (scene_prop_get_instance, ":tavern_keeper", "spr_tavern_keeper_morning", 0),
      (else_try),
            (scene_prop_get_instance, ":tavern_keeper", "spr_tavern_keeper_day", 0),
      (try_end),
        (prop_instance_get_position, pos0, ":tavern_keeper"),
        (entry_point_set_position, 7, pos0),
      ]),

You'd have to add the bolded scene_props to the scene and then depending on the conditions, entry_point 7 gets moved to one or the other position.
 
Nice project. Similar way to add more agents to the scenes is used in the upcoming DLC, although I prefer more scene props - each one for spawning different kind of agents and playing different kind of animations - and less number-based stuff  (since with your approach once you change your mod's troop or item order, you have to also edit the scenes and change values in scene props).

Anyway, some hints from me:
The tavern keeper always spawns at the same entry point,

Just check agent's troop ID on spawn and if he is a tavernkeeper, then do whatever you want with him - teleport him to different position, add items or animations, whatever. It's quite simple. Just a trigger to "town_default" mission template and you're good to go...

I simply want to check the current mission, is it a battle? Is it a prison break? Each mission template is numbered for easy reference.

Like Ikaguia wrote, easiest way (but boring, since you'll have to edit all missions) to do this is to assign a global value on "ti_before_mission_start", just like it's done in multiplayer missions and then just check that global.


Assign behaviours/override flags, mounted units spawn with horses and lords spawn with full armour, I'd like to be able to choose how they appear/ how they act (agents walking around castles)

Be aware - troops that have horses in their inventory will most probably spawn with their horse, even if you don't want them to. :wink:

Disable Talking / Assign conversation, Agents sometimes say out of context things so changing or disabling the conversation would be nice.

You can't disable conversation for single agents in scene (at least from what I know), but you can add a "fake" dialogue, for example player saying "I don't want to disturb that person" or something like that - check my animations OSP code, I believe such "dialogues" are there.

To easy assign a custom dialogues to spawned agents you can use new agents slots. Just assign a value to that slot on agent spawning and check that slot in dialogue conditions.

Additional agent slots will also help you organize your agents so that, for example, spawned townfolks won't be affected by walker scripts, or spawned military units won't be acting and talking like regular town guards...

Stop agents from turning to face you, this sometimes breaks the animation as they turn/ can lead to clipping and oddities as the turn and change angle.

Just wait for new patch. There should be special operation for that.

Set the frame of the scene prop, this way you can easily Identify the conditions of that scene prop.

Again, wait for new patch - there are few new operations to handle prop vertex animations.


Also, make sure that if you spawn agents with "spawn_agent" operation you'll assign them a proper team. By default they spawn at team 0 wich can lead to many unwanted bugs later. Normal townfolks are usually team 7, so if you don't want your newly spawned agents to mess up some native scripts, make sure their team matches other "neutral" agents in the scene.
 
Amazing, would really add a whole ton of life into scenes.

Although, I do agree with Slawomir on this point:
Slawomir of Aaarrghh said:
although I prefer more scene props - each one for spawning different kind of agents and playing different kind of animations - and less number-based stuff
I can imagine that individually going through every entry point and writing the exact variables each time would get old fast. :lol:
 
I have found and will implement some simple code for easy reference/constant conditions to spawn an agent found here.
 
slot_faction_tier_1_troop
slot_faction_tier_2_troop
slot_faction_tier_3_troop
slot_faction_tier_4_troop
slot_faction_tier_5_troop
slot_faction_leader
slot_faction_town_walker_male_troop
slot_faction_town_walker_female_troop
slot_faction_village_walker_male_troop
slot_faction_village_walker_female_troop
slot_faction_town_spy_male_troop
slot_faction_town_spy_female_troop
slot_faction_deserter_troop
slot_faction_guard_troop
slot_faction_messenger_troop
slot_faction_prison_guard_troop
slot_faction_castle_guard_troop

This way you can easily add agents without looking up the specific agent ID and won't have to change them all if the troop file is changed.

The problem with checking the troop ID of an agent you want to move is knowing the troop ID, the tavern keep was an example, if you wanted tavern visitor to sit instead of stand you'd have to guess their troop ID.

I'd rather not even touch the mission template file at all at all just for ease of use to implement the OSP to existing mods, I'd also like to just have a single scene prop to spawn agents at this point, once you start using it it becomes fairly simple get the agents you want to do the animation you want.

Besides once the OSP has been released people can tinker/easily modify the code for separate scene props that do specific things.
 
Hey Ruthven I will impliment the ability to spawn dead agents, not sure if they would play a death animation or just straight to ragdoll, I will test this later.

Moving and duplicating agents at the entry point of choice is "working" however the script in the Spawn_Agent scene prop is firing before any agents in the scene are added, so I will have to change the trigger in the scene until after the agents spawn. But at least the theory is working properly.

Edit: the spawned agent by default is on team -1 this team is neutral and recieves no damage however I plan to have ability to choose the team despite the inconsistent use of team numbers.
 
Back
Top Bottom