I'm trying to make a cog that, when you activate it, it creates the targetting reticle. If you release the key, it leaves the reticle on the enemy, and makes you look only toward it... The problem is, there's gotta be a problem with the syntax, because it doesn't even show the initial message... here it is (i don't know how to do it in UBB)
# ITEM_TARGETLOCK.COG
# Looks around for an enemy to lock on to,
# then keeps the player centered around the
# enemy for the time the hotkey is used.
#
# By Darth Reed, darthreed@earthlink.net
#
# This cog is not made or supported by LucasArts Entertainment Company.
symbols
int player local
int potential local
int victim local
int lockedon=0 local
flex maxdist=3 local
vector playerlook local
vector victimlook local
vector lockedlook local
message startup
message activated
message deactivated
message pulse
message user1
end
# ========================================================================================
code
startup:
player = GetLocalPlayerThing();
return;
# ........................................................................................
activated:
if(lockedon == 0)
{
Print("Locking Now...");
victim = -1;
SetPulse(0.3);
}
if(lockedon == 1)
{
call user1;
}
return;
# ........................................................................................
pulse:
if(lockedon == 1)
{
if(victim != -1)
{
playerlook = GetThingLVec(player);
victimlook = GetThingLVec(victim);
lockedlook = VectorCross(playerlook, victimlook);
SetThingLook(player, lockedlook);
if(VectorDist(GetThingPos(player), GetThingPos(victim)) > maxdist)
{
call user1;
}
}
}
if(lockedon == 0)
{
victim = -1;
potential = FirstThingInView(player, 90, 8, 2);
while(potential != -1)
{
if(potential != player)
{
victim = potential;
}
potential = NextThingInView();
}
if(victim != -1)
{
jkSetTargetColors(29, 30, 31);
jkSetTarget(victim);
}
else
{
jkEndTarget();
}
}
return;
# ........................................................................................
deactivated:
if(victim != -1)
{
lockedon = 1;
Print("Locked On!");
}
else
{
SetPulse(0);
jkEndTarget();
}
return;
# ........................................................................................
user1:
if(victim != -1)
{
SetPulse(0);
jkEndTarget();
lockedon = 0;
}
return;
# ........................................................................................
end
------------------
"We've compiled 43 songs on one CD... But it's a big one... And it's made outta chocolate!"
- Ryan Stiles of 'Whose Line Is It Anyway?'
# ITEM_TARGETLOCK.COG
# Looks around for an enemy to lock on to,
# then keeps the player centered around the
# enemy for the time the hotkey is used.
#
# By Darth Reed, darthreed@earthlink.net
#
# This cog is not made or supported by LucasArts Entertainment Company.
symbols
int player local
int potential local
int victim local
int lockedon=0 local
flex maxdist=3 local
vector playerlook local
vector victimlook local
vector lockedlook local
message startup
message activated
message deactivated
message pulse
message user1
end
# ========================================================================================
code
startup:
player = GetLocalPlayerThing();
return;
# ........................................................................................
activated:
if(lockedon == 0)
{
Print("Locking Now...");
victim = -1;
SetPulse(0.3);
}
if(lockedon == 1)
{
call user1;
}
return;
# ........................................................................................
pulse:
if(lockedon == 1)
{
if(victim != -1)
{
playerlook = GetThingLVec(player);
victimlook = GetThingLVec(victim);
lockedlook = VectorCross(playerlook, victimlook);
SetThingLook(player, lockedlook);
if(VectorDist(GetThingPos(player), GetThingPos(victim)) > maxdist)
{
call user1;
}
}
}
if(lockedon == 0)
{
victim = -1;
potential = FirstThingInView(player, 90, 8, 2);
while(potential != -1)
{
if(potential != player)
{
victim = potential;
}
potential = NextThingInView();
}
if(victim != -1)
{
jkSetTargetColors(29, 30, 31);
jkSetTarget(victim);
}
else
{
jkEndTarget();
}
}
return;
# ........................................................................................
deactivated:
if(victim != -1)
{
lockedon = 1;
Print("Locked On!");
}
else
{
SetPulse(0);
jkEndTarget();
}
return;
# ........................................................................................
user1:
if(victim != -1)
{
SetPulse(0);
jkEndTarget();
lockedon = 0;
}
return;
# ........................................................................................
end
------------------
"We've compiled 43 songs on one CD... But it's a big one... And it's made outta chocolate!"
- Ryan Stiles of 'Whose Line Is It Anyway?'