Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
I'd guess it's a missing comma (maybe braket) somewhere up.

Q: How can I get if there's water around the player's party? I can use this code:
Code:
 (party_get_position, pos1, "p_main_party"),
       (map_get_water_position_around_position, pos2, pos1, 5),
But if there isn't water? How do I check it? I want the code after that to execute if there is water.
 
Lueii said:
I have an odd problem:

Code:
upgrade(troops, "townsman","watchman")
       ^
 Invalid syntax
Check what you did last in mod_troops, probably some comma missing or something.
 
Lumos said:
Q: How can I get if there's water around the player's party? I can use this code:
Code:
 (party_get_position, pos1, "p_main_party"),
       (map_get_water_position_around_position, pos2, pos1, 5),
But if there isn't water? How do I check it? I want the code after that to execute if there is water.

I'm not certain of how the engine responds if the map_get_water_position fails to find water within the radius. My guess is either it 'zeros' the destination position (you could get_x or why and test if they are 0) or it doesn't record any data on the destination position if nothing is found, so it would still have its prior values. If that is the case, I would include a line between the two you have above where you copy_position pos1 to pos2 so after the map_get_water_position you can test whether pos1=pos2 or if they are now different.
 
Somebody said:
Caba`drin said:
Second, is there a way to get the number of soldiers in a troop stack that are ready to upgrade? I see the command to give XP to a stack (party_add_xp_to_stack) but there is no "get_xp" version...and it wouldn't make sense for (troop_get_xp) to do the trick. Is there something someone else is aware of that I'm missing?
As to your second question, you would have to do the following:
[list type=decimal]
[*]Make a copy of the desired party (or just the stack)
[*]Store the upgrade path of the desired stack (no need to store both), and deduct the amount of upgraded troops in that party
[*]Use (party_upgrade_with_xp, ":party_no", 1, 1), on the original party, since the copy might not have the same xp to automatically upgrade those troops (assuming this operation does takes into account the xp), and then count the number of upgraded troops which results.
[*]Return the copy of that party (remove the newly upgraded troops, etc)
[/list]

So, I had some success with your method, but I've come to a road block...perhaps I just need to think on it longer, but I thought I'd air it out here to see if others have input. If you upgrade the party and then compare the number of troops of a given type before the upgrade to after the upgrade, you are unable to differentiate between the troops that didn't upgrade and those that replaced them.

For instance, if you have 3 Spearmen ready to become Trained, 3 Trained ready to become vets, and 3 Vets ready to become Sergeants and you upgrade the lot, it doesn't look like there was any change with the Trained and the Veterans, since both groups were replaced. I'm trying to conceive of a loop to check for changes in each iteration of the upgrade path so this can be detected...but I've not had success yet.

EDIT: So, the process of identifying how many troops of each type will upgrade, taking into account the full upgrade tree and that some other troops will be replacing others, etc etc turns out to take a goodly amount of code and nested loops. The way I've done it takes somewhere around 125 lines. In any case it can be done.

EDIT 2:...now to identify how much XP is needed to gain one unit an upgrade, given their level...
If anyone has any hints on this, I'm all ears...er...eyes. When looking at the character sheets for the troops, it doesn't look like they gain XP before they are ready to upgrade. And if I give them the amount of XP that fits the level progression (ie about 2800XP from lv9 to 10), it is FAR too much for what is actually needed to make one troop upgrade.
 
I have a problem setting up bridge on my maps that im creating.
i cant set up bridge as it should be is seem always lower then terrain wich stop me from crossing.
on caladria map ive notice that water where bridge are is elevated.
how could i do it.
a video link will be apreciated as per it easier to follow.
thx
 
Caba`drin said:
EDIT 2:...now to identify how much XP is needed to gain one unit an upgrade, given their level...
If anyone has any hints on this, I'm all ears...er...eyes. When looking at the character sheets for the troops, it doesn't look like they gain XP before they are ready to upgrade. And if I give them the amount of XP that fits the level progression (ie about 2800XP from lv9 to 10), it is FAR too much for what is actually needed to make one troop upgrade.

Have you tried using script_game_get_upgrade_xp? As far as I know that script only works for regular troops - heroes still need to surpass the xp as given by get_level_boundary. The following code I've been using gives every regular troop stack sufficient xp to upgrade - so it's probably the right amount.
Code:
      ("camp_cheat_xp",[],"Add xp to party.",
       [
         (party_get_num_companion_stacks, ":num_stacks", "p_main_party"),
         (try_for_range, ":stack", 1, ":num_stacks"),
            (party_stack_get_troop_id, ":id", "p_main_party", ":stack"),
             (call_script, "script_game_get_upgrade_xp", ":id"),
             (party_stack_get_size, ":size", "p_main_party", ":stack"),
             (store_mul, ":xp", reg0, ":size"),
            (party_add_xp_to_stack, "p_main_party", ":stack", ":xp"),
         (try_end),
         # (party_upgrade_with_xp, "p_main_party", 1, 0), #random upgrade - disabled
         # (jump_to_menu, "mnu_camp_cheat"),
        ]
       ),
 
@Somebody, the script worked exactly as needed. I just hadn't noticed that before. Thanks for pointing it out.

I've been full of questions of late, it seems, and of course, I have another.
In a presentation is there a way to make a text overlay/container scrollable horizontally rather than vertically? Using tf_scrollable or tf_scrollable_style_2 hasn't produced any results, but--as always--I'm wondering if I'm missing a trick.
 
I have a problem. When you are a ship and click on land, there is a "Do you wish to disembark" menu showing up. For some reason, it stopped appearing for me. Can anyone tell me what might be causing this problem, or should I make a manual embarking option?
 
You can't define new ones, but you should be able to modify flags, meshes, colors etc of existing ones - just download the module system again (it's been updated) and modify the content inside module_data 1.132.

Lumos said:
I have a problem. When you are a ship and click on land, there is a "Do you wish to disembark" menu showing up. For some reason, it stopped appearing for me. Can anyone tell me what might be causing this problem, or should I make a manual embarking option?
Try modifying script_game_on_disembark - or did you modify the menu itself in some way?
 
Somebody said:
You can't define new ones, but you should be able to modify flags, meshes, colors etc of existing ones - just download the module system again (it's been updated) and modify the content inside module_data 1.132.

Ground_specs had what I was looking for.
How about terrain borders? I've made my own - Were can I define them so that the module use them?
 
Lucke189 said:
How about terrain borders? I've made my own - Were can I define them so that the module use them?
Here:
  ("castle_1_exterior",sf_generate,"none", "none", (0,0),(100,100),-100,"0x000000005a0932320004cd3000004e7d00007d6e00006c58",    [],[],"outer_terrain_desert"),
 
Egbert said:
Lucke189 said:
How about terrain borders? I've made my own - Were can I define them so that the module use them?
Here:
  ("castle_1_exterior",sf_generate,"none", "none", (0,0),(100,100),-100,"0x000000005a0932320004cd3000004e7d00007d6e00006c58",    [],[],"outer_terrain_desert"),

Thank you.
 
Somebody said:
Try modifying script_game_on_disembark - or did you modify the menu itself in some way?
I modified the menu. I'll see if reverting to the previous state will fix it, and if it does, I'll look for my mistake somewhere.

Nope, it's still there. I'll just make my own disembark option.
 
I'm testing store_enemy_count and store_friend_count but these command returns wrong value.
Here is using script.
Code:
#for mission_templates
	#debug
    (0, 0, 1, [(key_clicked, key_p)], 
	[
	(store_enemy_count,":enemy"),
	(assign, reg0, ":enemy"),
	(store_ally_count,":ally"),
	(assign, reg1, ":ally"),
	(store_friend_count,":friend"),
	(assign, reg2, ":friend"),
	(display_message, "@debug- enemy-{reg0} ally-{reg1} friend-{reg2}"),
	]),
When click P, message shows contrary value. (reg0 shows friend count and reg2 shows enemy count.)
These command are buggy or I'm wrong?
Sorry for my bad English but please help me!
 
Example;

Your models name is building, and and consists of three parts;

Naming should be like,

building
building.1
building.2

I remember like that... :smile: If you look castles,interiors or viking houses etc. brf files from Common res, you will see :smile:
 
Thanks. : P Works perfectly. Anyways, I was wondering, would it be possible to script and use animations to do example, mg positions? What I mean that you could deploy your machinegun.
 
Status
Not open for further replies.
Back
Top Bottom