LSP Kit Combat Project Age of Machinery [Released!]

Users who are viewing this thread

HyperCharge said:
KnightV said:
Ooooh i am stupid :wink:) i have added this before but your trigger doesnt work


Hypercharge , can we speak about modding in another place? Emm..facebook, discord, vk, skype?

I haven't gotten any report that the trigger you have problem with until now. Can you try to re-add everything?

We could have spoken, but I don't have much time for long talks. Sorry. :sad:

The is no need in this . Lets think carefully ...mission trigger of your mod depends on what ? I think that presentations dont touch trigger ...next...maybe scripts . In another words, can you tell me what files i need to check concretically  ??
 
i have checked again and saw that all are right....i have 12 swadian ingeneers 3 trebuchets and then i attack bandits but menu where i need choose a number of catapults not appears i am crying now...
 
KnightV said:
i have checked again and saw that all are right....i have 12 swadian ingeneers 3 trebuchets and then i attack bandits but menu where i need choose a number of catapults not appears i am crying now...

Search "Project Age of Machinery" in every single module_ file without the quotes. Check what is missing, then add it to yours.

It seems you have missed some parts.

And please try not to double posting.  :roll:
 
HyperCharge said:
KnightV said:
i have checked again and saw that all are right....i have 12 swadian ingeneers 3 trebuchets and then i attack bandits but menu where i need choose a number of catapults not appears i am crying now...

Search "Project Age of Machinery" in every single module_ file without the quotes. Check what is missing, then add it to yours.

It seems you have missed some parts.

And please try not to double posting.  :roll:

I have checked missions , scripts and game menus ...all are/is right(sorry for bad english)...what files are nessesary, too?
 
module_constants
module_game_menus
module_items
module_mission_templates
module_presentations
module_particle_systems
module_meshes
module_party_templates
module_scene_props
module_scenes
module_scripts
module_triggers
module_troops
module_sounds
 
I made it work finally. There problem was in myself)))). Thank you for sharing it!!!!!!!

Could you post a screenshot how random_props position looks like because i am using my own scenes.
 
HyperCharge said:
Hi there, i was tried that hardly. But cause of some bugs, I was abandoned it. This code could make mods more impressive including my. I'm bringing back to work myself.

Progress( = Done, = Will be added, = Partly done):

Porting artillery
Hunting
Adding artillery to sieges

hyper, i might have found you a way to use engines in sieges.
just use the normal in battle code and create exceptions

1: siege tower
go in scripts to script_cf_siege_move_belfry
then at the end edit the code to
Code:
  
   (assign, "$belfry_positioned", 1),
   (assign, "$g_stop_ballista_fire", 1),

then in your scripts add a condition of $g_stop_ballista_fire being 0, and ofcourse assing it to 0 in a general ti_once mission template

2: ladders
here it gets a little more complicated, in a scene add an entry point like 99 at the point where attackers should use the ladders
then add a mission template checking the distance till the point every 15 or what seconds, if the distance becomes to close then
Code:
  
   (assign, "$g_stop_ballista_fire", 1),
use this trick again and both defending and attacking engines will stop firing

What this means
your engines fire till the actual clash of troops start,, you can easily implent basic conditions to make siege battles use siege engines till the clash, making siege engines implentation way more easy then when you need to add 100 random props, in addition to that the accurary of siege engines both defensively and in attack will increase as they dont aim for random points anymore.
just a agent_set_slot if the distance to an enemy agent is to big then in your find enemy script

you can not, however, destroy walls or anything like that with this technique

This might look still look a bit absract, but i'm already using this simple technique to enable basic siege engine features in sieges on For Rome, and will try to add pictures in this later

Update 1
i'm now using this script
Code:
	#conditions 1
	(assign, "$firenow", 0),
	(try_begin),
		(eq, "$g_stop_ballista_fire", 1), #so we are already fighting
		(entry_point_get_position, pos10, 1), #lets get our reinforcement point position
		(assign, ":min_distance_1", 100000),
		(try_for_agents,":cur_agent"),
			(agent_is_alive, ":cur_agent"),
			(agent_is_human, ":cur_agent"),
			(agent_get_team, ":agent_team", ":cur_agent"),
			(eq, ":agent_team", 1),
			(agent_get_position, pos2, ":cur_agent"),
			(get_distance_between_positions,":cur_dist",pos2,pos10),
			(lt, ":cur_dist", ":min_distance_1"),
			(assign, ":min_distance_1", ":cur_dist"), #gets closest distance to 
                        (assign, "$closestagent", ":cur_agent"),
		(try_end),
		(lt, ":cur_dist", 1500), #within ten meters of reinforcement, tweakable
		(assign, "$firenow", 2),
	(else_try),
                (eq, "$g_stop_ballista_fire", 0), 
		(assign, "$firenow", 1),
	(try_end),
	
	(this_or_next|eq, "$firenow", 1),
	(eq, "$firenow", 2),

then in the code that selects an enemy
Code:
	#calculate target
	(try_begin),
		(eq, "$firenow", 1),
		(assign, ":counter", 0),
		(try_for_agents,":enemy_agent"),
			(agent_is_alive, ":enemy_agent"),
			(agent_is_human, ":enemy_agent"),
			(agent_get_team, ":enemy_team", ":enemy_agent"),
			(teams_are_enemies, ":enemy_team", 2),
		(val_add,":counter",1),
		(try_end),
		(store_random_in_range,":random",0,":counter"),
		(try_for_agents,":enemy_agent"),
			(agent_is_alive, ":enemy_agent"),
			(agent_is_human, ":enemy_agent"),
			(agent_get_team, ":enemy_team", ":enemy_agent"),
			(teams_are_enemies, ":enemy_team", 2),
			(try_begin),
				(eq,":counter",":random"),
				(agent_get_position, pos0, ":enemy_agent"),
			(try_end),
			(val_add,":counter",1),
		(try_end),
	(else_try),
		(eq, "$firenow", 2),
		(agent_get_position, pos0, "$closestagent"),
	(try_end),

what does this do?
if the troops have not reached the wall yet, fire
if the troops have reached the wall but there also are troops close to reinforcement point atm (reinforcements spawned), set fire mode to at reinforcements
this way it actually offers more siege engine features then your current system does


Will be further updated....
 
I've putted this to my mod. Everything works except that when I buy the artillery and the engineers. And when I've selected the artillery which I want on a battlefield, it doesn't spawn.  :???: Have I missed somewhere?

Nevermind I forgot the scenes XP, It is awesome!
 
cbamiduban said:
Initializing...
Compiling all global variables...
Exporting strings...
Exporting skills...
Exporting tracks...
Exporting animations...
Exporting meshes...
Exporting sounds...
Exporting skins...
Exporting map icons...
Creating new tag_uses.txt file...
Creating new quick_strings.txt file...
Exporting faction data...
Exporting item data...
Exporting scene data...
Exporting troops data
Exporting particle data...
Exporting scene props...
Exporting tableau materials data...
Exporting presentations...
WARNING: Local variable never used: value, at: 0
WARNING: Usage of unassigned global variable: $g_presentation_obj_7
Exporting party_template data...
Exporting parties
Exporting quest data...
Exporting info_page data...
Traceback (most recent call last):
  File "process_info_pages.py", line 32, in <module>
    save_info_pages()
  File "process_info_pages.py", line 20, in save_info_pages
    ofile.write("ip_%s %s %s"%(info_page[0],string.replace(info_page[1]," ","_")
, string.replace(info_page[2]," ","_")))
IndexError: tuple index out of range
Exporting scripts...
WARNING: Local variable never used: cannon_no, at: field_artillery_spawn_a
WARNING: Local variable never used: cannon_no, at: field_artillery_spawn_b
WARNING: Local variable never used: cannon_no, at: siege_artillery_spawn_a
WARNING: Local variable never used: cannon_no, at: siege_artillery_spawn_b
Exporting mission_template data...
WARNING: Local variable never used: num_other_cannons, at: 0
WARNING: Local variable never used: num_other_cannons, at: 0
WARNING: Local variable never used: player_agent, at: 0
WARNING: Local variable never used: num_other_cannons, at: 0
WARNING: Local variable never used: player_agent, at: 0
Exporting game menus data...
exporting simple triggers...
exporting triggers...
exporting dialogs...
Checking global variable usages...
WARNING: Global variable never used: $g_presentation_obj_7
Exporting postfx_params...

______________________________

Script processing has ended.
Press any key to exit. . .
I would like to ask how to solve the error! ~ :roll: :roll: :shock: :shock:

Those warnings for undefined variables are completely normal and do not do any problem. But this Traceback .... You messed somewhere with tupletes: ,
 
KnightV said:
Hello, as i see you completely have added this feature to the sieges, is it true? To all the castles` and towns` scenes?
HyperCharge said:
Progress( = Done, = Will be added, = Partly done):

Porting artillery
Hunting
Adding artillery to sieges

DONE
But he also wrote
Siege Artillery:
Not yet done and not sure if they will be.

Problems:
All castle scenes would have to be modified.
Defenders have usually little space for those big engines.
A collision system would have to be created
Building destruction is hard to make I think. I couldn't even give a hp to wall.
 
[Bcw]Btm_Earendil said:
KnightV said:
Hello, as i see you completely have added this feature to the sieges, is it true? To all the castles` and towns` scenes?
HyperCharge said:
Progress( = Done, = Will be added, = Partly done):

Porting artillery
Hunting
Adding artillery to sieges

DONE

I downloaded and checked the modsys resource. Instruction says that i need to find all the codes which are marked. It`s OK, but i also see the new stuff which was provided by a different user above in this thread and it`s not marked. And now i`m confused whether i need to add the new stuff or not.
 
I updated my answerwhile you have been answering, forgot to mention the second half.

If you mean this part, it is most probably not marked and you will need to add it by yourself since Hypercharge also didn't respond here anymore.
Godarcher said:
HyperCharge said:
Hi there, i was tried that hardly. But cause of some bugs, I was abandoned it. This code could make mods more impressive including my. I'm bringing back to work myself.

Progress( = Done, = Will be added, = Partly done):

Porting artillery
Hunting
Adding artillery to sieges

hyper, i might have found you a way to use engines in sieges.
just use the normal in battle code and create exceptions

1: siege tower
go in scripts to script_cf_siege_move_belfry
then at the end edit the code to
Code:
  
   (assign, "$belfry_positioned", 1),
   (assign, "$g_stop_ballista_fire", 1),

then in your scripts add a condition of $g_stop_ballista_fire being 0, and ofcourse assing it to 0 in a general ti_once mission template

2: ladders
here it gets a little more complicated, in a scene add an entry point like 99 at the point where attackers should use the ladders
then add a mission template checking the distance till the point every 15 or what seconds, if the distance becomes to close then
Code:
  
   (assign, "$g_stop_ballista_fire", 1),
use this trick again and both defending and attacking engines will stop firing

What this means
your engines fire till the actual clash of troops start,, you can easily implent basic conditions to make siege battles use siege engines till the clash, making siege engines implentation way more easy then when you need to add 100 random props, in addition to that the accurary of siege engines both defensively and in attack will increase as they dont aim for random points anymore.
just a agent_set_slot if the distance to an enemy agent is to big then in your find enemy script

you can not, however, destroy walls or anything like that with this technique

This might look still look a bit absract, but i'm already using this simple technique to enable basic siege engine features in sieges on For Rome, and will try to add pictures in this later

Update 1
i'm now using this script
Code:
	#conditions 1
	(assign, "$firenow", 0),
	(try_begin),
		(eq, "$g_stop_ballista_fire", 1), #so we are already fighting
		(entry_point_get_position, pos10, 1), #lets get our reinforcement point position
		(assign, ":min_distance_1", 100000),
		(try_for_agents,":cur_agent"),
			(agent_is_alive, ":cur_agent"),
			(agent_is_human, ":cur_agent"),
			(agent_get_team, ":agent_team", ":cur_agent"),
			(eq, ":agent_team", 1),
			(agent_get_position, pos2, ":cur_agent"),
			(get_distance_between_positions,":cur_dist",pos2,pos10),
			(lt, ":cur_dist", ":min_distance_1"),
			(assign, ":min_distance_1", ":cur_dist"), #gets closest distance to 
                        (assign, "$closestagent", ":cur_agent"),
		(try_end),
		(lt, ":cur_dist", 1500), #within ten meters of reinforcement, tweakable
		(assign, "$firenow", 2),
	(else_try),
                (eq, "$g_stop_ballista_fire", 0), 
		(assign, "$firenow", 1),
	(try_end),
	
	(this_or_next|eq, "$firenow", 1),
	(eq, "$firenow", 2),

then in the code that selects an enemy
Code:
	#calculate target
	(try_begin),
		(eq, "$firenow", 1),
		(assign, ":counter", 0),
		(try_for_agents,":enemy_agent"),
			(agent_is_alive, ":enemy_agent"),
			(agent_is_human, ":enemy_agent"),
			(agent_get_team, ":enemy_team", ":enemy_agent"),
			(teams_are_enemies, ":enemy_team", 2),
		(val_add,":counter",1),
		(try_end),
		(store_random_in_range,":random",0,":counter"),
		(try_for_agents,":enemy_agent"),
			(agent_is_alive, ":enemy_agent"),
			(agent_is_human, ":enemy_agent"),
			(agent_get_team, ":enemy_team", ":enemy_agent"),
			(teams_are_enemies, ":enemy_team", 2),
			(try_begin),
				(eq,":counter",":random"),
				(agent_get_position, pos0, ":enemy_agent"),
			(try_end),
			(val_add,":counter",1),
		(try_end),
	(else_try),
		(eq, "$firenow", 2),
		(agent_get_position, pos0, "$closestagent"),
	(try_end),

what does this do?
if the troops have not reached the wall yet, fire
if the troops have reached the wall but there also are troops close to reinforcement point atm (reinforcements spawned), set fire mode to at reinforcements
this way it actually offers more siege engine features then your current system does


Will be further updated....
 
[Bcw]Btm_Earendil said:
I updated my answerwhile you have been answering, forgot to mention the second half.

If you mean this part, it is most probably not marked and you will need to add it by yourself since Hypercharge also didn't respond here anymore.
Godarcher said:
HyperCharge said:
Hi there, i was tried that hardly. But cause of some bugs, I was abandoned it. This code could make mods more impressive including my. I'm bringing back to work myself.

Progress( = Done, = Will be added, = Partly done):

Porting artillery
Hunting
Adding artillery to sieges

hyper, i might have found you a way to use engines in sieges.
just use the normal in battle code and create exceptions

1: siege tower
go in scripts to script_cf_siege_move_belfry
then at the end edit the code to
Code:
  
   (assign, "$belfry_positioned", 1),
   (assign, "$g_stop_ballista_fire", 1),

then in your scripts add a condition of $g_stop_ballista_fire being 0, and ofcourse assing it to 0 in a general ti_once mission template

2: ladders
here it gets a little more complicated, in a scene add an entry point like 99 at the point where attackers should use the ladders
then add a mission template checking the distance till the point every 15 or what seconds, if the distance becomes to close then
Code:
  
   (assign, "$g_stop_ballista_fire", 1),
use this trick again and both defending and attacking engines will stop firing

What this means
your engines fire till the actual clash of troops start,, you can easily implent basic conditions to make siege battles use siege engines till the clash, making siege engines implentation way more easy then when you need to add 100 random props, in addition to that the accurary of siege engines both defensively and in attack will increase as they dont aim for random points anymore.
just a agent_set_slot if the distance to an enemy agent is to big then in your find enemy script

you can not, however, destroy walls or anything like that with this technique

This might look still look a bit absract, but i'm already using this simple technique to enable basic siege engine features in sieges on For Rome, and will try to add pictures in this later

Update 1
i'm now using this script
Code:
	#conditions 1
	(assign, "$firenow", 0),
	(try_begin),
		(eq, "$g_stop_ballista_fire", 1), #so we are already fighting
		(entry_point_get_position, pos10, 1), #lets get our reinforcement point position
		(assign, ":min_distance_1", 100000),
		(try_for_agents,":cur_agent"),
			(agent_is_alive, ":cur_agent"),
			(agent_is_human, ":cur_agent"),
			(agent_get_team, ":agent_team", ":cur_agent"),
			(eq, ":agent_team", 1),
			(agent_get_position, pos2, ":cur_agent"),
			(get_distance_between_positions,":cur_dist",pos2,pos10),
			(lt, ":cur_dist", ":min_distance_1"),
			(assign, ":min_distance_1", ":cur_dist"), #gets closest distance to 
                        (assign, "$closestagent", ":cur_agent"),
		(try_end),
		(lt, ":cur_dist", 1500), #within ten meters of reinforcement, tweakable
		(assign, "$firenow", 2),
	(else_try),
                (eq, "$g_stop_ballista_fire", 0), 
		(assign, "$firenow", 1),
	(try_end),
	
	(this_or_next|eq, "$firenow", 1),
	(eq, "$firenow", 2),

then in the code that selects an enemy
Code:
	#calculate target
	(try_begin),
		(eq, "$firenow", 1),
		(assign, ":counter", 0),
		(try_for_agents,":enemy_agent"),
			(agent_is_alive, ":enemy_agent"),
			(agent_is_human, ":enemy_agent"),
			(agent_get_team, ":enemy_team", ":enemy_agent"),
			(teams_are_enemies, ":enemy_team", 2),
		(val_add,":counter",1),
		(try_end),
		(store_random_in_range,":random",0,":counter"),
		(try_for_agents,":enemy_agent"),
			(agent_is_alive, ":enemy_agent"),
			(agent_is_human, ":enemy_agent"),
			(agent_get_team, ":enemy_team", ":enemy_agent"),
			(teams_are_enemies, ":enemy_team", 2),
			(try_begin),
				(eq,":counter",":random"),
				(agent_get_position, pos0, ":enemy_agent"),
			(try_end),
			(val_add,":counter",1),
		(try_end),
	(else_try),
		(eq, "$firenow", 2),
		(agent_get_position, pos0, "$closestagent"),
	(try_end),

what does this do?
if the troops have not reached the wall yet, fire
if the troops have reached the wall but there also are troops close to reinforcement point atm (reinforcements spawned), set fire mode to at reinforcements
this way it actually offers more siege engine features then your current system does


Will be further updated....

Do you know where i should put (assign, "$g_stop_ballista_fire", 1), and the rest pieces of codes?The first one is easy but the rest are not understandable for me. If you could help, i`d be thankful
 
disclaimer
this code was written only for an attacker dealing with a defensive ballista, you should reverse it to enable attackers using ballistas at defenders in sieges

Create a new mission template in module mission templates

Code:
common_siege_ballista = (
  19, 0, 0, [],
	[
	#conditions 1
	(scene_prop_get_num_instances,":num_instances","spr_ballista_loaded"),
	(gt, ":num_instances", 0), #we need to have actual ballista's
	
	#cleaning old messes
	(replace_scene_props, "spr_ballista_ammo_rock", "spr_ballista_pickup_rock"),	   
	
	#conditions 2
	(assign, "$firenow", 0),
	(try_begin),
		(eq, "$g_stop_ballista_fire", 1), #so we are already fighting
		(entry_point_get_position, pos10, 1), #lets get our reinforcement point position
		(assign, ":min_distance_1", 100000),
		(try_for_agents,":cur_agent"),
			(agent_is_alive, ":cur_agent"),
			(agent_is_human, ":cur_agent"),
			(agent_get_team, ":agent_team", ":cur_agent"),
			(eq, ":agent_team", 1),
			(agent_get_position, pos2, ":cur_agent"),
			(get_distance_between_positions,":cur_dist",pos2,pos10),
			(lt, ":cur_dist", ":min_distance_1"),
			(assign, ":min_distance_1", ":cur_dist"), #gets closest distance to 
			(assign, "$closestagent", ":cur_agent"),
		(try_end),
		(le, ":cur_dist", 2350), #within 23.5 meters of reinforcement, tweakable
		(assign, "$firenow", 2),
	(else_try),
		(eq, "$g_stop_ballista_fire", 0), 
		(assign, "$firenow", 1),
	(try_end),
	
	(this_or_next|eq, "$firenow", 1),
	(eq, "$firenow", 2),
		
	#conditions 3
	(assign, ":artillerycrew", 0),
	(assign, ":artillerycrewelite", 0),
	(assign, ":ballistakills", 0),
	(try_for_range,":instance_no",0,":num_instances"),
        (scene_prop_get_instance,":ballista_instance","spr_ballista_loaded",":instance_no"),
		(prop_instance_get_position, pos6, ":ballista_instance"),
		(try_for_agents, ":agent"),
			(agent_is_human, ":agent"),
			(agent_is_alive, ":agent"),
			(agent_get_team, ":team1", ":agent"),
			(eq, ":team1", 2),
			(agent_get_troop_id, ":troop", ":agent"),
			(try_begin),
				(this_or_next|eq, ":troop", "trp_roman_ballista"),
				(eq, ":troop", "trp_roman_gaul_ballista"),
				(agent_get_position, pos11, ":agent"),
				(get_distance_between_positions, ":dist", pos11, pos6),
				(le, ":dist", 700), #7 meter radius
				(val_add, ":artillerycrew", 1),	
				(agent_play_sound, ":agent", "snd_yellnew"),
				(agent_get_troop_id, "$bal_killer_troop", ":agent"),
			(else_try),
				(this_or_next|eq, ":troop", "trp_roman_gaul_elite_ballista"),
				(eq, ":troop", "trp_roman_elite_ballista"),
				(agent_get_position, pos11, ":agent"),
				(get_distance_between_positions, ":dist", pos11, pos6),
				(le, ":dist", 700), #7 meter radius
				(val_add, ":artillerycrew", 1),	
				(val_add, ":artillerycrewelite", 1),
				(agent_play_sound, ":agent", "snd_yellnew"),
				(agent_get_troop_id, "$bal_killer_troop", ":agent"),
			(try_end),
		(try_end),
		(ge, ":artillerycrew", 3), #engineers nearby
		
		#calculate target
		(try_begin),
			(eq, "$firenow", 1),
			(assign, ":counter", 0),
			(try_for_agents,":enemy_agent"),
				(agent_is_alive, ":enemy_agent"),
				(agent_is_human, ":enemy_agent"),
				(agent_get_team, ":enemy_team", ":enemy_agent"),
				(teams_are_enemies, ":enemy_team", 2),
				(val_add,":counter",1),
			(try_end),
			(store_random_in_range,":random",0,":counter"),
			(try_for_agents,":enemy_agent"),
				(agent_is_alive, ":enemy_agent"),
				(agent_is_human, ":enemy_agent"),
				(agent_get_team, ":enemy_team", ":enemy_agent"),
				(teams_are_enemies, ":enemy_team", 2),
				(try_begin),
					(eq,":counter",":random"),
					(agent_get_position, pos0, ":enemy_agent"),
				(try_end),
				(val_add,":counter",1),
			(try_end),
		(else_try),
			(eq, "$firenow", 2),
			(agent_get_position, pos0, "$closestagent"),
		(try_end),
		
		#spawning a rock, shooting it
		(set_spawn_position, pos6),
		(spawn_scene_prop, "spr_ballista_ammo_rock"),
		(scene_prop_get_instance, ":ammo", "spr_ballista_ammo_rock", 0), #we should be only using 1
	
		(store_random_in_range,":random",1,4), #1, 2 or 3
		(try_begin),
			(eq, ":random", 3),
			(prop_instance_animate_to_position,":ammo",pos0,4000), #takes 2 seconds
		(else_try),
			(position_get_x, ":x", pos0),
			(store_random_in_range, ":range", 1, 11), #1 to 10
			(try_begin),
				(gt, ":artillerycrewelite", 3), #only three troops actually fire the thing
				(assign, ":artillerycrewelite", 3),
			(try_end),
			(try_begin), #if ballista troops are elite that delivers a accurary bonus
				(gt, ":range", ":artillerycrewelite"),
				(val_sub, ":range", ":artillerycrewelite"),
				(val_add, ":x", ":range"),
				(position_set_x,pos0,":x"),
			(try_end),
		(try_end),
		(position_set_z, pos0, 100000),
		(position_set_z_to_ground_level,pos0),
		(prop_instance_animate_to_position,":ammo",pos0,5000), #takes 5 seconds
		
		#damage and effects
		(try_for_agents, ":agent"),
			(agent_is_alive, ":agent"),
			(agent_get_team, ":team"),
			(neq, ":team", 2), #defender in our situation
			(get_player_agent_no, ":player"),
			(neq, ":agent", ":player"),
			(agent_get_position, pos7, ":agent"),
			(get_distance_between_positions, ":distance", pos7, pos0),
			(le, ":distance", 132), #within 1.29 meter
			(val_add, ":ballistakills", 1),
			(agent_set_animation, ":agent", "anim_shield_strike"),
			(agent_play_sound, ":agent", "snd_man_hit"),
			(particle_system_burst, "psys_decap_blood", pos7, 10),
			(particle_system_burst, "psys_decap_blood", pos7, 10),
			(particle_system_burst, "psys_decap_blood", pos7, 10),
			(particle_system_burst, "psys_decap_blood", pos7, 10),
			(agent_deliver_damage_to_agent, "$bal_killer_troop", ":agent", 10000), #so youre pretty much dead
			(agent_deliver_damage_to_agent, "$bal_killer_troop", ":agent", 10), #to confirm the kill
		(try_end),
		(play_sound_at_position, "snd_ballista1", pos6), #bow release ballista variant
		(particle_system_burst, "psys_dummy_straw", pos6, 100), 
		(play_sound_at_position, "snd_ballista1", pos0),
		(particle_system_burst, "psys_broken_stones_a", pos0, 4),
		(particle_system_burst, "psys_broken_stones_b", pos0, 4),
		(particle_system_burst, "psys_broken_stones_c", pos0, 4),
		(store_random_in_range,reg1,0,4),
		(val_add,reg1,"snd_cannon_shot1"),
		(play_sound,reg1),	
	(try_end),
	
	#total notification
	(try_begin),
		(assign, reg11, ":ballistakills"),
		(gt, reg11, 0),
		(set_show_messages, 1),
		(display_message, "@A ballista strike killed {reg11} friendlies!", 0xf7f723),
		(set_show_messages, 0),
	(try_end),
	])

then i had a preparation mission template for my mod, sticking it into any ti_once which is called in every siege battle however also does the trick.
notice you only need the stop ballista fire = 0, the rest is just to illustrate suggested usage

Code:
common_battle_prepare = (
  ti_once, 0, 0, [],
  [
  (assign, "$rageused", 0), #reset every battle
  (assign, "$kill", 0), #reset first blood
  (assign, "$g_stop_ballista_fire", 0),
  (assign, "$notificationmode", 0),
  (assign, "$refill", 0),
  (assign, "$dead_enemies", 0),
  (assign, "$dead_enemiest", 0),
  (assign, "$dead_friendlies", 0),
  (assign, "$dead_friendliest", 0),
  ])


then in module_scripts search for
Code:
cf_siege_move_belfry

in this script add the g_stop_ballista_fire at  the end like down here
Code:
          (position_transform_position_to_parent, pos2, pos1, ":pos_no"),
          (prop_instance_animate_to_position, ":cur_belfry_object", pos2, ":belfry_speed"),
        (try_end),
      (try_end),
    (try_end),
    (gt, "$cur_belfry_pos", 55),
    (assign, "$belfry_positioned", 1),
    (assign, "$g_stop_ballista_fire", 1),
 
Hey, I`ve added your feature, but saw that in a battle throwing rocks or bars fly very slowly like they move on from one place into another until they finally get to the earth. It looks very scary.
 
Name error
(party_set_slot, "p_castle_36", slot_castle_num_att_art, 3),

böyle bi hata alıyorum C

I couldn't do it if someone shares their files if nobody bothered I have an idea of giving HP to these walls, maybe if we make the health of the walls too high and adjust the damage of the catapults accordingly, but probably the soldiers in the field battles will die with a single catapult stone
 
Code:
("projectile_physics_field",
[
  (set_fixed_point_multiplier, 100),
  (try_for_range, ":ammo", "spr_cannonball", "spr_cannonball_start_position"),
    (scene_prop_get_num_instances, ":num_cannonballs", ":ammo"),
    (get_player_agent_no, ":player_agent"),
    (agent_get_team, ":player_team", ":player_agent"),
    (try_begin),
      (assign, ":other_cannons_team", 0),
      (this_or_next|eq, ":ammo", "spr_cannonball"),
      (eq, ":ammo", "spr_rock_ammo"),
      (assign, ":other_cannons_team", ":player_team"),            
    (else_try),
      (assign, ":other_cannons_team", 10),
    (try_end),
    (try_for_range, ":instance_no", 0, ":num_cannonballs"),
      (scene_prop_get_instance, ":instance", ":ammo", ":instance_no"),
      (item_get_slot, ":moving", ":instance", 216),
      (eq, ":moving", 1),
      (item_get_slot, ":time", ":instance", 215),
      (prop_instance_get_position, pos1, ":instance"),
      (try_for_agents, ":agent_no"),
        (agent_get_team, ":agent", ":agent_no"),      
        (try_begin),
          (this_or_next|eq, ":agent", ":player_team"),
          (agent_is_ally, ":agent_no"),
          (agent_get_troop_id, ":troop_id", ":agent_no"),
          (is_between, ":troop_id", "trp_mercenary_engineer", "trp_new_array_a"),
          (agent_get_team, ":enemy_agent", ":agent_no"),
        (else_try),
          (agent_get_troop_id, ":agent_troop_id", ":agent_no"),
          (is_between, ":agent_troop_id", "trp_mercenary_engineer", "trp_new_array_a"),
          (agent_get_team, ":cur_team", ":agent_no"),
        (try_end),
      (try_end),
      (val_mul, ":time", 360),
      (val_div, ":time", -40),
      (position_rotate_x, pos1, ":time"),
      (position_rotate_y, pos1, ":time"),
      (get_player_agent_no, ":player_agent"),
      (agent_get_horse, ":agent_horse_id", ":player_agent"),  
      (try_for_agents, ":agents"),
        (agent_get_troop_id, ":cur_troop", ":agents"),
        (troop_get_type, ":troop_type", ":cur_troop"),       
        (neq, ":agents", ":player_agent"),
        (neq, ":agents", ":agent_horse_id"),
        (neq, ":troop_type", 16),
        (agent_is_alive, ":agents"),
        (agent_get_position, pos2, ":agents"),
        (position_move_z, pos2, 100),
        (position_transform_position_to_local, pos3, pos1, pos2),
        (position_get_x, ":x_value", pos3),
        (position_get_y, ":y_value", pos3),
        (position_get_z, ":z_value", pos3),
        (try_begin),
          (le, ":x_value", 50),
          (ge, ":x_value", -50),
          (try_begin),
            (le, ":z_value", 100),
            (ge, ":z_value", -100),
            (try_begin),
              (le, ":y_value", 200),
              (ge, ":y_value", -200),
              (agent_get_team, ":team_no", ":agents"),
              (try_begin),
                (try_begin),
                  (eq, ":other_cannons_team", ":player_team"),
                  (assign, ":enemy_team", ":enemy_agent"),
                (else_try),
                  (assign, ":enemy_team", ":cur_team"),
                (try_end),
                (teams_are_enemies, ":team_no", ":enemy_team"),
                (agent_get_troop_id, ":cur_troop", ":agents"),
                (troop_get_type, ":troop_type", ":cur_troop"),
                (try_begin),
                  (eq, ":troop_type", 1),
                  (agent_play_sound, ":agents", "snd_woman_die"),
                (else_try),
                  (agent_play_sound, ":agents", "snd_man_die"),
                (try_end),
                (agent_set_hit_points, ":agents", 0),
                (try_for_agents, ":agents_team"),
                  (agent_get_team, ":agentsteam", ":agents_team"),
                  (agent_get_troop_id, ":cur_troop", ":agents_team"),
                  (is_between, ":cur_troop", "trp_mercenary_engineer", "trp_new_array_a"),
                  (eq, ":agentsteam", ":enemy_team"),
                  (assign, ":agents_deliverer", ":agents_team"),
                (try_end),
                (agent_deliver_damage_to_agent, ":agents_deliverer", ":agents"),
              (try_end),
              (call_script, "script_get_cannon_instance", ":instance"),
              (assign, ":stop", 0),
              (try_for_agents, ":agents_deliverer"),          
                (neq, ":agents_deliverer", ":player_agent"),
                (neq, ":agents_deliverer", ":agent_horse_id"),
                (agent_get_troop_id, ":cur_troop", ":agents_deliverer"),
                (troop_get_type, ":troop_type", ":cur_troop"),
                (neq, ":troop_type", 16),
                (assign, ":agent_deliverer", ":agents_deliverer"),
                (eq, ":stop", 0),
                (agent_slot_eq, ":agent_deliverer", 13, reg0),
                (try_begin),
                  (agent_get_team, ":team_no", ":agents"),
                  (try_begin),
                    (try_begin),
                      (eq, ":other_cannons_team", ":player_team"),
                      (assign, ":enemy_team", ":enemy_agent"),
                    (else_try),
                      (assign, ":enemy_team", ":cur_team"),
                    (try_end),
                    (teams_are_enemies, ":team_no", ":enemy_team"),
                    (agent_get_troop_id, ":cur_troop", ":agents"),
                    (troop_get_type, ":troop_type", ":cur_troop"),
                    (try_begin),
                      (eq, ":troop_type", 1),
                      (agent_play_sound, ":agents", "snd_woman_die"),
                    (else_try),
                      (agent_play_sound, ":agents", "snd_man_die"),
                    (try_end),
                    (try_for_agents, ":agents_team"),
                      (agent_get_team, ":agentsteam", ":agents_team"),
                      (agent_get_troop_id, ":cur_troop", ":agents_team"),
                      (is_between, ":cur_troop", "trp_mercenary_engineer", "trp_new_array_a"),
                      (eq, ":agentsteam", ":enemy_team"),
                      (assign, ":agents_deliverer", ":agents_team"),
                    (try_end),
                    (agent_deliver_damage_to_agent, ":agents_deliverer", ":agents"),
                  (try_end),
                (try_end),
                (assign, ":stop", 1),
              (try_end),
              (eq, ":stop", 0),
              (try_begin),
                (agent_get_team, ":team_no", ":agents"),
                (try_begin),
                  (try_begin),
                    (eq, ":other_cannons_team", ":player_team"),
                    (assign, ":enemy_team", ":enemy_agent"),
                  (else_try),
                    (assign, ":enemy_team", ":cur_team"),
                  (try_end),
                  (teams_are_enemies, ":team_no", ":enemy_team"),
                  (agent_get_troop_id, ":cur_troop", ":agents"),
                  (troop_get_type, ":troop_type", ":cur_troop"),
                  (try_begin),
                    (eq, ":troop_type", 1),
                    (agent_play_sound, ":agents", "snd_woman_die"),
                  (else_try),
                    (agent_play_sound, ":agents", "snd_man_die"),
                  (try_end),
                  (try_for_agents, ":agents_team"),
                    (agent_get_team, ":agentsteam", ":agents_team"),
                    (agent_get_troop_id, ":cur_troop", ":agents_team"),
                    (is_between, ":cur_troop", "trp_mercenary_engineer", "trp_new_array_a"),
                    (eq, ":agentsteam", ":enemy_team"),
                    (assign, ":agents_deliverer", ":agents_team"), 
                  (try_end),
                  (agent_deliver_damage_to_agent, ":agents_deliverer", ":agents"),
                (try_end),
              (try_end),
            (try_end),
          (try_end),
        (try_end),
      (try_end),
      (position_get_z, ":pos1z", pos1),
      (copy_position, 2, 1),
      (position_set_z, pos2, 10000),
      (position_set_z_to_ground_level, pos2),
      (position_get_z, ":pos2z", pos2),
      (val_sub, ":pos1z", ":pos2z"),
      (try_begin),
        (try_begin),
          (le, ":pos1z", 100),
          (particle_system_burst, "psys_cannon_ground_hit", pos1, 3),
          (particle_system_burst, "psys_cannon_ground_hit_b", pos1, 3),
        (try_end),
        (le, ":pos1z", 40),
        (item_get_slot, ":z_direction", ":instance", 214),
        (item_get_slot, ":time", ":instance", 215),
        (store_mul, ":gravity", ":time", "$gravity_used"),
        (val_div, ":gravity", 5),
        (val_sub, ":z_direction", ":gravity"),
        (le, ":z_direction", 0),
        (val_div, ":z_direction", -3),
        (store_random_in_range, reg1, 0, 3),
        (val_add, reg1, "snd_groundhit1"),
        (play_sound_at_position, reg1, pos1),
        (try_begin),
          (this_or_next|eq, ":ammo", "spr_cannonball"),
          (eq, ":ammo", "spr_cannonball"),
          (try_begin),
            (le, ":z_direction", 80),
            (item_set_slot, ":instance", 216, 0),
            (position_set_z, pos1, 10000),
            (position_set_z_to_ground_level, pos1, 10000),
            (position_move_z, pos1, 5),
            (prop_instance_animate_to_position, ":instance", pos1, 1),
            (try_begin),
              (try_begin),
                (eq, ":other_cannons_team", ":player_team"),
                (assign, ":enemy_team", ":enemy_agent"),
              (else_try),
                (assign, ":enemy_team", ":cur_team"),
              (try_end),
              (call_script, "script_cannon_strike_effects", 1, ":enemy_team"),
            (try_end),
          (else_try),
            (scene_prop_get_instance, ":start_instance", "spr_cannonball_start_position", ":instance_no"),
            (prop_instance_animate_to_position, ":start_instance", pos1, 1),
            (item_get_slot, ":x_direction", ":instance", 212),
            (item_get_slot, ":y_direction", ":instance", 213),
            (val_div, ":x_direction", 3),
            (val_div, ":y_direction", 3),
            (val_mul, ":x_direction", 2),
            (val_mul, ":y_direction", 2),
            (item_set_slot, ":instance", 212, ":x_direction"),
            (item_set_slot, ":instance", 213, ":y_direction"),
            (item_set_slot, ":instance", 214, ":z_direction"),
            (item_set_slot, ":instance", 215, 0),
            (call_script, "script_force_movement", ":instance"),
          (try_end),
        (else_try),
          (this_or_next|eq, ":ammo", "spr_rock_ammo"),
          (eq, ":ammo", "spr_rock_ammo"),
          (item_set_slot, ":instance", 216, 0),
          (position_set_z, pos1, 10000),
          (position_set_z_to_ground_level, pos1),
          (position_move_z, pos1, 5),
          (prop_instance_animate_to_position, ":instance", pos1, 1),
          (try_begin),
            (eq, ":other_cannons_team", ":player_team"),
            (assign, ":enemy_team", ":enemy_agent"),
          (else_try),
            (assign, ":enemy_team", ":cur_team"),
          (try_end),
          (call_script, "script_cannon_explosion_effects", 1, ":enemy_team"),
          (try_begin),
            (try_begin),
              (eq, ":other_cannons_team", ":player_team"),
              (assign, ":enemy_team", ":enemy_agent"),
            (else_try),
              (assign, ":enemy_team", ":cur_team"),
            (try_end),
            (call_script, "script_cannon_fire_effects", 1, ":enemy_team"),
          (try_end),
          (store_random_in_range, reg1, 0, 4),
          (val_add, reg1, "snd_cannon_shot1"),
          (play_sound_at_position, reg1, pos1),
          (try_begin),
            (this_or_next|eq, ":ammo", "spr_rock_ammo"),
            (eq, ":ammo", "spr_rock_ammo"),
            (assign, ":max_damage", 1600000),
          (else_try),
            (assign, ":max_damage", 3200000),
          (try_end),
          (try_for_agents, ":agents"),
            (agent_get_troop_id, ":cur_troop", ":agents"),
            (troop_get_type, ":troop_type", ":cur_troop"),
            (agent_get_horse, ":agent_horse_id", ":player_agent"),
            (neq, ":agents", ":player_agent"),
            (neq, ":troop_type", 16),
            (neq, ":agents", ":agent_horse_id"),
            (agent_is_alive, ":agents"),
            (agent_get_position, pos2, ":agents"),
            (get_distance_between_positions, ":distance", pos1, pos2),
            (is_between, ":distance", 1, 800),
            (store_div, ":damage", ":max_damage", ":distance"),
            (val_div, ":damage", ":distance"),
            (call_script, "script_get_cannon_instance", ":instance"),
            (assign, ":stop", 0),
            (try_for_agents, ":agents_deliverer"),
              (agent_get_troop_id, ":cur_troop", ":agents_deliverer"),
              (troop_get_type, ":troop_type", ":cur_troop"),
              (neq, ":agents_deliverer", ":player_agent"),
              (agent_get_horse, ":agent_horse_id", ":player_agent"),
              (neq, ":agents_deliverer", ":agent_horse_id"),
              (neq, ":troop_type", 16),
              (assign, ":agent_deliverer", ":agents_deliverer"),
              (eq, ":stop", 0),
              (agent_slot_eq, ":agent_deliverer", 13, reg0),
              (try_begin),
                (agent_get_team, ":team_no", ":agents"),
                (try_begin),
                  (try_begin),
                    (eq, ":other_cannons_team", ":player_team"),
                    (assign, ":enemy_team", ":enemy_agent"),
                  (else_try),
                    (assign, ":enemy_team", ":cur_team"),
                  (try_end),
                  (teams_are_enemies, ":team_no", ":enemy_team"),
                  (call_script, "script_agent_deliver_damage_to_agent", ":agents", ":damage", ":enemy_team"),
                (try_end),
              (try_end),
              (assign, ":stop", 1),
            (try_end),
            (eq, ":stop", 0),
            (try_begin),
              (agent_get_team, ":team_no", ":agents"),
              (try_begin),
                (try_begin),
                  (eq, ":other_cannons_team", ":player_team"),
                  (assign, ":enemy_team", ":enemy_agent"),
                (else_try),
                  (assign, ":enemy_team", ":cur_team"),
                (try_end),
                (teams_are_enemies, ":team_no", ":enemy_team"),               
                (call_script, "script_agent_deliver_damage_to_agent", ":agents", ":damage", ":enemy_team"),
              (try_end),
            (try_end),
          (try_end),
        (try_end),
      (else_try),
        (item_get_slot, ":time", ":instance", 215),
        (val_mul, ":time", 10),
        (call_script, "script_get_position_delta_by_time", ":time", ":instance"),
        (val_div, ":time", 10),
        (copy_position, 3, 1),
        (scene_prop_get_instance, ":start_instance", "spr_cannonball_start_position", ":instance_no"),
        (prop_instance_get_position, pos5, ":start_instance"),
        (position_get_x, ":instance_x", pos5),
        (position_get_y, ":instance_y", pos5),
        (position_get_z, ":instance_z", pos5),
        (position_get_x, ":pos0_x", pos9),
        (position_get_y, ":pos0_y", pos9),
        (position_get_z, ":pos0_z", pos9),
        (val_add, ":instance_x", ":pos0_x"),
        (val_add, ":instance_y", ":pos0_y"),
        (val_add, ":instance_z", ":pos0_z"),
        (position_set_x, pos3, ":instance_x"),
        (position_set_y, pos3, ":instance_y"),
        (position_set_z, pos3, ":instance_z"),
        (val_mul, ":time", 360),
        (val_div, ":time", 40),
        (position_rotate_x, pos3, ":time"),
        (position_rotate_y, pos3, ":time"),
        (prop_instance_animate_to_position, ":instance", pos3, 15),
      (try_end),
    (try_end),
  (try_end),
]),

#####################################################################

Can anyone help to improve these two scripts in the source file to be suitable for AI teams on the battlefield to cause damage to players! Hope to correct it!
 
Last edited:
Back
Top Bottom