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 → enemy cogs
enemy cogs
2001-09-13, 2:21 PM #1
How do I make it so that if a certain enemy sees the player, you fail a mission objective.(you CAN fail objectives, right?)
2001-09-13, 2:54 PM #2
no you can't fail objectives. but you could make it so when the player is seen it prints you have been seen mission failed. and then the level ends. at least i think you can i don't think there is a message for if an actor sees the play but i know there is a message for when the actor comes into the players FOV(field of vision). hopefully someone will come along and clear this up
roses are red, violets are blue, I am schizophrenic, and I am too!
2001-09-13, 3:00 PM #3
How about when the player is seen, it prints "Mission Objective Failed", and then the player dies, or something.
2001-09-14, 2:10 AM #4
I've been away for a long time, but I know exactly what you mean. I once used a cog to check wheter a camera did or did not see the player. If it did, it'd release a horde of robots on the player...

Han is right, there is no message, all you can do is run a very fast pulse to check if the player is in sight. Put pretty simple it should look somewhat that way, but bear with me if it ain't completely right, it's been a year or so I've done this, and back then only once :

--------------------------------------------
symbols

message startup
message pulse

thing player local
thing watcher

end

code

startup:
player=GetPlayerThing();
SetPulse(0.1);

pulse:
if(IsAiTargetInSight(watcher)==player)
{
DestroyThing(player);
Print("Mission failed...");
}

end
--------------------------------------------
I do not remember if IsAiTargetInSight() works exactly as stated here, but it was the Code Syntax I used. If it works out that way it's good.

If not, well then try playing around with the IsAiTargetInSight()-Syntax. You don't have many options with that one anyway, as it can only take one parameter. [http://forums.massassi.net/html/smile.gif]


[This message has been edited by Maverick (edited September 14, 2001).]
Maverick
2001-09-14, 6:38 AM #5
You can try the sighted message. That's what Han was talking about.

Uhm, Maverick, that cog isn't nearly right. Destroything(player) will crash the game and it wouldn't run anyway because it's missing two returns and there is no GetPlayerThing().

If the sighted message doesn't work, try adding this into the enemy's actor cog.

Code:
Symbols
   thing  target  local
   thing  actor

end
#=================#
startup:
   SetPulse(1);
   Return;

#=================#
Pulse:
   target=FirstThingInView(actor, 180, 10, 0x404);
   if(target == GetLocalPlayerThing())
   {
     Print("Mission Failed...");
     JKEndLevel(0);
   }      
   Return;

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


This will make the actor search for a target every second. if there are other ai around this one(within 10 JKU), FirstThingInView() might return the ai, instead of the player, and never work. In that case, adjust FirstThingInView's fov and distance. Also, make sure you define the actor.

------------------
Fiction must be more realistic than truth or no one will believe it.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2001-09-14, 6:49 AM #6
Told ya I've been away for a while... that little brain of mine still aches as hell. Gotta check back on the JKSpecs... seems I forgot a lot. Thanks for straightnin' my bugs out, Sabermaster.
Maverick
2001-09-14, 8:08 AM #7
Thanks! I'll try it right away.
2001-09-14, 9:10 AM #8
sighted won't work since he wants the actor to be looking for the player so meverick is on the right track
Code:
symbols

message startup
message pulse
message entered

sector sector1
thing player local
thing watcher

end

code

startup:
player=GetLocalPlayerThing();
return;

entered:
SetPulse(0.1);
return;

pulse:
if(IsAiTargetInSight(watcher)==player)
{
SetThingHealth(player, 0); 
Print("Mission failed...");
}
return;
end


i changed it to setthinghealth so he actually dies and doesn't just dissapear. i also added the returns you forgot [http://forums.massassi.net/html/smile.gif] and made it so the pulse isn't always running just set the sector to one just before the thing would be able to see him. and i fixed all the verb mistakes, this should work fine. i haven't tested it though
roses are red, violets are blue, I am schizophrenic, and I am too!
2001-09-14, 9:13 AM #9
sorry sabermaster didn't look all the way through your code your way will work also but has more variables. also you forgot to put your messages in the symbols.
roses are red, violets are blue, I am schizophrenic, and I am too!
2001-09-15, 8:26 AM #10
Oh, yeah; missed that. [http://forums.massassi.net/html/redface.gif] I meant for Fetch to add it into his actor cog so I wasn't thinking about making the cog complete.

BTW, your welcome, Maverick.


------------------
Fiction must be more realistic than truth or no one will believe it.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2001-09-15, 2:15 PM #11
Thank you very much [http://forums.massassi.net/html/smile.gif]
2001-09-15, 3:30 PM #12
...But when I actually tried the cog out, strange things happened. If the watcher spotted me, nothing irregular happened, but if I entered the sector I had used in the cog my health goes to 0, but the player doesn't die, and it keeps printing Mission Failed over and over and over. Please help me! Me [http://forums.massassi.net/html/confused.gif]
2001-09-16, 12:01 PM #13
I've finally figured it out once again. It works that way :

Code:
symbols
	message entered
	message pulse
	int	test	local
	sector	testsec
	thing	watcher
end
#======================================#
code
entered:
SetPulse(1);
return;
#======================================#
pulse:
if(IsAiTargetInSight(watcher)==1)
  {
  SetThingHealth(player, 0); 
  Print("Mission failed...");
  }
return;
end


That has done the trick for me they way you seemed to want it. Be careful though... I dunno why, but use it before you fired once, you'll get a value of 1, no matter what. Strangely firing off a projectile fixes this... well that's all I guess. Good editing.

[This message has been edited by Maverick (edited September 16, 2001).]
Maverick
2001-09-17, 8:32 AM #14
Thanks! [http://forums.massassi.net/html/smile.gif]

↑ Up to the top!