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 → Setting an Enemy to a Friend
Setting an Enemy to a Friend
2001-03-12, 12:00 PM #1
I'm trying to make a COG where you can change an enemy Stormtrooper into an ally. I've tried setting its AI class using the "SetAIClass" command to the same as a Rebel Trooper, but it still attacks the player. I've also tried setting its COG the same as the Rebel and that still doesn't work, anyone got any ideas?

I would tell you what I need it for but.. it'll ruin the surprise.

------------------
Anthony Piggott
E-Mail: akpiggott@eidosnet.co.uk
ICQ: 41235225
Homepage: http://pages.eidosnet.co.uk/~akpiggott/
Xbox Live/PlayStation Network/Steam: tone217
http://twitter.com/ourmatetone
2001-03-12, 12:09 PM #2
For MotS or JK? Because friendly AI doesn't work quite right in JK. Of course, they still shouldn't attack you... Hmmm...

I'm working on some special AI COGs of my own, and one involves this sort of thing, so I will get back to you on this.

------------------
Black. His gloves of finest wool.
Black. His codpiece made of metal.
His horse is blacker than a hole.
His pot is blacker than his kettle.

Visit Virus Productions!
"And lo, let us open up into the holy book of Proxy2..." -genk
His pot is blacker than his kettle!
2001-03-12, 12:17 PM #3
Well, I'm pleased to say it's for MotS.

------------------
Anthony Piggott
E-Mail: akpiggott@eidosnet.co.uk
ICQ: 41235225
Homepage: http://pages.eidosnet.co.uk/~akpiggott/
Xbox Live/PlayStation Network/Steam: tone217
http://twitter.com/ourmatetone
2001-03-12, 4:51 PM #4
Well it's for mots eh ... i've got an easy solution

if it's single player just use the

If(haslos type thing ( if thats in mots ) and in the line of code with all the && , put in there

potential=!player

but if it's for multi then

created: ( this is the cog attatchd to the template)

guy=GetSenderRef();
player=GetLocalPlayerThing();

then down in the LOS

pulse:
if(ally == 1) && GetThingTeam(potental == guyteam) oktofire=1;
if(oktofire == 1) return;

trigger:

bla bla bla

ally=1;
guyteam=GetThingPlayerTeam(player);

else enemy again

ally=0
guyteam=0

sorry if this doesn't make sense but bassicly the multplayter is harder and i need to know if it;s jus
2001-03-13, 12:56 AM #5
I should have said before, it's SP. I don't understand what you've written though, I've never come across code like that before.

------------------
Anthony Piggott
E-Mail: akpiggott@eidosnet.co.uk
ICQ: 41235225
Homepage: http://pages.eidosnet.co.uk/~akpiggott/
Xbox Live/PlayStation Network/Steam: tone217
http://twitter.com/ourmatetone
2001-03-13, 2:09 AM #6
Try AISetAlignment(victim,int_align);, that may work.

------------------
Black. His gloves of finest wool.
Black. His codpiece made of metal.
His horse is blacker than a hole.
His pot is blacker than his kettle.

Visit Virus Productions!
"And lo, let us open up into the holy book of Proxy2..." -genk
His pot is blacker than his kettle!
2001-03-13, 3:39 AM #7
Tried that before, didn't work.

------------------
Anthony Piggott
E-Mail: akpiggott@eidosnet.co.uk
ICQ: 41235225
Homepage: http://pages.eidosnet.co.uk/~akpiggott/
Xbox Live/PlayStation Network/Steam: tone217
http://twitter.com/ourmatetone
2001-03-13, 10:02 AM #8
ok this is VERYVERYVERYVERYVERYVERYVERYVERY easy, you'll kill yourself it's so easy, ok try this:

go to create new template, click on the ... place, select the stormtrooper you want to be an ally with, click the >> button, click the .ai on the very right, and select rebdef.ai (i can't quite remember the rebel's ai file, it might be rdef.ai you can find out by selecting the rebel commando, and clicking >> and looking at its .ai file, and then opening the stormtrooper template and changing it to whatever the rebel commando's .ai file was).

I hope you didn't kill yourself.
I am lost and could care less if someone finds me.
2001-03-13, 11:02 AM #9
No, that's not what I want! I can do that already. I want an enemy to attack the player, but when this COG is activated the enemy becomes an ally and no-longer attacks the player.

------------------
Anthony Piggott
E-Mail: akpiggott@eidosnet.co.uk
ICQ: 41235225
Homepage: http://pages.eidosnet.co.uk/~akpiggott/
Xbox Live/PlayStation Network/Steam: tone217
http://twitter.com/ourmatetone
2001-03-13, 11:44 AM #10
oops, sorry, i didn't see that. i know almost nothing about cog, just templates and .ai files.
I am lost and could care less if someone finds me.
2001-03-13, 12:04 PM #11
Just an idea. Maybe this could work.
At the point where you want to switch the stormtrooper from hostile to friendly have the cog replace the stormtrooper thing with the friendly one in the same position. But this may look choppy in front of the player.

------------------
Sylvicolus JK homepage
If I have ever made any valuable discoveries, it has been owing more to
patient observation than to any other reason. -Isaac Newton
Sylvicolus JK homepage
If I have ever made any valuable discoveries, it has been owing more to
patient observation than to any other reason. -Isaac Newton
2001-03-15, 11:46 AM #12
hey i am doing this exact same thing!!! here use this ai
Code:
# Jedi Knight AI File
#
# FRDEFAULT.AI
#
# A friendly ai.
# All difficulties
#
# [Han5678]


alignment=1.0, rank=0.5, fov=200, maxstep=0.5, sightdist=5.0, heardist=2.0, accuracy=0.25

#instinct			args
Jump            	4000.0, 0.3, 0.3
LookForTarget   	500.0, 75000.0
Listen          	0.50, 2.0
PrimaryFire     	3000.0, 0.8, 5.0, 0.20, 0.0, 200.0, 0.50, 0.00, 3.0, 500.0
BlindFire       	1500.0, 0.75, 0, 0.8, 0.0, 0.10
Follow          	1.0, 2.0
OpenDoors
CircleStrafe    	5000.0, 30.0, 2.0, 1000.0, 0.0
ReturnHome
Withdraw        	5000.0, 1.5
Retreat         	0.50, 0.25, 2000.0, 1.0
Talk            	10000.0, 0.10
Dodge           	0.2, 0.1


/edit dang i hate ubb i can never remember where the slashes go /edit

then in the cog use SetAiClass(victim, friend);

then in the symbols of the cog have
ai friend=FRDEFAULT.AI local
bingo it will work fine.
there is another way to do it in mots but me can't remember

[This message has been edited by Han5678 (edited March 15, 2001).]
roses are red, violets are blue, I am schizophrenic, and I am too!
2001-03-15, 12:23 PM #13
Ahh, I'll give it a try, thanks a lot.

------------------
Anthony Piggott
E-Mail: akpiggott@eidosnet.co.uk
ICQ: 41235225
Homepage: http://pages.eidosnet.co.uk/~akpiggott/
Xbox Live/PlayStation Network/Steam: tone217
http://twitter.com/ourmatetone
2001-03-15, 12:50 PM #14
Odd, I tried it and it never worked.

It's for a weapon. I want it so that when the weapon is fired at the enemy, the enemy becomes an ally.

------------------
Anthony Piggott
E-Mail: akpiggott@eidosnet.co.uk
ICQ: 41235225
Homepage: http://pages.eidosnet.co.uk/~akpiggott/
Xbox Live/PlayStation Network/Steam: tone217
http://twitter.com/ourmatetone
2001-03-16, 6:47 AM #15
I'm not good with MotS, but if you post your cog, I may be able to spot an error in it.
2001-03-16, 7:51 AM #16
This is the COG for the projectile template it fires. I based the layout on Hideki's ST Rifle stun COG:

# Jedi Knight Cog Script
#
#
#
# By Anthony Piggott (akpiggott@jediknights.co.uk) for ToaM3
#
# This script is NOT supported by LucasArts Entertainment Company
# ==================================================================
#

symbols

thing victim local

model atst=at.3do local

message touched

ai friend=frdefault.ai local

end

# ========================================================================================

code

touched:

victim = GetSourceRef();

if( (GetThingModel(victim) != atst) && ( (GetThingType(victim) == 2) || (GetThingType(victim) == 10) ) )
{
print("Blarg!");
# SetActorFlags(victim, 0x2000);
# sleep(2.0);
# ClearActorFlags(victim, 0x2000);
AiSetClass(victim, friend);
# ParseArg(victim, "cog=actor_rc.cog typeflags=0x120001");
AISetAlignment(victim, 1);
return;
}

return;

end

------------------
Anthony Piggott
E-Mail: akpiggott@eidosnet.co.uk
ICQ: 41235225
Homepage: http://pages.eidosnet.co.uk/~akpiggott/
Xbox Live/PlayStation Network/Steam: tone217
http://twitter.com/ourmatetone
2001-03-16, 10:17 AM #17
I am using my in JK and it is a new force power not a weapon. So did you put cog=yourcog.cog in your weapon template or how did u go about doing it?
roses are red, violets are blue, I am schizophrenic, and I am too!
2001-03-16, 10:29 AM #18
Weapon COGs are defined in ITEMS.DAT.

------------------
Anthony Piggott
E-Mail: akpiggott@eidosnet.co.uk
ICQ: 41235225
Homepage: http://pages.eidosnet.co.uk/~akpiggott/
Xbox Live/PlayStation Network/Steam: tone217
http://twitter.com/ourmatetone
2001-03-16, 12:13 PM #19
Yeah i know i am not that stupid but what u got there isn't a weapons cog. Unless the weapon is touching something.
roses are red, violets are blue, I am schizophrenic, and I am too!
2001-03-16, 11:42 PM #20
No, that isn't a weapons COG. It's the COG for the projectile which the weapon fires.

------------------
Anthony Piggott
E-Mail: akpiggott@eidosnet.co.uk
ICQ: 41235225
Homepage: http://pages.eidosnet.co.uk/~akpiggott/
Xbox Live/PlayStation Network/Steam: tone217
http://twitter.com/ourmatetone
2001-03-17, 3:05 AM #21
And it prints?

------------------
http://millennium.massassi.net/ - Millennium
2001-03-17, 7:13 AM #22
I put the print in there temprorarily (forgot to remove) to check that there's no errors in the syntax of the COG, the print works fine.

------------------
Anthony Piggott
E-Mail: akpiggott@eidosnet.co.uk
ICQ: 41235225
Homepage: http://pages.eidosnet.co.uk/~akpiggott/
Xbox Live/PlayStation Network/Steam: tone217
http://twitter.com/ourmatetone
2001-03-17, 9:40 AM #23
Sorry about the confusion i didn't reAD above your cog that u said it was for the weapons template. And what i had meant with cog=yourcog.cog was that you put that under your weapon template
(+ouchy none cog=yourcog.cog)
yep okay all clear now?
roses are red, violets are blue, I am schizophrenic, and I am too!
2001-03-17, 11:18 AM #24
I think you're missing AiSetMode at the least.

Dig through this verb for mots cogs and you will find quite a few comment lines on this. Maybe you can use those that starts initiating a new target, like a turncoat cog.

------------------
http://millennium.massassi.net/ - Millennium
2001-03-17, 11:23 AM #25
OK, thanks. I'll have a look Hide' I tried Millennium yesterday but a lot of it is down at the moment.

------------------
Anthony Piggott
E-Mail: akpiggott@eidosnet.co.uk
ICQ: 41235225
Homepage: http://pages.eidosnet.co.uk/~akpiggott/
Xbox Live/PlayStation Network/Steam: tone217
http://twitter.com/ourmatetone
2001-03-18, 1:04 AM #26
Contacting admin to get cgi run the way I want.

If he won't make it, I either place files on a different server or rewrite the whole site...

Will get into the action in a few moments.

------------------
http://millennium.massassi.net/ - Millennium
2001-03-18, 2:50 AM #27
OK, thanks.

------------------
Anthony Piggott
E-Mail: akpiggott@eidosnet.co.uk
ICQ: 41235225
Homepage: http://pages.eidosnet.co.uk/~akpiggott/
Xbox Live/PlayStation Network/Steam: tone217
http://twitter.com/ourmatetone

↑ Up to the top!