johandenver2
Lieutenant
Posts: 101
Joined: Mon May 09, 2016 9:46 pm

Abilities on structures?

Tue Apr 25, 2017 6:57 pm

Is there any way to use abilities (that typically are used on leaders) on structures?

User avatar
Bohémond
Posts: 2799
Joined: Wed May 14, 2008 8:47 pm

Re: Abilities on structures?

Tue Apr 25, 2017 9:43 pm

AFAIK, there is no way to se abilities with structures.
But you can use attributes (even Custom made) and associate events to the structures via the DB.

What is the goal of using abilities with structures ?

Regards

johandenver2
Lieutenant
Posts: 101
Joined: Mon May 09, 2016 9:46 pm

Re: Abilities on structures?

Wed Apr 26, 2017 11:34 am

I was thinking about trying to create VMI, West Point, The Citadel etc. as places to train troops (in the same way McClellan can train troops with his ability)

User avatar
Bohémond
Posts: 2799
Joined: Wed May 14, 2008 8:47 pm

Re: Abilities on structures?

Wed Apr 26, 2017 5:19 pm

You can do it by

-Creating a custom structure with a script event associated.

Do you download the CW2 DB files ?

Let me know if you need some guidance to create the structure and the event.

Regards

johandenver2
Lieutenant
Posts: 101
Joined: Mon May 09, 2016 9:46 pm

Re: Abilities on structures?

Thu Apr 27, 2017 6:50 am

I've created a custom structure and that seems to be working fine so it would just be creating the event that I'd need help with.
I haven't downloaded the db-files since I find them overwhelming to work with, I just edit everything directly instead.

I'd love some information about creating events :-)

User avatar
Bohémond
Posts: 2799
Joined: Wed May 14, 2008 8:47 pm

Re: Abilities on structures?

Thu Apr 27, 2017 10:54 pm

At the end of your str file add ;

ScriptFileName = Structures
ScriptName = STRScriptWestPoint


Create a .sct file names Structures.sct un Event game folder.

In it you should have something like this in it ;

StartEvent = STRScriptWestPoint|999|0|NULL|NULL|NULL|NULL

Conditions

Actions
SelectSubUnits = models $mdl_USA_Inf5
AlterCuSubUnit = ApplytoList; Attempts 2; Convert $mdl_USA_Inf1

EndEvent


Not tested but it should work.

Let me know if works as you expect.

Regards

johandenver2
Lieutenant
Posts: 101
Joined: Mon May 09, 2016 9:46 pm

Re: Abilities on structures?

Fri Apr 28, 2017 7:59 am

Thanks a lot!

I'll try this and let you know how it works :-)

EDIT:
I tried creating a brigade of conscripts but they never upgraded to regular infantry.
In my brigade there are two regiments of INF5 and two INF6 but at least the two INF5 should have been upgraded I think.

Can I add multiple units to be upgraded in this way so that the event triggers for INF6 as well?
Last edited by johandenver2 on Fri Apr 28, 2017 9:55 pm, edited 1 time in total.

johandenver2
Lieutenant
Posts: 101
Joined: Mon May 09, 2016 9:46 pm

Re: Abilities on structures?

Fri Apr 28, 2017 8:41 pm

How would I change the event to emulate "MasterDriller" instead of "Trainer"?

Also, would it be possible to do a similar event to remove manpower from the opposing side?
The idea here is to simulate a prison by removing a small amount of manpower from your enemy and also make your enemy want to destroy the prison if possible.

Another thing I'd like to do is to make an event to create hospitals.
Could I make an event using "MedicalService"?

User avatar
Bohémond
Posts: 2799
Joined: Wed May 14, 2008 8:47 pm

Re: Abilities on structures?

Sat Apr 29, 2017 1:00 am

johandenver2 wrote:Thanks a lot!

I'll try this and let you know how it works :-)

EDIT:
I tried creating a brigade of conscripts but they never upgraded to regular infantry.
In my brigade there are two regiments of INF5 and two INF6 but at least the two INF5 should have been upgraded I think.

Can I add multiple units to be upgraded in this way so that the event triggers for INF6 as well?


I will need your ScriptReportsfolder to analyze why it is not working.

You can use the same script to upgrade any models int any models

Regards

johandenver2
Lieutenant
Posts: 101
Joined: Mon May 09, 2016 9:46 pm

Re: Abilities on structures?

Sat Apr 29, 2017 11:51 am

There are some content in the script reports about "West point" so it's obivously trying to run the script.
Sometimes one of the regiments in my brigade gets upgraded which leads me to think that the event is checking units everywhere to upgrade, not only in the city where the training camp is located.

Also, is there any guide to the contents of the structure file?
I know what some of the things in there are but not nearly all of them :-)

/J
Attachments
Scripts.zip
(1.19 MiB) Downloaded 191 times

User avatar
Bohémond
Posts: 2799
Joined: Wed May 14, 2008 8:47 pm

Re: Abilities on structures?

Sat Apr 29, 2017 9:23 pm

You are right, the script is looking for conscripts everywhere, please try this ;

StartEvent = STRScriptWestPoint|999|0|NULL|NULL|NULL|NULL

Conditions

Actions
SelectSubUnits = Region; models $mdl_USA_Inf5
AlterCuSubUnit = ApplytoList; Attempts 1; Convert $mdl_USA_Inf1
SelectSubUnits = Region; models $mdl_USA_Inf56
AlterCuSubUnit = ApplytoList; Attempts 1; Convert $mdl_USA_Inf2

EndEvent


If tyou want more informations about the structure file contents, you will have to download the DB files and I will try to answer your questions. DB files have a lot of comments from game designer that can help understand files contents.

Regards

johandenver2
Lieutenant
Posts: 101
Joined: Mon May 09, 2016 9:46 pm

Re: Abilities on structures?

Sat Apr 29, 2017 9:28 pm

Thanks!

I've downloaded the DB-files and got a lot of information from them. I think I know how to simulate prisons by event but I still can't figure out the mechanism behind the ability "MedicalService" or how to use that in an event.

I'll read more in the DB-files and let you know if there's something specific I don't understand.

Thanks for all your help.

/Johan

User avatar
Bohémond
Posts: 2799
Joined: Wed May 14, 2008 8:47 pm

Re: Abilities on structures?

Sun Apr 30, 2017 2:43 am

If you want to ''associate'' the medical service ability to a structure, you will have to create a event associated with the structure that will be similar to ;

StartEvent = STRScriptHospital|999|0|NULL|NULL|NULL|NULL

Conditions

Actions
SelectSubUnits = Region
AlterCuSubUnit = ApplytoList; SetCohesionPerc Value 100

EndEvent



Regards

johandenver2
Lieutenant
Posts: 101
Joined: Mon May 09, 2016 9:46 pm

Re: Abilities on structures?

Sun Apr 30, 2017 10:32 am

Thanks a million Bohémont, I really appriciate your information. I'll try all your suggestions and we'll see how it goes :-)

User avatar
Nikel
Posts: 2879
Joined: Sun Apr 20, 2008 8:38 pm

Re: Abilities on structures?

Sun Apr 30, 2017 5:42 pm

Bohémond is one of the ablest members of the forum , but posts too few.

Quite good that somebody gets him out of his cave :hat:

johandenver2
Lieutenant
Posts: 101
Joined: Mon May 09, 2016 9:46 pm

Re: Abilities on structures?

Thu May 04, 2017 2:31 am

I tried the script below but the results are confusing me a bit.

For testing purposes I have created a brigade in the same city as the hospital is located and set their health and cohesion to 50. The brigade is organized as this:
ModelType0 = $mdl_USA_Inf5|1
ModelType1 = $mdl_USA_Inf5|1
ModelType2 = $mdl_USA_Inf6|1
ModelType3 = $mdl_USA_Inf6|1
ModelType4 = $mdl_USA_Shp2|1

The get the following names (in my game)
4th Missouri, 5th Missouri, 6th Missouri, 7th Missouri and 7th MO Sharpshooter Co

For some reason the script always picks 4th & 5th Missouri but it lowers cohesion to 15-16 and sets health to 600/600 (max amount of men)
I was expecting health to stay at 300/600 and cohesion to be 100.
Also I don't understand why the script never picks any of the other units.
I've attached the script log at the bottom of this message.


Code: Select all

StartEvent = STRScriptHospital|999|0|NULL|NULL|NULL|NULL

Conditions

Actions
SelectSubUnits = Region; models $mdl_USA_Inf5
AlterCuSubUnit = ApplytoList; SetCohesionPerc Value 100
SelectSubUnits = Region; models $mdl_USA_Inf5
AlterCuSubUnit = ApplytoList; SetCohesionPerc Value 100

DescEvent = evt_STRScriptHospital
GenMsg

EndEvent



Code: Select all

No error in this script
--------------START OF SCRIPT----------------
Line 0:  Started processing event: STRScriptHospital
Line 0:  This event is not yet referenced, base number of allowed occurences 999
Line 4:  Entering triggered actions for event STRScriptHospital
Line 5:  SelectSubUnits 1003271 5th Missouri added, List Count now at: 1
Line 5:  SelectSubUnits 1003270 4th Missouri added, List Count now at: 2
Line 5:  SelectSubUnits finished Regions Selected: 1 SubUnits Selected: 2
Line 6:  AlterCuSubUnit 1003271 5th Missouri cohesion changed to  1
Line 6:  AlterCuSubUnit 1003270 4th Missouri cohesion changed to  1
Line 7:  SelectSubUnits 1003271 5th Missouri added, List Count now at: 1
Line 7:  SelectSubUnits 1003270 4th Missouri added, List Count now at: 2
Line 7:  SelectSubUnits finished Regions Selected: 1 SubUnits Selected: 2
Line 8:  AlterCuSubUnit 1003270 4th Missouri cohesion changed to  1
Line 8:  AlterCuSubUnit 1003271 5th Missouri cohesion changed to  1
Line 13:  Finished processing event: STRScriptHospital
Line 13:  ------------------------------
------------------------------
Error(s) found: 0
Warning(s) found: 0
--------------END OF SCRIPT----------------

johandenver2
Lieutenant
Posts: 101
Joined: Mon May 09, 2016 9:46 pm

Re: Abilities on structures?

Thu May 04, 2017 10:12 am

StartEvent = STRScriptHospital|999|0|NULL|NULL|NULL|NULL

Conditions

Actions
SelectSubUnits = Region; models $mdl_USA_Inf5
AlterCuSubUnit = ApplytoList; SetCohesionPerc Value 100
SelectSubUnits = Region; models $mdl_USA_Inf6
AlterCuSubUnit = ApplytoList; SetCohesionPerc Value 100

DescEvent = evt_STRScriptHospital
GenMsg


Ok, I corrected the stupid mistake above so now all but one (4th Missouri) get full health and very low cohesion. Even the sharpshooter unit that I would think isn't included in the script above?

johandenver2
Lieutenant
Posts: 101
Joined: Mon May 09, 2016 9:46 pm

Re: Abilities on structures?

Thu May 04, 2017 12:58 pm

I think I got it working ok with this script:
With this all units will get stronger than if the hospital wasn't there but not go to full health and cohesion within 1 turn.

Code: Select all

StartEvent = STRScriptHospital|999|0|NULL|NULL|NULL|NULL

Conditions

Actions
SelectSubUnits = Region
AlterCuSubUnit = ApplytoList; ChgCohesionPerc 25
SelectSubUnits = Region
AlterCuSubUnit = ApplytoList; ChgHealthPerc 25

DescEvent = evt_STRScriptHospital
GenMsg

EndEvent

User avatar
Bohémond
Posts: 2799
Joined: Wed May 14, 2008 8:47 pm

Re: Abilities on structures?

Thu May 04, 2017 1:09 pm

Nice job.

As you noted, there was a syntax error in my template (Value should not be there).

Regards

User avatar
Pocus
Posts: 25659
Joined: Wed Oct 19, 2005 7:37 am
Location: Lyon (France)

Re: Abilities on structures?

Thu May 04, 2017 3:46 pm

Good job and congrats also to Bohémond!

johandenver2
Lieutenant
Posts: 101
Joined: Mon May 09, 2016 9:46 pm

Re: Abilities on structures?

Thu May 04, 2017 11:20 pm

Thanks, I'm quite pleased with the result, couldn't have done it without your help though :-)

Is it possible to get a news item out of this script as well?
I've tried the usual way, that works when dealing with regular events but I never get any news when my modded structures produce or alter stuff.

User avatar
Bohémond
Posts: 2799
Joined: Wed May 14, 2008 8:47 pm

Re: Abilities on structures?

Fri May 05, 2017 12:10 am

Do you add the event name to the localStrings file and switch the 0 to 1 in the StartEvent SctiptCommand ?

johandenver2
Lieutenant
Posts: 101
Joined: Mon May 09, 2016 9:46 pm

Re: Abilities on structures?

Fri May 05, 2017 12:52 am

Arrrg, I forgot about changing 0 to 1...thanks. Now it's working as expected :-)

johandenver2
Lieutenant
Posts: 101
Joined: Mon May 09, 2016 9:46 pm

Re: Abilities on structures?

Sun May 07, 2017 10:40 pm

Is there a way to make the messages appear only in a unit actually was trained/healed at a structure?

Right now I'm getting messages every turn even if no unit is present.
I suspect I could use some sort of eval-function but I don't know the syntax at all for this.

User avatar
Bohémond
Posts: 2799
Joined: Wed May 14, 2008 8:47 pm

Re: Abilities on structures?

Mon May 08, 2017 12:51 am

You can switch back the 1 to 0 in the StartEvent Scriptcommand.
Then add a GenTextMsg ScriptCommand (http://www.ageod.net/agewiki/GenTextMsg) in the action Block.

Please let me know if it helps.

Regards

johandenver2
Lieutenant
Posts: 101
Joined: Mon May 09, 2016 9:46 pm

Re: Abilities on structures?

Tue May 09, 2017 12:36 am

I tried this but the result is unfortunately the same.



Code: Select all

StartEvent = STRScriptHospital|999|0|NULL|NULL|NULL|NULL

Conditions

Actions
SelectSubUnits = Region
AlterCuSubUnit = ApplytoList; ChgCohesionPerc 25
SelectSubUnits = Region
AlterCuSubUnit = ApplytoList; ChgHealthPerc 25
GenTextMsg = evt_STRScriptHospital|999|NULL|NULL|NULL

EndEvent

User avatar
Bohémond
Posts: 2799
Joined: Wed May 14, 2008 8:47 pm

Re: Abilities on structures?

Tue May 09, 2017 1:45 am

The event is always true as the Conditions Block is empty.

You can try this ;

StartEvent = STRScriptHospital|999|0|NULL|NULL|NULL|NULL

Conditions
SelectSubUnits = Region
EvalSubUnitSel = NULL

Actions
SelectSubUnits = Region
AlterCuSubUnit = ApplytoList; ChgCohesionPerc 25
SelectSubUnits = Region
AlterCuSubUnit = ApplytoList; ChgHealthPerc 25
GenTextMsg = evt_STRScriptHospital|1|NULL|NULL|NULL

EndEvent


The event will fire only if at least one element is present in the region.
Note that change the 999 in the GenTextMsg to 1.

Let me know if it helps

Regards

johandenver2
Lieutenant
Posts: 101
Joined: Mon May 09, 2016 9:46 pm

Re: Abilities on structures?

Tue May 09, 2017 2:32 am

That did the trick, thanks a lot (again) :-)

User avatar
Bohémond
Posts: 2799
Joined: Wed May 14, 2008 8:47 pm

Re: Abilities on structures?

Tue May 09, 2017 5:51 pm

You are welcome.

Do not hesitate to ask if you have any issue,

Regards

johandenver2
Lieutenant
Posts: 101
Joined: Mon May 09, 2016 9:46 pm

Re: Abilities on structures?

Wed May 10, 2017 3:23 pm

Can I somehow reference the specific region in my message?

For example I'd like my final message to be something like,
"Units have been trained at Jefferson Barracks, St Louis"

Is that possible?

Return to “CW2 Mods”

Who is online

Users browsing this forum: No registered users and 7 guests