[Need help] Is there any way to set delay or re-arm to triggers initiated on mesh spawn?

Users who are viewing this thread

velen

Recruit
As in topic, I try to set up a trigger on item which will set off on a specified time intervals, during battle. From what I found, triggers and simple triggers have possibility to set delay and rearm, but ti_on_init_item does not allow me to modify time parameters. In general, there are not many functions when it comes to time management within header_operations mentioned, I dug through a lot of useless stuff to find nothing suitable. Can I build a trigger in module_triggers.py and then somehow recall it on item? If yes, how to do it?
 
Sure, I want to set up a couple of items with the effects like damage aura, healing aura and similar. I do not want to have it global effect, just local within specified radius from the caster. I will possibly add my own particle effects to those, to make it nicely visible as well. I want to equip it to high level mobs instead of just player, so their effect cannot be constant dps, as if multiple agents wear them, they would instakill any enemies, even considering dps like 1hp/sec. Therefore I plan to store a value in range and hit it every 20 or 30 seconds while on battle scene. I checked all warband available triggers and it seems that the only ones using any timestamps are those related to general map checks, but I'm almost sure I saw something similar in one of the mods. Using what I found on the net I started preparing script, but I was not able to find anywhere things like "wait(20)", "sleep(20)" etc. as those are not existing within header_operations.py for Warband. I spend whole yesterday with this and I'm out of any further ideas..
Possible parameters would be: mage/caster, minHeal (minDamage), maxHeal (maxDamage), radius, optionally time interval for re-arm if I can place it as parameter as well.
 
Thank you very much for your answer. As I want to use the items in all regular battles, not in missions, I am not sure if I should follow this suggestion. As by now I implemented the following -
(ti_on_agent_spawn,
0,
0,
[],
[
(assign, "$aura_interval", 0), # Initialize your custom timer variable
]),
("cf_healing_aura",
[
(store_script_param_1, ":caster", 1),
(store_script_param_2, ":min_heal", 2),
(store_script_param_3, ":max_heal", 3),
(store_script_param_4, ":radius", 4),
(store_script_param_5, ":interval", 5),
(try_for_agents, ":target"),
(store_agent_hit_points,":hp",":target",1), # You can use agent-specific data to control the effect
(agent_is_alive, ":target"),
(agent_is_active, ":target"),
(agent_is_ally, ":target"), # Adjust the troop condition as needed
(agent_get_team, ":targets_team", ":target"),
(agent_get_position, pos1, ":target"),
(get_distance_between_positions, ":distance", pos1, pos2), # Calculate distance to the aura's position
(lt, ":distance", ":radius"), # Adjust this distance for the aura's radius
(try_begin),
(eq, "$aura_interval", 0), # Check if it's time to apply the effect
(play_sound, "snd_heal"), # Add any sound effects
(particle_system_burst, "psys_village_fire_big", pos1, ":radius"), # Adjust particle system and count
(store_agent_hit_points, ":hp", ":target", 1),
(store_random_in_range, ":heal", ":min_heal", ":max_heal"),
(val_sub, ":hp", ":heal"),
(try_begin),
(gt, ":hp", 70),
(try_end),
(agent_deliver_damage_to_agent, ":caster", ":target", ":heal"),
# Add any other effect logic here, like damage or healing
(assign, "$aura_interval", ":interval"), # Set the timer to the specified interval (adjust as needed)
(else_try),
(val_sub, "$caster_aura_interval", 1), # Decrement the timer
(try_end),
(try_end),
]),
and lastly:
["archmage_staff","Archmage Staff", [("archmage_staff",0)],
itp_type_polearm|itp_offset_lance|itp_primary|itp_penalty_with_shield|itp_wooden_parry|itp_wooden_attack,
itc_staff|itcf_carry_sword_back,1000, weight(4.5)|spd_rtng(120) | weapon_length(115)|swing_damage(25,blunt) | thrust_damage(25,blunt),imodbits_none
[(ti_on_init_item,
[
(store_trigger_param_1, ":caster"),
(assign, ":min_heal", -10),
(assign, ":max_heal", -25),
(assign, ":radius", 250),
(assign, ":interval", 20),
(call_script, "script_cf_healing_aura", ":caster", ":min_heal", ":max_heal", ":radius", ":interval"),
]),
]],
yet, it still tells me error that 'int' object is unsubscriptable and I think first parameter is the one causing the whole problem. When it comes to ti_on_init_item, according to header_operations first trigger parameter should be agent_id who has this item equipped, but how can I check if it really works like that?
 
Last edited:
First of all small update - I cleared missing comma, then found out that I need to change (store_script_param_3, ":max_heal", 3), to (store_script_param, ":max_heal", 3), as Warband consider only first two parameters in script.. Anyway, this is cleared up and somehow works to some extent.

Then I got to the core of the problem, I cannot find anything to count the tick during battle. If I run my script as they are, they set up once at the beginning of the battle (as I heard my sound firing before screen loaded) but then tick on my condition goes once from 20 to 19 and there is nothing to fire the trigger again. I will try again with simple triggers to check if I can set the trigger from there..
 
As I want to use the items in all regular battles, not in missions, I am not sure if I should follow this suggestion.
Every battle is a mission, a battle is just the standard mission template as it is the most common one.

Then I got to the core of the problem, I cannot find anything to count the tick during battle. If I run my script as they are, they set up once at the beginning of the battle (as I heard my sound firing before screen loaded) but then tick on my condition goes once from 20 to 19 and there is nothing to fire the trigger again. I will try again with simple triggers to check if I can set the trigger from there..
ti_on_init_item is only getting triggered when the item is getting spawned. That's not really how you want to implement your idea.
https://earendil_ardamire.gitlab.io...Module_System/Module_Items.html#Item_Triggers

Please read up about mission template triggers here (it's within a spoiler, the rest is very useful to read too):
 
Back
Top Bottom