Animations that can play while an agent is moving

Users who are viewing this thread

dstemmer

Knight at Arms
Simple question, how do I make an animation that will 'lock' the upper body in place but allow an agent to walk, similar to any of the weapon ready swing animations? The difference would be that I would want to trigger the animation for a certain fixed amount of time, instead of it being triggered by a the player swinging the weapon.
 
When called continiously, agent_set_walk_forward_animation does not block your movement like agent_set_animation does, but does not fix your upper body either. When you hit forward key, you can see glimpses of animation kicking in, but those are just glimpses

Maybe playing with acf flags can move us in the needed direction, I'm not knowledgeable enough about those, and there are no explanations in header_animations :sad:
 
Have you tried calling agent_set_walk_forward_animation just once, instead of continuously? Because agent_set_stand_animation only needs to be called once.
 
yeah, you only have to call agent_set_walk_forward_animation once.  I recently added it for the droids in my mod so they don't move up/down while walking around town.  This is the code I currently use and it works great.

module_animations.py
Code:
["droid_walk_forward", acf_enforce_lowerbody,		#from walk_forward
   #[1.0, "man_walk", 0, 32, arf_use_walk_progress|arf_cyclic|blend_in_walk|arf_make_walk_sound,pack2f(0.4,0.9), (0, 0, 0), 0.0],
   [1.0, "man_walk", 0, 1, arf_use_walk_progress|arf_cyclic|blend_in_walk,pack2f(0.0,0.0), (0, 0, 0), 0.0],
 ],

module_mission_templates.py
Code:
#SW - fix_droid_walking
common_fix_droid_walking = (ti_on_agent_spawn, 0, 0, [],
	[
		(store_trigger_param_1, ":cur_agent"),
		(try_begin),
			(agent_is_alive,":cur_agent"),
			(agent_is_human,":cur_agent"),
			(this_or_next|agent_has_item_equipped,":cur_agent","itm_r2series_blue"),
			(this_or_next|agent_has_item_equipped,":cur_agent","itm_r2series_green"),
			(this_or_next|agent_has_item_equipped,":cur_agent","itm_r2series_orange"),
			(this_or_next|agent_has_item_equipped,":cur_agent","itm_r2series_purple"),
			(this_or_next|agent_has_item_equipped,":cur_agent","itm_lin_droid_armor"),
			(this_or_next|agent_has_item_equipped,":cur_agent","itm_lin_droid_armor_w_arm"),
			(this_or_next|agent_has_item_equipped,":cur_agent","itm_mse6_armor"),
			(this_or_next|agent_has_item_equipped,":cur_agent","itm_power_droid_grey"),
			(this_or_next|agent_has_item_equipped,":cur_agent","itm_power_droid_snow"),
			(agent_has_item_equipped,":cur_agent","itm_power_droid_tan"),
			#(display_message, "@its a droid, setting agent to use anim_droid_walk_forward..."),
			(agent_set_walk_forward_animation, ":cur_agent", "anim_droid_walk_forward"),	#make these agents use a different walking animation
		(try_end),
	])
 
HokieBT said:
yeah, you only have to call agent_set_walk_forward_animation once.  I recently added it for the droids in my mod so they don't move up/down while walking around town.  This is the code I currently use and it works great.
It should be working fine for npc agents, no surprise. Just like walkers in town have their walking anim recieved only once.
But alas it is working differently for a player character, who receives cursor input commands now and then, and hence what you tell him with agent_set_walk_forward_animation seems to be overriden quite quickly :sad:
 
Maybe you can trigger the agent_set_walk_forward_animation whenever the player presses a key that would disrupt his movement.
I don't use these codes for my custom skeletons' animations, an easier way is to just give the agents using those skeletons weapons with their own animation, and change the animations for those weapons to work with the skeletons.
It works perfect in modern/future mods with firearms as a base, but if you're making a medieval mod, then I can't help you.
 
I don't need it to work for the player character though, I just need it to work for NPCs.  :grin:

Thanks HokieBT for the code and the info about agent_set_walk_forward_animation.

Let me try and understand what you are doing. You change the animation to be only one frame, so the droids don't move up and down. That's interesting, but not quite what I need. I want to have an NPC move around with their hands in the air, as if they'd been taken hostage. The upward polearm parry looks quite nice for this, but if I just make a 10 second or whatever animation of that, it locks the NPC in place and they can't move.

If it's not possible to get a fixed-time animation to play that will leave the feet free to move, I have to edit an animation in OpenBRF for running with the hands in the air...right? And does that mean I have to replace an existing animation? I was under the impression that you can't add new animations to the game.

Related question: if it's not possible to add a new animation to the game, though, is it possible to append to the end of an existing animation? So for example frames 0-32 of man_walk would be regular walking, and 32-64 would be man_walk with arms in the air?
 
dstemmer said:
If it's not possible to get a fixed-time animation to play that will leave the feet free to move...
you make target agent do that anim every 0.01s for a while, it will look like he keeps doing 1 movement.
 
dstemmer said:
If it's not possible to get a fixed-time animation to play that will leave the feet free to move, I have to edit an animation in OpenBRF for running with the hands in the air...right? And does that mean I have to replace an existing animation? I was under the impression that you can't add new animations to the game.
Ahh, npcs... :smile:
It's perfectly possible to add new animations, just write it's definition in one of the empty slots after human animations, give it unique text ID and flags like in Hokie's code, and you can reference it just fine in MS. Definition of animation includes beginning & ending frames, so leave only those frames from upward_polearm_parry that have hands in the air, and play anim with agent_set_walk_forward_animation when spawning a hostage. Might work.
 
edit: well these guys beat me to it, but I'm posting anyway...  :wink:

there is a max number of animations in the game, but you can just comment out one of the unused animations for the human or player and replace it with your own.  Make sure you comment out one for every one you add, because once I forgot to and the horse animation started using the last human animation or something like that...

Code:
 ["unused_human_anim_80", 0, [1.0, "anim_human", 0, 1, 0]],
 ["unused_human_anim_81", 0, [1.0, "anim_human", 0, 1, 0]],
# ["unused_human_anim_82", 0, [1.0, "anim_human", 0, 1, 0]],		#had to comment out for droid_walk_forward

You should just be able to copy the walk_forward and create a new one.  I made mine the same animation length and used the same flags, since I didn't know if the native game assumed a certain length, etc.  So something like this should probably work and would just be the 1 frame with both hands in the air.

Code:
 ["walk_forward_prisoner", acf_enforce_lowerbody,
#   [1.0, "man_walk", 0, 32, arf_use_walk_progress|arf_cyclic|blend_in_walk|arf_make_walk_sound,pack2f(0.4,0.9), (0, 0, 0), 0.0],	#original walk_forward
    [1.0, "anim_human", defend+2130, defend+2130, arf_use_walk_progress|arf_cyclic|blend_in_walk|arf_make_walk_sound,pack2f(0.4,0.9), (0, 0, 0), 0.0],	#from defend_up_staff_parry
 ],

You may also want to run agent_set_speed_limit so you force them to walk slow, instead of running around.
Code:
(agent_set_speed_limit, ":agent_no", 5),
 
I'm sorry for being unclear. I know how to edit module_animations.py, I've done it many times before. I know how to replaced the unused human animations. The question was whether I can add a new animation to the game using OpenBRF, so that instead of, for example, using "anim_man_walk" as the base of my animation, I could use "anim_walk_forward_hostage" or whatever, or whether I would have to overwrite an existing game animation.

HokieBT, I'll try out that code. I have a sneaky suspicion, though, that using the anim_human animation is just going to cause the NPC to slide forward with their hands in the air, without moving their feet. I can't test it right now, though.
 
yeah, you can use OpenBRF to import animations that you can add to the game.  We've only create a few new ones for the star wars mod, but its definitely possible.  We created a sitting animation and used agent_set_stand_animation to make them sit while in the tavern, etc.
 
Back
Top Bottom