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 → Following Guy Cog
Following Guy Cog
2003-01-06, 1:26 AM #1
I need a cog...

the player enters a sector [sector1], a guy [technican] starts following him (like in ToaM 2 but since I don't know anything about vectors I can't do that myself).
As soon as the player and the guy are both in one sector [sector2] the guy stops following the player.

I hope that did describe what I need.

------------------
*Elmo is Elmo
èl Moo Interactive
* Elmo is Elmo
2003-01-06, 2:35 AM #2
My cog writing knoledge is fundamental but functional, however I do not know if this will work.
Code:
# Elmo's stalking Cog
#
# [GoY]
#
# Don't blame LEC if this ****s up.
symbols

sector startstalk linkid=1
sector endstalk linkid=2
thing stalker
thing safety
thing player local

message entered
message exited

end

cod

entered:
if (GetSenderId()==2) return;
player=GetSourceRef();
AiSetMode(0x1);
AiSetMoveThing(stalker, player);
return;

exited:
if (GetSenderId()==1) return;
AiSetMoveThing(stalker, safety); 
return;

end


stalker is the follower.
safety is where he goes after the player leaves the last sector.
startstalk is the first sector
endstalk is the last sector
Massassi's Official Chatroom: irc.synirc.com #massassi
2003-01-06, 2:49 AM #3
That doesn't work.

The technican will move to the position the player stood when he entered the sector. I tried it. That's why I need vectors...

Plus he is pushing the player away. I need him to stop when he's close to the player.
(The following stuff ends if BOTH, the player and the technican are in sector 2)

------------------
*Elmo is Elmo
èl Moo Interactive
* Elmo is Elmo
2003-01-06, 3:59 AM #4
As the guy who created a great friendly AI system, I can help.
Code:
#Jedi Knight Cog Script
#
# This is just a guy who follows you around but doesn't get too close
#
# [DP]
#
symbols

thing          follower
sector         startFollow
sector         endFollow
flex           stopDistance

message        entered
message        pulse

end

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

code

Entered:
   If(GetSenderRef() == startFollow) SetPulse(.25);
   Else SetPulse(0);
   Return;

# ........................................................................................

Pulse:
   If(VectorDist(GetThingPos(GetLocalPlayerThing()), GetThingPos(follower)) < stopDistance)
   {
      AiSetMoveThing(follower, follower);
      AiClearMode(follower, 0x1);
      Return;
   }
   AiSetMode(follower, 0x1);
   AiSetMoveThing(follower, GetLocalPlayerThing());
   Return;

end
Note the correct usage of AiSetMode GoY. This isn't vectors, its AI verbs, execpt for the distance)

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

The Magician Saber System.

[This message has been edited by Descent_pilot (edited January 06, 2003).]
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack

↑ Up to the top!