Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Caba`drin said:
So, here's the part where I must be missing something obvious again.
Is there a trick to getting agent_set_animation to set the animation for the player in SP?

I've been trying the following mission template trigger:
Code:
  (0, 0, 1, [(key_clicked, key_z)], [
       (get_player_agent_no, ":agent"),
       (try_begin),
          (agent_slot_eq, ":agent", slot_agent_crouch, 0),
          (agent_get_horse, ":horse", ":agent"),
          (le, ":horse", 0),
          (display_message,"@crouch key pressed (begin)."),
          (agent_set_slot, ":agent", slot_agent_crouch, 1),
          (agent_set_animation, ":agent", "anim_stand_to_crouch"),
          (agent_set_walk_forward_animation,":agent","anim_walk_forward_crouch"),
       (else_try),
          (agent_slot_eq, ":agent", slot_agent_crouch, 1),
          (display_message,"@crouch key pressed (end)."),
          (agent_set_slot, ":agent", slot_agent_crouch, 0),
          (agent_set_animation, ":agent", "anim_crouch_to_stand", 1),
          (agent_set_walk_forward_animation,":agent","anim_run_forward"),   
       (try_end),
  ]),
to try and get a feel for what the Native crouch animation looks like/functions like in-game. (You can only guess so much staring at a checker-board OpenBRF figure going through the motions.) But...it doesn't do a dang thing. Sure, the debug text shows up and the slots are getting set appropriately, but the animations do not change. (And from watching OpenBRF, certainly those animations have frames and such.)

Any idea what gives?

I tried so many times before to enable low walk animation, and I failed. My code 's similar to yours. I tried to modify animation's flags on module_animations.py but as far as I can go is my character stay down after I press the crouch key. And get up again when I press it again, but the character can't move/walk in crouching mode.
 
:???: While it is good to hear I haven't missed the obvious...I was hoping I had missed the obvious.

dunde said:
I tried so many times before to enable low walk animation, and I failed. My code 's similar to yours. I tried to modify animation's flags on module_animations.py but as far as I can go is my character stay down after I press the crouch key. And get up again when I press it again, but the character can't move/walk in crouching mode.
This is farther than I have gotten. If you have the code where you achieved this, would you mind posting it? I plan on monkeying with it more, but a jump start is always appreciated.
 
Caba`drin said:
:???: While it is good to hear I haven't missed the obvious...I was hoping I had missed the obvious.

dunde said:
I tried so many times before to enable low walk animation, and I failed. My code 's similar to yours. I tried to modify animation's flags on module_animations.py but as far as I can go is my character stay down after I press the crouch key. And get up again when I press it again, but the character can't move/walk in crouching mode.
This is farther than I have gotten. If you have the code where you achieved this, would you mind posting it? I plan on monkeying with it more, but a jump start is always appreciated.

What I did:
module_animations: (these aren't the native ones, newly added to bottom)
Code:
 ["start_crouch", acf_enforce_lowerbody, amf_priority_kick|amf_client_prediction|amf_continue_to_next, 
   [1.0, "crouch_down", 0, 81,  arf_blend_in_1],
 ],
 ["cont_crouch", acf_enforce_lowerbody, amf_priority_kick|amf_client_prediction|amf_keep, 
   [1.0, "crouch_down", 82, 153,  arf_blend_in_3|arf_cyclic],
 ],
 ["end_crouch", acf_enforce_lowerbody, amf_priority_kick|amf_client_prediction,
   [1.0, "crouch_down", 154, 185,  arf_blend_in_1],
 ],
I think the "amf_priority_kick|amf_client_prediction" flags are necessary for them to work.

Your other code should be alright,
if not, here's what I used:
Code:
(ti_before_mission_start, 0, 0,	[], #initialize
	[
		(assign, "$crouching", 0),
	]),
	(0, 0, 1,
	[
	(neg|conversation_screen_is_active),
	(key_is_down, key_left_control),
	(eq, "$crouching", 0),
	],
	[
		#(display_message, "@jeng"),
		(get_player_agent_no, ":player_agent"),
		(agent_is_alive, ":player_agent"),	
		(agent_set_animation, ":player_agent", "anim_start_crouch"),	#play a 1 second crouch animation
		(assign, "$crouching", 1),
	]),
	(0, 0, 1, [
		(neg|conversation_screen_is_active),
		(neg|key_is_down, key_left_control),
		(eq, "$crouching", 1),
	],
	[
		(display_message, "@UP"),
		(get_player_agent_no, ":player_agent"), 
		(agent_set_animation, ":player_agent", "anim_end_crouch"),
		(assign, "$crouching", 0),
	]),
    ]
 
here it is my last code before I gave up.
Code:
player_crouch = (0, 0, 2, [(key_clicked, key_z)],
  [(try_begin),     
     (get_player_agent_no, ":player_agent"),
     (agent_get_horse, ":horse", ":player_agent"),
     (le, ":horse", 0),
     (eq,"$g_in_crouch",0),
     (display_message,"@crouch key pressed (begin)."),
     (assign,"$g_in_crouch",1),     
     (agent_set_animation,":player_agent", "anim_stand_to_crouch"),               
     (agent_set_walk_forward_animation, ":player_agent", "anim_walk_forward_crouch"),
   (else_try),
     (eq,"$g_in_crouch",1),
     (display_message,"@crouch key pressed (end)."),
     (assign,"$g_in_crouch",0),
     (agent_set_animation,":player_agent", "anim_crouch_to_stand"),
     (agent_set_walk_forward_animation, ":player_agent", "anim_run_forward"),
   (try_end), ])


Code:
 ["walk_forward_crouch", acf_enforce_lowerbody, 0,
  [1.7, "low_walk", 0, 48, arf_use_walk_progress|arf_cyclic|arf_make_walk_sound,pack2f(0.4,0.9), (0, 0, 0), 0.4], 
 ],
 ["stand_to_crouch", acf_enforce_lowerbody, amf_priority_kick|amf_client_prediction|amf_keep,
   [1.0, "crouch_down", 0, 81,  arf_blend_in_1, 0, (0.0,0,0.0)],
 ],
 ["crouch_to_stand", acf_enforce_lowerbody, amf_priority_kick|amf_client_prediction|amf_play,
   [1.0, "crouch_down", 154, 185, arf_blend_in_1, 0, (0.0,0,0.0)],
],

If I use amf_keep for "anim_stand_to_crouch" the character will stay down. He can attack with his weapon, even range weapon, but he can't walk.
If I use amf_play then the character will get up again.
agent_set_walk_forward_animation operation 's failed.

My desperated trial, adding 2nd trigger 's failed too:
Code:
player_crouching = (0, 0, 0, [(eq,"$g_in_crouch",1),], [(get_player_agent_no, ":player_agent"), (agent_set_walk_forward_animation, ":player_agent", "anim_walk_forward_crouch"),])   

 
mr.master said:
Friggin awesome. And yes, I would be interested on knowing of getting the walk while crouch working too D:

Maybe the creator of the video will share it.  Too bad no one knows who he is.  :wink:

 
Thanks to dunde and SonKidd for posting the code...making progress. I'll post whatever I find if it works.

But seeing that video makes me shake my internet fist. All this remaking the wheel business is silly.
There's a method to my open source WB, SP, Code madness I tell you.

[me=Caba]goes back to chipping away at a large piece of stone wondering "what if I take these corners off and smooth it out a bit?" * [/me]
 
agent_set_walk_forward_animation won't do. You can't prevent the player from running.
Your only chance is using the displace position flag.
 
Highlander said:
agent_set_walk_forward_animation won't do. You can't prevent the player from running.
Your only chance is using the displace position flag.

That's not completely true. It's a little hacky, but you can use agent_set_attached_scene_prop and have a thin, walk-only scene prop follow you around just above the ground in crouch mode.
 
How could i make a bullet for a pistol that heals the one it hits, regardless of Enemy or Ally? The healing thing would be no problem, but to find out who was hit... How can i do that?

edit: and how does the "spawn_scene_prop" command work? It only wants an ID for the scene Prop, no position?
 
Patta said:
How could i make a bullet for a pistol that heals the one it hits, regardless of Enemy or Ally? The healing thing would be no problem, but to find out who was hit... How can i do that?
Hi Patta. You can use that trigger for the pistol in module_items.py.
Code:
ti_on_missile_hit        = -52.0 #can only be used in module_items triggers
# Position Register 1: Missile Position
# Trigger Param 1: shooter agent id

Anyone have idea why the hell I always get ZERO when I call this server-side on the existing item?
Code:
(item_get_slot, ":num_item_price", ":item_id", slot_item_base_price),
 
Patta said:
OK, then my only remaining problem is getting the agent that is hit... (It's Multiplayer, if that matters)
Then use ti_on_agent_hit and on event handler check if reg0 is the pistol:
Code:
ti_on_agent_hit          = -28.0 #can only be used in module_mission_templates triggers
# Trigger Param 1: damage inflicted agent_id
# Trigger Param 2: damage dealer agent_id
# Trigger Param 3: inflicted damage
# Register 0: damage dealer item_id
 
Lord British said:
Anyone have idea why the hell I always get ZERO when I call this server-side on the existing item?
Code:
(item_get_slot, ":num_item_price", ":item_id", slot_item_base_price),
Because the price slots are not set in multiplayer.
Those slots are set in the "initialize_item_info" script, which is only called in the script "game_start"...which is only run at the beginning of single player games.
 
Lord British said:
Anyone have idea why the hell I always get ZERO when I call this server-side on the existing item?
Code:
(item_get_slot, ":num_item_price", ":item_id", slot_item_base_price),
Fairly certain that slot is only used for singleplayer goods. Use (store_item_value, ":num_item_price", ":item_id"), instead. There are no factional price modifiers in use in Native multiplayer, nor are there any item modifiers to deal with.
 
Status
Not open for further replies.
Back
Top Bottom