Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Lumos said:
My question: How would I go to create a trigger that evaluates as true on double-tap of a key?
EDIT: AFAIK, there's no (key_released) or ti_key_released operation/trigger. Am I right?
You don't need ti_key_released.

Evaluation is pretty straightforward.

1. If key clicked, then:
2. Store current time.
3. Store diff between current time and time last clicked.
4. Last time clicked set to current time.
5. If diff <= double click interval, then it's double click
 
Lav said:
Evaluation is pretty straightforward.

1. If key clicked, then:
2. Store current time.
3. Store diff between current time and time last clicked.
4. Last time clicked set to current time.
5. If diff <= double click interval, then it's double click

It will be like this (work only on  mission template) :
Code:
lav_double_click  = (0, 0, 0, [(key_clicked, "$lav_key"),
                               (store_mission_timer_a_msec, ":cur_time"),
                               (store_sub, ":diff", ":cur_key", "$g_last_time"),
                               (assign, "$g_last_time", ":cur_key"),
                               (le, "diff", 50),  # 50ms or less for a double click
                              ],
   [ 
    # Your code for Double click event here
   ])

Don't forget to reset "$g_last_time" at the beggining of the mission.
 
ilovemyhedgehog said:
I need help adding a new food foraging party form my mod for more details press the link (i posted in the wrong spot but you can't delete your posts so im trying this)

http://forums.taleworlds.com/index.php/topic,194473.0.html
still need help!

AND

Has anyone made a Warband 1.143 version of a hunting mod? I need hunting in my mod PLEASE HELP!!!!!

Sorry long code!

Code:
step1 = module_game_menus.py

#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
#-#-#-#Hunting Mod begin#-#-#-#
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
("deer_herd",mnf_scale_picture,
"You encounter a herd of deers.",
"none",
[
(try_begin),
(gt, "$num_deers_killed",0),
(troop_clear_inventory, "trp_temp_troop"),
(troop_add_items, "trp_temp_troop", "itm_deer_meat", "$num_deers_killed"),

(party_get_num_companions, ":num_deers", "$g_encountered_party"),
(try_begin),
(ge, "$num_deers_killed", ":num_deers"),
(remove_party, "$g_encountered_party"),
(else_try),
(party_remove_members, "$g_encountered_party", "trp_deer", "$num_deers_killed"),
(try_end),
(assign,"$num_deers_killed",0),
(troop_sort_inventory, "trp_temp_troop"),
(change_screen_loot,"trp_temp_troop"),
(try_end),
(set_background_mesh, "mesh_pic_cattle"),
],
[
("deer_kill",
[
(party_get_num_companions, ":num_deers", "$g_encountered_party"),
(try_begin),
(le,":num_deers",0),
(disable_menu_option),
(try_end),
]
,"Hunt some of the animals.",
[
(set_jump_mission,"mt_deer_hunting"),
(jump_to_scene,"scn_random_scene_plain_forest"),
(change_screen_mission),
]
),
("leave",[],"Leave.",
[(change_screen_return),
]
),
]
),
("deer_herd_kill_end",0,
"You shouldn't be reading this.",
"none",
[(change_screen_return)],
[
]
),
("boar_herd",mnf_scale_picture,
"You encounter a herd of boars.",
"none",
[
(try_begin),
(gt, "$num_boars_killed",0),
(troop_clear_inventory, "trp_temp_troop"),
(troop_add_items, "trp_temp_troop", "itm_boar_meat", "$num_boars_killed"),

(party_get_num_companions, ":num_deers", "$g_encountered_party"),
(try_begin),
(ge, "$num_boars_killed", ":num_deers"),
(remove_party, "$g_encountered_party"),
(else_try),
(party_remove_members, "$g_encountered_party", "trp_boar", "$num_boars_killed"),
(try_end),
(assign,"$num_boars_killed",0),
(troop_sort_inventory, "trp_temp_troop"),
(change_screen_loot,"trp_temp_troop"),
(try_end),
(set_background_mesh, "mesh_pic_cattle"),
],
[
("boar_kill",[
(party_get_num_companions, ":num_deers", "$g_encountered_party"),
(try_begin),
(le,":num_deers",0),
(disable_menu_option),
(try_end), 
],"Hunt some of the animals.",
[
(set_jump_mission,"mt_boar_hunting"),
(jump_to_scene,"scn_random_scene_plain_forest"),
(change_screen_mission),
]
),
("leave",[],"Leave.",
[(change_screen_return),
]
),
]
),
("boar_herd_kill_end",0,
"You shouldn't be reading this.",
"none",
[(change_screen_return)],
[
]
),
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
#-#-#-#Hunting Mod end#-#-#-#
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#

module_items.py

#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
#-#-#-#Hunting Mod begin#-#-#-#
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
["deer_meat","Deer Meat", [("raw_meat",0)], itp_merchandise|itp_type_goods|itp_consumable|itp_food, 0, 10,weight(30)|abundance(100)|food_quality(40)|max_ammo(30),imodbits_none],
["boar_meat","Boar Meat", [("raw_meat",0)], itp_merchandise|itp_type_goods|itp_consumable|itp_food, 0, 20,weight(30)|abundance(100)|food_quality(80)|max_ammo(50),imodbits_none],
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
#-#-#-#Hunting Mod end#-#-#-#
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#

#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
#-#-#-#Hunting Mod begin#-#-#-#
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
["deer","Deer", [("deer",0)], itp_unique|itp_type_horse, 0, 1411,abundance(40)|hit_points(40)|body_armor(0)|difficulty(11)|horse_speed(40)|horse_maneuver(32)|horse_charge(20),imodbits_horse_basic],
["boar","Boar", [("boar",0)], itp_unique|itp_type_horse, 0, 1411,abundance(40)|hit_points(100)|body_armor(0)|difficulty(11)|horse_speed(40)|horse_maneuver(20)|horse_charge(100),imodbits_horse_basic],
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
#-#-#-#Hunting Mod end#-#-#-#
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#

This wouldnt work for warband 1.143 Would it? Could it?
Another Question can you make maps with Wings 3d?

 
I could use some help here. I'm planning to add a new overlay/menu that can be opened during battle. Thing is, that menu could get rather complicated so I'm looking for a way to slow the game down while it is opened (like the slowmotion cheat) so players have time to think about their choice, it's a menu where you can activate special/magic abilities, but you only have limited uses so it requires a bit of thought/planning to choose which power to use.

Is there any way this is possible to do? The slowing down I mean, I don't need help with the menu. Oh, and when I say "like the slowmotion cheat" I really mean about a hundred times as slow. Or if possible, pausing the battle entirely while the menu is open. Hmm, can you add options to the escape-key menu?
 
Thanks,  :oops: should've checked there, forgot all these things are in header_operations, it's been a long time. It does say "this works only when cheat mode is enabled" though. Ah well, seems like my mod just got a "hard difficulty" option  :razz:.
 
Ok guys, there's got to be a more efficient way to do this
Code:
	("get_spell_slots",
	[(store_script_param, ":agent_no", 1),
	 (store_skill_level, reg10, "skl_arcane_magic", ":agent_no"),
	 (assign, reg0, 0)
	 (assign, reg1, -1)
	 (assign, reg2, -2)
	 (assign, reg3, -3)
	 (assign, reg4, -4)
	 (assign, reg5, -5)
	 (assign, reg6, -6)
	 (assign, reg7, -7)
	 (assign, reg8, -8)
	 (assign, reg9, -9)
	(try_begin),
	 (ge, reg10, 1),
	 (val_add, reg0, reg10),
	(try_end),
	(try_begin),
	 (ge, reg10, 2),
	 (val_add, reg1, reg10),
	(try_end),
	(try_begin),
	 (ge, reg10, 3),
	 (val_add, reg2, reg10),
	(try_end),
	(try_begin),
	 (ge, reg10, 4),
	 (val_add, reg3, reg10),
	(try_end),
	(try_begin),
	 (ge, reg10, 5),
	 (val_add, reg4, reg10),
	(try_end),
	(try_begin),
	 (ge, reg10, 6),
	 (val_add, reg5, reg10),
	(try_end),
	(try_begin),
	 (ge, reg10, 7),
	 (val_add, reg6, reg10),
	(try_end),
	(try_begin),
	 (ge, reg10, 8),
	 (val_add, reg7, reg10),
	(try_end),
	(try_begin),
	 (ge, reg10, 9),
	 (val_add, reg8, reg10),
	(try_end),
	(try_begin),
	 (ge, reg10, 10),
	 (val_add, reg9, reg10),
	(try_end),
	)],
What I'm doing here is using the magic skill level of a character to determine that character's spell slots (differs for each level tier of spells). But it seems to me I'm missing something to make this piece of code a lot shorter.
 
You need to use agent_get_troop_id before store_skill_level. Not sure why you're using registers when you can be using agent/troop slots - given the lack of context, the values won't differ for agents with the same troop template.
 
Shredzorz said:
What exactly does scene_prop_set_prune_time do? I tried using that operation on a spawned scene prop instance, but it didn't seem to do anything.
As the comment in header_operations.py says: "prune time can only be set to objects that are already on the prune queue. static objects are not affected by this operation.", which means you can only use it for item scene props that are dropped (use the instance id parameter to ti_on_item_dropped) or spawned with spawn_item (reg0); also see the bugtracker suggestion. It was only added in warband 1.142, so if you use it you need to require at least that version on the servers. There is no way to remove scene props without restarting the mission -a dev (Daegoth) was asked about that during the 1.134 beta, and he said that they wouldn't change it (probably because the engine would need a large redesign).

Another annoying thing you might not be aware of I stumbled upon when looking through the logs for this: random props spawned with spawn scene prop are not able to be used by players: it was reported, Daegoth said he knew why it happened but wasn't going to fix it, for undisclosed reasons, and that the workaround was to spawn enough usable props in ti_on_mission_start, then move them around as required.
 
Arcanesaint said:
Thanks,  :oops: should've checked there, forgot all these things are in header_operations, it's been a long time. It does say "this works only when cheat mode is enabled" though. Ah well, seems like my mod just got a "hard difficulty" option  :razz:.
You needn't...
Code:
(assign, "$cheat_mode", 1),
(mission_set_time_speed, 1),
(assign, "$cheat_mode", 0),
 
That's just a global that the module system uses to keeps track of it, changing its value will not disable/enable cheat mode...
Vornne said:
Another annoying thing you might not be aware of I stumbled upon when looking through the logs for this: random props spawned with spawn scene prop are not able to be used by players: it was reported, Daegoth said he knew why it happened but wasn't going to fix it, for undisclosed reasons, and that the workaround was to spawn enough usable props in ti_on_mission_start, then move them around as required.
I just tried spawning an useable prop, and it works like a charm. Are you sure the bug isn't outdated? What should the symptoms be?
 
cmpxchg8b said:
I just tried spawning an useable prop, and it works like a charm. Are you sure the bug isn't outdated? What should the symptoms be?
True at least for 1.132 - 1.134, haven't tested again lately; it seemed to happen randomly that out of many spawned props of a type a few wouldn't be usable, the same instances for multiple and restarted clients.
 
in the modmerger, there is this:

Code:
scripts_directives = [
	#rename scripts to "insert" switch scripts (see end of scripts[])
	# [SD_RENAME, "end_tournament_fight" , "orig_end_tournament_fight"], 
	# [SD_RENAME, "fill_tournament_participants_troop" , "orig_fill_tournament_participants_troop"],
	# [SD_RENAME, "get_random_tournament_participant" , "orig_get_random_tournament_participant"],
	#Add in global variable $g_wp_town_walkers into the visitor code for script_init_town_walkers.
	[SD_OP_BLOCK_INSERT, "fill_tournament_participants_troop", D_SEARCH_FROM_BOTTOM | D_SEARCH_SCRIPTLINE | D_INSERT_AFTER, (neq, ":cur_troop", "trp_kidnapped_girl"), 0, 
		[(neg|troop_slot_eq, ":cur_troop", slot_troop_tournament_never_spawn, 1),], 1],
	# [SD_OP_BLOCK_INSERT, "init_town_walkers", D_SEARCH_FROM_BOTTOM | D_SEARCH_LINENUMBER | D_INSERT_BEFORE, 0, 0, [
		# (call_script, "script_player_order_formations", ":order"),	#for formations
	# ]],
] # scripts_rename


how should I make it without the modmerger?
 
Sorry if this have been asked before,but someone care to explain me how the ''hitbox'' works on warband and if it can be editable?
Also,it's works the same for horses?

thanks anyway.
 
Status
Not open for further replies.
Back
Top Bottom