You must be logged in to post messages.
Please login or register

Scenario Design and Discussion
Moderated by Sebastien, Mr Wednesday

Hop to:    
Welcome! You are not logged in. Please Login or Register.4 replies
Age of Kings Heaven » Forums » Scenario Design and Discussion » Another question
Bottom
Topic Subject:Another question
Julius999
Imposter
posted 05-06-06 12:58 PM CT (US)         
I've searched through the forums and couldn't find anything that was quite what I wanted. Basically I need (triggers or AI) to generate a flag in a random position, looping at intervals(more than 4 flags needed, exact number not important). The only condition is that any delay between the removal of one flag and the generation of the next must not be more than a couple of seconds.

Any help would be greatly appreciated, thanks in advance.

AuthorReplies:
Enraged Orange
Squire
(id: RoboPaul88)
posted 05-08-06 00:48 AM CT (US)     1 / 4       
Hmm. The best way I can think of to do this would be using deer. Put a deer in pen, however large you want. Make a condition of "object in area" for the deer in each square (or chunk of squares) in the pen. As an effect, make it destroy all current flags and place new flags wherever. As long as each square (or chunk) places flags in different spots, it should end up being essentially random. True randomness is only attainable with AI, I think.
Julius999
Imposter
posted 05-08-06 02:00 PM CT (US)     2 / 4       
Thanks for taking the effort to reply.

I really wanted an example of ai rules that would help, but I've managed to make it myself (after much difficulty, why do they make ai so annoying?)

Cesar Bernardi
Squire
posted 05-08-06 02:27 PM CT (US)     3 / 4       
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).]

Julius999
Imposter
posted 05-08-06 03:17 PM CT (US)     4 / 4       
Thanks Cesar Bernardi, a resource system is what I decided to use in the end (I altered another AI). Although setting it up for 12 variables was a pain.

My current project is one of these giant city things with enough options to occupy until the Solar System is destroyed, 99% of which never get finished.

You must be logged in to post messages.
Please login or register

Hop to:    

Age of Kings Heaven | HeavenGames