Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Hallöchen,

i could use some help, i need an agent to stay attached to a scene prop, while he can move only upward/downward.

I could attach the agent to it, i could not move him vertically anymore.
Anyone knows how to lift the agent attached, thus bounden to a position?

Thanks
 
kalarhan said:
KratosMKII said:
Questions:

1. I can't find where the game defines what text will appear when getting close to a door like the prison or castle doors. Where is this located?

2. If a kill a prison guard, then try to get inside the prison, the game teleports me back to outside the town. But this doesn't happen if the rescue prisoner quest is active. How do i make it teleport the player to the prison every time?

1.

Code:
      ("town_arena",
        [....],"Visit the training grounds.",
        [....],"To the training grounds."),

Code:
#  6) List of Menu options (List).
#     Each menu-option record is a tuple containing the following fields:
#   6.1) Menu-option-id (string) used for referencing game-menus in other files.
#        The prefix mno_ is automatically added before each menu-option.
#   6.2) Conditions block (list). This must be a valid operation block. See header_operations.py for reference.
#        The conditions are executed for each menu option to decide whether the option will be shown to the player or not.
#   6.3) Menu-option text (string).
#   6.4) Consequences block (list). This must be a valid operation block. See header_operations.py for reference.
#        The consequences are executed for the menu option that has been selected by the player.
would be item 6.5 -> passage text

2. Passages are related to the game menu item, so check that code and the conditions on it. Native as a example calls script "enter_dungeon".
Check this PDF as it has info on passages https://forums.taleworlds.com/index.php/topic,56798.0.html
Thank you.
 
so people that worked with this kind of thingy can give it a look on your approach.
The thing here, is that i could show you the whole code, but it'll be worthless. I just attached the agent with a key-activated trigger to the scene prop position, and the agent so attached doesn't lift anymore.

So my question was whether would be possible to ascend being attached to the prop, how you would do it. If you were to raise
gradually an agent in front of a prop, what would you use?

I tried with agent_set_scripted_destination, agent_set_position, whenever the scene-prop position is used or even copied to a new
one, he can't be raised anymore.

Scene prop position is pos6, agent's(unused) is pos7, new (copied from pos7) one to transpose is pos8. Mina olen jumissa.

Edit- Issue occurs when pos6 is copied to pos8, prop position can't be referenced at all.
 
What are you trying to achieve in the first place?
You said that you want to move an agent vertically, is the agent climbing up a ladder or standing on some type of an elevator?

You either could lift up an agent which stands on some sort of platform (which has an active collision mesh ofc) and move up that platform, or turn off the agent's dynamics and set it's position manually.
 
Sebastian, du antwortest endlich!
I read many a post of yours, and you seem to know best about agent's displacement, yea i knew about agent's dynamics, i wanted
to forgo underfoot scene props thus trying manually.

Ok, it's for a climbable ladder, code is not only mine so i took the snippet out for testing:

climb_test = (
  0, 0, 0, [(key_is_down, key_numpad_:cool:],
[(scene_prop_get_instance,":ladder", "spr_ladder_test", 0),
  (prop_instance_get_position,pos6,":ladder"),
  (get_player_agent_no,":player"),
  #(agent_get_position, pos7, ":player"),
  (copy_position, pos8, pos6),
  #(position_move_y,pos8,-80),
  (position_move_z,pos8,10),
  (agent_set_no_dynamics,":player",1),
  (agent_set_position,":player",pos:cool:,
  (agent_set_animation, ":player", "anim_climb"), 
])
 
Sir John Hawkwood said:
Ok, it's for a climbable ladder, code is not only mine so i took the snippet out for testing:
climb_test = (
  0, 0, 0, [(key_is_down, key_numpad_:cool:],
[(scene_prop_get_instance,":ladder", "spr_ladder_test", 0),
  (prop_instance_get_position,pos6,":ladder"),
  (get_player_agent_no,":player"),
  #(agent_get_position, pos7, ":player"),
  (copy_position, pos8, pos6),
  #(position_move_y,pos8,-80),
  (position_move_z,pos8,10),
  (agent_set_no_dynamics,":player",1),
  (agent_set_position,":player",pos:cool:,
  (agent_set_animation, ":player", "anim_climb"), 
])
Think twice what your code is doing here.
You get the position of the prop, copy it to another position, then move the copied pos up 10cm... every frame.
The prop will stay at the same position all the time, so you just move the copied pos up 10cm from the initial prop position, thus the agent stays always at the same position.
 
The agent lift, but now he's stuck in mid-air, he can't move higher...i guess it's due to repeating the copy of scene prop position?
I'll have to recheck the trigger.

Thanks

Do you know any other operation to make it better? Did you ever do something with an agent attached to a scene prop? (besides your cannon in BoE)

:grin: Well...i always thought z-axis was returned is meters. Moreover are there some new operations to attach agents to props, like other games? Why there are none, i saw so many asking about scene props attached to agents, and not a thing about the opposite. Please add some operation!

Danke nochmal
 
I already told you the two methods how to lift an agent, so that's it.
You could deal with animations to displace an agent's position (like dismounting, or falling off a horse does), but that's not as dynamic as the other methods.

In general you don't have to copy over positions for that.
Only get the position of the prop once the key is clicked and move the agent to that position and turn off it's dynamics.
From there you only need to move up the agents position frame by frame.
Code:
climb_test = (0, 0, 0, [],
[
	#get the elapsed time between frames, so the climb speed is always the same later on and framerate independent
	(store_mission_timer_a_msec, ":time_ms"),
	(store_sub, ":delta_time", ":time_ms", "$last_frame_time"),#make sure the global variable is defined first somewhere
	(assign, "$last_frame_time", ":time_ms"),

	(get_player_agent_no, ":player"),
	(agent_is_active, ":player"),
	(agent_is_alive, ":player"),

	(try_begin),
		(key_clicked, key_numpad_8),#only fires once you press down a key
		(scene_prop_get_instance, ":ladder", "spr_ladder_test", 0),#wont work with multiple ladders ofc, but for testing its fine
		(prop_instance_get_position, pos0, ":ladder"),
		(agent_set_no_dynamics, ":player", 1),
		(agent_set_position,":player", pos0),
	(try_end),

	#you should limit the climbing height later on, now its infinitely
	(try_begin),
		(key_is_down, key_numpad_8),#fires aslong as the key is pressed
		(agent_get_position, pos0, ":player"),
		(store_div, ":move_z", ":delta_time", 10),#goes up 1 meter per second
		(val_max, ":move_z", 1),#ensure its not hitting zero
		(position_move_z, pos0, ":move_z"),
		(agent_set_position, ":player", pos0),
		(agent_set_animation, ":player", "anim_climb"),
	(else_try),#key released
		(agent_set_no_dynamics, ":player", 0),#back to normal movement
	(try_end),
 ])
 
I already told you the two methods how to lift an agent, so that's it.
I meant also to attach him to scene props...some games (Arma?) have specific operations for this.

Thanks! I've already refined the trigger, but thanks!
Wohlan denn Sebastian, du halfst mich mal, danke sehr.

I hope someone wills to improve the ladders on server, 'cause they're not ladders, but ramps.
How do you stand for random hire requests? Are you available for paid coding commitments?
 
What the hell is wrong with this code? I'm trying to make an equipped weapon slots check and create a dialog option for each bolt bag found.

Code:
 [anyone|plyr|repeat_for_100, "bolt_improvement_start", 
[
  (store_repeat_object, ":object"), # This is the line compiler is referring to
  (try_for_range, ":slot" 0, 3),
   (troop_get_inventory_slot, ":object", "trp_player", ":slot"), 
   (troop_get_inventory_slot_modifier, reg5, "trp_player", ":slot"), 
   (item_get_type, ":item_in_slot_type", ":object"), 
   (eq, ":item_in_slot_type", itp_type_bolts), 
   (neq, reg5, imod_large_bag), 
   (str_clear, s2),
   (str_store_item_name, s2, ":object"),
  (try_end),
 ],
 "{s2}.",
 "bolt_improvement_confirm",
 [
  (store_repeat_object, "$temp"), 
  (item_get_value, ":item_price", "$temp"), 
  (store_mul, reg6, ":item_price", 3), 
  (try_begin),
   (eq, reg5, imod_bent), 
   (store_mul, reg7, ":item_price", 2), 
   (str_clear, s3),
   (str_store_string, s3, "@ Additional cost: {reg7}.") 
  (else_try),
   (str_clear, s3), 
   (assign, reg7, 0),
  (try_end),
  (store_add, "$temp_2", reg6, reg7), 
  (val_add, "$temp_2", 2000),
 ]],

EMYMfFh.png

The default compiler gives me endless wall of errors so I used w.r.e.c.k to figure out what the initial problem is but still.... don't have a single clue. Any ideas?
 
UndeadDuke said:
What the hell is wrong with this code?

try copying that from your source into a simple editor like Notepad (not ++), it seems you have trash (from ctrl+c ctrl+v) in there (characters outside the encode range)


or check your encode configuration (like "utf-8") for the file and/or compiler
Lumos said:
Literally write
Code:
# -*- coding: utf-8 -*-
at the top of the file
 
He,

i would have further questions about anyways, why the z-axys is not returned the same as with x and y?

It's not in cms, everytime i manipulated the z-axys the movement was much greater than the other two, which makes sense, since z-axis is utilized chiefly for coarser height positioning.

Again, there is no plain attach operation in M&B? What if somebody wants to make an agent sitten Flak38-style attached to a scene prop, that is a full depended transposing with the prop, how should he do it?

Ok, forget about the first question, as for attaching an agent to a scene prop, like a Flak38 or whichever static weapon you wish, is it feasible?

Wehe mir, leider!
Nope, as yet it seems not possible to inherit scene prop rotation for an attached agent. I wonder if it were possible with longer scripts, but it doesn't suit my knowledge.

I thought of new animations, but it would be ridiculous.

So no Halo cannon (and Flak3:cool: stance for now folks.
 
Sir John Hawkwood said:
He, i would have further questions about anyways, why the z-axys is not returned the same as with x and y?
It's not in cms, everytime i manipulated the z-axys the movement was much greater than the other two, which makes sense, since z-axis is utilized chiefly for courser height positioning.
You are referring to the z axis in 2D space here, which is mainly used to manipulate the rendering order of 2D elements.
In 3D space it just works as expected.

Sir John Hawkwood said:
Again, there is no plain attach operation in M&B? What if somebody wants to make an agent sitten Flak38-style attached to a scene prop, that is a full depended transposing with the prop, how should he do it?
You are repeating yourself.
There's no dedicated operation for that and I told you how to do it yourself.
 
Grüß Gott Leute,

the climb function beseems well already, but it needs to have a more suitable animation.
Without scripts is it possible an animation which, when interrupted, stops at the current frame, or at least shows the initial frame? Something i obtained with a glitch once, and never saw again.
 
Hello guys.

Where does the pic_arms_swadia mesh get assigned?
I have been looking through all the files but cannot find
the place where this gets assigned.

I need to know this because I wish to assign coat of arms meshes to my own
factions.
 
Status
Not open for further replies.
Back
Top Bottom