Page 1 of 1

help with some scripting

Posted: Tue Nov 20, 2012 2:54 pm
by loki100
I'm pretty rubbish at scripting but would really like to clean up one small irritant in my current PoN game.

I captured Massawa from the Ottomans in a war, have 100% MC, it even shows as an Italian colony but the harbour in the province remains Ottoman (& thus Massawa stays as Ottoman according to the F10 screen).

can anyone give me the syntax I can use to write a small event that will bounce ownership from the Ottomans to Italy? Or what I might need to adjust in the trn/save files?

its just I'd really like a concrete gain for 3 years of war ...

ta

Posted: Tue Nov 20, 2012 4:25 pm
by Moriety
I have exactly the same problems in the region (as Russia), but not from war. Massawa is an S-P owned town, along with several structures. I also have a French town parked in the middle of Ethiopia. The British have a fleet parked in Djibouti despite there being no sea structures. Several provinces in the horn of Africa also have S-P structures. In Afghanistan the Brit's own the Khyber Pass town and MO. All three provinces are illegally owned by them, not me.

A script that you can run to check for illegally owned structures would be great.

Posted: Tue Nov 20, 2012 11:14 pm
by powloon1
There is a link on the paradox site where Sagji explains how to do something similar

Remove Add Structures

Basically it looks like you need to remove the structure and recreate it. I tried it with the problem in my game where Austria retained control of the Parma Iron mine and wheat farm after unification.

I used the 2 scripts below (which I added to the Italian unification event file)

Code: Select all

SelectFaction = $AUS
SelectRegion = $Parma

StartEvent = Austria returns iron mines to Italy|1|1|NULL|NULL|$Po|NULL
Actions
 
  SelectRegion = $Parma
  RemoveStructure = ByDefUID $Iron1;RANDOM;SINGLEFAC

  SelectFaction = $ITA
  SelectRegion = $Parma
  CreateStruc
  SetType = $Iron1
  SetName = Italian Feris
  Apply   
 
EndEvent

SelectFaction = $AUS
SelectRegion = $Parma

StartEvent = Austria returns cereal mines to Italy|1|1|NULL|NULL|$Po|NULL
Actions

  SelectRegion = $Parma
  RemoveStructure = ByDefUID $Cereals1;RANDOM;SINGLEFAC

  SelectFaction = $ITA
  SelectRegion = $Parma
  CreateStruc
  SetType = $Cereals1
  SetName = Parma Wheat
  Apply   
 
EndEvent



It seemed to work ok

Posted: Thu Nov 22, 2012 9:05 pm
by Kensai
loki100,

Code: Select all

SelectFaction = $CMN
SelectRegion = $Massawa

StartEvent = Massawa Ownership Change|1|1|NULL|NULL|$Massawa|NULL
Actions
  SelectFaction = $ITA
  SelectRegion = $Massawa
  ChangeRgnOwner = TUR
EndEvent


Bear in mind this will give all Turkish assets of Massawa to Italy, including structures, loyalty and CP. Units will not be given though.

Posted: Thu Nov 22, 2012 9:16 pm
by loki100
thank you both, I'll run it tomorrow ... then 3 years after conquest it will all be mine .... mine, my precious ...

Posted: Thu Nov 22, 2012 9:38 pm
by Jim-NC
Will you get a ring to go with it? And maybe a fiery mountain? :w00t:

Posted: Fri Nov 23, 2012 8:57 am
by loki100
Jim-NC wrote:Will you get a ring to go with it? And maybe a fiery mountain? :w00t:


well rather scarily, shortly after I captured it, Vesuvius blew up ....

Posted: Sat Nov 24, 2012 4:41 am
by Jim-NC
loki100 wrote:well rather scarily, shortly after I captured it, Vesuvius blew up ....


:rofl: mere coincidence I'm sure.

Posted: Sat Nov 24, 2012 12:27 pm
by czert2
i did this event :

SelectFaction = $CMN
SelectRegion = $Sonla

StartEvent = Soula Ownership Change|1|1|NULL|NULL|$Sonla|NULL
Actions
SelectFaction = $RUS
SelectRegion = $Sonla
ChangeRgnOwner = FRA

EndEvent

SelectFaction = $CMN
SelectRegion = $Hanoi
StartEvent = Hanoi Ownership Change|1|1|NULL|NULL|$Hanoi|NULL
Actions
SelectFaction = $RUS
SelectRegion = $Hanoi
ChangeRgnOwner = FRA

EndEvent

SelectFaction = $CMN
SelectRegion = $Thanh Hoa
StartEvent = Thanh Hoa Ownership Change|1|1|NULL|NULL|$Thanh Hoa|NULL

SelectFaction = $RUS
SelectRegion = $Thanh Hoa
ChangeRgnOwner = FRA

EndEvent

it was meaned to fix problem france still controling regions after i have 100MC here and are my colonys. I named it xxx.sct and copied undes events folder and event dont fire, what i did wrong ?

Posted: Sat Nov 24, 2012 8:12 pm
by Jim-NC
Did you add the script name to the 1850 GC.sct? This the main controlling script, and any scripts you add need to be in there. It can be found in the events folder as well.

Posted: Sat Nov 24, 2012 9:16 pm
by czert2
Hehehe, no :) . Have no idea it is needed here too, OTOH it is logical, since is here many files for many campaigns.

Posted: Sun Nov 25, 2012 7:39 pm
by czert2
After adding them to corect file, only hanoi changed ownership, ohers two not, and yes i notited and fixed typo, it was sonla instead of soula :) .

Posted: Sun Nov 25, 2012 9:48 pm
by loki100
czert2 wrote:After adding them to corect file, only hanoi changed ownership, ohers two not, and yes i notited and fixed typo, it was sonla instead of soula :) .


well looking at your syntax, the Hanoi event is the only one with no gaps, not got a clue if that is relevant, but its the only obvious difference between them?

Posted: Mon Nov 26, 2012 12:35 pm
by Moriety
Kensai wrote:loki100,

Code: Select all

SelectFaction = $CMN
SelectRegion = $Massawa

StartEvent = Massawa Ownership Change|1|1|NULL|NULL|$Massawa|NULL
Actions
  SelectFaction = $ITA
  SelectRegion = $Massawa
  ChangeRgnOwner = TUR
EndEvent


Bear in mind this will give all Turkish assets of Massawa to Italy, including structures, loyalty and CP. Units will not be given though.


Thank you Kensai!!
I managed to change the three stuck provinces by putting this script into a random Russian scenario file (Politics I think).
I'm so glad the cities involved have changed ownership.....at last! :)

Posted: Tue Nov 27, 2012 4:44 pm
by czert2
loki100 wrote:well looking at your syntax, the Hanoi event is the only one with no gaps, not got a clue if that is relevant, but its the only obvious difference between them?

after more looking at it i found that i lacked Actions between start event and select faction,after adding it worked.

Posted: Fri Nov 30, 2012 12:39 pm
by Sir Garnet
I have the same problem in the Congo with a Belgian flag flying over my colony and blocking colonial actions. I was looking for something that changes the flag without changing their structures (which they may be disinclined to agree to though I think I am entitled to the flag).