Page 1 of 1

Events

Posted: Fri Jul 23, 2010 10:22 pm
by AH4Ever
What method or methods should be used to have a country surrender, once war is declared?

City.FirePartisans(int cityX, int cityY, int countryID, int unitType, int unitLevel, int unitStrength, name) - Does this create an actual physical unit that can be seen?


RE: Events

Posted: Sun Jul 25, 2010 5:26 am
by AH4Ever
ORIGINAL: AH4Ever

What method or methods should be used to have a country surrender, once war is declared?

Trial and error, mostly error. I tried several approaches that I thought would work and got close each time. Finally I realized I forgot to declare war. Whoops!




Also along the way I got a few of these:





Image

RE: Events

Posted: Sun Jul 25, 2010 7:33 am
by Bleck
%% fixed

RE: Events

Posted: Mon Jul 26, 2010 1:24 pm
by AH4Ever
Clarification Please:

METHOD:
Flag.GetValue
DESCRIPTION:
Returns the value of given flag.

When using this to check on an event that has options, it seems to me that it only returns that the event occurred or not. There is no way to see if a particular option within the event triggered.


RE: Events

Posted: Mon Jul 26, 2010 4:14 pm
by Bleck
You need to set/change value of flag when particular option is triggered. You can use "Flag.SetValue" or "Flag.ChangeValue".
<event eventID="5678" ...>
...
<condition>
<and>
<!--Option 3 in event 1234-->
<expression>
<leftOperand method="Flag.GetValue" param0="1234"/>
<operator value="equals"/>
<rightOperand constValue="3"/>
</expression>
</and>
</condition>
<options>

<option optionID="1" ...>
...
<effects>
...
<effect method="Flag.SetValue" param0="5678" param1="1"/>
</effects>
</option>

<option optionID="2" ...>
...
<effects>
...
<effect method="Flag.SetValue" param0="5678" param1="2"/>
</effects>
</option>

</options>
</event>

After this you can read value of flag "5678" to know what option was chosen.

RE: Events

Posted: Tue Jul 27, 2010 4:32 pm
by AH4Ever
It seems you have given us several ways to accomplish the same thing.

From ai_data comments:

DesiredTechLevels - then list of 7 integers -
this describes technology levels in 6 fields that AI will try to achieve.
1 = artillery
2 = tanks
3 = NOT USED
4 = airplanes
5 = submarines
6 = naval units
7 = nuclear bomb

NOTE: do not set levels to more than 5
last field (ie nuclear bomb) can be set to 0 or 1 only.
Default is (1,1,1,1,1,1,0).


Event Engine Methods:

METHOD:
AI.SetDesiredTechLevel (int countryID, int techID, int desiredLevel)

DESCRIPTION:
Sets desired level of given technology for AI of given country.
Only when desired tech level is greater than current level AI will spend PP on research.
This method is very important, using it is the only way to make the AI do any research!
Current levels of technology can be checked in countries.csv, desired levels of techs are in
ai_data.csv.

techID parameters:
0: artillery
1: tanks
2: not used anymore...
3: combat aircrafts
4: submarines
5: naval units
6: nuclear weapons

It appears that the above is a process where the AI will spend PP's


METHOD:
Country.SetTechLevel (int countryID, int TechType, int Value)

DESCRIPTION:
Sets tech level of given tech type for given country.

This last one is the one you chose to use for the event .xml's
and it would seem that it is an immediate change yet you give the event
a range of a year with the begin & end dates.



Is one somehow a better choice than another?


RE: Events

Posted: Wed Jul 28, 2010 10:55 am
by doomtrader
Depends how you want to manage AI.
First option is of course most costly for the AI and gives more what if feeling to the game. The AI can be able or not to enter into higher level.
Second option gives more historical gameplay, as you are simply setting when AI will get new technology, no matter how well it's playing.

RE: Events

Posted: Thu Jul 29, 2010 12:20 am
by AH4Ever
ORIGINAL: doomtrader

Depends how you want to manage AI.

First option is of course most costly for the AI and gives more what if feeling to the game.

I'm glad I cleared that up with you I was just about to start modding your AI TECH events, thinking that it might be a necessary thing.