Random effects using AI:
(defrule
(true)
=>
(generate-random-number 3)
(disable-self)
)Set a parameter. "True", roughly speaking, means no parameters. The "generate-random-number" action generates a certain amount of numbers. In this case, it generates 3 numbers: 1, 2 and 3. It only fires once (because of the disable-self).(defrule
(random-number equal 1)
=>
(set-signal 1)
(disable-self)
)If the generated number is 1 (I'll only put this rule here, for the other ones you only need to change the number), for example, then it sets signal 1 (that should then be detected by triggers). AI signals can only fire once. If you want it to fire more than once, you should do the following:(defrule
(gold-amount equal 0)
(random-number equal 1)
=>
(cc-add-resource gold equal 1)
)(defrule
(gold-amount equal 1)
=>
(cc-add-resource gold equal -1)
)
Resources can be added and removed over and over again. Therefore, adding a resource and then reseting the player's stockpile is a good way to do it (remember to detect the 1 gold by triggers). The only problem with this system is that it takes a "dummy player", one that'll have a certain stockpile equal to 0.I must remind you that this is a very simple version of the system, it can get more complicated.
As for the timer for the flags to be created, you can do it by triggers.
[This message has been edited by Cesar Bernardi (edited 05-08-2006 @ 02:28 PM).]