Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Is there a way to 'tweak' the game files to increase the number of people walking around in towns and villages? Or does it involve making an entirely new module? Please let me know either way, thanks.
 
Code:
        ("init_town_walkers",
          [
            (try_begin),
              (eq, "$town_nighttime", 0),
              (try_for_range, ":walker_no", 0, num_town_walkers),
                (store_add, ":troop_slot", slot_center_walker_0_troop, ":walker_no"),
                (party_get_slot, ":walker_troop_id", "$current_town", ":troop_slot"),
                (gt, ":walker_troop_id", 0),
                (store_add, ":entry_no", town_walker_entries_start, ":walker_no"),
                (set_visitors, ":entry_no", ":walker_troop_id", number), #change number and set_visitor to plural
              (try_end),
            (try_end),
        ]),
 
Somebody said:
Code:
        ("init_town_walkers",
          [
            (try_begin),
              (eq, "$town_nighttime", 0),
              (try_for_range, ":walker_no", 0, num_town_walkers),
                (store_add, ":troop_slot", slot_center_walker_0_troop, ":walker_no"),
                (party_get_slot, ":walker_troop_id", "$current_town", ":troop_slot"),
                (gt, ":walker_troop_id", 0),
                (store_add, ":entry_no", town_walker_entries_start, ":walker_no"),
                (set_visitors, ":entry_no", ":walker_troop_id", number), #change number and set_visitor to plural
              (try_end),
            (try_end),
        ]),

OK, thanks Somebody. So can I add this to my 'scripts' file in my native game? Or do I need to create a new module?
 
While things slightly advanced thanks to Abhuvas help, the problem with bandits at sea is still not resolved. If they move too far away from the shore they do get send back to the specified point. Yet they do not reinitialize their behavior once they have "achieved" that objective - so they all clutter around that location, which is why i assigned them the behavior to patrol around that area once they get within a certain distance of said location. However even though they patrol - they do not attack. I have tried setting their aggressiveness to 150, i have tried setting player faction and player supporter faction relation to the bandit faction to negative, yet the bandit ships completely ignore the player once they have been send back (due to being too far into the open sea) and reassigned the patrol behavior.

This is the code that is called every hour:
Code:
		(set_fixed_point_multiplier, 10),
		(try_for_parties, ":party_no"),													#Floris Get Back to Shore Check
			(party_get_template_id,":template",":party_no"),
			(this_or_next|eq, ":template", "pt_sea_raiders_ships"),
			(this_or_next|eq, ":template", "pt_sea_raiders_ships_r"),
			(eq, ":template", "pt_sea_raiders_ships_e"),
			(try_begin),
				(party_get_position, pos1, ":party_no"),
				(position_get_y, ":value_y", pos1),
				(position_get_x, ":value_x", pos1),
				(val_div, ":value_y", 10),
				(val_div, ":value_x", 10),
				(this_or_next|gt, ":value_y", 155),
				(lt, ":value_x", -180),
				(assign, reg1, ":value_y"),
				(assign, reg2, ":value_x"),
				(display_message, "@X is {reg2} and Y is {reg1}"),
				(party_set_flags, ":party_no", pf_default_behavior, 0),
				(party_set_ai_behavior, ":party_no", ai_bhvr_travel_to_party),
				(party_set_ai_object, ":party_no", "p_ship_raider_spawn_point_1"),
				(display_message, "@Get Back to Shore"),
			(else_try),
				(store_distance_to_party_from_party, ":distance", ":party_no", "p_ship_raider_spawn_point_1"),
				(lt, ":distance", 4),
				(party_set_flags, ":party_no", pf_default_behavior, 1),
				(party_set_ai_behavior, ":party_no", ai_bhvr_patrol_party),
				(party_set_ai_object, ":party_no", "p_ship_raider_spawn_point_1"),
				(party_set_aggressiveness, ":party_no" , 150),
				(display_message, "@Now get back to sea"),
			(try_end),
		(try_end),

I have also tried to simply set the default behavior flag, but that by itself left them all sitting around the spawn point (after they were assigned to travel there). If anybody knows a way to restore default bandit behavior after a specific AI was assigned (to get them back to the shore), please share. This is the last somewhat gamebreaking thing in seafaring and i would prefer fixing it instead of letting the player escape from a ship regardless of whether he is anywhere near land or not.
 
A question here. In my project i usually make the models about 600 polies for weapon&armor stuff, 1000 for scene props.  Is it a bit much in case of lagging&crashes or even less more than it can already handle?
 
dunde said:
How about do some tricks with ti_on_init_item? Returning the troop_id if the agent_id is not -1 to write to troop's slot about skill bonus?
Possibly  troubles :
  • Need to check for multiple agents with same troop id. May be 1 slot for each special item with the bonus will simplify it.
  • Need more check if agent unequipt the item in scene.
It sounds like I don't need to write anything about bonus on ti_on_init_item, I just need to set global variable, basing on comparison agent_id with -1. 
And when recall it in script_game_get_skill_modifier_for_troop.

Ok, seems I get answer to my question, that there in no simple way to check if we are inside mission, any work around will be laborious.

Thanks for brainstorm, guys.
 
Duh said:
I have also tried to simply set the default behavior flag, but that by itself left them all sitting around the spawn point (after they were assigned to travel there). If anybody knows a way to restore default bandit behavior after a specific AI was assigned (to get them back to the shore), please share. This is the last somewhat gamebreaking thing in seafaring and i would prefer fixing it instead of letting the player escape from a ship regardless of whether he is anywhere near land or not.
I think you're missing party_set_ai_patrol_radius - also, party_set_aggressiveness should only go up to 15. Look in module_simple_triggers for the bandit lair patrol code.
Cozur said:
How exactly do invasions work?
You make a trigger that spawns a bunch of parties given certain conditions are fulfilled and make a hidden faction declare war on everybody else.
 
Belendor Torheal Artendor said:
A question here. In my project i usually make the models about 600 polies for weapon&armor stuff, 1000 for scene props.  Is it a bit much in case of lagging&crashes or even less more than it can already handle?
 
Well, I'm not sure Belendor. I have tons of guns in WW3 over 1k polygons, and with LOD's, it works fine for me (so far). Even spamming it on 75-100 bots.
I guess the answer would be that if you have LOD's, it should be fine
 
Specialist said:
Well, I'm not sure Belendor. I have tons of guns in WW3 over 1k polygons, and with LOD's, it works fine for me (so far). Even spamming it on 75-100 bots.
I guess the answer would be that if you have LOD's, it should be fine

Uhm, i guess that gets me what i ask of. Thanks, spec.
 
What code part in v1.143 module system handles reinforcement waves troop selection in field battles?
Single player campaign and troops from players stacks are in my mind.
I have had hard time finding that particular code part. Or is it hard coded?


 
You can control the timing and size but not composition of reinforcements via add_reinforcements_to_entry. If you simply add_visitors or spawn_agent this leads to problems with agent_get_party and casualties.
 
Somebody said:
You can control the timing and size but not composition of reinforcements via add_reinforcements_to_entry. If you simply add_visitors or spawn_agent this leads to problems with agent_get_party and casualties.

All right. That answered my question.
 
For some reason it seems that my random values are always the same each time the scene is started up. I've made a script that spawns scene props in random positions around a position, and it sort of works. It does neatly place the props around the area, but it always places them in the same spots each time I load the map. Also, it has the same problem on both local and dedicated servers, but the positions are different for some reason.

Here's the script:

Code:
		 (scene_prop_get_num_instances, ":marker_num", "spr_spawn_marker_tree"),
		 (try_for_range, ":cur_instance", 0, ":marker_num"),
		   (scene_prop_get_instance, ":instance", "spr_spawn_marker_tree", ":cur_instance"),
		   (prop_instance_is_valid, ":instance"),
		   (prop_instance_get_position, pos1, ":instance"),
		   (prop_instance_get_scale, pos3, ":instance"),
		   (position_get_scale_x, ":scale", pos3),
		   (store_div, ":amount", ":scale", 100),
		   (try_for_range, reg0, 0, ":amount"),
		     (init_position, pos2),
		     (position_copy_origin, pos2, pos1),
		     (store_random_in_range, ":movement", -1100, 1100),
		     (position_move_x, pos2, ":movement"),
		     (store_random_in_range, ":movement", -1100, 1100),
		     (position_move_y, pos2, ":movement"),
		     (store_random_in_range, ":movement", 0, 360),
		     (position_rotate_z, pos2, ":movement"),
		     (store_random_in_range, ":movement", -5, 5),
		     (position_rotate_x, pos2, ":movement"),
		     (store_random_in_range, ":movement", -5, 5),
	             (position_rotate_y, pos2, ":movement"),
		     (position_set_z_to_ground_level, pos2),
		     (store_random_in_range, ":prop_kind", "spr_tree_destructible_a", "spr_rock_destructible_ore_1"),
		     (set_spawn_position, pos2),
		     (spawn_scene_prop, ":prop_kind"),
		   (try_end),
		 (try_end),

Help please.
 
@Shredzorz,
In my experience (I wish I could be more specific, but I've not located any patterns as such) the position_move_* operations seem to work very oddly at times, so my assumption is that your issues lie in the use of those operations. More predictably random placement would likely result in rewriting the code to utilize the position_set_* operations.
 
Status
Not open for further replies.
Back
Top Bottom