Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
For an animation test (i.e., what animation is currently playing, you need two parts.

First, a simple loop trigger in your module_mission_templates:

Code:
cheer_animation_state_check = (0,0,0,[
(try_for_agents,":agent"),#cycle through every Agent
(call_script, ("script_cf_cheer_animation_state"),
],
[])

Note that you have to include the line "cheer_animation_state_check," within the loops for the Missions; see examples such as common_reinforcement_check to see how to do that correctly.

module_scripts:
Code:
("cf_cheer_animation_state", [

(agent_get_animation, ":anim", ":agent",0),  #query the engine about our animation state
(agent_get_horse, ":agent_horse", ":agent"),  #Got horse?

(try_begin),
	(eq, ":anim", "anim_cheer"), #We're currently cheering
	(neq, ":agent_horse", -1), #We're on a horse, of course
        #Do Stuff
(try_end),

]),

This would make it possible to then have horses respond to their riders' cheers, for example.  Keep in mind that you'll also want to check the horse's animation state, so that if it's playing "anim_horse_cheer" (or whatever you call it) you don't call it again.
 
halafradrimx said:
hey guys I'm a total noob in moding.

Is there a way to put items from other Warband mods into the native item list?

Because I want to have nice samurai stuff in Warband, the Strange japanese set is too old and dull.

Please also give me advice on wich mods have nice japanese items.

Thanks I apreciate the aid.
try this http://forums.taleworlds.com/index.php/topic,133708.0.html


Caba`drin said:
dia151 said:
Should i put it anywhere in module_presentations or somewhere(where?) under multiplayer troop select tuple?
And where to put the part that tells it what mesh to load?
You'll notice that each presentation begins like:
  ("multiplayer_troop_select", prsntf_manual_end_only, 0, [
which has the pres name, any flags, any background meshes, and then the bracket that begins a python list.
The items in that list are triggers, like
Code:
    (ti_on_presentation_load,
     [
    #stuff (list of operations)
     ]),
and then
   (ti_on_presentation_event_state_change,
     [
    #stuff (list of operations)
     ]),
and
   (ti_on_presentation_run,
     [
    #stuff (list of operations)
     ]),
##stick it here??
]), #end the presentation
You would add the mouse enter/leave outside of one of these triggers, but still within the "multiplayer_troop_select" tuple, yes.

So far as adding the overlay, you'd need to identify which overlay has the troop type.
This data is stored here:
Code:
        (store_add, ":button_index_slot", ":cur_troop_index", multi_data_troop_button_indices_begin),
        (troop_set_slot, "trp_multiplayer_data", ":button_index_slot", reg0),

So you'd need a loop like the one there to identify the appropriate overlay ID and then create an overlay.

Can i use something like
(try_for_range,<destination(dont know what to put here, module_troops??)>,<heavy_crossbowman_multiplayer( thats my first multiplaye troop)>,<feudal_knighth_multiplayer(thats my last multiplayer troop)>)

then put try_begin and else_try operators for every troop?

if not, what to put then?

EDIT

I dont know what to put after

(ti_on_presentation_mouse_enter_leave,
    [
          (store_trigger_param_1, ":eek:bject"),
          (store_trigger_param_2, ":enter_leave"), #0 if mouse enters, 1 if mouse leaves
 
Were in the closing elements of warsword, I know that most of the posts are to do with warband and Fire and sword,
1 thing in warsword as always played on me, Can I make the village farmers and defenders the same as 1 of the fantasy factions?
Its not in the feel of the game when you come across some village farmers on the map, say from the skevan and there Human,
I’ve looked in party template.py and found
("village_defenders","Village Defenders",icon_axeman,0,fac_commoners,merchant_personality,[(trp_farmer,10,20),(trp_peasant_woman,0,4)]),
I fort of using this for 1 of the factions
  ("warr_1_village_defenders","Village defenders",icon_peasant|carries_goods(2),0,fac_innocents,merchant_personality,[(trp_warr_swadian_recruit,10,20),(trp_peasant_woman,0,0)]),
where else is the village farmers
I noticed in scripts.py
    (store_faction_of_party, ":party_faction", ":town_no"),
    (set_spawn_radius, 0),
    (spawn_around_party, ":village_no", "pt_village_farmers"),
    (assign, ":new_party", reg0),
#  (else_try),
#    (eq, "$g_war_country", 5),
#    (store_faction_of_party, ":party_faction", ":town_no"),
#    (set_spawn_radius, 0),
#    (spawn_around_party, ":village_no", "pt_warr_5_village_farmers"),#you1 test WARR Village farmers
#    (assign, ":new_party", reg0),
I tried the things blocked out 1 at a time but it did nothing?
Any one help
 
Code:
              (try_begin),
                (is_between, ":town_no", towns_begin, towns_end),
                (set_spawn_radius, 0),
                (try_begin),
                  (eq, ":party_faction", "fac_whatever"),
                  (assign, ":new_party", "pt_warr_1_village_defenders"),
                (try_end),
                (spawn_around_party, ":village_no", ":new_party"),
                (assign, ":new_party", reg0),
Code:
      (try_begin),
        (party_get_num_companions, ":party_size", ":village_no"),
        (lt, ":party_size", ":ideal_size"),
        (store_faction_of_party, ":party_faction", ":village_no"),
        (try_begin),
          (eq, ":party_faction", "fac_whatever"),
          (assign, ":new_party", "pt_warr_1_village_defenders"),
        (try_end),
        (party_add_template, ":village_no", ":new_party"),
      (try_end),
 
i want to make a mesh appear when i hover mouse cursor over a multiplayer troop.

I put this

Code:
(ti_on_presentation_mouse_enter_leave,
     [
           (store_trigger_param_1, ":object"),
           (store_trigger_param_2, ":enter_leave"), #0 if mouse enters, 1 if mouse leaves
   ]),

but i dont know what to put next?
this?
Code:
(store_add, ":button_index_slot", ":cur_troop_index", multi_data_troop_button_indices_begin),
           (troop_set_slot, "trp_multiplayer_data", ":button_index_slot", reg0),
what does that code mean? i dont knwo what to edit
 
@dia, the likelihood that someone is going to code this whole feature for you, as it isn't necessarily simple/straightforward, is little-to-none.
Those two lines are part of the loop that stores what overlay ID is used for what troop/type.

Code:
      (try_for_range, ":troop_no", multiplayer_troops_begin, multiplayer_troops_end), ##begins a loop that will iterate through each mp troop
        (store_troop_faction, ":troop_faction", ":troop_no"), #gets the faction of that troop
        (eq, ":troop_faction", ":my_faction_no"), #makes sure the troop is of the player's faction (which is set above)
        (str_store_troop_name, s1, ":troop_no"), #gets the troop's name
        (create_button_overlay, reg0, s1, 0), #creates the link/button overlay that has s1 (the troop's name) as the words that are shown, and stores the overlay ID number in reg0
        (overlay_set_color, reg0, 0xFFFFFF), #sets the color for that overlay
        (store_add, ":button_index_slot", ":cur_troop_index", multi_data_troop_button_indices_begin), #adjusts an index to store the overlay ID in the proper place for the troop
        (troop_set_slot, "trp_multiplayer_data", ":button_index_slot", reg0), #stores the overlay ID in a list of overlay IDs
        (position_set_y, pos1, ":cur_y"), #sets the overlay's position
        (overlay_set_position, reg0, pos1), #as above
        (val_sub, ":cur_y", escape_menu_item_height), #adjusts the position for the next troop name
        (position_set_y, pos1, ":cur_y"),
        (val_add, ":cur_troop_index", 1),
      (try_end),
You'll need to do somewhat the reverse. Go through the list of overlay IDs stored in multiplayer_data, once you have found the one that was hovered over, identify which troop that referred to and create whatever overlay you need to.

An example of this, taken from a presentation I've written:
Code:
(ti_on_presentation_mouse_enter_leave,
     [
           (store_trigger_param_1, ":object"),
           (store_trigger_param_2, ":enter_leave"), #0 if mouse enters, 1 if mouse leaves
           (try_begin),
		    (eq, ":enter_leave", 0), #mouse enters
		    (party_get_num_companion_stacks, ":num_of_stacks", "p_main_party"),
		    (try_for_range, ":i", 0, ":num_of_stacks"), #the loop through the relevant troops
			    (party_stack_get_troop_id, ":troop_id", "p_main_party", ":i"), #get the troop
			    (neq, ":troop_id", "trp_player"),
			    (troop_slot_eq, "trp_temp_array_a", ":troop_id", ":object"),  #overlay IDs were stored in a list within temp_array_a (rather than multiplayer_data in your case); checks if this troop's overlay ID is the one that was hovered over
                            ##do stuff
		    (try_end),
           (try_end),
 
Question: Anyone can tell me were and how would I go to change the generation settings of random scene maps? Furtermore, I'd like to know if its possible to spawn scene_objects around those scenes in random, or fixed, positions. Also, if possible, a way to make the objects that were spawned random, short of like when the game spawns trees.
 
Thanks Barabas, that fixed the error message, but it wasn't the problem.. I'd gone past 127 slots. So I'm merging all of my custom events into one megaevent to get below the 127-slot limit, and having some troubles with it. The client event just won't fire off at all. Here's a fix bayonet script I've redone to fit in with the big event:

Trigger:
Code:
#fix bayonet script
         (0, 1, 30, [(key_clicked, key_b),
    ], [
        
         (multiplayer_get_my_player, ":playernum"),
         (player_get_agent_id, ":agentnum", ":playernum"),
         (agent_get_wielded_item, ":rifle",":agentnum"),
         (assign,":val",1),
#springfield to bayo
         (try_begin),
         (eq, ":rifle", "itm_springfield_1861"),
         (assign,":val",1),
         (multiplayer_get_my_player,":player"),
         (multiplayer_send_3_int_to_server,multiplayer_event_secessionstuff,":val","itm_springfield_1861",":player"),
         (display_message,"@You've fixed your bayonet! You may unfix it in 30 seconds."),
#bayo to springfield
         
         (else_try),
         (eq, ":rifle", "itm_springfield_1861_bayo"),
         (assign,":val",1),
         (multiplayer_get_my_player,":player"),
         (multiplayer_send_3_int_to_server,multiplayer_event_secessionstuff,":val","itm_springfield_1861_bayo",":player"),
         (display_message,"@You've unfixed your bayonet! You may fix it in 30 seconds."),
#enfield to bayo
         
         (else_try),
         (eq, ":rifle", "itm_enfield_1853"),
         (assign,":val",1),
         (multiplayer_get_my_player,":player"),
         (multiplayer_send_3_int_to_server,multiplayer_event_secessionstuff,":val","itm_enfield_1853",":player"),
         (display_message,"@You've fixed your bayonet! You may unfix it in 30 seconds."),

#bayo to enfield
         
         (else_try),
         (eq, ":rifle", "itm_enfield_1853_bayo"),
         (assign,":val",1),
         (multiplayer_get_my_player,":player"),
         (multiplayer_send_3_int_to_server,multiplayer_event_secessionstuff,":val","itm_enfield_1853_bayo",":player"),
         (display_message,"@You've unfixed your bayonet! You may fix it in 30 seconds."),



         (try_end),


]),

This code works perfectly fine.

Server event:

Code:
      #################
      #SECESSION STUFF#
      #################
      (eq,":event_type", multiplayer_event_secessionstuff),
      (store_script_param, ":val",3),
      (store_script_param, ":var1",4),
      (store_script_param, ":var2",5),
         (assign,reg1,":val"),
		(display_message,"@Val Server: {reg1}"), 

#FIX BAYONETS
(try_begin),
      (eq,":val",1),
         (assign,reg2,":val"),
		(display_message,"@Val Server BayoCheck: {reg2}"), 
          (get_max_players, ":num_players"),
              (try_for_range, ":cur_player", 0, ":num_players"),
                  (player_is_active,":cur_player"),
                  (multiplayer_send_3_int_to_player, ":cur_player", multiplayer_event_secessionstuff, ":val",":var1",":var2"),
          (try_end),
      
(try_end),

This code works fine as well. Val Server and Val Server Bayocheck both report back with the correct number for Val (1), and since Val Bayocheck is firing off I know it's passing the val=1 check.


Client code:

Code:
#################
#Secession Stuff#
#################
      (else_try),
      (eq, ":event_type", multiplayer_event_secessionstuff),
      (store_script_param, ":val",3),
      (store_script_param, ":var1",4),
      (store_script_param, ":var2",5),
         (assign,reg3,":val"),
		(display_message,"@Val Client: {reg3}"), 
      (multiplayer_get_my_player,":player"),
         (assign,reg4,":player"),
		(display_message,"@Player: {reg4}"), 

#FIX BAYONETS
(try_begin),
      (eq,":val",1),
    (try_begin),
         (eq,":var1","itm_springfield_1861"),
         (assign,":newrifle","itm_springfield_1861_bayo"),
    (try_end),
    (try_begin),
         (eq,":var1","itm_springfield_1861_bayo"),
         (assign,":newrifle","itm_springfield_1861"),
    (try_end),
    (try_begin),
         (eq,":var1","itm_enfield_1853"),
         (assign,":newrifle","itm_enfield_1853_bayo"),
    (try_end),
    (try_begin),
         (eq,":var1","itm_enfield_1853_bayo"),
         (assign,":newrifle","itm_enfield_1853"),
    (try_end),

      (player_get_agent_id,":agent",":var2"),
      (agent_unequip_item,":agent", ":var1"),
      (agent_equip_item, ":agent", ":newrifle"),
      (agent_set_wielded_item, ":agent", ":newrifle"),
(try_end),

This is where the problem comes in. This code doesn't fire off at all. The Val Client and Player messages don't fire off, the val=1 check doesn't pass, and none of the fix bayonet code is executed.

I've tried just about everything at this point, and I've not a single clue what's wrong. Is there anything obvious I'm missing here?
 
Caba`drin said:
You'll need to do somewhat the reverse. Go through the list of overlay IDs stored in multiplayer_data, once you have found the one that was hovered over, identify which troop that referred to and create whatever overlay you need to.

where exactly is "multiplayer_data" ?
 
Is there a way to make certain troops simply exempt from morale? That they'd never leave the party on the map and definitely would never ever run away from a fight?
 
I don't know if the "hero" flag would work. Also i am not sure if that would not have other effects too.

One thing from me: When starting my mod with WSE, the game crashes without a word. WSE_log says:
Code:
[10:59:19] EXCEPTION_ACCESS_VIOLATION (0xC0000005, 0x00000000, 0x4703EFD0)
[10:59:20] 0x00429962 mb_warband.exe+0x29962 (??+0x0)
[10:59:20] 0xFFFFFFFFBEBE7FAC ??+0xFFFFFFFFBEBE7FAC (??+0x0)
[10:59:20] 0x00000000 ??+0x0 (??+0x0)
[10:59:20] >
If i start it without WSE, all works fine. butI can't plya the mod as without WSE as there are WSE commands used, so that is no option.
 
dia151 said:
Caba`drin said:
You'll need to do somewhat the reverse. Go through the list of overlay IDs stored in multiplayer_data, once you have found the one that was hovered over, identify which troop that referred to and create whatever overlay you need to.

where exactly is "multiplayer_data" ?
...it is the fake troop that is referenced in the troop-slot operations, whose slots are used to store the overlay IDs, etc, in the presentation.

Patta said:
One thing from me: When starting my mod with WSE, the game crashes without a word. WSE_log says:.
Likely will get better support in the WSE thread.

FrisianDude said:
Is there a way to make certain troops simply exempt from morale? That they'd never leave the party on the map and definitely would never ever run away from a fight?
Add a quick exception to those troop IDs in the script "decide_run_away_or_not" and to the desertion simple trigger's party-stack loop (the trigger begins:
Code:
(1, 
   [
     (store_current_day, ":cur_day"),
     (gt, ":cur_day", "$g_last_report_control_day"),
     (store_time_of_day, ":cur_hour"),
     (ge, ":cur_hour", 18),

I don't believe any troop flag or other troop-template setting will make this happen though.
 
I've solved my problem (at the top of this page)... for anybody having the same problem finding this in the future, the server event and the client event need to have different names.
 
Status
Not open for further replies.
Back
Top Bottom