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 → Cog Coding Help with a very badly needed Project...
Cog Coding Help with a very badly needed Project...
2001-02-25, 5:33 AM #1
Ive been trying to do this for days with no success at all. Here is the code I am working with.

personinview = FirstThingInView(player, 179, 0x1, 0x404);
healthwise = GetPlayerHealth(personinview);
PrintInt(healthwise);

I basically only want it to return a proper value for another person in game to get the OTHER players health. Ive tried variations and I just cant do it. I have tried GetThingHealth instead of GetPlayerHealth, just about everything, if I could have your thoughts Id greatly appriciate it.

Affirmation_Grp
2001-02-25, 5:36 AM #2
Oh, It Does return one thing, -1 for not in view and 0 for when the other person is. But I cant get it to come back with their real health.
2001-02-25, 7:30 AM #3
Well, first of all change it back to GetThingHealth(); and second, it probably isn't finding a a target. You should add this:

if (personinview == -1) Return;

before that other stuff. Another thing you may want to do is put this in a pulse so it is constantly looking for a target.

------------------
Those who stare in the eyes of death and laugh will be the first to go.
Those who stare in the eyes of death and laugh will be the first to go.
2001-02-25, 8:29 AM #4
sorry, It actually is in a pulse, but is it possible to return a health value of another person in the game like a value 96?

I dont know the code [http://forums.massassi.net/html/frown.gif] or how to arrange it....
2001-02-25, 10:32 AM #5
Oh, and it defenitely finds the target, because I have it checking something else and that part Defenietly works, It just wont return me a value for the other guys health .... :\
2001-02-26, 2:21 PM #6
FirstThingInView is not right.
(player, FOV, *distance*, charFlag)
Your code only checks for 1 jku, which is pretty close to player.

Check for parenthesis either in http://www.code-alliance.com/~editors/jediknight/docs/jk_specs/jkspecs.htm or at http://millennium.massassi.net/cogverb/

------------------
http://millennium.massassi.net/ - Millennium
2001-02-27, 4:57 AM #7
Ok, if the FirstThingInView is set up to only view one player, (or not set up to check for the other players health), then what is the best way to do that?

I found this NextThingInView(); verb in one of the archives you sent me, should I possibly try using this?

I tested this with only one other player in the game, I ... think ... it should've worked either way but I don't know ;\
2001-02-27, 5:56 PM #8
You can refer the force_throw.cog for the reticle coding, which gets players in front of you, this time, not the reticle but report the health. Get this in the pulse message.

Code:
pot = FirstThingInView(player, 180, 10, 0x404);

while(pot != -1)
{
   if( (pot != player) && (HasLOS(player, pot) )
   {
      dot = ThingViewDot(player, pot);
 
      if(dot > maxDot)
      {
         victim = pot;
         maxDot = dot;
      }
   }

   pot = NextThingInView();
}

vit = GetThingHealth(victim);
//PrintInt(vit);


------------------
http://millennium.massassi.net/ - Millennium
2001-02-28, 3:30 AM #9
Thank you, I think thats just the information I was looking for when I came here...(More or less an example of a working FirstThingInView)


Thanks =P

↑ Up to the top!