[Modding] Creating my first scenario

pavelk
Kubat Software
Kubat Software
Posts: 2467
Joined: Mon May 16, 2016 4:27 pm

Re: [Modding] Creating my first scenario

Post by pavelk »

Cablenexus wrote:The one that he is CURRENTLY researching? Or the last one researchED? I probably was confused with the list below.
The one which is currently researched. There is no "record" about the last researched technology in the save files...
Cablenexus wrote:Also, isn't their an ambient sound for flying animals? I hear them.
Those are terrain sounds...You can use them and add cows moo
Cablenexus wrote:Also is their a tech needed to be able to drain? Is that part of the field and/or farm technology?
It is currently not bound to any technology...
Last edited by pavelk on Thu Jun 14, 2018 5:21 pm, edited 1 time in total.
Cablenexus
Sr. Colonel - Battleship
Sr. Colonel - Battleship
Posts: 1691
Joined: Mon Jan 04, 2016 7:09 pm

Re: [Modding] Creating my first scenario

Post by Cablenexus »

- Since I also want to make a guide for modding, I try to organize all information already for myself what you give me in the forums. That's very helpful.

I wonder of there is a fixed lists of tech ID's, terrain ID's and unit ID's avaialble as used by the game (or the rome ag file at least).
If not I have to make one myself what is no problem, only a lot of work if this list is already available.
Cablenexus
Sr. Colonel - Battleship
Sr. Colonel - Battleship
Posts: 1691
Joined: Mon Jan 04, 2016 7:09 pm

Re: [Modding] Creating my first scenario

Post by Cablenexus »

pavelk wrote:
Cablenexus wrote:The one that he is CURRENTLY researching? Or the last one researchED? I probably was confused with the list below.
The one which is currently researched. There is no "record" about the last researched technology in the save files...
Cablenexus wrote:Also, isn't their an ambient sound for flying animals? I hear them.
Those are terrain sounds...You can use them and add cows moo
Cablenexus wrote:Also is their a tech needed to be able to drain? Is that part of the field and/or farm technology?
It is currently not bound to any technology...[/quote]

It doesn't feel right to make requests just for my scenario, but in general I think it should be a tech itself (or part of a current tech).

Since half of my scenario is based on draining tiles (that's how Holland is build) I want to add some diversity in tribes who can drain in the beginning of the game.
pavelk
Kubat Software
Kubat Software
Posts: 2467
Joined: Mon May 16, 2016 4:27 pm

Re: [Modding] Creating my first scenario

Post by pavelk »

Cablenexus wrote:It doesn't feel right to make requests just for my scenario, but in general I think it should be a tech itself (or part of a current tech).

Since half of my scenario is based on draining tiles (that's how Holland is build) I want to add some diversity in tribes who can drain in the beginning of the game.
No problem. That's what the scripts are for.
Find "Msgs.cs" file add find this part in DrainWater class (it should be somewhere near line 680)

Code: Select all

public override bool IsEnabled
{
	get
	{
		ChartSquare square = State.Chart[Unit.Position];
		if (Unit.Model.Id != 15
			|| !IsPositionChecked
			|| (square.HasOwner && square.Owner != Unit.OwnedBy))
		{
			return false;
		}

		return true;
	}
}
and in front of the "return true" add these lines:

Code: Select all

Technology requiredTechnology = State.Technologies.GetTechnologyById(10);
PlayerTechnology playerTechnology = playerFrom.Technologies.GetTechnology(requiredTechnology);
if (playerTechnology == null || !playerTechnology.IsDeveloped)
{
	return false;
}
The only part missing is to change the number 10 to whatever technology you want:)
Cablenexus
Sr. Colonel - Battleship
Sr. Colonel - Battleship
Posts: 1691
Joined: Mon Jan 04, 2016 7:09 pm

Re: [Modding] Creating my first scenario

Post by Cablenexus »

pavelk wrote:
Cablenexus wrote:It doesn't feel right to make requests just for my scenario, but in general I think it should be a tech itself (or part of a current tech).

Since half of my scenario is based on draining tiles (that's how Holland is build) I want to add some diversity in tribes who can drain in the beginning of the game.
No problem. That's what the scripts are for.
Find "Msgs.cs" file add find this part in DrainWater class (it should be somewhere near line 680)

Code: Select all

public override bool IsEnabled
{
	get
	{
		ChartSquare square = State.Chart[Unit.Position];
		if (Unit.Model.Id != 15
			|| !IsPositionChecked
			|| (square.HasOwner && square.Owner != Unit.OwnedBy))
		{
			return false;
		}

		return true;
	}
}
and in front of the "return true" add these lines:

Code: Select all

Technology requiredTechnology = State.Technologies.GetTechnologyById(10);
PlayerTechnology playerTechnology = playerFrom.Technologies.GetTechnology(requiredTechnology);
if (playerTechnology == null || !playerTechnology.IsDeveloped)
{
	return false;
}
The only part missing is to change the number 10 to whatever technology you want:)
Cool, thanks!
pavelk
Kubat Software
Kubat Software
Posts: 2467
Joined: Mon May 16, 2016 4:27 pm

Re: [Modding] Creating my first scenario

Post by pavelk »

Cablenexus wrote:I wonder of there is a fixed lists of tech ID's, terrain ID's and unit ID's avaialble as used by the game (or the rome ag file at least).
If not I have to make one myself what is no problem, only a lot of work if this list is already available.
Of course there is. Look at ancient_rome and find TechnologyMemento, TerrainPropertiesMemento, UnitModelMemento memento... everything is in the mod file - no hardcoded values in the code itself. If you mean if there is such a list, here you go

Terrain IDs
1 grassland
2 plain
3 desert
4 water
5 mountain
6 forest
7 hill
8 jungle
9 tundra
10 swamp


Technologies
1 Primitive
2 Religion - Temple
3 Sailing - Boat
4 Cultivation Field
5 Astrology - Monarchy
6 Exploration - Settler
7 Siege warfare - city raider
8 Transportation - Wagon
9 Fortification - city walls
10 horsemanship - basic cavalry
11 Defensive wall
12 Ethics - Aristocracy
13 Navigation - galley
14 Irrigation - farms
15 Forging - blacksmith
16 Paving - paved roads
17 Literacy - republic
18 Guarding - patrol tower
19 military elite - expert unit
20 warship - trireme
21 riding academy - expert cavalry
22 citizenship - democracy
23 Law - empire
24 guerilla troops - double attack
25 survival skills - withdrawal
26 weapon skills - extra attack force
27 Coinage - trading
28 standing army - basic unit
29 shipbuilding - shipyard
30 Riding school - stable
31 marching camp - stockade
32 city defense - homeland defender
33 philosophy - school
34 beacons - extra view range
35 drill arena - discipline
36 ranking system - advanced unit
37 construction - amphiteater
38 earthworks - palisade
39 elite corps - strength
40 military duty - indomitability
41 patronage - obedience
42 casting - Eco blacksmith
43 riding hall - expert cavalry
44 urbanization - eco city
45 warrior cult - petrifying
46 public order - civil service
47 field defense - extra fortified
48 sanitation - sewer
49 mountain unit - mountain movement
50 physicians - healer
51 close combat - sneak attack
52 scouting - commando
53 arts - academy
54 engineering - protected
55 honor code - tenacious
56 medicine - hospital
57 raiding - coastal landing
58 camouflage - ambush
59 marching - traveller
60 heroism - strength of defense
61 loaded march - extra movement

Unit models
1 City
4 Shipyard
6 Defensive Wall
7 Temple
8 Patrol Tower
9 Stable
10 Fort
11 Blacksmith
13 Nomad
15 Settler
16 Hoplite
17 Legionary
18 Warrior
19 Warriors
20 Axemen
21 Axemasters
22 Light Cavalry
23 Melee infantry
24 Swordsmen
25 Sacred Band
26 Peltasts
27 Hoplites
28 Phalanx
29 Spearmen
30 Pikemen
31 Immortals
32 Milites
33 Centurias
34 Legionaries
35 Warrior Cavalry
36 Axeman Cavalry
37 Axemaster Cavalry
38 Peltast Cavalry
39 Hoplite Cavalry
40 Hippeis Cavalry
41 Melee Cavalry
42 Swordsman Cavalry
43 Numidian Cavalry
44 Milites Cavalry
45 Centuria Cavalry
46 Legionary Cavalry
47 Spearman Cavalry
48 Lanced Cavalry
49 Cataphract
57 Boat
58 Galley
59 Trireme
63 Heavy Cavalry
66 Coal Mine
67 Gold Mine
68 Iron Mine
69 Stone Quarry

Some of the technology name might got changed a bit and also its revealed inventions... (we still tweak them)
Last edited by pavelk on Thu Jun 21, 2018 8:52 am, edited 1 time in total.
Cablenexus
Sr. Colonel - Battleship
Sr. Colonel - Battleship
Posts: 1691
Joined: Mon Jan 04, 2016 7:09 pm

Re: [Modding] Creating my first scenario

Post by Cablenexus »

Great list. Thank you
Cablenexus
Sr. Colonel - Battleship
Sr. Colonel - Battleship
Posts: 1691
Joined: Mon Jan 04, 2016 7:09 pm

Re: [Modding] Creating my first scenario

Post by Cablenexus »

Goodmorning,

Before I (hopefully today) upgrade the scenario for Beta v4 I have a few questions regarding my scenario ag. Please keep in mind that I was not aware of the isInEditMode command at start of creating my scenario so there are left overs (like the reports etc) in my file that I don't want.

I get rid of the reports now without crashing. This seems to work.

Still there are some lines I don't understand. For example the Roman Empire has this line:

<serverCacheObjects>
<doubles>
<SerializableStringDoublePair key="skippedTurns" value="2" />
</doubles>
</serverCacheObjects>

What is it?

And all tribes have:

<maintenanceResources>
<resources>
<PlayerResourceMemento id="1" value="-0.897" />
<PlayerResourceMemento id="2" value="-0.175" />
<PlayerResourceMemento id="3" value="-0.193" />
<PlayerResourceMemento id="4" value="-0.175" />
<PlayerResourceMemento id="5" value="3.346" />
<PlayerResourceMemento id="6" value="0.117" />
<PlayerResourceMemento id="8" value="0.862" />
<PlayerResourceMemento id="9" value="0.586" />
<PlayerResourceMemento id="10" value="0.053" />
<PlayerResourceMemento id="11" />
</resources>
</maintenanceResources>
<lastTurnResources>
<resources>
<PlayerResourceMemento id="1" value="20" />
<PlayerResourceMemento id="2" value="20" />
<PlayerResourceMemento id="3" value="20" />
<PlayerResourceMemento id="4" value="10" />
<PlayerResourceMemento id="5" value="20" />
<PlayerResourceMemento id="6" value="10" />
<PlayerResourceMemento id="8" value="26.732" />
<PlayerResourceMemento id="10" value="16" />
<PlayerResourceMemento id="11" value="86.242" />
<PlayerResourceMemento id="9" />
</resources>
</lastTurnResources>

Can I safely delete those blocks completely?
Cablenexus
Sr. Colonel - Battleship
Sr. Colonel - Battleship
Posts: 1691
Joined: Mon Jan 04, 2016 7:09 pm

Re: [Modding] Creating my first scenario

Post by Cablenexus »

I also wonder for the Unit Availability you can specify, true or false for unit models per player. If you do not specify anything at all will it have access to all or none of the units? Are wagons, settlers always available? And are those true flase options only for military?
Cablenexus
Sr. Colonel - Battleship
Sr. Colonel - Battleship
Posts: 1691
Joined: Mon Jan 04, 2016 7:09 pm

Re: [Modding] Creating my first scenario

Post by Cablenexus »

Do you also have one ID list for the factions?

Is there an easy way to get ID lists myself from the ag files in notepad++ ?
I know where I can find the ID numbers for certain game elements, but how to get just the ID's in a list like you gave me?
Cablenexus
Sr. Colonel - Battleship
Sr. Colonel - Battleship
Posts: 1691
Joined: Mon Jan 04, 2016 7:09 pm

Re: [Modding] Creating my first scenario

Post by Cablenexus »

With the release of V 4 I want to add another 3 factions.

I also hope I run out of factions, so I might need to learn to ADD one, instead of overwriting one ;-)

I want to give an example of how complicated things can be some times in terms of getting historical accurate names in the scenario, without doing a study for years.

I want to add a second Frisii tribe on the Western island next to Frisii. They are also Frisii, but West Frisii, so I tried to find the name used in ancient times for "West"

As it's a German origin word I can use Wes Frisii, or the Latin name Frisii Occidentālis.

https://linguistics.stackexchange.com/q ... t-and-west
pavelk
Kubat Software
Kubat Software
Posts: 2467
Joined: Mon May 16, 2016 4:27 pm

Re: [Modding] Creating my first scenario

Post by pavelk »

Cablenexus wrote:serverCacheObjects
To allow modders to create and store their own variables (per - unit, player, game action, game condition, event and unit action) the concept of cache objects was created. Basically if you for example want to (for whatever reason) store an information about unit (like first successful attack for example) which you later use again (for whatever functionality you might implement) you create your own cache object. This differs to the fixed variables like "movement", "attack", "defense", etc. which are already in the core of the game and that's also the reason why it looks differently in the save file.
To answer your questions - usually you can delete all serverCacheObjects. It depends on the usage but so far all the server cache objects can be deleted and they are reinitialized (so far because everything was created by me. I cannot guarantee that once modders start to script new functionality:))
Cablenexus wrote:maintenanceResources, lastTurnResources
You can safely delete all this. It is up to you. These information are used to show player the information about used resources in the tooltip of the resource panel and in the resource window.
Cablenexus wrote:I also wonder for the Unit Availability you can specify, true or false for unit models per player. If you do not specify anything at all will it have access to all or none of the units? Are wagons, settlers always available? And are those true flase options only for military?
Depends on the usage. It is possible to use it both directions. If you set defaultTechnologyAvailability to true, it allows it. If you set it to false it forbids it.
It is related to unitModelMemento property called isModelDisabledByDefault. If you want a unit to be disabled for all the players and enabled just for one specific player, it is easier to set isModelDisabledByDefault to false and defaultTechnologyAvailability to true for that one player than the other way around.
Cablenexus wrote:Do you also have one ID list for the factions?
Here you go:

Roman Empire - 1
Epirus - 2
Carthage -3
Sparta - 4
Athens - 5
Gallaeci -6
Antigonid -7
Ardinaie - 8
Lysimachus - 9
Seleucid - 10
Ptolemaic Empr - 11
Pontus 12
Massilia - 13
Bospran - 14
Pergamon - 15
German tribes - 16
Iberia tribes - 17
Odrysian - 18
Celtic - 19
Dacian - 20
Cablenexus wrote:Is there an easy way to get ID lists myself from the ag files in notepad++ ?
No, because every list is of different type. You can be able to create a script to list them, but it would take more time to do, because every collection would need to be scripted separately.
Cablenexus wrote:I also hope I run out of factions, so I might need to learn to ADD one, instead of overwriting one
That should be very easy to do. I am sure you will succeed :)
Cablenexus
Sr. Colonel - Battleship
Sr. Colonel - Battleship
Posts: 1691
Joined: Mon Jan 04, 2016 7:09 pm

Re: [Modding] Creating my first scenario

Post by Cablenexus »

Added Wes Frisii at the island west of Frisii.
Attachments
wesfrisii.jpg
wesfrisii.jpg (34.48 KiB) Viewed 1754 times
Cablenexus
Sr. Colonel - Battleship
Sr. Colonel - Battleship
Posts: 1691
Joined: Mon Jan 04, 2016 7:09 pm

Re: [Modding] Creating my first scenario

Post by Cablenexus »

Wes Frisii ingame:
Attachments
wfrisii.jpg
wfrisii.jpg (230.96 KiB) Viewed 1754 times
Cablenexus
Sr. Colonel - Battleship
Sr. Colonel - Battleship
Posts: 1691
Joined: Mon Jan 04, 2016 7:09 pm

Re: [Modding] Creating my first scenario

Post by Cablenexus »

Population levels reduced in overall game. No millions of people more in Holland in 50 BC.
Attachments
pop.jpg
pop.jpg (189.37 KiB) Viewed 1754 times
Cablenexus
Sr. Colonel - Battleship
Sr. Colonel - Battleship
Posts: 1691
Joined: Mon Jan 04, 2016 7:09 pm

Re: [Modding] Creating my first scenario

Post by Cablenexus »

I'm happy to say that after some testing I managed to migrate the scenario to V4.

I was not following step by step directions from Pavel at first so I messed up, but in the end it was a smooth and fast experience.

I won't go in much detail since there will be further updates in V 5 for modding tools.

Anyway, the scenario is back on track in v 4. After doing some testing of the v 4 main game I will continue the next days.

- I see already some UI changes I have to make for the diplo button.
Attachments
frisiioc.jpg
frisiioc.jpg (792.04 KiB) Viewed 1750 times
Cablenexus
Sr. Colonel - Battleship
Sr. Colonel - Battleship
Posts: 1691
Joined: Mon Jan 04, 2016 7:09 pm

Re: [Modding] Creating my first scenario

Post by Cablenexus »

- Also changed the square size to match the amount of km2 better.
Cablenexus
Sr. Colonel - Battleship
Sr. Colonel - Battleship
Posts: 1691
Joined: Mon Jan 04, 2016 7:09 pm

Re: [Modding] Creating my first scenario

Post by Cablenexus »

- Found out by accident that a little transparancy for tooltips doesn't look that bad and give the game a modern feel. (To be honest I did not managed yet to implement it in a proper way so all menu's are now transparant), just noticed it and want to show you:
Attachments
trans.jpg
trans.jpg (1.03 MiB) Viewed 1745 times
Cablenexus
Sr. Colonel - Battleship
Sr. Colonel - Battleship
Posts: 1691
Joined: Mon Jan 04, 2016 7:09 pm

Re: [Modding] Creating my first scenario

Post by Cablenexus »

- I changed in my scenario, just as an example, the citynames displayed with only a colored border instead of a totally colored banner. Maybe it's just a personal taste, also I have to improve my outline (it's too static now), but just for you to take a look:
Attachments
citynames.jpg
citynames.jpg (353.89 KiB) Viewed 1741 times
pavelk
Kubat Software
Kubat Software
Posts: 2467
Joined: Mon May 16, 2016 4:27 pm

Re: [Modding] Creating my first scenario

Post by pavelk »

Cablenexus wrote:Also changed the square size to match the amount of km2 better.
Nice touch! As far as I remember, I didnt even tell you how to do it, did I?
Cablenexus wrote: Found out by accident that a little transparancy for tooltips doesn't look that bad and give the game a modern feel. (To be honest I did not managed yet to implement it in a proper way so all menu's are now transparant), just noticed it and want to show you:
We were also experimenting with that but in general it was reducing the readability so we put it back.
Cablenexus wrote:I changed in my scenario, just as an example, the citynames displayed with only a colored border instead of a totally colored banner. Maybe it's just a personal taste, also I have to improve my outline (it's too static now), but just for you to take a look:
We also tried a similar thing (four weeks ago) and it seemed to be a good idea but once we compared it side by side, the same full colour looked better to us (I am sure it is about personal taste).

Well, so far so good. Keep going!:)
Post Reply

Return to “Aggressors Modding”