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 → security ai cog
security ai cog
2003-05-15, 5:36 PM #1
i have been trying to think of a way to make an actor attack a player if the actor sees the player attacking a fellow actor or another player. hopefully that makes sense. i can't think of a way to do it. so any help would be welcome, thanks

------------------
roses are red, violets are blue, I am schizophrenic, and so am I!
roses are red, violets are blue, I am schizophrenic, and I am too!
2003-05-15, 11:09 PM #2
OK...
A COG where you have damaged message.
Then add a "Who is damaged" verb, and "Does He see this" verb, and "Help out" verb.
Now I'm not sure about the verbs but I think it is:

Who: If(GetSenderRef()==friend1)
Sees: If(... No I don't know this one)
Help: SetAITurnCoat(him,player or who ever)

I think we will have to call in a pro!

/Edward
Edward's Cognative Hazards
2003-05-16, 1:50 AM #3
-pro arrives-
Code:
#JK cog script
#
# makes a enermy attack if you damage 
# another actor or object.
# includes LOS so he wont attack if he
# dosent see you.
#
# not surported by LEC.
#
Symbols
message damaged
message startup
thing	player		local
thing badboy linkid=0 DESC=the_guy_to_attack
thing hurtme linkid=1 DESC=me_be_attacked
end
code
startup:
player=GetLocalPlayerThing(); 
return;
damaged:
if (GetSenderID()==1)
{
if(HasLOS(badboy, player)==1)
{
AISetFireTarget(badboy, player); 
}
}
if (GetSenderID()==0)
{
if(HasLOS(badboy, player)==1)
{
AISetFireTarget(badboy, player); 
}
}
return;
end


that should work.
badboy is the guy who attacks, if he cant see you he wont.
hurtme is the guy you have to attack for him to attack you.

------------------
I am pjb.
Another post......
another moment of my life wasted.....
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
2003-05-16, 2:16 AM #4
thanks, thats all well and good but i need it so the security actor will attack you if it is any actor or player within the whole level. i need it so its not specified for just one actor.

------------------
roses are red, violets are blue, I am schizophrenic, and so am I!
roses are red, violets are blue, I am schizophrenic, and I am too!
2003-05-16, 1:17 PM #5
ah.... ok....
well then i am going to have to make a loop to find all the objects in the level.... well i coudl do that now but i am lasy and i need sleepies, so i will tomrow morning.

------------------
I am pjb.
Another post......
another moment of my life wasted.....
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
2003-05-16, 11:56 PM #6
my comps gone all screwie.. i can hardly see what i am typeing. can some one handle this for me as it needs fixing.

------------------
I am pjb.
Another post......
another moment of my life wasted.....
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
2003-05-17, 4:40 AM #7
ahh if you don't get around to it i might just do it another way. since all the actors in my level are custom i might just add a trigger to the actors damaged message and send it to the security guard and then check to see if they people are in his los. but if you still get a chance to whip up the other one go ahead, i would appreciate it.

------------------
roses are red, violets are blue, I am schizophrenic, and so am I!
roses are red, violets are blue, I am schizophrenic, and I am too!
2003-05-20, 10:03 AM #8
ok, i got the basics of the cog. i jsut cant thing how to impliment the check to see if you damaged it, heres the cog, i hav eshown the bit that needs a If test for the dameage part.

Code:
#
#JK cog script
#
# makes a enermy attack if you damage 
# another actor or object.
# includes LOS so he wont attack if he
# dosent see you.
#
# not surported by LEC.
#
Symbols
message damaged
message startup
message pulse
thing 	x 		local
thing	player		local
thing badboy linkid=0 DESC=the_guy_to_attack
end
code
startup:
player=GetLocalPlayerThing(); 
for(x=0; x<GetThingCount(); x=x+1)
SetThingPulse(x, 0.5); 
return;

pulse:
if(x==y)//<actor helth check needed here HERE
{
call GOH;
}
return;

GOH:
if(HasLOS(badboy, player)==1)
AISetFireTarget(badboy, player); 
return;
end


------------------
I am pjb.
Another post......
another moment of my life wasted.....
at least i made a level.
PJB's JK page's

-the PJB jedi rule book-
rule one,
Quote:
<font face="Verdana, Arial" size="2">never trust a barman with bad grammar</font>
-kyle katarn in JO

Rule Two,
Quote:
<font face="Verdana, Arial" size="2">Gravity is a crule misstress</font>
-kyle katarn in MotS, and the alternatior MK I in AJTD
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
2003-05-21, 11:58 AM #9
You have some learning to do.
Lession -
If this is a class cog (actor cog), then it will affect all of the templates with that class cog as its cog w/ actor flags of 0x400.

There is a very good verb called CaptureThing(); what ever thing number you put in that verb, the cog will respond to that things actions.

So take your pick. [http://forums.massassi.net/html/tongue.gif]

------------------
The Sniper Missions. Current project, The Sniper Missions

The Magician Saber System.
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2003-05-22, 3:57 AM #10
but its not a actor cog, its level cog. can i still use that sytem, and if i can show me a example plz.

------------------
I am pjb.
Another post......
another moment of my life wasted.....
at least i made a level.
PJB's JK page's

-the PJB jedi rule book-
rule one, "never trust a bartender with bad grammar"-kyle katarn in JO

Rule Two, "Gravity is a crule misstress" -kyle katarn in MotS, and the alternatior MK I in AJTD
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
2003-05-23, 4:26 AM #11
Didn't I explain CaptureThing()? [http://forums.massassi.net/html/tongue.gif]
If you want to get all things you do this ->
Code:
For(i=0;i<GetNumThings();i=i+1) CaptureThing(i);


If you want to get a specific template, do this ->
Code:
For(i=0;i<GetNumThings();i=i+1) If(GetThingTemplate(i) == tpl) CaptureThing(i);
There's my lession on CaptureThing().


------------------
The Sniper Missions. Current project, The Sniper Missions

The Magician Saber System.
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack

↑ Up to the top!