Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
How can I get cattle to accompany me like a caravan? (the quest caravans)

I've tracked down the code for cattle, and there's an AI behavior. I just can't find the caravan behavior.
 
HyperCharge said:
Im added shield bash.But,i want to make useful for AI

If you didn't understand;

i can shield bash.But i want to use this feature to AI

Its may be possible ? if its possible,How ?
Well, you'll have to make a repeating mission template trigger which will check currently active agents if shield bashing makes sense for them at the current moment, and for those who are eligible, activate it the same way it's activated for player.

TheGME said:
How can I get cattle to accompany me like a caravan? (the quest caravans)

I've tracked down the code for cattle, and there's an AI behavior. I just can't find the caravan behavior.
Escort, I believe. Look in header_parties.py, all party AI's are there.
 
lol I was just here writting a post to ask if anyone could see what was the problem and suddently I read "This script is called from the game engine when a multiplayer map is ended in clients (not in server)." when I was using a (multiplayer_is_server), line  :oops:
Code:
  #script_multiplayer_server_before_mission_start_common
  # INPUT: none
  # OUTPUT: none
  ("multiplayer_server_before_mission_start_common",
   [
...
	 ##LWBR
     (set_rain, "$g_rain_type", "$g_rain_amount"),
     (scene_set_day_time, "$g_round_day_time"),
     (try_begin),
		(multiplayer_is_server),
		(try_begin),
			(eq,"$g_rain_type",0),
			(str_store_string,s1,"@Clear"),
		(else_try),
			(eq,"$g_rain_type",1),
			(str_store_string,s1,"@Rainy"),
		(else_try),
			(str_store_string,s1,"@Snowy"),
		(try_end),
		(assign,reg1,"$g_rain_amount"),
		(str_store_string, s1, "@Weather set to {s1} with {reg1} strenght"),
		#(call_script, "script_lwbr_send_msg_to_all_players"),
		(server_add_message_to_log, s1),
		(assign,reg1,"$g_round_day_time"),
		(str_store_string, s1, "@Day time set to {reg1}"),
		#(call_script, "script_lwbr_send_msg_to_all_players"),
		(server_add_message_to_log, s1),
     (try_end),
	 ##LWBR
...
     ]),
Code:
  #script_game_set_multiplayer_mission_end
  # This script is called from the game engine when a multiplayer map is ended in clients (not in server).
  # INPUT:
  # none
  # OUTPUT:
  # none
  ("game_set_multiplayer_mission_end",[
	(assign, "$g_multiplayer_mission_end_screen", 1),
	##LWBR
	(try_begin),
		(multiplayer_is_server),
		(try_begin),
			(eq, "$g_rain_type", -10),#Random Weather
			(store_random_in_range, "$g_rain_type", 0, 3),
		(else_try),
			(neq, "$g_rain_type", 0),
			(store_random_in_range, "$g_rain_amount", 0, 101),
		(try_end),
		(try_begin),
			(eq, "$g_round_day_time", -10),#Random Time
			(store_random_in_range, "$g_round_day_time", 6, 18),
		(else_try),
			(eq, "$g_round_day_time", -11),#Random Time no Night
			(store_random_in_range, "$g_round_day_time", 0, 24),
		(try_end),
		(try_begin),
			(eq, "$g_fog_distance", -10),#No Fog
			(assign, "$g_fog_distance", 1300),
		(else_try),
			(eq, "$g_fog_distance", -11),#Random Fog
			(store_random_in_range, "$g_fog_distance", 100, 1300),
		(else_try),
			(eq, "$g_fog_distance", -12),#Sparse Fog
			(store_random_in_range, "$g_fog_distance", 600, 1300),
		(else_try),
			(eq, "$g_fog_distance", -13),#Thick Fog
			(store_random_in_range, "$g_fog_distance", 100, 800),
		(try_end),
		(val_min, "$g_fog_distance", 999),
		(get_max_players, ":num_players"),
		(try_for_range, ":player", 1, ":num_players"),
			(player_is_active, ":player"),
			(multiplayer_send_3_int_to_player, ":player", multiplayer_event_lwbr_client, lwbr_client_set_var, lwbr_client_var_day_time,			"$g_round_day_time"),
			(multiplayer_send_3_int_to_player, ":player", multiplayer_event_lwbr_client, lwbr_client_set_var, lwbr_client_var_rain_type,		"$g_rain_type"),
			(multiplayer_send_3_int_to_player, ":player", multiplayer_event_lwbr_client, lwbr_client_set_var, lwbr_client_var_rain_amount,		"$g_rain_amount"),
			(multiplayer_send_3_int_to_player, ":player", multiplayer_event_lwbr_client, lwbr_client_set_var, lwbr_client_var_fog_dist,			"$g_fog_distance"),
			(multiplayer_send_3_int_to_player, ":player", multiplayer_event_lwbr_client, lwbr_client_set_var, lwbr_client_var_fog_color_red,	"$g_fog_r"),
			(multiplayer_send_3_int_to_player, ":player", multiplayer_event_lwbr_client, lwbr_client_set_var, lwbr_client_var_fog_color_green,	"$g_fog_g"),
			(multiplayer_send_3_int_to_player, ":player", multiplayer_event_lwbr_client, lwbr_client_set_var, lwbr_client_var_fog_color_blue,	"$g_fog_b"),
		(try_end),
	(try_end),
	##LWBR
  ]),
Code:
16:26:19 - Weather set to Clear with 0 strenght 
 16:26:19 - Day time set to 12 
 16:28:12 - Weather set to Clear with 0 strenght 
 16:28:12 - Day time set to 12 
 16:29:19 - Weather set to Clear with 0 strenght 
 16:29:19 - Day time set to 12 
 16:29:32 - Weather set to Clear with 0 strenght 
 16:29:32 - Day time set to 12 
 16:29:44 - Weather set to Clear with 0 strenght 
 16:29:44 - Day time set to 12 
 16:29:57 - Weather set to Clear with 0 strenght 
 16:29:57 - Day time set to 12 
 16:30:19 - Weather set to Clear with 0 strenght 
 16:30:19 - Day time set to 12 
 16:30:39 - Weather set to Clear with 0 strenght 
 16:30:39 - Day time set to 12 
 16:30:59 - Weather set to Clear with 0 strenght 
 16:30:59 - Day time set to 12 
 16:45:31 - Weather set to Clear with 0 strenght 
 16:45:31 - Day time set to 12 
 16:53:54 - Weather set to Clear with 0 strenght 
 16:53:54 - Day time set to 12 
 16:54:18 - Weather set to Clear with 0 strenght 
 16:54:18 - Day time set to 12 
 16:58:27 - Weather set to Clear with 0 strenght 
 16:58:27 - Day time set to 12 
 16:59:10 - Weather set to Clear with 0 strenght 
 16:59:10 - Day time set to 12
does anyone knows if there is a multiplayer script that gets called when the mission ends on the server?

edit: just found it "ti_on_multiplayer_mission_end"
 
For some reason this prop will spawn in the position I want, but will not move. Any suggestions?

Code:
(copy_position, pos3, pos1),
		(position_move_z, pos3, 3000),
		(set_spawn_position, pos3),
		(spawn_scene_prop, "spr_artillery_shell"),
		(scene_prop_get_num_instances, ":shellNum", "spr_artillery_shell"),
		(scene_prop_get_instance, ":shell", "spr_artillery_shell", ":shellNum"),
		(prop_instance_animate_to_position, "spr_artillery_shell", pos1, 5),
 
These two lines will not give you the instance id (the one that is on the scene)
(scene_prop_get_num_instances, ":shellNum", "spr_artillery_shell"),
(scene_prop_get_instance, ":shell", "spr_artillery_shell", ":shellNum"),

After spawn_scene_prop, in reg0 will be store the instance id.
 
Ok my bad  :oops:
Then you could do how @Ikaguia suggested: put (val_sub, ":shellNum", 1), in between those two lines that I quoted.

(I know that you fixed it, but just in case you want that scene prop kind to be used for anything else and not be moved to pos1 when it is spawned)
 
Prop instances are enumerated from 0, just like everything else in Warband.

So if you get the total number of instances, you must decrease it by 1 as Ikaguia said.
 
I see.

Well I have hit another snag, Im using a slightly modified version of beavers osp grenade script for the artillery impact. the shell moves okay and all the graphics work, but the damaging doesn't seem to process.


Artillery scene prop
Code:
("artillery_shell",sokf_moveable,"artillery_shell","bo_artillery_shell", [(ti_on_init_scene_prop,
         [
		 (store_trigger_param_1, ":instance_no"),
		 (prop_instance_animate_to_position, ":instance_no", pos1, 700),
        ]),
		
		(ti_on_scene_prop_animation_finished,
         [
		 (assign, ":grenadier", reg1),
		 (try_for_agents,":target"),
        (agent_get_position,pos2,":target"),
        (get_distance_between_positions,":dist",pos1,pos2),
	(try_begin),
            (lt,":dist",250),	#Distance between target and impact position needs to be less than 
				#this for it to deal damage (in cm's)
            (store_agent_hit_points,":hp",":target",1),
	    (store_random_in_range,":dmg",60,100),    #Deal random damage between those two values
	    (val_sub,":hp",":dmg"),
	    (agent_set_hit_points,":target",":hp",1),
	    (le,":hp",0),
	    (agent_deliver_damage_to_agent,":grenadier",":target"),
	(try_end),
		(particle_system_burst,"psys_pistol_smoke",pos1,500),
        (particle_system_burst,"psys_village_fire_big",pos1,500),
        (play_sound_at_position,"snd_explosion",pos1),
        ]),
     ]),

Artillery Strike Item
Code:
["artillery", "artillery Strike", [("kg13",0)], itp_type_thrown|itp_merchandise|itp_primary|itp_no_pick_up_from_ground, itcf_throw_axe, 360, weight(2)|difficulty(0)|spd_rtng(105)|shoot_speed(55)|thrust_damage(1,blunt)|max_ammo(3)|weapon_length(5), imodbits_thrown_minus_heavy, [(ti_on_missile_hit, [	
(this_or_next|multiplayer_is_server), #Only run on server for multiplayer
(neg|game_in_multiplayer_mode),

(store_trigger_param_1,":grenadier"),
(assign, reg(1), ":grenadier"),
		(copy_position, pos3, pos1),
		(position_move_z, pos3, 30000),
		(set_spawn_position, pos3),
		(spawn_scene_prop, "spr_artillery_shell")
 
Frenzied_Crocoduck_Herder said:
I was wondering if I could bind the pause cheat to another key and make it work with out the cheat mode being activated.
The pause cheat is hardcoded. You can use
Code:
[color=navy](mission_set_time_speed, <value_fixed_point>),[/color]
as a hacky workaround, but you can't set the time to zero, so you'll have to do with small values. Also, it appears to work only when cheat mode is enabled, so this isn't really a helpful answer.
If you're using the WSE, you've got some other operations at your disposal (stop_time, options_get_cheat_mode, options_set_cheat_mode) that will do the trick, but I don't think it's possible to do what you want without WSE.
 
@ Lumos, that's a shame, man. Such a thing would be really helpful for my particular mod.

I have another question, where are the map textures located? I wish to give the ford texture the same one as the ocean so it doesn't look out of place.
 
The_dragon said:
Can someone tell me when game_in_multiplayer_mode fails and when it is true?
My guess is it fails when the game is in single-player mode. :smile:

I.e. any time during standard game, tutorial or quick battle.
 
I asked the question above because I saw many cases using these two lines to check if the game is server, even in native (for scene props)
(this_or_next|multiplayer_is_server),
(neg|game_in_multiplayer_mode),

Wouldn't it be enough to use (multiplayer_is_server) only? (it will fail if the game is in single player, since it is not server)

Also I can't see the logic of those two lines if game_in_multiplayer_mode would fail if it is not multiplayer (I am judging the same as you, @Lav).

"multiplayer_is_server" will be true if it is server                                      ||
"neg|game_in_multiplayer_mode" will be true if it is not multiplayer        ||  => operations after these two lines will be executed if it is server or if it is single player, BUT the native operations after them refers only to multiplayer (see "catapult_destructible" for example), resulting in a contradiction

 
Would love some feedback on this:

Was thinking about adding a sort of market feature, where certain cities would be known far and wide as places where, say pumpkins, are produced. But the big pumpkin market would only happen once a year, and run for a month.

Would do it by having a trigger that fires informing the player the market has begun, adding a variable that allows the player to access the great pumpkin market in Praven, and then have another trigger fire after a month announcing the end of the big pumpkin market, adding another variable that removes the option to access the market in Praven.

Two things I'd like some feedback on:

Execution - anyone got a better idea for a system?

I wouldn't want the player to be able to sell the pumpkins in the usual marketplace in Praven for a profit, any way to drop the price of a certain item in a certain city for a set period of time?
 
Hello!

I want to ask if it is possible to add executions in towns, for example it would work like when you have a wedding in Singleplayer, and you have all those animations.
The idea is that you enter a town, and you suddenly see someone being executed, either he/she is being hung, or is awaiting his/her head to be cut off.
Could something like this be possible to achieve?
 
Status
Not open for further replies.
Back
Top Bottom