Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Thanks, kalarhan. Do you mean multiplayer lag or engine lag?

Separate issue: In Lav's MS documentation for header_operations (section: SCRIPT/TRIGGER PARAMETERS AND RESULTS), he says, "You can declare your scripts with as many parameters as you wish. Triggers, however, are always called with their predefined parameters. Also the game engine does not support more than 3 parameters per trigger. As the result, some triggers receive extra information which could not be fit into those three parameters in numeric, string or position registers."

Does the 3 parameter limit for triggers no longer apply? ti_on_agent_hit has 5 parameters, which seems to contradict this.

Code:
store_trigger_param         = 2070  # (store_trigger_param, <destination>, <trigger_param_no>),
                                    # Version 1.153+. Retrieve the value of arbitrary trigger parameter. Parameters are enumerated starting from 1. Note that despite the introduction of this operation, there's not a single trigger with more than 3 parameters.

Code:
ti_on_agent_hit               = -28.0 # Agent has been damaged with a weapon attack. Does not fire on client side in multiplayer missions.
    # trigger param 1 = damage inflicted agent_id
    # trigger param 2 = attacker agent_id
    # trigger param 3 = inflicted damage
    # trigger param 4 = hit bone
    # trigger param 5 = item_id of missile used to attack (if attack was with a ranged weapon)
    # reg0            = weapon item_id
    # pos0            = position of the hit area, rotation fields contain the direction of the blow
    # If (set_trigger_result) is used in the code with operation parameter equal or greater than zero, it will override the inflicted damage.
 
Hello guys,
İn this photo:
VYPPpv.jpg
All archers going to entry point 10, I want to hold on in their place, how can I?Just infantry go to entrypoint 10.I want to Archers hold on.
 
Hello guys !

Wanted to ask, how do I change the bonuses and rename the choices in "character creation" ? Or even add them ?
If you don't know what I am talking about: http://media.moddb.com/images/mods/1/26/25173/mb3.jpg
 
ZektorSK said:
Hello guys !

Wanted to ask, how do I change the bonuses and rename the choices in "character creation" ? Or even add them ?
If you don't know what I am talking about: http://media.moddb.com/images/mods/1/26/25173/mb3.jpg
You can do that in module_game_menus under start_character_1 to start_character_4, the bonuses are assigned to constants such as cb_noble for example, you will have to edit the latter part for bonuses at character_skill (or something like that) just look for cb_noble till you find a part where the bonuses are applied.
 
Nate said:
Does the 3 parameter limit for triggers no longer apply?

That is outdated, yes. Recent updates to the engine have changed that rule, but as always, you need to refer to the documentation to see which values are valid parameters. Check header_triggers.py for that.



frozenpainter said:
All archers going to entry point 10, I want to hold on in their place, how can I?Just infantry go to entrypoint 10.I want to Archers hold on.
You can give orders to each division (like infantry, archers, etc... the 1 to 9 divisions). Including hold position. Check header_operations.py, formations OSP or even VC code for some examples on how to do it.



Khamukkamu said:
So we've been spending a lot of time to make sure our mod is compatible with Linux and Mac (swyter has ported all TLD shaders to GLSL).
Make sure  you don't have unassigned variables. They work on Windows (most of the time), but they break on Linux/Mac. A classic example is players having a budged with deficit on the bilions because of a unassigned variable.

You will have to review a lot of code for that... good luck  :mrgreen:



troycall said:
Do you know how to grab the battle size data, as well as edit party sizes in the module files?
You have operations for battle size (the slider). Check header_operations.py. VC code uses a range of 150-750, so they added some conversions for the module.ini and game code.

Party sizes can be changed in many ways. If you are talking about lords (leaded by heroes) parties, you can change the effect of leadership. You can adapt the script that controls size. And so on. A common formula is to increase party sizes as the player gets higher in level.
--> VC has a system to control bandit parties based on strenght, so you would see big parties of weak bandits, and smaller parties of elites.
TLDR: its all defined on modules, so you are free to change it



Nate said:
Thanks, kalarhan. Do you mean multiplayer lag or engine lag?
TLDR: its not a clock, just a aproximation. And if you have too many triggers running at the same time, they will lag one another (and may result in FPS issues as well). Try to keep them in a chain, instead of creating 20 triggers that run every 10 seconds (9 seconds of peace, 1 second of hell). Spread them out.



troycall said:
For example I want to make a slider in mod options that allows players to change the battle size
VC has a slider on a custom presentation, but keep in mind its the same you have on game options. And that you can change the limits on your module.ini



builder of the gods said:
hello me again working at boiling oil but having a irritating error i dont understand
compiles fine(WRECK), game loads fine, but script error on opcode 1818, invalid scene prop instance id, 847, line four and five at mission templates
1) You are counting lines in the wrong way. It starts at 0 (zero), not 1. So line 4 is the 5th line on your code.
2) Check your header_operations.py. You can search for a operation number (like 181:cool: to find the actual operation.
3) Check your ID_scene_props.py to see if that number is the correct one.
4) Check if the scene prop is on the scene (edit mode)



troycall said:
try_for_agents
agent_is_active
agent_is_none_player
agent_is_human
agent_is_alive
when in doubt your first stop should be native. That code base is years old, "stable" and it was created by the people that either worked on the engine or was sitting next to them.

also don't over think about performance. One loop on agents is OK, you need to worry if you start to do it often (every few seconds), thats when you can create lag. Avoid that situation, use proper range to filter/limit the searching area, and test your code to see if it is reducing FPS or not. There are many ways to do most things, start from the basic and improve as needed it.
 
I made a custom blood particle in particle systems
This line says its the scale keys

("blood_effect", psf_billboard_3d | psf_randomize_size|psf_randomize_rotation ,  "prt_mesh_blood_1",
    2000, 40.6, 2.0, 0.0, 0, 0,        #num_particles, life, damping, gravity_strength, turbulance_size, turbulance_strength
    (0.0, 0.25), (0.7, 0.1),        #alpha keys
    (0.1, 0.7), (1, 0.7),      #red keys
    (0.1, 0.7), (1, 0.7),      #green keys
    (0.1, 0.7), (1, 0.7),      #blue keys
    (0.1, 0.4),  (1, 0.35),    #scale keys
    (0.01, 0.0, 0.01),            #emit box size
    (0.2, 0.0, 0),                #emit velocity
    0.3,                        #emit dir randomness
    150,                      #rotation speed
    0,                      #rotation damping
    ),

I read the info at the top of the module file but its not very clear,

so the 0.1 is the starting size and the 0.4 the final size it grows too, so what's the  (1, 0.35), part? Or am I wrong about the first statement?
 
Good think I'm making a video now that explains how to make maps. surprised noone has done it yet.
 
Solved: Use ^^ in your dialogs so that it acts as an ENTER.

When creating dialogs, how to skip to the next line?
For example > All hail the new Monarch!(Now I want to make a new line without interrupting the conversation (him saying that) without clicking left click, or whatever) how do I do that?,  I can't find a solution to this anywhere so far.) >Continuation in the next line >> all hail the new Monarch!

Any ideas?

So it would look exactly like this inside the spoiler in the game:
all hail the new Monarch!
all hail the new Monarch!
^ That's what he would be saying rather than this:
all hail the new Monarch! all hail the new Monarch!
 
frozenpainter said:
All archers going to entry point 10, I want to hold on in their place, how can I?Just infantry go to entrypoint 10.I want to Archers hold on.
Its also possible the game thinks that your archer troops are infantry, make sure they have tf_guarantee_ranged as a flag on the troop
 
I'm trying to extend the torches at night parameters for deciding on weither to equip torches or not.

In here, I check for the right hand and attempt to remove items in a range from itm_lance to itm_wooden shield in the right hand, if that passes then the engine begins to search for left hand.

The problem here is, is there an easy way to check for items in a list, rather than by checking each item one by one?
For example, I can make it so that it checks for spear_a, spear_b, spear_c one by one, but I can't make it check for from spear_a to spear_c. I literally have to write a line for every weapon it seems.

Take a look at this code:

Code:
         (agent_get_wielded_item, ":item_right", ":agent", 0), # Left hand: shield or -1
		  (try_begin),
		 	#####Extension to exclude all spears because they look weird with torches
			#(is_between, ":item_right_hand", "itm_lance", "itm_wooden_shield"),
			#(is_between, ":item_right_hand", "itm_pike_banner_jer", "itm_cross_jer"),
			#(is_between, ":item_right_hand", "itm_lance_banner_jer", "itm_battlefield_crescent"),
			#(is_between, ":item_right_hand", "itm_pike_banner_sar", "itm_battlefield_crescent"),
			#(neq, ":item_right", ":item_right_hand"), #This solution did not work for some reason...
			#(neq, ":item_right", "itm_lance", "itm_wooden_shield"), #If agent is using items around that list, ignore them, dosen't seem to work too.
                        #Those are the things I tried, any ideas?
			#####End Extension

(agent_get_wielded_item, ":item", ":agent", 1), # Left hand: shield or -1
#Scans for left-hand are below this as a result there is no point of including its code.
 
@troycall you could use an item slot for that. In game_start script, set the slot to 1 for all items that you want to remove. Then, when you check your item, check if the slot is equal to 1; if it is, then remove the item from agent's hand.
 
troycall said:
The problem here is, is there an easy way to check for items in a list, rather than by checking each item one by one?

you can use this modificator for you operations: this_or_next

(this_or_next|is_between, ...)
(this_or_next|is_between, ...)
(is_between, ...)
 
The_dragon said:
@troycall you could use an item slot for that. In game_start script, set the slot to 1 for all items that you want to remove. Then, when you check your item, check if the slot is equal to 1; if it is, then remove the item from agent's hand.
@The_dragon I do not intend on removing the spears, the checking for left hand after the provided code will remove the left hand shields and apply a torch, right now im simply extending the code so that it avoids scanning for left hand if the right hand contains certain polearms such as spears or lances, if it does (the right hand) contain those certain polearms, then the code should stop and not apply torches. as a result your solution wouldn't work, also I would have to include all the items, minus the polearms so that might cause performance loss if I do it the way you recommended, perhaps you know of a better way now that you are more informed of the situation?



@Kalarhan, That also dosen't work for me, I get unassigned variable issues, even if I use 1 is_between, i'm uncertain on how to resolve this issue, after scanning  I use

is_between, ":item_right", "itm_pike_banner_sar", "itm_battlefield_crescent"),
use (neq, ":item_right", "item_right_hand"), #Item_right is the variable for slot 0 of agent hand (right hand), item_right_hand is the variable for the is_between above to avoid those certain items in the is_between.

Now I get unassigned variables when I run the code, I do not know how to resolve this issue, if I include it in the left hand code it wouldn't make sense and wouldn't work right - because i'd be checking the left hand, not the right hand.

Simplified: I simply do not want certain polearms (in the right hand) to get a torch (in the left hand) in other words the game shouldn't continue the code if those certain polearms exist in the right hand.


 
Couple of questions:

1. Is it possible to tweak the overall 'brightness' of a mod (not through gamma in options menu)?

2. Is it possible to 'force' daytime/night time in battles? For example, it is currently daytime, but in a certain battle, force night time? (without having to force time shift)?

Thanks in advance!
 
troycall said:
I get unassigned variable issues, even if I use 1 is_between

For this_or_next, look at this snippet from native:
Code:
          (this_or_next|is_between, ":other_center", towns_begin, towns_end),
          (is_between, ":other_center", villages_begin, villages_end),

unassiged variable is a local variable that you are using without giving it a value first. You should do stuff like this:

Code:
(assign, ":my_var", 10)
Code:
(party_get_slot, ":my_var", ...)
and so on. Check your code for it
 
troycall said:
if the right hand contains certain polearms such as spears or lances

That's your problem, isn't it? You don't know how to detect if the item that the agent is holding in his hand could be used with a torch or not.
The concept is the same: you mark the items that can't be used with a torch by setting a slot to 1. By default all slots's values are 0, so you only need to use item_set_slot on those items that you want to mark. Then, after you marked your items (in script game_start via item_set_slot operation), in your code you will do (item_slot_eq, ":right_hand_wielded_item", slot_item_cant_be_used_with_torch, 1). If this operation is true, then you detected that it shouldn't use a torch.

Performance wise this will add some lag at the beginning of the game, but it will be very very small amount of lag compared to whatever it already is. No need to worry about that.
 
The_dragon said:
That's your problem, isn't it? You don't know how to detect if the item that the agent is holding in his hand could be used with a torch or not.

all those flags you add on module_items.py can be tested with operations, so you can filter weapon by type (1handed, polearm, etc) on your code, no need for extra flags(slots)
 
Status
Not open for further replies.
Back
Top Bottom