• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.
Well if you want an answer, take the time to properly explain the problem.

Right now it's not even clear where the problem lies, because you've not explained what you've done so far and it's entirely unclear where and why you're stuck.

There's a lot of information for complete beginners here:
 
Well if you want an answer, take the time to properly explain the problem.

Right now it's not even clear where the problem lies, because you've not explained what you've done so far and it's entirely unclear where and why you're stuck.

There's a lot of information for complete beginners here:

Okay, in that case, I will

Attacking fleets in orbit, as that mod manages to pull off, is what I'm trying to do. It basically makes an event that checks whether or not the planet has a cannon and if it does, there will be damage done, as shown here:

country_event = {
id = eac_at_war.101
hide_window = yes
is_triggered_only = yes

trigger = {
any_owned_planet = {
OR = {
has_building = eac_building_planetary_proton_cannon
has_building = eac_building_planetary_neutron_cannon
has_building = eac_building_planetary_tachyon_cannon
has_building = eac_building_planetary_coil_scattergun
has_building = eac_building_planetary_rail_scattergun
}
OR = {
has_orbital_bombardment = yes
has_enemy_transport_in_orbit = yes
}
}
}

immediate = {
# log = "eac_at_war.101 - Country = [This.GetName]"
every_owned_planet = {
limit = {
OR = {
has_building = eac_building_planetary_proton_cannon
has_building = eac_building_planetary_neutron_cannon
has_building = eac_building_planetary_tachyon_cannon
has_building = eac_building_planetary_coil_scattergun
has_building = eac_building_planetary_rail_scattergun
}
OR = {
has_orbital_bombardment = yes
has_enemy_transport_in_orbit = yes
}
}
planet_event = { id = eac_at_war.110 }
}
}
}

# If enemy in orbit, fire!
planet_event = {
id = eac_at_war.110
hide_window = yes
is_triggered_only = yes

trigger = {
OR = {
has_orbital_bombardment = yes
has_enemy_transport_in_orbit = yes
}
}


immediate = {
# log = "eac_at_war.110 - Planet = [This.GetName]"
switch = {
trigger = has_building
eac_building_planetary_proton_cannon = {
planet_event = { id = eac_at_war.111 }
planet_event = { id = eac_at_war.111 days = 7 }
planet_event = { id = eac_at_war.111 days = 13 }
planet_event = { id = eac_at_war.111 days = 19 }
planet_event = { id = eac_at_war.111 days = 26 }

}
eac_building_planetary_neutron_cannon = {
planet_event = { id = eac_at_war.112 }
planet_event = { id = eac_at_war.112 days = 8 }
planet_event = { id = eac_at_war.112 days = 16 }
planet_event = { id = eac_at_war.112 days = 24 }
}
eac_building_planetary_tachyon_cannon = {
planet_event = { id = eac_at_war.113 }
planet_event = { id = eac_at_war.113 days = 11 }
planet_event = { id = eac_at_war.113 days = 21 }
}
eac_building_planetary_coil_scattergun = {
planet_event = { id = eac_at_war.114 }
planet_event = { id = eac_at_war.114 days = 4 }
planet_event = { id = eac_at_war.114 days = 8 }
planet_event = { id = eac_at_war.114 days = 12 }
planet_event = { id = eac_at_war.114 days = 16 }
planet_event = { id = eac_at_war.114 days = 20 }
planet_event = { id = eac_at_war.114 days = 24 }
}
eac_building_planetary_rail_scattergun = {
planet_event = { id = eac_at_war.115 }
planet_event = { id = eac_at_war.115 days = 5 }
planet_event = { id = eac_at_war.115 days = 10 }
planet_event = { id = eac_at_war.115 days = 15 }
planet_event = { id = eac_at_war.115 days = 20 }
planet_event = { id = eac_at_war.115 days = 25 }
}
}
}
}
This would mean that it allows only one cannon of each type. I'm looking for a way to allow multiple cannons in one planet firing at the same time and have the damage scale accordingly. This is because I'm trying to make districts with cannons which would fire any time an enemy is seen in orbit.
 
Well in that case you'll need to learn the basics of the scripting language. You can use other mods for reference, but you probably can't just copy the entire script and make some edits and then call it "your" mod, unless you've got permission of the author.

As for the actual problem though, using a while loop...
Code:
while - Repeats enclosed effects while limit criteria are met or until set iteration count is reached
while = { limit = { <triggers> } <effects> }
 while = { count = [3|Variable] <effects> }
Supported Scopes: all

...with num_districts...

Code:
num_districts - Checks the number the planet has of any, or a specific, district
num_districts = { type = <key/any> value > 2/variable }
Supported Scopes: planet
...as the trigger should work. Alternatively, one could save num_districts as a variable that is then multiplied with the damage of each weapon and go from there.