Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
i have an bug on catapult system..When catapult balls are killing the enemy,player also killing himself.Even he is too away from enemy,or catapult ball.What is the problem ?

Code:
("cf_agent_deliver_damage_to_agent",
  [
      (store_script_param, ":agent_deliverer", 1),
      (store_script_param, ":agent", 2),
      (store_script_param, ":damage", 3),
      (store_agent_hit_points,":health",":agent",1),
      (val_sub,":health",":damage"),
	  #bugfix
	  (get_player_agent_no, ":player"), 
        (neq, ":agent", ":player"),
		#bugfix
      (try_begin),
        (lt,":health",0),
	(agent_set_hit_points,":agent",0,1),
        (agent_deliver_damage_to_agent,":agent_deliverer",":agent"),
      (else_try),
	(agent_set_hit_points,":agent",":health",1),
      (try_end),
  ]),
 
Vornne said:
Fraser said:
Does anyone know of a way that Mount&Blade:Warband Could automatically connect to a server on launch. So when I execute a file it launches M&B:Warband and connects to the server?
That feature was suggested and rejected years ago, here. I vaguely remember hearing that one reason was to avoid making cracked clients simpler, since anyone could easily bypass the TaleWorlds master server.

Well, I don't think there is any way to protect your game from being pirated and does not to break something for those who do not pirate. The best protection is "always online" model, but it pisses off those who payed for the game because of obvious reasons, any other way will result in a game being pirated soon.

Didn't they think about that?
 
(In response to "connect to server" replies)
That excuse for not making an operation that would connect to a server is completely bull**** (not saying that vornne is lying)...(all games get pirated, except the ones that don't share the server files (they do eventually when someone stoles the server files)). I don't see how this kind of operation would make pirating more easier (when the operation get executed, it will act like when you press the connect button from the server list (sending the key to masterserver; getting the connect key; sending the connect key to the server you wanna connect; server validates the connect key via masterserver and if it is valid then start sending info to the player)).

The reason why they haven't made it (I guess) is because is pretty complicated to do it (the game would need to release/free current used memory for current game instance , then init the multiplayer stuffs and then connect to the server)...

They (developers) could have added lots of useful operations (like cmp has done with WSE; good work man, all my respect for you), but they just didn't wanted to...(it took them so many years to add the troop face key operations (they added them because of the next DLC...if the dlc wouldn't exist, these operations would have not been added...all for money...all for money...))

 
Somebody said:
How are you calling cf_agent_deliver_damage_to_agent?

from projectile physics field script.;

Code:
(assign,":stop",0),
	    (try_for_agents,":agent_deliverer"),
	       (eq,":stop",0),
	       (agent_slot_eq,":agent_deliverer",13,reg0),
	       (call_script,"script_cf_agent_deliver_damage_to_agent",":agent_deliverer",":agent",":damage"),
	       (assign,":stop",1),
	    (try_end),
	    (eq,":stop",0),
	    (call_script,"script_cf_agent_deliver_damage_to_agent",":agent",":agent",":damage"),
	  (try_end),
	(try_end),

I think you should look up to "(call_script," operations.
 
HyperCharge said:
i have an bug on catapult system..When catapult balls are killing the enemy,player also killing himself.Even he is too away from enemy,or catapult ball.What is the problem ?

Code:
("cf_agent_deliver_damage_to_agent",
  [
      (store_script_param, ":agent_deliverer", 1),
      (store_script_param, ":agent", 2),
      (store_script_param, ":damage", 3),
      (store_agent_hit_points,":health",":agent",1),
      (val_sub,":health",":damage"),
	  #bugfix
	  (get_player_agent_no, ":player"), 
        (neq, ":agent", ":player"),
		#bugfix
      (try_begin),
        (lt,":health",0),
	(agent_set_hit_points,":agent",0,1),
        (agent_deliver_damage_to_agent,":agent_deliverer",":agent"),
      (else_try),
	(agent_set_hit_points,":agent",":health",1),
      (try_end),
  ]),

afaik get_player_agent_no is used in multiplayer for getting the agent of a certain player, for singleplayer you'd need sth like a try_for_agents checking for player troop I think

if it is for multiplayer, you need:

Code:
	  (get_player_agent_no, ":player_agent", ":player"), 
        (neq, ":agent", ":player_agent"),



EDIT: nevermind, just checked and I was talking ****, I was thinking about player_get_agent_id which does what I said

you could try using this instead:
Code:
	  #bugfix
        (neq, ":agent", ":agent_deliverer"),
		#bugfix
 
Ikaguia said:
HyperCharge said:
i have an bug on catapult system..When catapult balls are killing the enemy,player also killing himself.Even he is too away from enemy,or catapult ball.What is the problem ?

Code:
("cf_agent_deliver_damage_to_agent",
  [
      (store_script_param, ":agent_deliverer", 1),
      (store_script_param, ":agent", 2),
      (store_script_param, ":damage", 3),
      (store_agent_hit_points,":health",":agent",1),
      (val_sub,":health",":damage"),
	  #bugfix
	  (get_player_agent_no, ":player"), 
        (neq, ":agent", ":player"),
		#bugfix
      (try_begin),
        (lt,":health",0),
	(agent_set_hit_points,":agent",0,1),
        (agent_deliver_damage_to_agent,":agent_deliverer",":agent"),
      (else_try),
	(agent_set_hit_points,":agent",":health",1),
      (try_end),
  ]),

afaik get_player_agent_no is used in multiplayer for getting the agent of a certain player, for singleplayer you'd need sth like a try_for_agents checking for player troop I think

if it is for multiplayer, you need:

Code:
	  (get_player_agent_no, ":player_agent", ":player"), 
        (neq, ":agent", ":player_agent"),



EDIT: nevermind, just checked and I was talking ****, I was thinking about player_get_agent_id which does what I said

you could try using this instead:
Code:
	  #bugfix
        (neq, ":agent", ":agent_deliverer"),
		#bugfix
same thing...

Player kills himself even he is away from ball.

Maybe i should add this bugfix to all of catapult codes in module_scripts ?
 
Can someone tell me why is this happening?

Code:
Getting Header Files
Getting ID Files
Getting Process Files
Getting Source Kits
______________________________
Initializing...
Compiling all global variables...
Exporting strings...
Exporting skills...
Exporting tracks...
Exporting animations...
Exporting meshes...
Exporting sounds...
Exporting skins...
Exporting map icons...
Creating new tag_uses.txt file...
Creating new quick_strings.txt file...
Exporting faction data...
Exporting item data...
Exporting scene data...
Exporting troops data...
Exporting particle data...
Exporting scene props...
Exporting tableau materials data...
Exporting presentations...
Exporting party template data...
Exporting parties...
Exporting quest data...
Exporting info page data...
Exporting scripts...
Error in script_npc_decision_checklist_party_ai: ERROR: Usage of unassigned loca
l variable: :enemy_strength_nearby
Traceback (most recent call last):
  File "process_scripts.py", line 52, in <module>
    save_scripts(variables,variable_uses,scripts,tag_uses,quick_strings)
  File "process_scripts.py", line 20, in save_scripts
    save_statement_block(file,convert_to_identifier(func[0]), 0,func[1], variabl
e_list,variable_uses,tag_uses,quick_strings)
  File "C:\Users\<Username>\Desktop\Warband\Module System\Diplomacy\process_oper
ations.py", line 458, in save_statement_block
    save_statement(ofile,opcode,no_variables,statement,variable_list,variable_us
es,local_vars, local_var_uses,tag_uses,quick_strings)
  File "C:\Users\<Username>\Desktop\Warband\Module System\Diplomacy\process_oper
ations.py", line 409, in save_statement
    operand = process_param(statement[i + 1],variable_list,variable_uses,local_v
ars_list,local_var_uses,tag_uses,quick_strings)
  File "C:\Users\<Username>\Desktop\Warband\Module System\Diplomacy\process_oper
ations.py", line 383, in process_param
    result = get_variable(param, local_vars_list,local_var_uses)
  File "C:\Users\<Username>\Desktop\Warband\Module System\Diplomacy\process_oper
ations.py", line 305, in get_variable
    raise Exception("ERROR: Usage of unassigned local variable: " + variable_str
ing)
Exception: ERROR: Usage of unassigned local variable: :enemy_strength_nearby
Exporting mission template data...
Exporting game menus data...
Exporting simple triggers...
Exporting triggers...
Exporting dialogs...
Checking global variable usages...
WARNING: Global variable never used: g_jrider_reset_selected_on_faction
WARNING: Global variable never used: g_latest_character_relation_entry
WARNING: Global variable never used: g_give_advantage_to_original_faction
Imported 76 global variables for saved-game compatability that are not used.
Exporting postfx params...
______________________________
Deleting Compiled Python
Deleting Header Files
Deleting ID Files
Deleting Process Files
Deleting Source Kits
______________________________
Script processing has ended.
Press any key to exit.

I have merged THIS with my module_scripts and that error appears. I tried it in Native and I got a clean compile.
 
Hi.
I'm trying to write a code that execute at each round end but not if it is the last round. Now, i check if round ends with
Code:
(eq, "$g_round_ended", 1),
How can i check if a round end is a map end and so not execute my script ? Of cource the script is under a trigger.
Thanks.
 
"script_multiplayer_event_mission_end"

also, you should look into module_mission_templates for the triggers that end the maps so that the code doesn't run in the last round
 
can sb tell me how do I use agent_set_visibility correctly?

I can't get it to work on dedicated server (character doesn't disappear' but on 'host game' works fine :oops:
 
JohnRocket said:
can sb tell me how do I use agent_set_visibility correctly?

I can't get it to work on dedicated server (character doesn't disappear' but on 'host game' works fine :oops:

You have to send the agent_id to the server which in turn sends it to the client, where you will execute agent_set_visibility.

Look here for more information.
 
vonboD.jpg

the code;
Code:
# script_give_center_to_lord
  # Input: arg1 = center_no, arg2 = lord_troop, arg3 = add_garrison_to_center
  ("give_center_to_lord",
    [
      (store_script_param, ":center_no", 1),
      (store_script_param, ":lord_troop_id", 2), #-1 only in the case of a player deferring ownership of a center
      (store_script_param, ":add_garrison", 3),

	  (try_begin),
	    (eq, "$cheat_mode", 1),
		(ge, ":lord_troop_id", 0),
		(str_store_party_name, s4, ":center_no"),
		(str_store_troop_name, s5, ":lord_troop_id"),
		(display_message, "@{!}DEBUG -- {s4} awarded to {s5}"),
	  (try_end),
	  
	  (try_begin),
	    (eq, ":lord_troop_id", "trp_player"),
	    (unlock_achievement, ACHIEVEMENT_ROYALITY_PAYMENT),
	    
	    (assign, ":number_of_fiefs_player_have", 1),
	    (try_for_range, ":cur_center", centers_begin, centers_end),
	      (neq, ":cur_center", ":center_no"),
	      (party_slot_eq, ":cur_center", slot_town_lord, "trp_player"),
	      (val_add, ":number_of_fiefs_player_have", 1),
	    (try_end),
	    
	    (ge, ":number_of_fiefs_player_have", 5),
	    (unlock_achievement, ACHIEVEMENT_MEDIEVAL_EMLAK),	    
	  (try_end),
	  
      (party_get_slot, ":old_lord_troop_id", ":center_no", slot_town_lord),
      
	  (try_begin), #This script is ONLY called with lord_troop_id = -1 when it is the player faction 
	    (eq, ":lord_troop_id", -1),
	    (assign, ":lord_troop_faction", "fac_player_supporters_faction"),
        (party_set_banner_icon, ":center_no", 0),#Removing banner
		
      (else_try),	
	    (eq, ":lord_troop_id", "trp_player"),
	    (assign, ":lord_troop_faction", "$players_kingdom"), #was changed on Apr 27 from fac_plyr_sup_fac

      (else_try),	  
		(store_troop_faction, ":lord_troop_faction", ":lord_troop_id"),
	  (try_end),	
	  (faction_get_slot, ":faction_leader", ":lord_troop_faction", slot_faction_leader),

	  (try_begin),
	    (eq, ":faction_leader", "trp_player"),

        (try_begin),
            (troop_get_type, ":is_female", "trp_player"),
            (eq, ":is_female", 1),
            (unlock_achievement, ACHIEVEMENT_QUEEN),
        (try_end),
	  (try_end),
	  
	  (try_begin),
		(eq, ":faction_leader", ":old_lord_troop_id"),
		(call_script, "script_add_log_entry", logent_liege_grants_fief_to_vassal, ":faction_leader", ":center_no", ":lord_troop_id", ":lord_troop_faction"),
        (troop_set_slot, ":lord_troop_id", slot_troop_promised_fief, 0),		
	  (try_end),

      (try_begin),
	    (eq, ":lord_troop_id", -1), #Lord troop ID -1 is only used when a player is deferring assignment of a fief
        (party_set_faction, ":center_no", "$players_kingdom"),
	  (else_try),
        (eq, ":lord_troop_id", "trp_player"),
        (gt, "$players_kingdom", 0),
        (party_set_faction, ":center_no", "$players_kingdom"),
      (else_try),
        (eq, ":lord_troop_id", "trp_player"),
        (neg|is_between, "$players_kingdom", kingdoms_begin, kingdoms_end),
        (party_set_faction, ":center_no", "fac_player_supporters_faction"),
      (else_try),
        (party_set_faction, ":center_no", ":lord_troop_faction"),
      (try_end),
      (party_set_slot, ":center_no", slot_town_lord, ":lord_troop_id"),

      (try_begin),
        (party_slot_eq, ":center_no", slot_party_type, spt_village),
        (party_get_slot, ":farmer_party_no", ":center_no", slot_village_farmer_party),
        (gt, ":farmer_party_no", 0),
        (party_is_active, ":farmer_party_no"),
        (store_faction_of_party, ":center_faction", ":center_no"),
        (party_set_faction, ":farmer_party_no", ":center_faction"),
      (try_end),

    (try_begin),
        (this_or_next|party_slot_eq, ":center_no", slot_party_type, spt_town),
			(party_slot_eq, ":center_no", slot_party_type, spt_castle),
		(gt, ":lord_troop_id", -1),
		
#normal_banner_begin
        (troop_get_slot, ":cur_banner", ":lord_troop_id", slot_troop_banner_scene_prop),
        (gt, ":cur_banner", 0),
        (val_sub, ":cur_banner", banner_scene_props_begin),
        (val_add, ":cur_banner", banner_map_icons_begin),
        (party_set_banner_icon, ":center_no", ":cur_banner"),
# custom_banner_begin
#        (troop_get_slot, ":flag_icon", ":lord_troop_id", slot_troop_custom_banner_map_flag_type),
#        (ge, ":flag_icon", 0),
#        (val_add, ":flag_icon", custom_banner_map_icons_begin),
#        (party_set_banner_icon, ":center_no", ":flag_icon"),
    (try_end),

#    (try_begin),
#		(eq, 1, 0),
 #       (eq, ":lord_troop_id", "trp_player"),
 #       (neq, ":old_lord_troop_id", "trp_player"),
 #       (party_get_slot, ":center_relation", ":center_no", slot_center_player_relation),
 #       (is_between, ":center_relation", -4, 5),
 #       (call_script, "script_change_player_relation_with_center", ":center_no", 5),
 #       (gt, ":old_lord_troop_id", 0),
 #       (call_script, "script_change_player_relation_with_troop", ":old_lord_troop_id", -25),
 #   (try_end),
	(try_begin),
		(gt, ":lord_troop_id", -1),
		(call_script, "script_update_troop_notes", ":lord_troop_id"),
	(try_end),
	
    (call_script, "script_update_center_notes", ":center_no"),
    
    (try_begin),
      (gt, ":lord_troop_faction", 0),
      (call_script, "script_update_faction_notes", ":lord_troop_faction"),
    (try_end),  
    
    (try_begin),
        (ge, ":old_lord_troop_id", 0),
        (call_script, "script_update_troop_notes", ":old_lord_troop_id"),
        (store_troop_faction, ":old_lord_troop_faction", ":old_lord_troop_id"),
        (call_script, "script_update_faction_notes", ":old_lord_troop_faction"),
    (try_end),

    (try_begin),
        (eq, ":add_garrison", 1),
        (this_or_next|party_slot_eq, ":center_no", slot_party_type, spt_town),
			(party_slot_eq, ":center_no", slot_party_type, spt_castle),
        (assign, ":garrison_strength", 3), 
        (try_begin),
          (party_slot_eq, ":center_no", slot_party_type, spt_town),
          (assign, ":garrison_strength", 9),
        (try_end),
        (try_for_range, ":unused", 0, ":garrison_strength"),
          (call_script, "script_cf_reinforce_party", ":center_no"),
        (try_end),
        ## ADD some XP initially
        (try_for_range, ":unused", 0, 7),
          (store_mul, ":xp_range_min", 150, ":garrison_strength"),
          (store_mul, ":xp_range_max", 200, ":garrison_strength"),
          (store_random_in_range, ":xp", ":xp_range_min", ":xp_range_max"),
          (party_upgrade_with_xp, ":center_no", ":xp", 0),
        (try_end),
    (try_end),

	(faction_get_slot, ":faction_leader", ":lord_troop_faction", slot_faction_leader),
	(store_current_hours, ":hours"),
	
	#the next block handles gratitude, objections and jealousies
	(try_begin),
	  	(gt, ":hours", 0),
		(gt, ":lord_troop_id", 0),
		
    	(call_script, "script_troop_change_relation_with_troop", ":lord_troop_id", ":faction_leader", 10),
		(val_add, "$total_promotion_changes", 10),
		
		#smaller factions are more dramatically influenced by internal jealousies
		#Disabled as of NOV 2010
#		(try_begin),
#			(neg|faction_slot_ge, ":lord_troop_faction", slot_faction_number_of_parties, 4),
#			(assign, ":faction_size_multiplier", 6),
#		(else_try),
#			(neg|faction_slot_ge, ":lord_troop_faction", slot_faction_number_of_parties, 8),
#			(assign, ":faction_size_multiplier", 5),
#		(else_try),
#			(neg|faction_slot_ge, ":lord_troop_faction", slot_faction_number_of_parties, 16),
#			(assign, ":faction_size_multiplier", 4),
#		(else_try),
#			(neg|faction_slot_ge, ":lord_troop_faction", slot_faction_number_of_parties, 32),
#			(assign, ":faction_size_multiplier", 3),
#		(else_try),	
#			(assign, ":faction_size_multiplier", 2),
#		(try_end),
		
		#factional politics -- each lord in the faction adjusts his relation according to the relation with the lord receiving the faction
		(try_for_range, ":other_lord", active_npcs_begin, active_npcs_end),
			(troop_slot_eq, ":other_lord", slot_troop_occupation, slto_kingdom_hero),
			(neq, ":other_lord", ":lord_troop_id"),
			
		    (store_troop_faction, ":other_troop_faction", ":other_lord"),
		    (eq, ":lord_troop_faction", ":other_troop_faction"),

		    (neq, ":other_lord", ":faction_leader"),
			
	        (call_script, "script_troop_get_relation_with_troop", ":other_lord", ":lord_troop_id"),
			(assign, ":relation_with_troop", reg0),

			#relation reduction = relation/10 minus 2. So,0 = -2, 8 = -1, 16+ = no change or bonus, 24+ gain one point
		    (store_div, ":relation_with_liege_change", ":relation_with_troop", 8), #changed from 16
		    (val_sub, ":relation_with_liege_change", 2),

		    (val_clamp, ":relation_with_liege_change", -5, 3),
			
			(try_begin),
				#upstanding and goodnatured lords will not lose relation unless they actively dislike the other lord
				(this_or_next|troop_slot_eq, ":other_lord", slot_lord_reputation_type, lrep_upstanding),
					(troop_slot_eq, ":other_lord", slot_lord_reputation_type, lrep_goodnatured),
				(ge, ":relation_with_troop", 0),
				(val_max, ":relation_with_liege_change", 0),
			(else_try),
				#penalty is increased for lords who have the more unpleasant reputation types
				(this_or_next|troop_slot_eq, ":other_lord", slot_lord_reputation_type, lrep_selfrighteous),
				(this_or_next|troop_slot_eq, ":other_lord", slot_lord_reputation_type, lrep_debauched),
					(troop_slot_eq, ":other_lord", slot_lord_reputation_type, lrep_quarrelsome),
				(lt, ":relation_with_liege_change", 0),
				(val_mul, ":relation_with_liege_change", 3),
				(val_div, ":relation_with_liege_change", 2),
			(try_end),

			
		    (neq, ":relation_with_liege_change", 0),
			#removed Nov 2010
#		  	(val_mul, ":relation_reduction", ":faction_size_multiplier"),
#		  	(val_div, ":relation_reduction", 2),
			#removed Nov 2010
			
			(try_begin),
				(troop_slot_eq, ":other_lord", slot_troop_stance_on_faction_issue, ":lord_troop_id"),
				(val_add, ":relation_with_liege_change", 1),
				(val_max, ":relation_with_liege_change", 1),
			(try_end),
			
 	        (call_script, "script_troop_change_relation_with_troop", ":other_lord", ":faction_leader", ":relation_with_liege_change"),
			(val_add, "$total_promotion_changes", ":relation_with_liege_change"),
			
		    (try_begin),
				(this_or_next|le, ":relation_with_liege_change", -4), #Nov 2010 - changed from -8
				(this_or_next|troop_slot_eq, ":other_lord", slot_troop_promised_fief, 1), #1 is any fief
					(troop_slot_eq, ":other_lord", slot_troop_promised_fief, ":center_no"),
				(call_script, "script_add_log_entry", logent_troop_feels_cheated_by_troop_over_land, ":other_lord", ":center_no", ":lord_troop_id", ":lord_troop_faction"),
		    (try_end),
		  
		(try_end),
	(try_end),
	
	#Villages from another faction will also be transferred along with a fortress
    (try_begin),
		(is_between, ":center_no", walled_centers_begin, walled_centers_end),
        (try_for_range, ":cur_village", villages_begin, villages_end),
			(party_slot_eq, ":cur_village", slot_village_bound_center, ":center_no"),
			(store_faction_of_party, ":cur_village_faction", ":cur_village"),
			(neq, ":cur_village_faction", ":lord_troop_faction"),
			
			(call_script, "script_give_center_to_lord", ":cur_village", ":lord_troop_id", 0),
        (try_end),
    (try_end),       
  ]),
 
i have :
["stones", "Stones", [("throwing_stone",0)], itp_type_thrown |.........
[(ti_on_init_item, [(particle_system_add_new, "psys_torch_fire"),(particle_system_add_new, "psys_torch_smoke").............

how the Stones are flying then it does psys_torch_smoke and psys_torch_smoke ? , please help me
sorry my english bad  :mrgreen:  :mrgreen:  :mrgreen:
 
A quick question. I'm trying to choose a random troop. My goal would be to have a random troop type (from within a set of choices) chosen to be recruit-able in the village menu. So I guess I'm wondering is there something I could call to make this random choice? Or is what I'm thinking of even possible? I've been poking around with little luck so far...

I guess something analogous to random.choice(x,y,z)
 
Status
Not open for further replies.
Back
Top Bottom