User avatar
McNaughton
Posts: 2766
Joined: Wed Mar 21, 2007 8:47 pm
Location: Toronto, Canada

Events and AI triggers

Fri Oct 05, 2007 3:20 am

I want to have an event triggered only if the nation is played by the AI. I am aware of this set of commands, but, have not had any success using them.

CheckAILevel command, syntax is: CheckAILevel = AILevel

// AI Level
_aiHuman = 0;
_aiLvlEasy = 1;
_aiLvlNormal = 2;
_aiLvlHard = 3;
_aiLvlVHard = 4;

Here's an event I created based on the above (done as a place holder, if the event triggers, that means the player is human, and 'blocks' other AI specific events, if the player is the AI, then the event should not trigger, thereby allowing AI events to take place).

Code: Select all

SelectFaction = $CSA
StartEvent = evt_nam_AIonEvent|1|1|NULL|NULL|NULL|NULL

Conditions
  MinDate = 1861/05/01

CheckAILevel = 0

Actions

EndEvent


I created an event that looked to see if the AI level was zero (human according to the above), and then this event would deactivate other AI specific events (as I didn't want to have to do a series of events for each level). However, here's what I got in the script report with the CSA as AI...

Code: Select all

Line 2405:  SelectFactions, 1 Faction selected: Confederate States of America
Line 2406:  Started processing event: evt_nam_AIonEvent
Line 2406:  This event is not yet referenced, base number of allowed occurences 1
Line 2409:  Min date evaluated: 1861/05/01 converted to turn  2673 current turn 2678  True
Line 2411:  CheckAILevel: Checking AI Level of faction  Confederate States of America at least equal to 0 True
Line 2413:  Entering triggered actions for event evt_nam_AIonEvent
Line 2415:  Finished processing event: evt_nam_AIonEvent


Looking at line 2411. Even though the player was AI, and the selection was Zero, it still triggered this as True (even though it should not). I want the event to trigger, if and only if, the player is human (thereby, if this event is triggered, all other events tagged on will not fire). If the player is any AI (i.e., not player 0), then the event should not trigger, thereby allow all of the other AI events to fire.

Here's the event that should have triggered, but didn't (even though the AI was playing the CSA). Note that line 2423 says False (that the above event actually did trigger).

Code: Select all

Line 2417:  SelectFactions, 1 Faction selected: Confederate States of America
Line 2418:  Started processing event: evt_nam_CSA_Beauregard1
Line 2418:  This event is not yet referenced, base number of allowed occurences 1
Line 2421:  Min date evaluated: 1861/07/01 converted to turn  2677 current turn 2678  True
Line 2422:  Max date evaluated: 1861/08/01 converted to turn  2679 current turn 2678 True
Line 2423:  EvalEvent evaluated: Checking evt_nam_AIonEvent 1 equal to 0 False
Line 2431:  Finished processing event: evt_nam_CSA_Beauregard1


Any help as to what is wrong in my event?

User avatar
Primasprit
Posts: 1614
Joined: Mon Jun 19, 2006 7:44 pm
Location: Germany

Fri Oct 05, 2007 8:42 am

Hi McNaughton!

As I understand you want to deactivate certain events which help the AI if the player is human.
As [font="Courier New"]CheckAILevel[/font] does not check if the AILevel is equal to a given number but checks if the AILevel is equal or bigger than a given number you have to do it the other way:
Use [font="Courier New"]CheckAILevel = 1[/font] (player is an AI) and activate the AI events which had a Occurrences value of zero before ([font="Courier New"]ChgEvtOccurs[/font]).

Cheers
Norbert

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

Fri Oct 05, 2007 9:10 am

I forgot something, the test is 'is the player AI level at least equal to'.

So you can't check if a player is human, but you can check if a player is AI, by testing CheckAILevel = 1


(Primasprit beats me on that. He truely desserve his abandonned title) :) )
Image


Hofstadter's Law: "It always takes longer than you expect, even when you take into account Hofstadter's law."

User avatar
Rafiki
Posts: 5811
Joined: Thu Aug 24, 2006 9:19 am
Location: Oslo, Norway

Fri Oct 05, 2007 9:12 am

Pocus, is there a generic "NOT" that can applied to conditions to reverse the result of the check performed in it?
[CENTER]Latest patches: AACW :: NCP :: WIA :: ROP :: RUS :: PON :: AJE
Visit AGEWiki - your increasingly comprehensive source for information about AGE games
[SIGPIC][/SIGPIC]
[/CENTER]

User avatar
Primasprit
Posts: 1614
Joined: Mon Jun 19, 2006 7:44 pm
Location: Germany

Fri Oct 05, 2007 9:16 am

As far as I know there is no general way to invert conditions, some accept a 'not' as parameter though.

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

Fri Oct 05, 2007 9:24 am

Rafiki wrote:Pocus, is there a generic "NOT" that can applied to conditions to reverse the result of the check performed in it?


No, it has to be coded on a per command basis.
Image


Hofstadter's Law: "It always takes longer than you expect, even when you take into account Hofstadter's law."

User avatar
McNaughton
Posts: 2766
Joined: Wed Mar 21, 2007 8:47 pm
Location: Toronto, Canada

Fri Oct 05, 2007 11:12 am

Ok, thanks! I get it now. Actually, I have been very impressed with the way events run in AACW. I like their format, and you can do a lot with them.

When I have time, I will put all that I have found out for events, and models, and units, etc. on the How-To-WIKI. I really appreciate the help!

User avatar
Rafiki
Posts: 5811
Joined: Thu Aug 24, 2006 9:19 am
Location: Oslo, Norway

Fri Oct 05, 2007 11:18 am

McNaughton wrote:When I have time, I will put all that I have found out for events, and models, and units, etc. on the How-To-WIKI.

If there's any help I can provide in that endeavor, let me know :)
[CENTER]Latest patches: AACW :: NCP :: WIA :: ROP :: RUS :: PON :: AJE

Visit AGEWiki - your increasingly comprehensive source for information about AGE games

[SIGPIC][/SIGPIC]

[/CENTER]

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

Fri Oct 05, 2007 11:19 am

I appreciate you appreciate the format :)
And we all appreciate what added value modders like you (and others) give to the game. We don't want modders to be left alone, wondering during a whole day why their script don't work, whereas with a 1-mn answer, the team can give the right clue.
Image


Hofstadter's Law: "It always takes longer than you expect, even when you take into account Hofstadter's law."

Return to “Modding AGE engine games”

Who is online

Users browsing this forum: No registered users and 17 guests