Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
rgcotl said:
flag can be usied in directly in module animation.py file just for one action like arf_stick_item_to_left_hand
Thank you for answer, rgcotl. Like I said, this flag doesn't help me in this case, because I need not just stick rifle to left hand instead of right hand, I need fingers of left hand to be under rifle's butt, not on fore-end of rifle, so rifle in this animation must be placed higher comparatively to hand than it is holded now, so I guess for this I need model with new coordinates (unfortunatelly I can't move bone of rifle independend of other bones :sad:)

And anyway I can't make this flag work fine, rifle is always in right hand like here
bySJrcbEnfU.jpg
Code of animation, just in case:
Code:
 ["stand_crossbow", 0, amf_client_prediction,
   [2.0, "staff_cstance", 0, 60, arf_use_stand_progress|arf_cyclic|arf_stick_item_to_left_hand, 0, (0, 0, 0), 0.0], 
("staff_cstance" is animation from NW "staff_cstance_musket")
 
jacobhinds said:
I'm using a slightly modified version of Xenoargh's Shotgun script.

Code:
#script_effects_shotgun
#called when blunderbusses are fired
#Inputs = none
#Outputs = none
	("effects_shotgun",
		[

			(store_trigger_param, ":agent", 1), #Get the attacker Agent for add_missile
			(store_trigger_param, ":num_shots", 2), #number of shots
			(store_trigger_param, ":item", 3), #item name
			(store_trigger_param, ":bullet_type", 4), #bullet type

			(set_fixed_point_multiplier, 100),
			(play_sound,"snd_arquebus"),

			(try_begin),
				(store_random_in_range, ":rand", 0,5),
				(eq, ":rand", 0),
				(play_sound,"snd_release_crossbow_far"),
			(try_end),

			(position_move_x,pos1,0),
			(position_move_y,pos1,150),
			(particle_system_burst,"psys_pistol_smoke",pos1,6),
			(particle_system_burst,"psys_pistol_flare",pos1,5),
			(particle_system_burst,"psys_pistol_smoke_large",pos1,5),
			(try_for_range, ":unused", 0, ":num_shots"),
				(copy_position, pos2, pos1),
				
				#Shotgun script
				#Rifle Version

				#Kludge code to fix the final angles and arrive at a satisfactory result.
				#The engine doesn't appear to use Euler angles to give perfect precision...
				#Under all circumstances, so this will be off a bit if firing way up or down.	
				(assign, ":x_fix", -350),#-3.5 degrees
				(assign, ":z_fix", 570),#5.7 degrees
				#The following line is our "choke" adjustment on the Z axis.
				#Unless you need a fan pattern, You'll want to keep the change...
				#The same for X and Z, but Z needs to be applied through the special fix below.
				(store_random_in_range, ":z_offset", -200, 201),#2 deg. of random rotation on the Z axis
				(val_add, ":z_fix", ":z_offset"),#Add offset to the Z fix
				#Fix for Z axis, using floating-point adjustment of the quaternian
				#Don't mess with the next three lines...
				#Unless you really know what's going on with the math :-)
				(position_rotate_x_floating, pos2, 9000), # change axis by rotating 90 degrees
				(position_rotate_y_floating, pos2, ":z_fix"), # rotate z floating
				(position_rotate_x_floating, pos2, -9000), # change axis back
				#Choke adjustment for the X axis.  
				#Should match the choke adjustment for the Z in most cases.
				(store_random_in_range, ":x_offset", -200, 201),#2 deg. of random rotation on the X axis
				(val_add, ":x_fix", ":x_offset"),#Add offset to the X fix
				(position_rotate_x_floating, pos2, ":x_fix"), # Final adjustment of X
				(store_random_in_range, ":ammo_speed", 7800,8200), #2 This is a random amount of speed per spawned missile, between 78 and 82 standard units

				(add_missile, ":agent", pos2, ":ammo_speed", ":item", 0, ":bullet_type", 0),
			(try_end),
			# (play_sound,"snd_gunshot_heavy"),#Firing sound
			# (position_move_y,pos1,95),#Move out along Y
			# (particle_system_burst,"psys_pistol_smoke",pos1,15),#Smoke
			# (particle_system_burst,"psys_gun_sparks",pos1,15),#Flare
		]
	),

The parameters are all fine. The problem is that when I shoot the shotgun, either 1,000 generic missiles appear, or none at all. It might have something to do with the fixed_point multiplier and its position (maybe it's screwing with the local variables) but I'm not sure how those things work.
From where do you call this script?
 
jacobhinds said:
I'm not at my computer. But the parameters are all perfectly fine; I've tested the out.
They obviously dont, otherwise you wont experience these issues.
So please post the related code of the calls once you get back on your pc.
 
if its a fixed point parameter issue put this above add_missile (set_fixed_point_multiplier, 1),

if you still get hundreds of missiles you know its nothing to do with the fixed point multiplier
 
Ivkolya said:
rgcotl said:
flag can be usied in directly in module animation.py file just for one action like arf_stick_item_to_left_hand
Thank you for answer, rgcotl. Like I said, this flag doesn't help me in this case, because I need not just stick rifle to left hand instead of right hand, I need fingers of left hand to be under rifle's butt, not on fore-end of rifle, so rifle in this animation must be placed higher comparatively to hand than it is holded now, so I guess for this I need model with new coordinates (unfortunatelly I can't move bone of rifle independend of other bones :sad:)

And anyway I can't make this flag work fine, rifle is always in right hand like here
bySJrcbEnfU.jpg
Code of animation, just in case:
Code:
 ["stand_crossbow", 0, amf_client_prediction,
   [2.0, "staff_cstance", 0, 60, arf_use_stand_progress|arf_cyclic|arf_stick_item_to_left_hand, 0, (0, 0, 0), 0.0], 
("staff_cstance" is animation from NW "staff_cstance_musket")

well arf_stick_item_to_left_hand really should work i remeber i tested it with 2 handed atack animation and it worked all ok
it is used also in NW for reloading animation and it worked here to..
also in header animations here is an constant acf_displace_position  (well but i cant help here much cause i newer tryed to use it).
 
Can anyone comment on the purpose of these itpflags:
itp_civilian (I noticed that nearly all armor and tunic items in Brytenwalda have this flag, but don't see the point)
This is my top question.
itp_unique as opposed to (vs) itp_no_pick_up_from_ground
itp_fit_to_head vs itp_covers_head vs itp_covers_hair (why do some items make my companions bald?)
itp_offset_lance
itp_unbalanced
itp_force_show_body
itp_extra_penetration
itp_no_blur 
itp_has_upper_stab


I have revamping module_items and want to know if I should include or remove these.
I am especially confused about helmet flags.
 
gdwitt said:
itp_civilian
itp_unbalanced
Fairly sure itp_civilian allows the troop to use the item when in a civil state (a.k.a in scenes without combat)
And I guess itp_unbalanced determines whether the weapon has the 'Unbalanced' stat.
 
That's helpful.
I have a problem with Lords at feasts not wearing anything.However, I don't want to make an item civilian if it measn they will not wear it to battle.
How would you set up an inventory so they can wear different gear in halls versus on the battlefield?
I would guess that we need a flag like that to enable this kind of situational dressing.
Some troops:
["knight_7_1", "Mael Morcant Glas map Morfael", "Edling Morgan Glas ap Morfael", tf_hero, 0, reserved,  fac_kingdom_7, [itm_horsecourser2,itm_noblearmor12res,      itm_noblearmor12res,  itm_noble_shoesorange, itm_splinted_leather_greaves,      itm_dux_ridge_helm_goldres,          itm_rich_spathaswordt2,  itm_leather_gloves1,        itm_banner_round_shield_ironrim, itm_javelins],  knight_attrib_1,wp(130),knight_skills_1|knows_trainer_3, 0x00000001870862c13a928a44ec5012f200000000001d57120000000000000000],
["knight_9_5", "Ealdorman Frithewalh", "Ealdorman Frithewalh", tf_hero, 0, reserved,  fac_kingdom_9, [itm_fastwarhorset3,      itm_mailnoble_greenclk,    itm_mailnoble_greenclk,                itm_shoes1blue,              itm_noble_greavesblue,                      itm_anglehelmt3,  itm_leather_gloves1,    itm_angle_swordt3,  itm_banner_round_shield_ironrim],    knight_attrib_3,wp(240),knight_skills_3|knows_trainer_3, 0x0000000a070c4387374bd19addd2a4ab00000000001e32cc0000000000000000, vaegir_face_old_2],

Also, cloaks have this setup:itp_type_head_armor| itp_attach_armature| itp_doesnt_cover_hair|itp_fit_to_head|itp_civilian
while half the helmets have this: itp_type_head_armor|itp_fit_to_head
 
rgcotl said:
well arf_stick_item_to_left_hand really should work i remeber i tested it with 2 handed atack animation and it worked all ok
it is used also in NW for reloading animation and it worked here to..
also in header animations here is an constant acf_displace_position  (well but i cant help here much cause i newer tryed to use it).
Yes, it should work, but it doesn't (I've probably did something wrong, I don't know what, all seems right). But if I understand right, it will not help me (item will be attached to left hand, but in position, where left hand already is by two-handed animations), 'cause besides attaching rifle to left hand I need to move rifle up, so it must be probably new model with new coordinates...
acf_displace_position is used in animation of dismounting and falling from horse, so it probably means dislacing position of whole skeleton, not just one bone((

UPD.: I was thinking, what if try solve it via vertex animation? I mean, make vertex animation of two models - one usual and one with other coordinates, so it will like I need. Here cmes the question - how make game to use vertex animation and, accordingly, another model of rifle for animations of standing and walking? (In NW there is vertex animation in animation of firing musket, but I don't understand how is it working)
 
Ivkolya said:
Yes, it should work, but it doesn't (I've probably did something wrong, I don't know what, all seems right). But if I understand right, it will not help me (item will be attached to left hand, but in position, where left hand already is by two-handed animations), 'cause besides attaching rifle to left hand I need to move rifle up, so it must be probably new model with new coordinates...
The offset is defined in game_variables.txt, so feel free to change it until it fits well.
Code:
#Global_values
musket_left_hand_x_dif = 0.0
musket_left_hand_y_dif = -0.37
musket_left_hand_z_dif = -0.04
 
_Sebastian_ said:
jacobhinds said:
I'm not at my computer. But the parameters are all perfectly fine; I've tested the out.
They obviously dont, otherwise you wont experience these issues.
So please post the related code of the calls once you get back on your pc.

Code:
["shotgun", "Hand Cannon", [("rrr_handgonne",0)], itp_type_crossbow|itp_merchandise|itp_two_handed|itp_primary, itcf_shoot_musket|itcf_carry_spear|itcf_reload_musket, 230, weight(1.5)|abundance(90)|difficulty(0)|spd_rtng(38)|shoot_speed(160)|thrust_damage(57,pierce)|max_ammo(1)|accuracy(70), imodbits_none, [(ti_on_weapon_attack,[(call_script,"script_effects_shotgun", reg1, 20, "itm_shotgun", "itm_dummy_bullet")])] ],
 
jacobhinds said:
_Sebastian_ said:
jacobhinds said:
I'm not at my computer. But the parameters are all perfectly fine; I've tested the out.
They obviously dont, otherwise you wont experience these issues.
So please post the related code of the calls once you get back on your pc.
Code:
["shotgun", "Hand Cannon", [("rrr_handgonne",0)], itp_type_crossbow|itp_merchandise|itp_two_handed|itp_primary, itcf_shoot_musket|itcf_carry_spear|itcf_reload_musket, 230, weight(1.5)|abundance(90)|difficulty(0)|spd_rtng(38)|shoot_speed(160)|thrust_damage(57,pierce)|max_ammo(1)|accuracy(70), imodbits_none, [(ti_on_weapon_attack,[(call_script,"script_effects_shotgun", reg1, 20, "itm_shotgun", "itm_dummy_bullet")])] ],
Do you not need to use
Code:
store_trigger_param
first?
 
_Sebastian_ said:
Ivkolya said:
Yes, it should work, but it doesn't (I've probably did something wrong, I don't know what, all seems right). But if I understand right, it will not help me (item will be attached to left hand, but in position, where left hand already is by two-handed animations), 'cause besides attaching rifle to left hand I need to move rifle up, so it must be probably new model with new coordinates...
The offset is defined in game_variables.txt, so feel free to change it until it fits well.
Code:
#Global_values
musket_left_hand_x_dif = 0.0
musket_left_hand_y_dif = -0.37
musket_left_hand_z_dif = -0.04
Wow, many thanks to you! It is very helpful, but I guess if I will change these values - it will change also offset for animation of reloading? Is there way to keep these values for reloading and make new ones for walking and standing?
If so - maybe it is better to use vertex animation? In NW there is vertex animation in animation of firing musket and in reload animation, but I don't understand how is it working, never saw tutorial about adding vertex animation to skeletal animation/
TOUERj2PVIA.jpg
0nt_sGLDY50.jpg
Here I made model of rifle with new coordinates and attached it to left hand (like shield in Warband) as second frame of vertex animation.
 
How can I get a spawned "plane" (flat) item to lay flat with the terrain in a battle scene?

Currently I just have the following simple code:

Code:
....
(set_spawn_position, pos0),
(spawn_item, itm.item0, 0, 0),
....
(My module system is fully integrated with WRECK so I am using the dynamic ref syntax...)

However, it always results in the "BAD" illustration below:

hDUtwWj.jpg

How do I fix this and get the "GOOD" result? I see there are rotate ops available, but not sure how I can use those to apply the correct rotation (or where to get the correct rotation data for that matter).

EDIT: I suppose since my mesh is just a plane, I could calculate the Z-coord for each of the four endpoints and calculate the rotation using that, is there an easier way?

Thanks!
 
wrwlf said:
EDIT: I suppose since my mesh is just a plane, I could calculate the Z-coord for each of the four endpoints and calculate the rotation using that, is there an easier way?
This makes sense to me. Copy the position, move it to the corners, set z to ground, and check the differences. Actually, the calculations might be easier if you simply slide it one direction on the X axis and one direction on the Y axis, so it will be at the center of the edges rather than the corners.
 
Caba`drin said:
wrwlf said:
EDIT: I suppose since my mesh is just a plane, I could calculate the Z-coord for each of the four endpoints and calculate the rotation using that, is there an easier way?
This makes sense to me. Copy the position, move it to the corners, set z to ground, and check the differences. Actually, the calculations might be easier if you simply slide it one direction on the X axis and one direction on the Y axis, so it will be at the center of the edges rather than the corners.

Thanks Caba!

I think I can even get away with only using one of the edge-center coords to calculate the rotation angle; however, what is the scale for the units? I can get the dimensions of my mesh from OpenBRF, but how does that translate to in-game units?
 
Status
Not open for further replies.
Back
Top Bottom