O_CirclesO_Circles
(edited: )

Quote

[Hide]  

Jedi Knight Cog Script

#

[Hide]  

17a_BocSearch.cog

# Modified from 00_AISearchPath.cog for the Boc level

[Hide]  

# Used for Dark Jedis

[Hide]  

# [IS]

[Hide]  

# (C) 1997 LucasArts Entertainment Co. All Rights Reserved

symbols
message startup
message timer
message pulse

thing darkJedi nolink

sector sect0 nolink

thing searchNode0 nolink
thing searchNode1 nolink
thing searchNode2 nolink
thing searchNode3 nolink
thing searchNode4 nolink
thing searchNode5 nolink
thing searchNode6 nolink
thing searchNode7 nolink
thing searchNode8 nolink
thing searchNode9 nolink
thing searchNode10 nolink
thing searchNode11 nolink
thing searchNode12 nolink
thing searchNode13 nolink
thing searchNode14 nolink
thing searchNode15 nolink

float searchWait=5.0
float searchSpeed=2.0

int searchNodes=-1 local
vector currNode local

int player local
float lastSeenTime local
int looking=0 local

int i=0 local
int debug=0 local
end

code

[Hide]  

................................................................................

startup:
player = jkGetLocalPlayer();
SetTimerEx(1.0, 1, 0, 0);

for (i=0; i<=15; i=i+1)
{
if (searchNode0[i] >= 0)
searchNodes = searchNodes + 1;
}
if (debug) print("Number of Search Nodes:");
if (debug) printint(searchNodes);
return;

[Hide]  

................................................................................

timer:
if (GetSenderId() == 1)
{
if (HasLOS(darkJedi, player))
{
SetPulse(0.0);
lastSeenTime = GetLevelTime();
looking = 0;
}
else
{
if ((!looking) && ((GetLevelTime() - lastSeenTime) > searchWait))
{
if (debug) print("Looking for Kyle...");
call StartSearch;
looking = 1;
}
}
SetTimerEx(1.0, 1, 0, 0);
}
return;

[Hide]  

................................................................................

StartSearch:
currNode = 0;
if (GetThingSector(darkJedi) == sect0)
{
// Boc is in the main chamber
currNode = 0;
}
else
{
for (i=1; i<=searchNodes; i=i+1)
{
if (VectorDist(GetThingPos(darkJedi), GetThingPos(searchNode0[i])) < VectorDist(GetThingPos(darkJedi), GetThingPos(searchNode0[currNode])))
{
currNode = i;
}
}
}
call DJMove;
return;

[Hide]  

................................................................................

DJMove:
if (debug) print("Heading to node:");
if (debug) printint(currNode);
AISetMode(darkJedi, 0x200); // awake and active
AISetLookPos(darkJedi, GetThingPos(searchNode0[currNode]));
AISetMovePos(darkJedi, GetThingPos(searchNode0[currNode]));
AISetMoveSpeed(darkJedi, searchSpeed);
SetPulse(0.5);
return;

[Hide]  

................................................................................

pulse:
if (debug) printflex(VectorDist(GetThingPos(darkJedi), GetThingPos(searchNode0[currNode])));

call DJMove;
if (VectorDist(GetThingPos(darkJedi), GetThingPos(searchNode0[currNode])) < 0.2)
{
if (debug) print("Reached Node:");
if (debug) printint(currNode);
// Dark Jedi has reached a node
SetPulse(0.0);
if (currNode == searchNodes)
{
currNode = 0;
}
else
{
currNode = currNode + 1;
}
call DJMove;
}
return;

end

 
Latest News
View all
No news
Recent Threads
View all
Thread Author
20_bocsearch.cog
Last post
O_CirclesO_Circles
0 replies
Unlimited Force Speed Glitch Research
Last post
O_CirclesO_Circles
0 replies
Better boss strats c:
Last post
O_CirclesO_Circles
1 replies