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

AI and RM Scripting
Moderated by Crazed Ewok, Gen_Rhys_Dallows

Hop to:    
Welcome! You are not logged in. Please Login or Register.188 replies, Sticky
SWGB Heaven » Forums » AI and RM Scripting » A Newbie's Guide To AI Scripting
Bottom
Topic Subject:A Newbie's Guide To AI Scripting
« Previous Page  1 ··· 3 4 5 6 7  Next Page »
Wok
Clone Trooper
posted 02-01-03 04:23 PM EDT (US)         


By Wok



Welcome to my article about AI Scripting. If you want to know what AI
scripting is, or how to do it, you've come to the right place! This guide
will teach you the basic principles of creating AI scripts, and some more
advanced techniques to improve your abilities. This guide was made with the
intent of teaching people how to make AI for scenaio design purposes, but
hopefully everybody will be able to make use of it! Happy scripting!


Table Of Contents:

Part 1 - The Technology
Defining AI
How this relates to the game
Your first script

Part 2 - Basic Functions
Rules
Facts
Fact List
Actions
Action List

Part 3 - Scenario Design Effects
Creating Taunt Effects
Random Numbers

Comments/Suggestions




Part 1 - The Technology

Defining AI:

Before I get underway with my guide, you'll probably want to
know what the topic at hand is all about. What is AI scripting all about?

Well, AI stands for Artificial Intelligence, which basically
means methods that a computer uses to simulate thought. It tells it how to
make decisions based on your interactions, and what to do in certain
situations. Almost every time you make your computer do something, it is
using AI.

What form does it take?

The AI that we will be dealing with in this guide is merely a set of
instructions, typed into a text editor, and used in certain ways to create
effects. That's all you will need to create AI, a text editor (I recommend
NotePad if you are using Windows).

Don't worry if you didn't quite take all that in just yet. AI is a tricky
subject. Here's what we have learned so far:


  • AI is the method a computer uses to simulate thought.
  • It is created in a text editor.


How This Relates To The
Game:


Well, at least you know what AI is now. It is used differently
with all things, and you'll probably we itching to find out what it can be
made to do in-game.

In Star Wars: Galactic Battlegrounds, you can create custom AI scripts or
edit existing scripts to edit how the computer plays in-game, i.e. its
stategy. The computer has a default AI script built into it that tells it
how to play, but creating your own script will change that. Do you want the
computer to rush faster? Do you want it to be more agressive? AI scripting
can make that happen. It can also be used in conjunction with the scenario
editor, and interact with triggers to create powerful effects in-game. AI
for SWGB is a ver powerful tool .

What you should understand by now:


  • AI is the method a computer uses to simulate though.
  • It is created in a text editor.
  • In SWGB, it tells the computer how to play the game.
  • It can be used to create scenario designing effects.



Your First Script:

It's time to learn how you put these scripts into the game, so
you're all set for when you can create them yourself. It's actually quite
simple to put a created script into effect in the game, but it's a step that
many beginners stumble over for some reason

Right, to get a script into the game, you need a script . You won't
understand this yet, it's just to show you an example of a custom script in
a game. First, open up NotePad (I always use it, but if you don't have it
for some reason, a simple, easy to use text editor is the best). Then,
copy/paste the following into your new document:



(defrule
(food-amount > 0)
=>
(chat-local-to-self "My first AI script")
)


That is the script we will use for now. I'll explain what it
means later.

Right, now you have your script, you need to save it. However, AI scripts
cannot just be saved as regular text files. You can try it, but it won't
work! We need to save it as a .per file.

What is a .per file?

For the game to understand the script, it needs to be a .per file. If it
isn't, the computer will skip over it and won't think it's a script.

How do you make it into a .per file?

That is easy. When you save your notepad file, save it as myfirstai.per, and
set the file type to "all files." Of course it doesn't have to be
myfirsai.per, it can be immobile.per, agressive.per, bigbuttocks.per, or
absolutely anything you choose, as long as it is something with .per on the
end. The name you give it now will be its name in the game. For now, save it
as myfirstai.per.

Where do I save it to?

You save your .per file into your SWGB/Game/AI folder. If you don't save it
there, it won't work .

What next?

You've got your .per file and saved it to the right directory, but there's
one more step that you need to take before the computer will recognise the
AI script in-game. This step, however, is much easier. Open up NotePad and
create a new document. Then, without typing anything, save it as
myfirstai.ai. If you saved your .per file under a different name to
myfirstai, then just save the .ai file under the same name as that, instead.
They must have the same name apart from the .ai and .per endings. Save the
.ai file to the same directory as you did the .per file (SWGB/Game/AI). The
.ai file doesn't at all affect the script, it just tells the computer that
there should be a script called samenameasdotaifile.per in the AI folder.

If you have follwed these steps correctly, your new AI will be all ready for
you to use. To test it, run SWGB. Go to the screen where you configure your
random map settings, and for Player 1, under name, set it to myfirstai.
Then, start a random map, with any settings. Upon entering the game, you
should constantly receive chat messages saying "My first AI Script." If you
do, it worked. If you get an error message, or it doesn't give you chat
messages, then you've done something wrong. Go back and double check all of
the instructions I gave you.

Summary of what you now know:


  • AI is the method a computer uses to simulate though.
  • It is created in a text editor.
  • In SWGB, it tells the computer how to play the game.
  • It can be used to create scenario designing effects.
  • To make your script work, you need to save a .per and a .ai file to your
    Game/AI folder
  • You test your script by choosing it in the "Player Name" option in the
    random map settings.



Part 2 - Basic Functions

So, now you know what an AI script is, and how to install a
custom script, but you don't know how to write them yet . This part of the
tutorial will teach you just that - how to write AI scripts.

Rules:

Let's start by defining a rule. An AI script is made up of
many rules that tell the computer how to make decisions. They basically
state: "If [a fact] is true, perform [an action]." For those of you with
programming experience, that is a simple if-then statement.

Here is how a rule is layed out:



(defrule ; This always starts a rule
(fact) ; A valid fact goes here
=> ; Signifies the end of the fact(s), and the start
of the action(s)
(action) ; A valid action goes here. If the fact above is
true, the action will take place.
)


Of course, this isn't a valid rule, as where it says fact and
action, you must replace the text with valid facts and actions (I'll go over
those later). This is just to show you how a rule is set out. The
(defrule always starts a rule, the => signifies the end of the
fact and the beginning of the action(s), and the ) shows the end of a
rule. Remember, if the fact is true, the condition takes place! Drum
that into your mind now, and you won't go far wrong. Everything behind the
semi-colon ( is a comment, and will be ignored by the computer. You can
type whatever you like after a comment, and you won't get errors. You don't
have to have them, but they are convenient.

Now let's look at a valid rule. We'll use the one you used in your first
script earlier:



(defrule
(food-amount > 0)
=>
(chat-local-to-self "My first AI script")
)


For now, I'll tell you that the fact, (food-amount > 0)
means (If you have more than 0 food), and that the action,
(chat-local-to-self "My first AI script") means (Send a chat to
myself saying "My first AI script")


Now, try and guess what this rule does. Highlight the below text to check
your answer.

If you have more than 0 food (the fact), you will recieve a chat message
from yourself saying "My first AI script" (action)..

Did you get it right? Good .

Well, an AI script is made up of almost all rules, so you're not far off
being able to write your own scripts . Now we just need to learn how to
write facts and actions.

Summary so far for this chapter:


  • Rules are the basis of an AI script
  • They state that if a fact is true, then an action is performed.
  • They always start with (defrule, end with ), and have a => in the
    middle.


Facts:

You know what facts are and how they fit into a rule, you just
need to learn how to write them.

Facts are generally layed out like so: ([game stat] [rel-op] [value])

The game stat is something in the game which can be recorded and has a
value. For example, food-amount, or civilian-population. As a
general rule, all game stats have a dash (-) for spaces. There is a list of
all available game stats below.

The rel-op (standing for Relative-Operator) is the method used to compare
the game stat with the value. These are the rel-ops:

== (equal to)
!= (not equal to)
>(greater than)
< (less than)
<= (less than or equal to)
>= (greater than or equal to)


Examples:



([game stat] == [value]) ; Is true if the game stat is equal to the value.
([game stat] != [value]) ; Is true if the game stat is not equal to the
value.
([game stat] > [value]) ; Is true if the game stat is greater than the
value.


etc...

The value could be anything fitting to the game stat. For example, the game
stat food-amount would have a value of any number. The game stat
current-age would have a value of tech-level-1, tech-level-2,
tech-level-3, or tech-level-4
. Just use whatever applies. In most cases,
it is a number.

So, here are some examples of complete, valid facts:



(food-amount > 0)
(current-age != tech-level-1)
(civilian-population == 40)
(civ-selected GUNGANS) ;note - has no rel-op


Of course, there are some facts which are exceptions to the
[game stat][rel-op][value] rule. For example, (cheats-enabled)
needs no rel-op or value. The fact (can-build) has no rel-op but has
a value of a building. For example, (can-build BLDG-PREFAB).
There are also the facts True and False. The True fact is
always true, and the False fact is always false (duh :)).
Rules can also have more than one fact. It would be set out like
this:



(defrule
(fact 1)
(fact 2)
=>
(action)
)


If you have more than one fact in a rule, all facts must be
true before the action takes place.

Summary of chapter so far:


  • Rules are the basis of an AI script
  • They state that if a fact is true, then an action is performed.
  • They always start with (defrule, end with ), and have a => in the middle.
  • Facts usually have 3 parameters: a game stat, a rel-op, and a
    value.



Fact List:

Right, now you know how to create facts, here's a list of
different facts you can use:



true
false
attack-soldier-count <rel-op> <value>
attack-warboat-count <rel-op> <value>
building-available <building>
building-count <rel-op> <value>
building-count-total <rel-op> <value>
building-type-count <building> <rel-op> <value>
building-type-count-total <building> <rel-op> <value>
can-afford-building <building>
can-afford-complete-wall <perimeter> <wall-type>
can-afford-research <research-item>
can-afford-unit <unit>
can-build <building>
can-build-gate <perimeter>
can-build-gate-with-escrow <perimeter>
can-build-wall <perimeter> <wall-type>
can-build-wall-with-escrow <perimeter> <wall-type>
can-build-with-escrow <building>
can-buy-commodity <commodity>
can-research<research-item>
can-research-with-escrow <research-item>
can-sell-commodity <commodity>
can-spy
can-spy-with-escrow
can-train <unit>
can-train-with-escrow <unit>
cc-players-building-count <player-number> <rel-op> <value>
cc-players-building-type-count <player-number> <building> <rel-op>
<value>
cc-players-unit-count <player-number> <rel-op> <value>
cc-players-unit-type-count <player-number> <unit> <rel-op> <value>
cheats-enabled
civ-selected <civ>
civilian-population <rel-op> <value>
commodity-buying-price <commodity> <rel-op> <value>
commodity-selling-price <commodity> <rel-op> <value>
current-age <rel-op> <age>
current-age-time <rel-op> <value>
current-score <rel-op> <value>
death-match-game
defend-soldier-count <rel-op> <value>
defend-warboat-count <rel-op> <value>
difficulty <rel-op> <difficulty>
doctrine <value>
dropsite-min-distance <resource-type> <rel-op> <value>
enemy-buildings-in-town
enemy-captured-relics
escrow-amount <resource-type> <rel-op> <value>
event-detected <event-type> <event-id>
food-amount <rel-op> <value>
game-time <rel-op> <value>
goal <goal-id> <value>
nova-amount <rel-op> <value>
housing-headroom <rel-op> <value>
idle-farm-count <rel-op> <value>
map-size <map-size>
map-type <map-type>
military-population <rel-op> <value>
player-computer <player-number>
player-human <player-number>
player-in-game <player-number>
player-number <player-number>
player-resigned <player-number>
player-valid <player-number>
players-building-count <player-number> <rel-op> <value>
players-building-type-count <player-number> <building> <rel-op> <value>
players-civ <player-number> <civ>
players-civilian-population <player-number> <rel-op> <value>
players-current-age <player-number> <rel-op> <age>
players-current-age-time <player-number> <rel-op> <value>
players-military-population <player-number> <rel-op> <value>
players-population <player-number> <rel-op> <value>
players-score <player-number> <rel-op> <score>
players-stance <player-number> <diplomatic-stance>
players-tribute <player-number> <resource-type> <rel-op> <value>
players-tribute-memory <player-number> <resource-type> <rel-op> <value>
players-unit-count <player-number> <rel-op> <value>
players-unit-type-count <player-number> <unit> <rel-op> <value>
population <rel-op> <value>
population-cap <rel-op> <value>
population-headroom <rel-op> <value>
random-number <rel-op> <value>
regicide-game
research-available <research-item>
research-completed <research-item>
resource-found <resource-type>
shared-goal <shared-goal-id> <value>
sheep-and-forage-too-far
soldier-count <rel-op> <value>
stance-toward <player-number> <diplomatic-stance>
starting-age <rel-op> <age>
starting-resources <rel-op> <starting-resources>
metal-amount <rel-op> <value>
strategic-number <strategic-number> <rel-op> <value>
taunt-detected <player-number> <taunt-id>
timer-triggered <timer-id>
town-under-attack
unit-available <unit>
unit-count <rel-op> <value>
unit-count-total <rel-op> <value>
unit-type-count <unit> <rel-op> <value>
unit-type-count-total <unit> <rel-op> <value>
victory-condition <victory-condition>
wall-completed-percentage <perimeter> <rel-op> <value>
wall-invisible-percentage <perimeter> <rel-op> <value>
warboat-count <rel-op> <value>
carbon-amount <rel-op> <value>


Actions:

We're almost there

Actions are simpler than facts - there's no 3 part layout. It's generally
just something simple like (build BLGD-PREFAB).

You can also have more than 1 action. All of them will fire, one after the
other, the moment the fact(s) are true.

Remember that first script you wrote? This one:



(defrule
(food-amount > 0)
=>
(chat-local-to-self "My first AI script")
)


Well, when you tested it in-game, the chat message should have
repeated itself over and over again - even though there was only one action.
This is because the actions loop. Basically, that means that the actions
keep on taking place again and again the whole time the fact is true. This
will happen in all rules, but there is a way to stop it. There is an action
called (disable-self), which will mean that the actions in the rule
never fire, even while the facts are true. Now, when the computer makes a
rule pass (something the computer does many times a second where it
looks at all the rules in the AI and carries out all the actions that it
should, in order), it will see that the facts are true (if they are ), and
carry out the actions. It will carry out the first action, and then it will
get to the second action, (disable-self). This will disable the rule,
so that even if the facts remain true, the actions will not be carried out
again.
For example, this rule will repeat over and over while the facts are
true:



(defrule
(food-amount > 0)
=>
(chat-local-to-self "My first AI script")
)


But this rule will not. If the facts become true, the actions
will happen once, and then disable:



(defrule
(food-amount > 0)
=>
(chat-local-to-self "My first AI script")
(disable-self)
)


One last thing to note - every rule needs an action (it's
pretty pointless without them ). For testing purposes, the action
(do-nothing) exists.

I think that just about covers everything to do with actions. Here's a list
of ones to choose from:

Action List:



do-nothing
acknowledge-event <event-type> <event-id>
acknowledge-taunt <player-number> <taunt-id>
attack-now
build <building>
build-forward <building>
build-gate <perimeter>
build-wall <perimeter> <wall-type>
buy-commodity <commodity>
cc-add-resource <resource-type> <amount>
chat-local <string>
chat-local-using-id <string-id>
chat-local-using-range <string-id-start> <string-id-range>
chat-local-to-self <string>
chat-to-all <string>
chat-to-all-using-id <string-id>
chat-to-all-using-range <string-id-start> <string-id-range>
chat-to-allies <string>
chat-to-allies-using-id <string-id>
chat-to-allies-using-range <string-id-start> <string-id-range>
chat-to-enemies <string>
chat-to-enemies-using-id <string-id>
chat-to-enemies-using-range <string-id-start> <string-id-range>
chat-to-player <player-number> <string>
chat-to-player-using-id <player-number> <string-id>
chat-to-player-using-range <player-number> <string-id-start>
<string-id-range>
chat-trace <value>
clear-tribute-memory <player-number> <resource-type>
delete-building <building>
delete-unit <unit>
disable-self
disable-timer <timer-id>
enable-timer <timer-id>
enable-wall-placement <perimeter>
generate-random-number <value>
log <string>
log-trace <value>
release-escrow <resource-type>
research <research-item>
research <age>
resign
sell-commodity <commodity>
set-difficulty-parameter <difficulty-parameter> <value>
set-doctrine <value>
set-escrow-percentage <resource-type> <value>
set-goal <goal-id> <value>
set-shared-goal <shared-goal-id> <value>
set-signal <signal-id>
set-stance <player-number> <diplomatic-stance>
set-strategic-number <strategic-number> <value>
spy
taunt <value>
taunt-using-range <taunt-start> <taunt-range>
train <unit>
tribute-to-player <player-number> <resource-type> <value>

Input / Output Actions
chat-local
chat-local-using-id
chat-local-using-range
chat-local-to-self
chat-to-all
chat-to-all-using-id
chat-to-all-using-range
chat-to-allies
chat-to-allies-using-id
chat-to-allies-using-range
chat-to-enemies
chat-to-enemies-using-id
chat-to-enemies-using-range
chat-to-player
chat-to-player-using-id
chat-to-player-using-range
chat-trace
log
log-trace
taunt
taunt-using-range
Rule Control Actions
disable-self
Event Actions
acknowledge-event
acknowledge-taunt
disable-timer
enable-timer
set-signal
Commodity Trade Actions
buy-commodity
sell-commodity
Tribute Actions
clear-tribute-memory
tribute-to-player
Escrow Actions
release-escrow
set-escrow-percentage
Regicide Actions
spy
Cheating Actions
cc-add-resource
Other Actions
do-nothing
attack-now
build
build-forward
build-gate
build-wall
delete-building
delete-unit
enable-wall-placement
generate-random-number
research
resign
set-difficulty-parameter
set-doctrine
set-goal
set-shared-goal
set-stance
set-strategic-number
train



Summary Of Part 2:


  • Rules are the basis of an AI script
  • They state that if a fact is true, then an action is performed.
  • They always start with (defrule, end with ), and have a => in the middle.
  • Facts usually have 3 parameters: a game stat, a rel-op, and a value.
  • There is a list of different facts and actions to choose
    from.



Part 3 - Scenario Design Effects

, now you are capable of creating your own AI scripts. Now I'm
going to teach you how to use them in conjunction with triggers to create
some nifty effects in your scenarios.

What can you do with AI that you cannot do with triggers?

The concept of AI is similar to the concept of triggers (not what they are
used for, but how they work). However, they vary in a few ways. There are
two game stats that can be measured by AI, and not triggers, that can make
neat scenario tricks. Taunts and Random Numbers.

Taunt Tricks:

The taunt trick was first used for SWGB in The Phantom
Menace
, by Tevious. It basically allowed a trigger effect to fire
when a taunt was typed into the chat box.

Since Taunts cannot be regustered by triggers, it must be done with AI. You
use the fact (taunt-detected [value]), to tribute some resources to a
computer player. The resources can be measured with triggers, so can be used
in a condition, which sets off an effect.

You use this AI script to tribute resources:


)
(defrule
(taunt-detected 1 1)
=>
(acknowledge-taunt 1 1)
(cc-add-resource nova 1)
)


The red number is the number of the player sending the taunt.
It will almost always be player 1.
The yellow text is the number of the taunt you want to use. In this case, it
is number 1 ("I got it!")
The purple text is the resource that will be tributed when you type the
taunt. It doesn't matter too much because there are four equal options to
choose from.
The green number is the amount that of the resource that will be tributed.

Then, save your AI as taunt.per, inside your Game/AI directory. Then create
a blank document and save it as taunt.ai, inside the same folder.
Inside the scenario builder, you need to set up triggers.
You need to make a trigger system so that when the player receives the
resource you specified in the AI, it does a desired effect (It could be to
heal a character, for example). Then, it tributes the resource back to GAIA,
so you can use the effect again.

Random Numbers:

Ever wanted to make a completely random effect in your
scenario? Well now you can . Many methods of simulating this have been
attempted, but the most fool-proof way is through the use of AI. Luckily,
the AI for this game has a (set-random-number) action .

Start by pasting the following into NotePad:



(defrule
(true)
=>
(set-random-number 4) ;This code generates a random number
between 1 and 4 at the beginning of the scenario
(disable-self)
)

(defrule
(random-number == 1) ;This code tributes 1 food if the random
number equals 1
=>
(cc-add-resource food 1)
(disable-self)
)

(defrule
(random-number == 2) ;This code tributes 1 carbon if the
random number equals 2
=>
(cc-add-resource carbon 1)
(disable-self)
)

(defrule
(random-number == 3) ;This code tributes 1 nova if the random
number equals 3
=>
(cc-add-resource nova 1)
(disable-self)
)

(defrule
(random-number == 4) ;This code tributes 1 ores if the random
number equals 4. Note == In AI ore is called Metal.
=>
(cc-add-resource metal 1)
(disable-self)
)



Save the file into your Game/AI folder as random.per, then
create a blank text document. Save it into the same directory as random.ai.

Then whenever you start a game and somebody has this AI, a random number
will be set. If it is 1, 1 Food will be tributed to the player. If it is 2,
1 Carbon will be tributed to the player. If it is 3, 1 Nova will be tributed
to the player, and if it is 4, 1 Ore will be tributed to the player. You can
use this in combination with triggers to make a nice effect, like a random
character or a random hitpoint increase.



Comments/Suggestions:

Thank you for reading my AI tutorial. If you have any questions
related to my tutorial or to AI scritping, then please ask me via this
thread and I will try my best to answer. If I have lots of questions, I may
start a small FAQ.

I have also undoubtable made errors in spelling, so if you spot any, please
point them out .

Anyway, I hope you now feel a lot more informed about the ways of AI
scripting, and I hope to see some AI based projects from you soon

- Wok

Wok?

[This message has been edited by Gen_Rhys_Dallows (edited 03-08-2019 @ 11:12 PM).]

AuthorReplies:
Darth Zach
Clone Trooper
posted 05-16-03 09:47 AM EDT (US)     121 / 188       

Quoted from Boris:

Why not?

Because Wok said so.


*******************_____**************
*****
______________\___|}__*************
----<[==Darth Zach=====\************
*****
"""""""""""""""""""\)|"\===\***********
***********************
\===\***********
************************
"""""""**********

Sev_Rance_Tann_
Clone Trooper
posted 05-16-03 09:00 PM EDT (US)     122 / 188       
Hey Wok,

I need help with this AI:

I want it so when I get 20 kills, then a chat comes up and says reload. Then it changes my attack to 0. Then when I use the Taunt 1 then it decreases 1 nova and then I gain + 10 attack. And I want it to loop but I can do that.

All I ask is tha you maybe make the script and tell me the triggers.

I have tried to make a script but no luck.

So basically when I hit 1 after I kill 20 units then 1 nova is taken away from me and my attack goes from 0 to + 10 or whatever.

THANKS

Padishar
Clone Trooper
posted 05-17-03 12:40 PM EDT (US)     123 / 188       
Sev_Rance_Tann_ You just need to use the Taunt AI that Wok has in the download section in the Scenarios AI Pack and include these two triggers. At least I think it should work I haven't tested it or anything give it a try and let me know.

Make a trigger like this (On, No Loop)
Condition: Player 1 Kill Ratio=20
Effect: Tribute 1 Nova from player 1 to GAIA
Effect: Create Unit X (Whatever you want in some
secluded area that is for another player that is
not in use) You need to repeat this effect 20 times
to maintain the Kill ratio.
Effect: Change Ownership of Unit X from player X to player 1
Effect: Kill Unit X in secluded area
Effect: Change attack -10 (I don't know if you can give a
unit a zero attack but if you can this is what you
would do.)
Effect: Display Message: Time to Reload!
Effect: Activate Trigger 2

Trigger 2 (Off, No Loop)
Condition: Accumulate Attribute: Player with Taunt AI,
However much the tribute is.
Effect: Display Message: Reloaded
Effect: Change Attack 10 Selected unit
Effect: Activate Trigger 1


Proud Member of The New Jedi Order Project
Finished Projects: The Dawn of the New Jedi Order --- Slave Princess Leia Slave & Hermione Bagwa MOD
Winner of the Fettmeister award for "New Modder with Mad Skills"
Sev_Rance_Tann_
Clone Trooper
posted 05-17-03 12:46 PM EDT (US)     124 / 188       
Hey Padishar,

Would the Taunt from SOTE the taunt activated helath system work ?

Padishar
Clone Trooper
posted 05-17-03 10:35 PM EDT (US)     125 / 188       
I don't see why not.

Good luck


Proud Member of The New Jedi Order Project
Finished Projects: The Dawn of the New Jedi Order --- Slave Princess Leia Slave & Hermione Bagwa MOD
Winner of the Fettmeister award for "New Modder with Mad Skills"
BobaFett
Clone Trooper
posted 05-29-03 02:09 AM EDT (US)     126 / 188       
SWEEEET Guide Wok. Now i know how to AI script.*Goes and plots an evil plan*

--------\BobaFett
----------\Rogue Creations
----------\Plague Of Darkness
Admiral Fyyar
Clone Trooper
posted 05-29-03 11:52 AM EDT (US)     127 / 188       
Hey Wok!
Can you make tanut controlled force powers?
If yes what code?

ADMIRAL FYYAR
The RPG & Election Ruiner
Lord Fooby & Lord Fyyarby '09 - The Superior Choice
Wok
Clone Trooper
posted 05-29-03 12:01 PM EDT (US)     128 / 188       

Quote:

Hey Wok!
Can you make tanut controlled force powers?
If yes what code?

It's in the guide.


Wok?
THE RCR
Clone Trooper
posted 06-02-03 06:07 PM EDT (US)     129 / 188       
Hey wok wheneever i save it it saves as a text document not a .per file i'm doing everything you said and when i go to test it it says file not found whats the problem?

THE RCR
Proud Member of ASD
Current project: Tale of the summoner
This is the dumbest thing i've ever heard: "is
that a lobster playing the accordion?""Yep" ROTFLMEO

Check out my website
shadowraithe
Clone Trooper
posted 06-11-03 07:33 AM EDT (US)     130 / 188       
Ok, I need help with setting up an AI. Simply, I have a player using the Immobile Units AI gold, but I want to be able to deactivate the immobile part with a trigger and make it super agressive and go beserk with eveything it's got. I'm not much of an AI programmer, and the task object trigger doesn't work quite right for the situation, so can someone tell me how I can get the player to do what I want (hint: can someone write an AI for me if it's not already in Immobile Units?). Thanks.

*** Current Project: Clan Histories - Apocalypse ***
Spector
Clone Trooper
posted 06-11-03 02:00 PM EDT (US)     131 / 188       
Well I do not think it is possible to load an annother AI in the middle of a scenario but it is possible to load a second one right when the scenario starts.

We live in an age when pizza gets to your home before the police.
Double your drive space - delete Windows!
Apple Copyright 1767, Sir Isaac Newton.
I used to have a handle on life, then it broke.
Very funny, Scotty. Now beam down my clothes.
I'm not a complete idiot, some parts are missing!
Wok
Clone Trooper
posted 06-11-03 02:12 PM EDT (US)     132 / 188       
Have one player with an immobile AI, and another player with a more aggressive AI. Then, use change owensership to switch between the two freely.

You could probably do it all in one script with AI goals, but alas, I don't know how to use them.


Wok?
shadowraithe
Clone Trooper
posted 06-12-03 07:14 AM EDT (US)     133 / 188       
But can't you link AI behaviour to a trigger? In which case, wouldn't it be easier to have the AI change the attack range settings etc. to higher numbers on a trigger?

*** Current Project: Clan Histories - Apocalypse ***
Spector
Clone Trooper
posted 06-13-03 11:34 PM EDT (US)     134 / 188       
Is it possible to stop the AI from doing things? I told the computer to make 15 troopers and it made about 50 of them instead. the only reason it stoped was because it ran out of resources. And I told the compueter to train 10 workers and it built way more than that. I put this for the workers:


(defrule
(civilian-population <= 15)
=>
(train UNIT-WORKER)
)


And for the troopers:


(defrule
(soldier-count <= 15)
(can-train UNIT-LASER-LINE)
=>
(train UNIT-LASER-LINE)
)

too many troopers


too many workers & prefabs

How is the new guide comming? If you need any help with the research things just ask me. I think I found all of them.


We live in an age when pizza gets to your home before the police.
Double your drive space - delete Windows!
Apple Copyright 1767, Sir Isaac Newton.
I used to have a handle on life, then it broke.
Very funny, Scotty. Now beam down my clothes.
I'm not a complete idiot, some parts are missing!

[This message has been edited by Spector (edited 06-13-2003 @ 11:39 PM).]

The Mace
Jedi Knight
(id: mace windu9d9)
posted 06-13-03 11:53 PM EDT (US)     135 / 188       
at the end of the script after the last action you need disable-self

Mace
Darth Zerok
Clone Trooper
posted 06-16-03 03:47 PM EDT (US)     136 / 188       
I was told to come here and ask this so anyway...Is there an aggressive AI that makes computer controlled units go to agressive mode?

Darth Zerok
==========[:::::::::::::::::]==========
[Galactic Senate Series]|[Purge of the Jedi]
Member Of Purple Raccoon Productions
Spector
Clone Trooper
posted 06-16-03 04:19 PM EDT (US)     137 / 188       
I don't think there is one available now but you can make your own. Just copy and paste this into an AI and modify it a bit to make it more agressive.


;DISTANCES

(defrule
(true)
=>
(set-strategic-number sn-maximum-food-drop-distance 20)
(set-strategic-number sn-maximum-carbon-drop-distance 20)
(set-strategic-number sn-maximum-nova-drop-distance 20)
(set-strategic-number sn-maximum-metal-drop-distance 20)
(set-strategic-number sn-maximum-hunt-drop-distance 25)
(set-strategic-number sn-holocron-return-distance 200)
(set-strategic-number sn-enemy-sighted-response-distance 30)
(disable-self)
)

;OTHERS

(defrule
(true)
=>
(set-strategic-number sn-percent-enemy-sighted-response 100)
(set-strategic-number sn-hits-before-alliance-change 5)
(set-strategic-number sn-percent-attack-soldiers 50)
(set-strategic-number sn-task-ungrouped-soldiers 2)
(set-strategic-number sn-number-attack-groups 4)
(set-strategic-number sn-maximum-town-size 30)
(disable-self)
)

;SCOUTS

(defrule
(true)
=>
(set-strategic-number sn-cap-civilian-explorers 0)
(set-strategic-number sn-percent-civilian-explorers 0)
(set-strategic-number sn-number-explore-groups 1)
(set-strategic-number sn-total-number-explorers 3)
(disable-self)
)

;SOLDIERS & BOATS

(defrule
(true)
=>
(set-strategic-number sn-number-attack-groups 3)
(set-strategic-number sn-number-defend-groups 4)
(set-strategic-number sn-number-boat-attack-groups 3)
(set-strategic-number sn-number-boat-defend-groups 4)
(set-strategic-number sn-task-ungrouped-soldiers 4)
(set-strategic-number sn-number-air-attack-groups 3)
(set-strategic-number sn-minimum-air-attack-group-size 10)
(set-strategic-number sn-minimum-air-attack-group-size 20)
;
(set-strategic-number sn-coop-share-information 1)
(set-strategic-number sn-coop-share-attacking 1)
(set-strategic-number sn-attack-intelligence 2)
(disable-self)
)

;DEFENDERS

(defrule
(true)
=>
(set-strategic-number sn-town-defend-priority 7)
(set-strategic-number sn-nova-defend-priority 3)
(set-strategic-number sn-metal-defend-priority 2)
(set-strategic-number sn-forage-defend-priority 4)
(set-strategic-number sn-holocron-defend-priority 2)
)


We live in an age when pizza gets to your home before the police.
Double your drive space - delete Windows!
Apple Copyright 1767, Sir Isaac Newton.
I used to have a handle on life, then it broke.
Very funny, Scotty. Now beam down my clothes.
I'm not a complete idiot, some parts are missing!
Spector
Clone Trooper
posted 06-16-03 06:42 PM EDT (US)     138 / 188       
Since Wok is banned I think I will try to type up a quick AI guide with all the research things in it. Expect it in a day or two.

We live in an age when pizza gets to your home before the police.
Double your drive space - delete Windows!
Apple Copyright 1767, Sir Isaac Newton.
I used to have a handle on life, then it broke.
Very funny, Scotty. Now beam down my clothes.
I'm not a complete idiot, some parts are missing!
Admiral Fyyar
Clone Trooper
posted 06-17-03 11:39 AM EDT (US)     139 / 188       
Is Wok banned?

ADMIRAL FYYAR
The RPG & Election Ruiner
Lord Fooby & Lord Fyyarby '09 - The Superior Choice
The Mace
Jedi Knight
(id: mace windu9d9)
posted 06-17-03 05:27 PM EDT (US)     140 / 188       
Yes. He will not be coming back this time as he was banned for violation.

*secretly shows off new sig*


Mace
The Mace
Jedi Knight
(id: mace windu9d9)
posted 06-17-03 05:30 PM EDT (US)     141 / 188       

Quote:

Since Wok is banned I think I will try to type up a quick AI guide with all the research things in it. Expect it in a day or two

Dont Bother. Wok said He'll give his to someone to post when he is done with his


EDIT: Shoot. Wrong button


Mace

[This message has been edited by Mace (edited 06-17-2003 @ 05:31 PM).]

xSR_HeizKatchup
Clone Trooper
posted 06-19-03 05:28 PM EDT (US)     142 / 188       
hi

I am very confused

wut does houseing-headroom mean????


i do have AIM and my name on it is Fred1424
i need help so add me to ur list and im me

Spector
Clone Trooper
posted 06-19-03 05:41 PM EDT (US)     143 / 188       
housing-headroom mean how much room is left in your population thing where it says 125/150 or annother number like that. so if you have 50/50 that means you have no more headroom. so if you are making an ai for the computer and need them to make a new prefab shelter so they can have more population then put:

(defrule
(housing-headroom <= 2)
=>
(build BLDG-PREFAB)
)

That will make the computer player build a prefab shelter when it only has 2 or less population headroom left. I hope that made sense.


We live in an age when pizza gets to your home before the police.
Double your drive space - delete Windows!
Apple Copyright 1767, Sir Isaac Newton.
I used to have a handle on life, then it broke.
Very funny, Scotty. Now beam down my clothes.
I'm not a complete idiot, some parts are missing!
Kongou Dess
Moff
(id: Moff Yittreas)
posted 06-27-03 10:48 AM EDT (US)     144 / 188       
Spector, did you write the tech thing yet? I know Wok said he'll give his to someone, but, there is a chance he'll just get rid of, since it would be another reminder of GBH.

New RPG Coming Soon | Purveyor of the Poi | Weeaboo Brony Conserative - The Ultimate Foe to the Internet
Lord Sipia: "THIS IS WHAT HAPPENS WHEN SIPPY IS EXCLUDED! EVERYBODY LOSES THEIR SANITY" | Also Lord Sipia: "...Of course. Prepare the butter."
Hi, I'm Kongou! Are you my admiral?
Spector
Clone Trooper
posted 06-27-03 05:11 PM EDT (US)     145 / 188       
I haven't been doing it because Wok is. I will start doing it on sunday if I haven't seen or heard anything from Wok about his guide.

We live in an age when pizza gets to your home before the police.
Double your drive space - delete Windows!
Apple Copyright 1767, Sir Isaac Newton.
I used to have a handle on life, then it broke.
Very funny, Scotty. Now beam down my clothes.
I'm not a complete idiot, some parts are missing!
Spector
Clone Trooper
posted 06-27-03 08:51 PM EDT (US)     146 / 188       
I decided to type up all the units really quick since there arew only a few. So here they are:


AIR BASE

ut-fighter-2 = fast fighter
ut-fighter-3 = adv fighter
ut-bomber-2 = hvy bomber
ut-bomber-3 = adv bomber

SHIPYARD

ut-boat-laser-2 = frigate
ut-boat-laser-3 = adv frigate
ut-boat-cutlaser-2 = hvy destroyer
ut-boat-missile-2 = hvy missile boat (I forgot the real name. it is the only boat that shoots missiles though)
ut-boat-artillery-2 = adv cruiser

TROOP CENTER

ut-laser-2 = trooper
ut-laser-3 = hvy trooper
ut-laser-4 = repeater trooper
ut-mounted-2 = hvy mounted trooper
ut-mounted-3 = adv mounted trooper
ut-missile-troop-2 = hvy missile trooper

MECH FACTORY

ut-single-mech-2 = strike mech
ut-dual-mech-2 = mech destroyer
ut-multi-mech-2 = assault mech

HEAVY WEAPONS

ut-missile-launcher-2 = anit-air mobile
ut-artillery-2 = hvy artillery
ut-ram-2 = hvy pummel


We live in an age when pizza gets to your home before the police.
Double your drive space - delete Windows!
Apple Copyright 1767, Sir Isaac Newton.
I used to have a handle on life, then it broke.
Very funny, Scotty. Now beam down my clothes.
I'm not a complete idiot, some parts are missing!
Kongou Dess
Moff
(id: Moff Yittreas)
posted 06-29-03 03:12 PM EDT (US)     147 / 188       
Thanks,m SPector.

New RPG Coming Soon | Purveyor of the Poi | Weeaboo Brony Conserative - The Ultimate Foe to the Internet
Lord Sipia: "THIS IS WHAT HAPPENS WHEN SIPPY IS EXCLUDED! EVERYBODY LOSES THEIR SANITY" | Also Lord Sipia: "...Of course. Prepare the butter."
Hi, I'm Kongou! Are you my admiral?
Knotted maggots
Clone Trooper
posted 07-01-03 05:09 AM EDT (US)     148 / 188       
)
(defrule
(taunt-detected 1 1)
=>
(acknowledge-taunt 1 1)
(cc-add-resource nova 1)

)
(defrule
(taunt-detected 1 2)
=>
(acknowledge-taunt 1 2)
(cc-add-resource carbon 1)

)
(defrule
(taunt-detected 1 3)
=>
(acknowledge-taunt 1 3)
(cc-add-resource food 1)
)


I wrote this very basic AI but when it is loaded in a scenario it says ERROR: cannot loadopening parenthesis

Spector
Clone Trooper
posted 07-01-03 02:36 PM EDT (US)     149 / 188       
did you copy that from Wok's guide? Wok wrote it wrong and you will always get an error if you copy it from him. it is actually suposed to be like this:


(defrule
(taunt-detected 1 1)
=>
(acknowledge-taunt 1 1)
(cc-add-resource nova 1)
)


(defrule
(taunt-detected 1 2)
=>
(acknowledge-taunt 1 2)
(cc-add-resource carbon 1)
)


(defrule
(taunt-detected 1 3)
=>
(acknowledge-taunt 1 3)
(cc-add-resource food 1)
)

You will also always get an error if you copy and paste ther random number trick from Wok's guide. instead of set-random-number it should be generate-random-number.


PS incase anyone was wondering, I have started on the research things guide and it should be done in a few days.


We live in an age when pizza gets to your home before the police.
Double your drive space - delete Windows!
Apple Copyright 1767, Sir Isaac Newton.
I used to have a handle on life, then it broke.
Very funny, Scotty. Now beam down my clothes.
I'm not a complete idiot, some parts are missing!

[This message has been edited by Spector (edited 07-01-2003 @ 02:42 PM).]

Knotted maggots
Clone Trooper
posted 07-02-03 03:30 AM EDT (US)     150 / 188       
I didnt copy and paste it i wrote it myself. But i found out what the problem was. I had saved this Ai as both the .ai and .per files. Insetead of just using a blank file for the .ai

Thanks anyway

« Previous Page  1 ··· 3 4 5 6 7  Next Page »
You must be logged in to post messages.
Please login or register

Hop to:    

SWGB Heaven | HeavenGames