Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Is there a better way to add combat triggers to mission templates than pasting it 10 times?
I see diplomacy defines them in the top and them runs them together, but I get error whenever I try to run mine from the top instead of pasting the whole thing, and you still have to put it in many times.
 
So I'm guessing nobody knows how to convert a string like itm_hunting_bow into item's numeric id (in this example: 54:cool:?
 
If I set flag to troop - "guarantee ranged" and give him 2,3 different range weapons, for example carbine, carbine clip and grenade, does the flag guarantees all ranged I gave him, or just one of them?


@Pio
I have an item name stored as a string in the database. After I receive that string in the game I want to equip agent with that item. The problem is that I receive it as s0 and it doesn't get converted into numeric item id as it normally happens when you do
Code: [Select]
(assign, ":item", "itm_british_pistol"), # this will convert itm_british_pistol to item's numeric id - this totally works

This means that the following code will not work:
Code: [Select]
(agent_equip_item, ":agent_no", s0, ":cur_slot"), # s0 containts itm_british_pistol received from the database - doesn't work


How do I make it work? How to convert a string item name like itm_british_pistol into a numeric id?

Pio I don't know how to convert s0 back to item id, but maybe you show us this piece of code which makes this s0?

To create s0 code normally uses piece of code like this:

Code:
str_store_item_name             = 2325  # (str_store_item_name, <string_register>, <item_id>),

So my guess is, your best move is to find piece of code for example

Code:
(str_store_item_name, s0, <item_id>),   #<item_id> it can be ":item"
or something like this

when your "database" code sends normally s0 , just make it to send ":item", or assign it to register
Code:
(assign, reg0, ":item_id"),
and send reg0.

Maybe if you have problems post a piece of code of your database?

And by the way:
if your item is for example
Code:
["pirate_energy_shuriken_blaster", "Energy Heavy Blaster", [("shuriken_blaster",0),("inv_shuriken_blaster",ixmesh_inventory)], itp_type_crossbow|itp_merchandise|itp_two_handed|itp_primary|itp_can_penetrate_shield|itp_bonus_against_shield|itp_crush_through|itp_can_knock_down|itp_extra_penetration|itp_cant_reload_while_moving|itp_ignore_gravity|itp_ignore_friction, itcf_shoot_crossbow|itcf_carry_crossbow_back|itcf_reload_musket, 5200, weight(8.5)|abundance(40)|difficulty(16)|spd_rtng(55)|shoot_speed(62)|thrust_damage(120,pierce)|max_ammo(4)|accuracy(94), imodbits_none, [(ti_on_weapon_attack,[(play_sound,"snd_laser_blaster_shot"),(position_move_x,pos1,27),(position_move_y,pos1,36),(particle_system_burst,"psys_pistol_flare",pos1,15)])] ,[fac_kingdom_3] ],
then your s0 will be not "itm_pirate_energy_shuriken_blaster" but it will be "Energy Heavy Blaster"
 
Joemog said:
Is there a better way to add combat triggers to mission templates than pasting it 10 times?
I see diplomacy defines them in the top and them runs them together, but I get error whenever I try to run mine from the top instead of pasting the whole thing, and you still have to put it in many times.

you can use Python variables to store them, that way you don't need to copy and paste the code, just the reference. Then you can group up triggers that go together into one variable/reference. You mentioned Floris, so you already saw that done

VC is also a good example. They have grouped triggers for combat, for weather effects, etc.  This one is about enhanced combat

Code:
#chief listos para aplicar
battle_mode_triggers = [  #ca. 43 triggers
  common_realistic_casualties,
  sistema_fatiga, #stamina
  start_display_fatiga, #stamina
  recupera_fatiga,#stamina
  suma_fatigue,#stamina
  suma_fatigue_player,#stamina
  resta_fatigue_porcorrer,#stamina
  resta_fatigue,#stamina
  more_difficult_damage, #insane damage
  respiracion_moribunda, #respiracion con bloodloss
  respiracion_moribunda2, #respiracion con bloodloss
  respiracion_moribunda3, #respiracion con bloodloss
  common_critical_system,
  common_critical_system2,
  common_wound_system,
  common_weapon_break,
  common_armor_break,
  common_drowning,
  common_disable_ai_crouching,
] + dedal_sp_triggers + player_trait + berserker_ai_mode + common_gore+common_gear_check
two things to notice: 1) it has several triggers in one; 2) it can even call triggers saved in another file (not just module_mission_templates.py)

You will always have to apply your trigger to a mission template, as they are not generic (you need to decide if they should be in a particular mission or not). The more missions you have in your mod the more specialized they become (quests, unique encounters, etc)


Pio said:
So I'm guessing nobody knows how to convert a string like itm_hunting_bow into item's numeric id (in this example: 54:cool:?
your question was answered. You use the same ID reference from the module system (ID_items.py), so you can use operations or your custom strings on Warband and whatever you want on your website/database/server
 
I have a question: How do we use another mod's map (I have that mod's module system)? If you're wondering what world map I'm using, it's the 16th Century World Map. Thanks in advance!
 
maater66241 said:
I have a question: How do we use another mod's map (I have that mod's module system)? If you're wondering what world map I'm using, it's the 16th Century World Map. Thanks in advance!
just move its map.txt to your mod folder.

Edit:
Yes. As MadGuarang pointed out, you also need to move parties but you said you have the mod's module system. So you can move module_parties.py codes to yours one (if you have also module system of the mod you want to use 16th Century World Map in.). map codes aren't included by module system but parties are.
MadGuarang said:
@maater66241

you can just copy/paste map.txt from mod to mod, but you have to do something also with parties.txt which are different in every mod. They give you positions of all towns, castles and villages.

If this would not be same in two mods the game prbably will broke / ctd.
 
@maater66241

you can just copy/paste map.txt from mod to mod, but you have to do something also with parties.txt which are different in every mod. They give you positions of all towns, castles and villages.

If this would not be same in two mods the game prbably will broke / ctd.
 
MadGuarang said:
Indeed, factions are mostly relevant on the camapign map. In battles you have teams. You also work mostly with agents, not troops. agents are spawned from their respective troop template. Check out Lav's expanded header operations, or even better this module system version by Lav. You will find in Lav's expanded header_operations.py detailed descriptions to all operations neatly sorted. You will find all operations related to agents and teams under Z22. Start with those two operations:
Code: [Select]
agent_get_team                          = 1770  # (agent_get_team, <destination>, <agent_id>),
                                                # Retrieves the team that the agent belongs to.
agent_set_team                          = 1771  # (agent_set_team, <agent_id>, <value>),
                                                # Puts the agent to specified team number.

DerGreif - thank you for your help. Yes, I use Lav headers, it is very helpful. I used faction not teams because by "find all" I have found some code in missions templates I thought could be relevant. Anyways - agent_get_team/set it is what I needed.

edit:
But my first problem is that even first part of my code doesn't work. If "ti_on_agent_killed_or_wounded" would work it should spawn debug message - for hero "@Hero become undead!"

So I stripped code just to this:
Code:
#script on attacker persuading defender to change faction during the batlle
common_battle_persuadraton = (
  ti_on_agent_killed_or_wounded, 0, 0, [],
  [
    (store_trigger_param, ":agent_no", 2), #attacker
    (store_trigger_param, ":troop_id", 1), #defender
  

   
  (store_troop_faction,":attacker_faction",":agent_no"),

    
    (try_begin),
	    (agent_get_wielded_item, ":item_w", ":agent_no", 0),     # (agent_get_wielded_item, <destination>, <agent_id>, <hand_no>),
                                                    # Retrieves the item reference that the agent is currently wielding in his right hand (hand_no = 0)  
      	
		(eq, ":item_w", "itm_persuadraton"), #does attacker wields persuadraton
		
	
		
	#MOST IMPORTANT: DEFEDER TROOP BECOMES ATTACKER TROOP
	(troop_set_faction,":troop_id",":attacker_faction"),
	(display_message, "@faction changed!"), #debug info
   	   

	(try_end),        
  ])

When I run game to test it I wield this "Persuadraton" and I don't see debug messages. That is my main problem for now. If somebody could tell me what I am doing wrong I would be grateful.

EDIT: I changed code to that:
Code:
#script on attacker persuading defender to change faction during the batlle
common_battle_persuadraton = (
  ti_on_agent_killed_or_wounded, 0, 0, [],
  [
    (store_trigger_param, ":agent_no", 2), #attacker
    (store_trigger_param, ":troop_id", 1), #defender
  
  (agent_get_team, ":persuaded_faction",":agent_no"),
  
  
    
    (try_begin),
	    (agent_get_wielded_item, ":item_w", ":agent_no", 0),    
      	
		(eq, ":item_w", "itm_persuadraton"), #does attacker wields persuadraton
		
	
		
	#MOST IMPORTANT: DEFEDER TROOP BECOMES ATTACKER TROOP
	(agent_set_team, ":troop_id", ":persuaded_faction"),
	(display_message, "@agent persuaded!"), #debug info
   	   

	(try_end),        
  ])

debug message shows up, so I think I'll manage from here. Thanks again for help!

Your code still doesn't do what you think it does.  ti_on_agent_killed_or_wounded is only called when an agent is killed or knocked out, so changing the team will not do anything because the agent is already a casualty.  2nd  your line  (store_trigger_param, ":agent_no", 2), #attacker is not the attacker but the agent id of the defender.  Your line (agent_set_team, ":troop_id", ":persuaded_faction"), is not going to work because you cannot send agent_set_team a troop id.  You must send it an agent id. 

So, the trigger you are wanting is the trigger ti_on_agent_hit.  This will fire every time an agent is hit instead of killed or wounded.  There you get both defender agent id and attacker agent id.  From there you can use their troop ids to get the persuasion skills of the attacker and defender and check against those to then change the team of the defender agent.  Be aware that pretty much no npc has persuasion set above 0 so you will need to modify that in module troops for every troop and npc. 
 
If a party has 0 troops (any of the operations that count # of troops [store_party_size or party_get_number_companions]) return 0), is that party considered 'active'?

EDIT: Another unrelated question:

Is there a way to 'hide' a troop from the hiring screen (basically, either make the troop unhirable OR simply have it there but can't be seen by the player)?
 
kalarhan said:
Joemog said:
Is there a better way to add combat triggers to mission templates than pasting it 10 times?
I see diplomacy defines them in the top and them runs them together, but I get error whenever I try to run mine from the top instead of pasting the whole thing, and you still have to put it in many times.

you can use Python variables to store them, that way you don't need to copy and paste the code, just the reference. Then you can group up triggers that go together into one variable/reference. You mentioned Floris, so you already saw that done

VC is also a good example. They have grouped triggers for combat, for weather effects, etc.  This one is about enhanced combat

Code:
#chief listos para aplicar
battle_mode_triggers = [  #ca. 43 triggers
  common_realistic_casualties,
  sistema_fatiga, #stamina
  start_display_fatiga, #stamina
  recupera_fatiga,#stamina
  suma_fatigue,#stamina
  suma_fatigue_player,#stamina
  resta_fatigue_porcorrer,#stamina
  resta_fatigue,#stamina
  more_difficult_damage, #insane damage
  respiracion_moribunda, #respiracion con bloodloss
  respiracion_moribunda2, #respiracion con bloodloss
  respiracion_moribunda3, #respiracion con bloodloss
  common_critical_system,
  common_critical_system2,
  common_wound_system,
  common_weapon_break,
  common_armor_break,
  common_drowning,
  common_disable_ai_crouching,
] + dedal_sp_triggers + player_trait + berserker_ai_mode + common_gore+common_gear_check
two things to notice: 1) it has several triggers in one; 2) it can even call triggers saved in another file (not just module_mission_templates.py)

You will always have to apply your trigger to a mission template, as they are not generic (you need to decide if they should be in a particular mission or not). The more missions you have in your mod the more specialized they become (quests, unique encounters, etc)


Pio said:
So I'm guessing nobody knows how to convert a string like itm_hunting_bow into item's numeric id (in this example: 54:cool:?
your question was answered. You use the same ID reference from the module system (ID_items.py), so you can use operations or your custom strings on Warband and whatever you want on your website/database/server
Thanks! I got it working now. Since Diplomacy is my base, and it has some battle mode triggers I finally got it working putting it into those. So only have to make it one place now, awesome!

EDIT:
"2) it can even call triggers saved in another file (not just module_mission_templates.py)" - Does this mean triggers like ti_on_shield_hit that usually only works with item triggers can be used for mission doing this? Or any other cool things? Don't know why I asked this, I'll just try it out, sorry. Answer is no.
 
Hello guys,
I want to add randomly war, I added look like,
(1,
  [

    (try_for_range, ":cur_kingdom", "fac_kingdom_1", kingdoms_end),
        (faction_slot_eq, ":cur_kingdom", slot_faction_state, sfs_active),
 
(try_for_range, ":cur_kingdom_2", kingdoms_begin, kingdoms_end),
(neq, ":cur_kingdom", ":cur_kingdom_2"),
(faction_slot_eq, ":cur_kingdom_2", slot_faction_state, sfs_active),
(try_end),

    (call_script, "script_diplomacy_start_war_between_kingdoms", ":cur_kingdom", ":cur_kingdom_2", 1),
  (try_end),
  ]),
But the result
faction 1 decleare war to fac 16
fac 2  decleare war to fac 16
fac 3  decleare war to fac 16
fac 4  decleare war to fac 16
fac 5  decleare war to fac 16
fac 6  decleare war to fac 16
fac 7  decleare war to fac 16
fac 8  decleare war to fac 16
.
.
.
fac 16  decleare war to fac 16
I want to randomly war, example fac 8 - fac 11 or fac 2 - fac 14 etc..
 
Hello everyone,
I have a modding problem regarding custom battle scenes, and I need someone to light my way as I try to implement them for Native, but beforehand, I'll tell you the whole story.
I have long detested they way random battle scenes in Native are set up. I guess that each one of you had a bitter bite of the ubiquitous hilly and small forest scenes, the annoying mountains or any other weirdness thrown upon you by the game when you wanted to have a nice battle. I decided to put an end to that issue by taking the terrain generator and getting the best possible battle scenes for all the environments, and I also made sure to choose good looking flora. The result is: 20 plain scenes, 10 forest scenes, 5 plain river scenes, 10 mountain scenes (not the annoying type), 10 desert scenes, 5 desert forest scenes, 10 steppe scenes, 5 steppe forest scenes, 10 snow scenes, 5 snow forest scenes. That's quite a number, and they're all max sized on 2 meter polygons.
Now here is the challenge: actually implement them. I tried to look for the file responsible for random scene assignment and it looks like it's module_scripts.py, but I need further explanation on this process, as I'm quite bad with coding.
If anyone's wondering, here is my whole register:
Code:
0x0000000034400925000d23480000659c00004d18000006c9 - plains
0x0000000033a01221000d23480000511700001f5300004fd2 - plains
0x0000000035e00f21000d23480000511700001f530000785e - plains
0x0000000035e00f21000d23480000413900001f530000785e - plains
0x0000000035e00715000d23480000662800001f5300007ea6 - plains
0x0000000035e00715000d234800004b0600001f5300001905 - plains
0x000000003c600715000d23480000567b00001f5300001905 - plains
0x000000003c6009a7000d2348000068ab00001f530000639d - plains
0x000000003c6009a7000d23480000076d00001f5300001ac2 - plains
0x00000000368009a7000d23480000585500001f5300005855 - plains
0x0000000030e009a7000d234800001f5800001f5300001b9f - plains
0x00000000346009a7000d234800006c9200001f5300006421 - plains
0x00000000346009a7000d2348000064d200001f5300005603 - plains
0x0000000034600ca0000d2348000066cf00001f530000638a - plains
0x0000000034600ca0000d234800001bf700001f530000217f - plains
0x0000000034600ca0000d2348000052f100001f530000626d - plains
0x0000000034600ca0000d23480000148400001f53000064ca - plains
0x0000000038800ca0000d2348000079b800001f5300004656 - plains
0x0000000036e00820000d2348000079b800001f53000021e8 - plains
0x0000000034e00820000d2348000079b800001f5300000f0c - plains

0x0000000034e00557800d23480000127b00001f5300006aee - plains river
0x0000000034e005bf800d23480000048e00004ae900005db3 - plains river
0x0000000034e00633800d234800004d7800007a9000005db3 - plains river
0x0000000034e00633800d234800007d9100007a9000001a3b - plains river
0x000000003c600663800d234800004d6a00007a9000007359 - plains river

0x000000003c6013e3000d234800004d6a00007a9000000f49 - mountains
0x00000000344013e3000d2348000054c300007a9000000c96 - mountains
0x00000000344013e3000d234800005d5900007a90000064f6 - mountains
0x00000000390251e3000d23480000197500007a90000064f6 - mountains
0x00000000390013e3000d23480000197500007a900000075b - mountains
0x000000003c6013e3000d23480000197500007a9000006f62 - mountains
0x00000000372013e3000d23480000731200007a9000003311 - mountains
0x000000003a4013e3000d23480000731200007a90000030e6 - mountains
0x000000003c6a4fe3000d23480000731200007a90000013df - mountains
0x000000003c6d4763000d23480000731200007a9000001d00 - mountains

0x000000003c600715000d23480000499200001f530000639d - forest
0x00000000ba018a63000d23480000163100005cd6000004ad - forest
0x00000000ba018a63000d234800004a3e00005cd600001fcc - forest
0x00000000bc618a63000d234800004a3e00005cd600005be9 - forest
0x00000000bc618a63000d234800004a3e00005cd6000045cc - forest
0x00000000bc600e63000d234800004a3e00005cd600003541 - forest
0x00000000bc600e63000d2348000023f400005cd600006475 - forest
0x00000000bc600e63000d2348000023f400005cd600001e1d - forest
0x00000000bc600963000d2348000054f800005cd6000000d6 - forest
0x00000000bc600563000d234800000d1400000c2800006616 - forest
0x00000000bc600563800d23480000769000000c280000193e - forest

0x000000002c600563000d234800006fb100000c280000193e - steppe
0x000000002c600563000d23480000163d00000c2800000d67 - steppe
0x0000000020800563000d23480000163d00000c2800000a91 - steppe
0x0000000020800563000d234800006b1f00000c2800004a0a - steppe
0x0000000022e00563000d234800006b1f00000c2800006b90 - steppe
0x0000000022e00be3000d234800007d4c00000c28000031f4 - steppe
0x0000000022e00be3000d23480000012800000c2800000dc4 - steppe
0x000000002c6008e3000d234800002ada00000c2800000eb7 - steppe
0x000000002c6008e3000d234800003c6e00000c2800006676 - steppe
0x0000000027c008e3000d234800003c6e00000c2800006ba7 - steppe
0x00000000212008e3800d2348000011ba000067d500000c9c - steppe

0x00000000ac600563000d234800000692000000db00002d7c - steppe forest
0x00000000ac600863000d234800000692000000db000011cf - steppe forest
0x00000000ac600563000d234800000572000000db0000773a - steppe forest
0x00000000ac600563000d2348000060bd000000db00006d4c - steppe forest
0x00000000ac600563800d2348000060bd00005053000043dc - steppe forest

0x00000000d12008e3000d2348000011ba000067d500000c9c - desert forest
0x00000000dc600663000d234800000fdb000067d500007142 - desert forest
0x00000000dc600663000d234800004132000067d500003697 - desert forest
0x00000000dc600663000d234800002da0000067d500000fe5 - desert forest
0x00000000dc600a63000d2348000052d4000067d500007b2d - desert forest

0x000000005c601063000d2348000052d4000067d500007b2d - desert
0x000000005c6009e3000d2348000052d4000067d500006373 - desert
0x000000005c600563000d2348000052d4000067d5000029c1 - desert
0x000000005c600563000d2348000052d4000067d5000070e2 - desert
0x000000005c600563000d2348000052d4000067d500004f42 - desert
0x000000005c600963000d2348000052d4000067d500007cc4 - desert
0x000000005c600963000d2348000052d4000067d5000070e2 - desert
0x000000005c600963000d2348000052d4000067d50000474c - desert
0x000000005c600963000d2348000052d4000067d5000031b4 - desert
0x000000005c600963000d2348000052d4000067d500005ec1 - desert

0x00000000468005e3000d234800004470000067d500004470 - snow
0x0000000041c005e3000d234800004470000067d500002885 - snow
0x00000000426005e3000d234800004470000067d5000055c9 - snow
0x00000000426005e3000d23480000057f000067d500007ecc - snow
0x0000000043e005e3000d23480000057f000067d50000660b - snow
0x000000004c6005e3800d23480000057f0000403d00004af3 - snow
0x0000000044e005e3800d23480000057f000000db00005e1b - snow
0x0000000044e005e3000d23480000590a000000db0000455e - snow
0x00000000482005e3000d23480000590a000000db0000229b - snow
0x000000004c600563000d23480000590a000000db00006bd5 - snow
0x000000004c600ae3000d23480000590a000000db00006e4b - snow

0x00000000cc600ae3000d23480000590a000000db00006e4b - snow forest
0x00000000cc600563000d2348000037cc000000db000045f6 - snow forest
0x00000000cc600563000d234800001ea3000000db000027bb - snow forest
0x00000000cc600563000d234800005cfa000000db000017fb - snow forest
0x00000000cc600563000d234800007432000000db00002d7c - snow forest
If I'll manage to get it done, I'll make everything public for download. Thanks.
 
frozenpainter said:
Hello guys,
I want to add randomly war, I added look like,
(1,
  [

    (try_for_range, ":cur_kingdom", "fac_kingdom_1", kingdoms_end),
        (faction_slot_eq, ":cur_kingdom", slot_faction_state, sfs_active),
 
(try_for_range, ":cur_kingdom_2", kingdoms_begin, kingdoms_end),
(neq, ":cur_kingdom", ":cur_kingdom_2"),
(faction_slot_eq, ":cur_kingdom_2", slot_faction_state, sfs_active),
(try_end),

    (call_script, "script_diplomacy_start_war_between_kingdoms", ":cur_kingdom", ":cur_kingdom_2", 1),
  (try_end),
  ]),
But the result
faction 1 decleare war to fac 16
fac 2  decleare war to fac 16
fac 3  decleare war to fac 16
fac 4  decleare war to fac 16
fac 5  decleare war to fac 16
fac 6  decleare war to fac 16
fac 7  decleare war to fac 16
fac 8  decleare war to fac 16
.
.
.
fac 16  decleare war to fac 16
I want to randomly war, example fac 8 - fac 11 or fac 2 - fac 14 etc..
Then use store_random_in_range instead of try_for_range
(1,
  [

    (store_random_in_range, ":cur_kingdom", "fac_kingdom_1", kingdoms_end),
        (faction_slot_eq, ":cur_kingdom", slot_faction_state, sfs_active),
 
(store_random_in_range, ":cur_kingdom_2", kingdoms_begin, kingdoms_end),
(neq, ":cur_kingdom", ":cur_kingdom_2"),
(faction_slot_eq, ":cur_kingdom_2", slot_faction_state, sfs_active),

    (call_script, "script_diplomacy_start_war_between_kingdoms", ":cur_kingdom", ":cur_kingdom_2", 1),
  ]),
 
The Bowman said:
Hello everyone,
I have a modding problem regarding custom battle scenes, and I need someone to light my way as I try to implement them for Native, but beforehand, I'll tell you the whole story.
I have long detested they way random battle scenes in Native are set up. I guess that each one of you had a bitter bite of the ubiquitous hilly and small forest scenes, the annoying mountains or any other weirdness thrown upon you by the game when you wanted to have a nice battle. I decided to put an end to that issue by taking the terrain generator and getting the best possible battle scenes for all the environments, and I also made sure to choose good looking flora. The result is: 20 plain scenes, 10 forest scenes, 5 plain river scenes, 10 mountain scenes (not the annoying type), 10 desert scenes, 5 desert forest scenes, 10 steppe scenes, 5 steppe forest scenes, 10 snow scenes, 5 snow forest scenes. That's quite a number, and they're all max sized on 2 meter polygons.
Now here is the challenge: actually implement them. I tried to look for the file responsible for random scene assignment and it looks like it's module_scripts.py, but I need further explanation on this process, as I'm quite bad with coding.
If anyone's wondering, here is my whole register:
Code:
0x0000000034400925000d23480000659c00004d18000006c9 - plains
0x0000000033a01221000d23480000511700001f5300004fd2 - plains
0x0000000035e00f21000d23480000511700001f530000785e - plains
0x0000000035e00f21000d23480000413900001f530000785e - plains
0x0000000035e00715000d23480000662800001f5300007ea6 - plains
0x0000000035e00715000d234800004b0600001f5300001905 - plains
0x000000003c600715000d23480000567b00001f5300001905 - plains
0x000000003c6009a7000d2348000068ab00001f530000639d - plains
0x000000003c6009a7000d23480000076d00001f5300001ac2 - plains
0x00000000368009a7000d23480000585500001f5300005855 - plains
0x0000000030e009a7000d234800001f5800001f5300001b9f - plains
0x00000000346009a7000d234800006c9200001f5300006421 - plains
0x00000000346009a7000d2348000064d200001f5300005603 - plains
0x0000000034600ca0000d2348000066cf00001f530000638a - plains
0x0000000034600ca0000d234800001bf700001f530000217f - plains
0x0000000034600ca0000d2348000052f100001f530000626d - plains
0x0000000034600ca0000d23480000148400001f53000064ca - plains
0x0000000038800ca0000d2348000079b800001f5300004656 - plains
0x0000000036e00820000d2348000079b800001f53000021e8 - plains
0x0000000034e00820000d2348000079b800001f5300000f0c - plains

0x0000000034e00557800d23480000127b00001f5300006aee - plains river
0x0000000034e005bf800d23480000048e00004ae900005db3 - plains river
0x0000000034e00633800d234800004d7800007a9000005db3 - plains river
0x0000000034e00633800d234800007d9100007a9000001a3b - plains river
0x000000003c600663800d234800004d6a00007a9000007359 - plains river

0x000000003c6013e3000d234800004d6a00007a9000000f49 - mountains
0x00000000344013e3000d2348000054c300007a9000000c96 - mountains
0x00000000344013e3000d234800005d5900007a90000064f6 - mountains
0x00000000390251e3000d23480000197500007a90000064f6 - mountains
0x00000000390013e3000d23480000197500007a900000075b - mountains
0x000000003c6013e3000d23480000197500007a9000006f62 - mountains
0x00000000372013e3000d23480000731200007a9000003311 - mountains
0x000000003a4013e3000d23480000731200007a90000030e6 - mountains
0x000000003c6a4fe3000d23480000731200007a90000013df - mountains
0x000000003c6d4763000d23480000731200007a9000001d00 - mountains

0x000000003c600715000d23480000499200001f530000639d - forest
0x00000000ba018a63000d23480000163100005cd6000004ad - forest
0x00000000ba018a63000d234800004a3e00005cd600001fcc - forest
0x00000000bc618a63000d234800004a3e00005cd600005be9 - forest
0x00000000bc618a63000d234800004a3e00005cd6000045cc - forest
0x00000000bc600e63000d234800004a3e00005cd600003541 - forest
0x00000000bc600e63000d2348000023f400005cd600006475 - forest
0x00000000bc600e63000d2348000023f400005cd600001e1d - forest
0x00000000bc600963000d2348000054f800005cd6000000d6 - forest
0x00000000bc600563000d234800000d1400000c2800006616 - forest
0x00000000bc600563800d23480000769000000c280000193e - forest

0x000000002c600563000d234800006fb100000c280000193e - steppe
0x000000002c600563000d23480000163d00000c2800000d67 - steppe
0x0000000020800563000d23480000163d00000c2800000a91 - steppe
0x0000000020800563000d234800006b1f00000c2800004a0a - steppe
0x0000000022e00563000d234800006b1f00000c2800006b90 - steppe
0x0000000022e00be3000d234800007d4c00000c28000031f4 - steppe
0x0000000022e00be3000d23480000012800000c2800000dc4 - steppe
0x000000002c6008e3000d234800002ada00000c2800000eb7 - steppe
0x000000002c6008e3000d234800003c6e00000c2800006676 - steppe
0x0000000027c008e3000d234800003c6e00000c2800006ba7 - steppe
0x00000000212008e3800d2348000011ba000067d500000c9c - steppe

0x00000000ac600563000d234800000692000000db00002d7c - steppe forest
0x00000000ac600863000d234800000692000000db000011cf - steppe forest
0x00000000ac600563000d234800000572000000db0000773a - steppe forest
0x00000000ac600563000d2348000060bd000000db00006d4c - steppe forest
0x00000000ac600563800d2348000060bd00005053000043dc - steppe forest

0x00000000d12008e3000d2348000011ba000067d500000c9c - desert forest
0x00000000dc600663000d234800000fdb000067d500007142 - desert forest
0x00000000dc600663000d234800004132000067d500003697 - desert forest
0x00000000dc600663000d234800002da0000067d500000fe5 - desert forest
0x00000000dc600a63000d2348000052d4000067d500007b2d - desert forest

0x000000005c601063000d2348000052d4000067d500007b2d - desert
0x000000005c6009e3000d2348000052d4000067d500006373 - desert
0x000000005c600563000d2348000052d4000067d5000029c1 - desert
0x000000005c600563000d2348000052d4000067d5000070e2 - desert
0x000000005c600563000d2348000052d4000067d500004f42 - desert
0x000000005c600963000d2348000052d4000067d500007cc4 - desert
0x000000005c600963000d2348000052d4000067d5000070e2 - desert
0x000000005c600963000d2348000052d4000067d50000474c - desert
0x000000005c600963000d2348000052d4000067d5000031b4 - desert
0x000000005c600963000d2348000052d4000067d500005ec1 - desert

0x00000000468005e3000d234800004470000067d500004470 - snow
0x0000000041c005e3000d234800004470000067d500002885 - snow
0x00000000426005e3000d234800004470000067d5000055c9 - snow
0x00000000426005e3000d23480000057f000067d500007ecc - snow
0x0000000043e005e3000d23480000057f000067d50000660b - snow
0x000000004c6005e3800d23480000057f0000403d00004af3 - snow
0x0000000044e005e3800d23480000057f000000db00005e1b - snow
0x0000000044e005e3000d23480000590a000000db0000455e - snow
0x00000000482005e3000d23480000590a000000db0000229b - snow
0x000000004c600563000d23480000590a000000db00006bd5 - snow
0x000000004c600ae3000d23480000590a000000db00006e4b - snow

0x00000000cc600ae3000d23480000590a000000db00006e4b - snow forest
0x00000000cc600563000d2348000037cc000000db000045f6 - snow forest
0x00000000cc600563000d234800001ea3000000db000027bb - snow forest
0x00000000cc600563000d234800005cfa000000db000017fb - snow forest
0x00000000cc600563000d234800007432000000db00002d7c - snow forest
If I'll manage to get it done, I'll make everything public for download. Thanks.

I have a similar system set up which also differentiates map sizes (based on the number of men in the smaller army, so that curbstomp 1000 vs 10 battles don't take place on giant battlefields, while 50 vs 50 battles are around native size, and 200 vs 200 battles are large.)

What you have there are the scene codes. You need to implement them in module_scenes.py using this template:

Code:
  ("battle_scene_plain_small",sf_generate|sf_auto_entry_points,"none", "none", (0,0),(240,240),-0.5,"0x000000013a40006340048d1e000054b20000126b00006c47", [],[], "outer_terrain_plain"),

The scene ID and scene codes can obviously be changed to whatever you want.

You will also have to set up a system to cycle randomly between these scenes within a script in module_scripts.py called setup_random_scene.
 
How do you calculate distance on the world map?

How do I know what a distance of 1000 outwards from town 1 is?

Basically, how do I measure the world map? Is there a nifty guide or is just doing it by hand?
 
Cozur said:
How do you calculate distance on the world map?

How do I know what a distance of 1000 outwards from town 1 is?

Basically, how do I measure the world map? Is there a nifty guide or is just doing it by hand?
Code:
store_distance_to_party_from_party = 2281	# (store_distance_to_party_from_party,<destination>,<party_id>,<party_id>),
I am not sure what excactly you need but this operation might do what you want but it needs another party to check the distance.
 
The Bowman said:
Hello everyone,
I have a modding problem regarding custom battle scenes, and I need someone to light my way as I try to implement them for Native, but beforehand, I'll tell you the whole story.
I have long detested they way random battle scenes in Native are set up. I guess that each one of you had a bitter bite of the ubiquitous hilly and small forest scenes, the annoying mountains or any other weirdness thrown upon you by the game when you wanted to have a nice battle. I decided to put an end to that issue by taking the terrain generator and getting the best possible battle scenes for all the environments, and I also made sure to choose good looking flora. The result is: 20 plain scenes, 10 forest scenes, 5 plain river scenes, 10 mountain scenes (not the annoying type), 10 desert scenes, 5 desert forest scenes, 10 steppe scenes, 5 steppe forest scenes, 10 snow scenes, 5 snow forest scenes. That's quite a number, and they're all max sized on 2 meter polygons.
Now here is the challenge: actually implement them. I tried to look for the file responsible for random scene assignment and it looks like it's module_scripts.py, but I need further explanation on this process, as I'm quite bad with coding.
If anyone's wondering, here is my whole register:
Code:
0x0000000034400925000d23480000659c00004d18000006c9 - plains
0x0000000033a01221000d23480000511700001f5300004fd2 - plains
0x0000000035e00f21000d23480000511700001f530000785e - plains
0x0000000035e00f21000d23480000413900001f530000785e - plains
0x0000000035e00715000d23480000662800001f5300007ea6 - plains
0x0000000035e00715000d234800004b0600001f5300001905 - plains
0x000000003c600715000d23480000567b00001f5300001905 - plains
0x000000003c6009a7000d2348000068ab00001f530000639d - plains
0x000000003c6009a7000d23480000076d00001f5300001ac2 - plains
0x00000000368009a7000d23480000585500001f5300005855 - plains
0x0000000030e009a7000d234800001f5800001f5300001b9f - plains
0x00000000346009a7000d234800006c9200001f5300006421 - plains
0x00000000346009a7000d2348000064d200001f5300005603 - plains
0x0000000034600ca0000d2348000066cf00001f530000638a - plains
0x0000000034600ca0000d234800001bf700001f530000217f - plains
0x0000000034600ca0000d2348000052f100001f530000626d - plains
0x0000000034600ca0000d23480000148400001f53000064ca - plains
0x0000000038800ca0000d2348000079b800001f5300004656 - plains
0x0000000036e00820000d2348000079b800001f53000021e8 - plains
0x0000000034e00820000d2348000079b800001f5300000f0c - plains

0x0000000034e00557800d23480000127b00001f5300006aee - plains river
0x0000000034e005bf800d23480000048e00004ae900005db3 - plains river
0x0000000034e00633800d234800004d7800007a9000005db3 - plains river
0x0000000034e00633800d234800007d9100007a9000001a3b - plains river
0x000000003c600663800d234800004d6a00007a9000007359 - plains river

0x000000003c6013e3000d234800004d6a00007a9000000f49 - mountains
0x00000000344013e3000d2348000054c300007a9000000c96 - mountains
0x00000000344013e3000d234800005d5900007a90000064f6 - mountains
0x00000000390251e3000d23480000197500007a90000064f6 - mountains
0x00000000390013e3000d23480000197500007a900000075b - mountains
0x000000003c6013e3000d23480000197500007a9000006f62 - mountains
0x00000000372013e3000d23480000731200007a9000003311 - mountains
0x000000003a4013e3000d23480000731200007a90000030e6 - mountains
0x000000003c6a4fe3000d23480000731200007a90000013df - mountains
0x000000003c6d4763000d23480000731200007a9000001d00 - mountains

0x000000003c600715000d23480000499200001f530000639d - forest
0x00000000ba018a63000d23480000163100005cd6000004ad - forest
0x00000000ba018a63000d234800004a3e00005cd600001fcc - forest
0x00000000bc618a63000d234800004a3e00005cd600005be9 - forest
0x00000000bc618a63000d234800004a3e00005cd6000045cc - forest
0x00000000bc600e63000d234800004a3e00005cd600003541 - forest
0x00000000bc600e63000d2348000023f400005cd600006475 - forest
0x00000000bc600e63000d2348000023f400005cd600001e1d - forest
0x00000000bc600963000d2348000054f800005cd6000000d6 - forest
0x00000000bc600563000d234800000d1400000c2800006616 - forest
0x00000000bc600563800d23480000769000000c280000193e - forest

0x000000002c600563000d234800006fb100000c280000193e - steppe
0x000000002c600563000d23480000163d00000c2800000d67 - steppe
0x0000000020800563000d23480000163d00000c2800000a91 - steppe
0x0000000020800563000d234800006b1f00000c2800004a0a - steppe
0x0000000022e00563000d234800006b1f00000c2800006b90 - steppe
0x0000000022e00be3000d234800007d4c00000c28000031f4 - steppe
0x0000000022e00be3000d23480000012800000c2800000dc4 - steppe
0x000000002c6008e3000d234800002ada00000c2800000eb7 - steppe
0x000000002c6008e3000d234800003c6e00000c2800006676 - steppe
0x0000000027c008e3000d234800003c6e00000c2800006ba7 - steppe
0x00000000212008e3800d2348000011ba000067d500000c9c - steppe

0x00000000ac600563000d234800000692000000db00002d7c - steppe forest
0x00000000ac600863000d234800000692000000db000011cf - steppe forest
0x00000000ac600563000d234800000572000000db0000773a - steppe forest
0x00000000ac600563000d2348000060bd000000db00006d4c - steppe forest
0x00000000ac600563800d2348000060bd00005053000043dc - steppe forest

0x00000000d12008e3000d2348000011ba000067d500000c9c - desert forest
0x00000000dc600663000d234800000fdb000067d500007142 - desert forest
0x00000000dc600663000d234800004132000067d500003697 - desert forest
0x00000000dc600663000d234800002da0000067d500000fe5 - desert forest
0x00000000dc600a63000d2348000052d4000067d500007b2d - desert forest

0x000000005c601063000d2348000052d4000067d500007b2d - desert
0x000000005c6009e3000d2348000052d4000067d500006373 - desert
0x000000005c600563000d2348000052d4000067d5000029c1 - desert
0x000000005c600563000d2348000052d4000067d5000070e2 - desert
0x000000005c600563000d2348000052d4000067d500004f42 - desert
0x000000005c600963000d2348000052d4000067d500007cc4 - desert
0x000000005c600963000d2348000052d4000067d5000070e2 - desert
0x000000005c600963000d2348000052d4000067d50000474c - desert
0x000000005c600963000d2348000052d4000067d5000031b4 - desert
0x000000005c600963000d2348000052d4000067d500005ec1 - desert

0x00000000468005e3000d234800004470000067d500004470 - snow
0x0000000041c005e3000d234800004470000067d500002885 - snow
0x00000000426005e3000d234800004470000067d5000055c9 - snow
0x00000000426005e3000d23480000057f000067d500007ecc - snow
0x0000000043e005e3000d23480000057f000067d50000660b - snow
0x000000004c6005e3800d23480000057f0000403d00004af3 - snow
0x0000000044e005e3800d23480000057f000000db00005e1b - snow
0x0000000044e005e3000d23480000590a000000db0000455e - snow
0x00000000482005e3000d23480000590a000000db0000229b - snow
0x000000004c600563000d23480000590a000000db00006bd5 - snow
0x000000004c600ae3000d23480000590a000000db00006e4b - snow

0x00000000cc600ae3000d23480000590a000000db00006e4b - snow forest
0x00000000cc600563000d2348000037cc000000db000045f6 - snow forest
0x00000000cc600563000d234800001ea3000000db000027bb - snow forest
0x00000000cc600563000d234800005cfa000000db000017fb - snow forest
0x00000000cc600563000d234800007432000000db00002d7c - snow forest
If I'll manage to get it done, I'll make everything public for download. Thanks.

What Jacobhinds said, there's also the code I've been using for the randomized battle scenes:

Seek n Destroy said:
Go to module_scripts.py,
This is the script that handles the scenes generated for battles:
Code:
  # script_setup_random_scene
  # Input: arg1 = center_no, arg2 = mission_template_no
  # Output: none
  ("setup_random_scene",
    [
      (party_get_current_terrain, ":terrain_type", "p_main_party"),
      (assign, ":scene_to_use", "scn_random_scene"),
      (try_begin),
        (eq, ":terrain_type", rt_steppe),
        (assign, ":scene_to_use", "scn_random_scene_steppe"),
      (else_try),
        (eq, ":terrain_type", rt_plain),
        (assign, ":scene_to_use", "scn_random_scene_plain"),
      (else_try),
        (eq, ":terrain_type", rt_snow),
        (assign, ":scene_to_use", "scn_random_scene_snow"),
      (else_try),
        (eq, ":terrain_type", rt_desert),
        (assign, ":scene_to_use", "scn_random_scene_desert"),
      (else_try),
        (eq, ":terrain_type", rt_steppe_forest),
        (assign, ":scene_to_use", "scn_random_scene_steppe_forest"),
      (else_try),
        (eq, ":terrain_type", rt_forest),
        (assign, ":scene_to_use", "scn_random_scene_plain_forest"),
      (else_try),
        (eq, ":terrain_type", rt_snow_forest),
        (assign, ":scene_to_use", "scn_random_scene_snow_forest"),
      (else_try),
        (eq, ":terrain_type", rt_desert_forest),
        (assign, ":scene_to_use", "scn_random_scene_desert_forest"),
      (else_try),
        (eq, ":terrain_type", rt_water),
        (assign, ":scene_to_use", "scn_water"),
      (else_try),
        (eq, ":terrain_type", rt_bridge),
        (assign, ":scene_to_use", "scn_random_scene_plain"),
      (try_end),
      (jump_to_scene,":scene_to_use"),
  ]),

Then add custom scenes for rt_plain (plain terrain encounter in the game map) for example:
.....
    (else_try),
        (eq, ":terrain_type", rt_plain),
(store_random_in_range,":battle_scene",1,100),
(try_begin),
(is_between,":battle_scene",1,20),
(assign, ":scene_to_use", "scn_custom_battle_scene_plain_01"),
(else_try),
(is_between,":battle_scene",21,40),
(assign, ":scene_to_use", "scn_custom_battle_scene_plain_02"),
(else_try),
(is_between,":battle_scene",41,60),
(assign, ":scene_to_use", "scn_custom_battle_scene_plain_03"),
(else_try),
(assign, ":scene_to_use", "scn_random_scene_plain"),
(try_end),
      (else_try),
        (eq, ":terrain_type", rt_snow),
        (assign, ":scene_to_use", "scn_random_scene_snow"),
...
 
Cozur said:
How do you calculate distance on the world map?

How do I know what a distance of 1000 outwards from town 1 is?

Basically, how do I measure the world map? Is there a nifty guide or is just doing it by hand?
ctrl+e on the world map will show party coordinates. These are calculated 1:1 afaik
 
Status
Not open for further replies.
Back
Top Bottom