Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → AI Change cog help please
AI Change cog help please
2002-08-11, 12:01 AM #1
I need a cog that can change the AI of a actor im using jk not mots since the ai alighnment dosent work well in jk i simple removed the lookfortarget,follow,primaryfire and blind fire makeing in essentialy a freindly that can roam or guard but i need a cog that can changed the AI back to the original AI file When shot(damaged) and in the sight distance of an attack on a fellow guard happening ,would be a plus im looing a generic cog,meaning not for a specfic actor does anyone know where i can get a cog that does this? or could someone write one? also if im lucky enough to get someone to write a cog please leave out any fleeing id prefer them to fight to the death and perhasp even get a rage bonus to health and attack damage each time shot but the changing ai is the main thing
2002-08-11, 7:30 AM #2
I'm witnessing the mutilation of the English language! [http://forums.massassi.net/html/eek.gif]

Next time be more coherent and use proper spelling. You're talking about two seperate things here: Changing an actor's AI file, and improving his AI. The first would be done with a level cog. And that's easy enough to do:
Code:
# changeai.cog
#
# A cog to change an actor's AI when he or another actor is damaged.
#
# [SM]
#==============================================================#
symbols

thing     actor      linkid=0
thing     guard0     linkid=1
thing     guard1     linkid=1
thing     guard2     linkid=1
thing     guard3     linkid=1

ai        attackAI

int       locked=0   local

message   damaged

end
#==============================================================#
code
#------------------------------------------------------
damaged:
	if(GetSenderID() == 1 && !HasLOS(actor, GetSenderRef()) || locked) Return;
	locked = 1;
	AISetClass(actor, attackAI);

Return;
#------------------------------------------------------
end


That should do well enough. Ask if you need anything changed. [http://forums.massassi.net/html/wink.gif]

The second would involve the actor's class cog. They typically will make an actor flee only when his weapon is pulled. After that, the actor can't attack. To do what you want would involve scripting a lot of the actor's AI, and it's not really worth it.

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.

[This message has been edited by SaberMaster (edited August 11, 2002).]
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-08-11, 8:45 AM #3
Quote:
<font face="Verdana, Arial" size="2">Originally posted by SaberMaster:
I'm witnessing the mutilation of the English language! [http://forums.massassi.net/html/eek.gif]

Next time be more coherent and use proper spelling.
</font>


------------------
I used to believe that we only want what we can't have. I was wrong. The truth is, the wonderful truth is, we only want what we think we can't have.

JK editing resources.
And when the moment is right, I'm gonna fly a kite.
2002-08-13, 10:37 AM #4
hey sabermaster


thank you for the code but IM having trouble getting it to work i copied and pasted and figured the i would have to add my AI file name exp.:

ai attackAI=filename.ai

Now i assumed that's all I had to do but its not working meaning not changing the AI so im wondering am I doing it right?
2002-08-13, 11:29 AM #5
I'm assuming that this cog is for a level.

In JED's Cog Placement window, add the new cog, select it, and you'll see where to enter values for the variables that do not have the 'local' symbol extension. Double-click the text field after attackAI, and JED will open a new window allowing you to choose which AI file you want to use.

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-08-13, 2:40 PM #6
SaberMaster


making progress, but still haveing a problem

i assumed that the actor Thing would be the ghost where my actor spawns from

i assumed that the guard0 thing though guard3 thing would be what the actors is guarding
if im wrong please correct me

now it seems like the actor is changing AI when i shot him because he turns and comes at me but he dosent shoot do you have any idea why this might be happening?

heres the starting AI for my actor

# Jedi Knight AI File
#
# battledroid2.AI
#

alignment=-1.0, rank=0.5, fov=170, maxstep=0.2, sightdist=5.0, heardist=2.0, accuracy=0.30

#instinct args
OpenDoors
Listen 0.33, 2.0
CircleStrafe 6000.0, 30.0, 1.5, 1000.0, 1.0
ReturnHome
Roam 5000.0, -2.0
Talk 5000.0, 0.50

heres what im trying to get it to change to

# Jedi Knight AI File
#
# battledroid.AI
#

alignment=-1.0, rank=0.5, fov=170, maxstep=0.2, sightdist=5.0, heardist=2.0, accuracy=0.30

#instinct args
LookForTarget 500.0, 45000.0
Listen 0.75, 2.0
PrimaryFire 2000.0, 0.8, 5.0, 0.20, 0.0, 300.0, 0.20, 0.00, 1.0, 500.0
BlindFire 1500.0, 0.50, 0, 0.8, 0.0, 0.20
Follow 0.0, 1.5
OpenDoors
CircleStrafe 6000.0, 30.0, 1.5, 1000.0, 1.0
ReturnHome
Talk 5000.0, 0.50

also i dont know it it would matter in this type of cog but this is for a mp map/level

any idea why he's not shooting?
2002-08-13, 2:46 PM #7
also ive tried using alignment=0.0 on my starting AI but i didnt see any difference so i just put it back to alignment=-1.0
2002-08-13, 7:54 PM #8
SaberMaster

i still cant get my actor to change AI and shoot after several hours, although he does guard the objects i selected in guard0 thing through guard3 thing

so here what ive done

for actor(thing) i have thing 63 witch is my ghost object the spawn portal

for guard things ive picked various objects in my level i even tried the walkplayer thinking out of sheer hope, did nothing with walkplayer but he guards the other objects or patrols and stops at object would be more accurate

for attackAI i have Battledroid.ai i listed that earlier

ive tried switching the ai so he attacks first, so when he's shot it should switch to him not shooting didn't work he continued shooting

for object 63(ghost) ive tried checking the used in cogs box under thingsflaged no change either way still doesn't change ai

and ive tried about every possible combination of the above

now i know there's something im not doing right i just cant figure out what it is

any idea?

2002-08-14, 3:31 AM #9
Why would you assume that you should use a ghost when it's supposed to be the actor? The cog, as it is, expects you to have an actor in the level, not an actor created ingame.

The guard variables are there for you to define the "fellow guard[s]" that you mentioned.

Could you explain the situation with a little more detail? Why are you creating the actors ingame, and what type of cog are you using to do it?

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-08-14, 7:03 AM #10
SaberMaster


ive tried placing the actor before and they show up fine in jed and 3d preview but the actor dosent show up in game , im using the enemygenmp.cog to get the actors in the game

so to anwser you question: im doing it with the ghost because that the only way i have found that gets actors in the game

im using the enemygenmp.cog to do it

more info:
makeing my fisrt map/level learning thing as i go
this map is
multiplayer map/level
actor in this case:battledroid

if the is something you need to know tell me i dont really know what information would help you help me with this

2002-08-14, 10:20 AM #11
Whenever asking for a cog, the most important details are: JK or MotS, SP or MP, and the events that the cog must act on.

Actors were not meant to be used in multiplayer. That's why they won't be created if you simply place them in your level. Creating them ingame does work, but they will not be synced without special coding. Massassi does have an "AI - synced" cog pack in the Cogs section.

However, this is not the type of project I would recommend for a beginner, let alone his first level. But if you still want to do it, download and implement the AI sync cogs. If you can get them working well, I'll modify the cogs to change their AI when damaged. [http://forums.massassi.net/html/smile.gif]

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-08-14, 11:40 AM #12
SaberMaster

cool , i already have the AI - synced cog pack from massassi but i did run into a problem when trying to use it

there a 3 files in that pack

ais_basic_jk.cog
ais_basic_cli.cog
ais_basic_svr.cog

the only one of the 3 files that i can put in the placed cogs and not get the error could not load level is the ais_basic_jk.cog

when i open up that ais_basic_jk.cog
i see this

# Jedi Knight Cog Script
#
# ais_basic_svr.cog
#
# Basic Synced AI: MOTS Version
#
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# AIS Beta .5
# Incomplete, but functional. You may use this in your levels, but
# be aware that there may still be a few bugs, and that improved versions
# with more features will be coming out.
# JK Version.
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

so what i would like to know is

is the ais_basic_jk.cog the right file for jk and is it the only file i need to have in placed cogs? (i assumed that i needed a client side cog aswell )

note: when i have placed any of the 3 cogs i didnt make any changes to the varaibles on the right
2002-08-15, 2:18 AM #13
SaberMaster

i wanted to see the ai change in action so i turned my level into a single player level(updated it in episode editor) and placed 4 actors(not ghost),placed the 4 change AI cogs in the placed cogs area

i set it up like this

actorthing 90 (my actor thing(battledroid)
guardthing0 91(another battledroid,did same for other guardthings(ie 92 93)
attackAI battledroid.ai
(my starting AI is battledroid2.ai)

now im hopeing i did something wrong because he didnt change his ai, meaning didnt shoot at me

one thing i wasnt sure about is wheather i need 1 cog per actor or could one cog handle 5 actors since theres 4 guard things

but my best guess was i needed 1 cog per actor

please let me know if i did something wrong
2002-08-15, 5:38 AM #14
You might not have done anything incorrectly, and the cog is based around the one actor. I rewrote the cog to be a little more functional:
Code:
# changeai.cog
#
# A cog to change an actor's AI when he or another actor is damaged.
#
# [SM]
#==============================================================#
symbols

thing     actor0          mask=0x48
thing     actor1          mask=0x48
thing     actor2          mask=0x48
thing     actor3          mask=0x48
thing     actor4          mask=0x48
thing     actor5          mask=0x48
thing     actor6          mask=0x48
thing     actor7          mask=0x48
thing     sender          local

ai        attackAI

int       numActors
int       disableActors
int       i               local

message   startup
message   damaged

end
#==============================================================#
code
#------------------------------------------------------
startup:
	if(disableActors)
	for(i = 0; i < numActors; i = i + 1)
	AISetMode(actor0, 0x2000);

Return;
#------------------------------------------------------
damaged:
	sender = GetSenderRef();
	AISetClass(sender, attackAI);
	AISetMode(sender, 0x4);
	if(disableActors) AIClearMode(sender, 0x2000);
	for(i = 0; i < numActors; i = i + 1)
	{
		if(actor0 != sender &&
		HasLOS(actor0, sender) &&
		!(AIGetMode(actor0) & 0x200) &&
		!(GetThingFlags(actor0) & 0x200))
		{
			AISetClass(actor0, attackAI);
			AISetMode(actor0, 0x4);
			if(disableActors)
			AIClearMode(actor0, 0x2000);
		}
	}

Return;
#------------------------------------------------------
end


Now, when any one of the actors is damaged, all actors in view will have their AI changed. The disableActors int is provided so that you can have the cog disable the actors on startup. That should work for your SP test.

I'll download the AI sync cogs and take a look at them. There may be a problem with them.

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.

[This message has been edited by SaberMaster (edited August 15, 2002).]
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-08-15, 7:27 AM #15
SaberMaster

ive tried it with the new AI you posted

this is how i did it

actorthing0-3 ,i have actor thing90.91,92,93
actorthing4-7 left alone
attackAI-battledroid.ai
numActors-i put 4 (for the number of actors im using, i assumed thats what it was for)
disableactors i also put 4

ive also tried numactor with 0
diasableactor with 0 and there combinations

now im not sure the ai isnt changing, but he dosent shoot, the reason i say im not sure is because when i shoot or punch the battledroids the begin to turn and follow me

also i switch the actor from battledroid to stormtrooper thinking maybe the might be something wrong with batteldroid since it is a custom 3do , with the stormtrooper as the actor when i shot him he did the turn and follow, plus i heard set blasters on full of something like that

note:for the stormtroop i used i loaded the stormtrooper template and only change the ai
renamed it

also i took the follow instint out of the starter ai witch is why im thinkning maybe its changeing alteast somehow in part although that makes no sence

please let me know if i am doing it wrong
2002-08-16, 3:18 PM #16
disableActors is boolean. That is, it should be given a value of 0 for false or 1 for true. Any value greater than 1 would also make disableActors true, so a value of 4 should have worked.

I think something is wrong either with the template you're using or its placement in JED. Zip your project dir and email it to me (address in my profile). I'll fix the problem and email it back to you. [http://forums.massassi.net/html/wink.gif]

I tested the AI sync cogs and found that they don't work correctly for JK. For JK, you're supposed to use the ai_basic_jk cog instead of ai_basic_svr.cog. The _svr cog is for MotS. But even so, the JK version of the cog uses MotS verbs. So it's pretty useless to try to use them as they are in JK. [http://forums.massassi.net/html/frown.gif]

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-08-16, 3:54 PM #17
I found that Nightmare released a level demonstrating his synced AI code for JK. This is not the same code for download in the Cog section.

Download the level and extract the AI sync cog and the JKL from it. Open the JKL, and copy any template beginning with _ais into the master.tpl file in your project dir. If the master.tpl isn't there, copy it from your JED install dir's Jeddata folder. Then when you place the cog, you will be able to select the templates that you added to the master.tpl.

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-08-16, 7:05 PM #18
ok im sending you the zip

i do have that level with the the different cog but it states in the heading that no one is allowed to use it
2002-08-17, 3:58 PM #19
sabermaster

A BIG TAHNK YOU ,it works
2002-08-17, 3:59 PM #20
sorry that was thank you
2002-08-18, 12:30 PM #21
You're welcome. [http://forums.massassi.net/html/wink.gif]

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.

↑ Up to the top!