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 → need a little help
need a little help
2002-01-04, 11:46 AM #1
i hav just made a cog that is meant to stop all projectiles in ur LOS but it only seems to stop most of the projectiles.

heres the cog

# Jedi Knight Cog Script
#
# shield.COG
#
# Description
#
#
# This Cog is Not supported by LucasArts Entertainment Co

symbols

thing player


message startup
message selected
message deselected
message pulse
message killed


end

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

code

startup:

player = GetLocalPlayerThing();

return;

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

selected:

Print("Shield Online");
SetPulse(0.00000000000000001);

return;

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

deselected:

Print("Shield Offline");
SetPulse(0.0);

return;

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

killed:

Print("Shield Offline");
SetPulse(0.0);

return;

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

pulse:

bullet = FirstThingInView(player, 179, 15, 0x48);
bulletshooter = GetParentThing(bullet);
if((bulletshooter != player) && (GetThingParent(bullet) != player) && (VectorDist(GetThingPos(bullet), GetThingPos(player)) > 0.2))
{
StopThing(bullet);
}

return;


end

never posted cogs b4.
Do i just havta make the pulse a little faster to stop some from getting in?
and can some1 plz tell me how to post pics?
2002-01-04, 12:59 PM #2
Hmm, interesting. I didn't think to use GetThingParent() when I wrote mine. I used ThingViewDot() instead, so that bullets you shot out (facing away) wouldn't be stopped.

Also, you have a redundant check in there:

Code:
bulletshooter = GetParentThing(bullet);
if(bulletshooter != player) && (GetThingParent(bullet) != player)


The first check and second check are the same; but, that first line (bulletshooter = GetParentThing(bullet);) has a nonexistant verb, GetParentThing, which I'm sure was a typo. So, the first check doesn't even work, anyways.

I'm not sure why it doesn't stop everything, but I remember running into trouble with it not stopping everything, but it was fixed, somehow.. if the distance is too small some will slip by, because JK can't "react" fast enough.
2002-01-04, 1:05 PM #3
i noticed that under a certain range it didnt work. im gonna leave it as it is xcept for the pulse, gonna make it a little faster.
if the GetParentThing line doesnt do anything i wont even worry about taking it out so not to cause any slips i mite do.

------------------
I_Chop_Ur_PP!
2002-01-04, 1:35 PM #4
Is it just me, or is that pulse set a little too high? I hope this isnt for MP...

 

Can we say LAG?

------------------
Success is the inverse relationship between effort, gain, and loss.
And when the moment is right, I'm gonna fly a kite.
2002-01-04, 5:34 PM #5
i have already tested this cog in multiplayer and i didnt notice any lag at all.
2002-01-04, 6:24 PM #6
You got to use NextThingInView to get all incoming things(in a while loop), FirstThingInView is always probably getting the first thing in view and none behind it.

Btw setting pulse THAT low has no effect. On my comp(PII) it went about 40 pulses in a second at maximum. And I think it depends on the computer power.

------------------
http://millennium.massassi.net/ - Millennium

[This message has been edited by Hideki (edited January 04, 2002).]
2002-01-04, 9:01 PM #7
so i jsut replace FirstThingInView with NextThingInView? remember im fairly new to this.

------------------
I_Chop_Ur_PP!
2002-01-05, 5:04 PM #8
Code:
pulse:


bullet = FirstThingInView(player, 179, 15, 0x48);


while(bullet != -1)
{
   bulletshooter = GetThingParent(bullet);


   if(bulletshooter != player && VectorDist(GetThingPos(bullet), GetThingPos(player)) > 0.2) StopThing(bullet);


   bullet = NextThingInView();
}


return;


This should get ALL the thing in view at once for each pulse.

------------------
http://millennium.massassi.net/ - Millennium

[This message has been edited by Hideki (edited January 05, 2002).]

↑ Up to the top!