Home   Help Search Login Register  

Author Topic: Touch of death  (Read 1039 times)

0 Members and 4 Guests are viewing this topic.

ShrubberyJSC

  • Guest
Touch of death
« on: 13 Jul 2006, 10:27:36 »
Ok, here's my "touch of death"

myloc = getpos player; deadguy = nearestobject myloc; deadguy setdammage 1;

This, quite hilariously, kills me.   ;D

It does exactly what I told it to do, but if I want to kill the person closest to me, (without killing me) how would I do this?  ???

BTW, nobody should lose sleep over this, it's just a way for me to learn this stuff.  ;)

Yay! I found a way to do this, even with crappy 1.30 version!   (OFPR) coming in the mail........... :-\

I take apart the array, using select, then using variables, put together a new array. I wish I could use SET, but I will be

able to use it once I get OFPR.

So now it kills a poor idiot that happens to be standing east of me.

But the question still stands, can I have it not target me with nearestobject?

because it seems silly to have the nearest object to me be me... I understand, but can it not include me in the search?
« Last Edit: 13 Jul 2006, 11:40:45 by Justin »

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Touch of death
« Reply #1 on: 13 Jul 2006, 17:36:19 »
Only way to get this to work is to set the exact type of object you are looking for, and that type is not you. Execute the nearestObj command once for each specific object type i.e. OfficerG, SoldierGB etc.
urp!

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: Touch of death
« Reply #2 on: 13 Jul 2006, 18:53:20 »
Code: [Select]
myloc = getpos player
deadguy = nearestobject myloc
?not  (deadguy == player) : deadguy setdammage 1

will have to be a looping script, but it won't kill you any longer. vehicles exploding nearby might though....

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Touch of death
« Reply #3 on: 13 Jul 2006, 20:18:47 »
problem is that nearestObject getPos player will return always the player.

You may try something like:
Code: [Select]
#check
_dir = getDir player
_pos = [(getPos player select 0)+3*sin(_dir),(getPos player select 1)+3*cos(_dir), 2]
_obj = nearestObject _pos
?(alive _obj) &&(driver _obj == _obj)&&(_obj!=player):_obj setDamage 1
~0.5
goto "check"

That will return the alive nearest object (not vehicles) of a point 3 meters ahead of the player.

ShrubberyJSC

  • Guest
Re: Touch of death
« Reply #4 on: 14 Jul 2006, 02:15:50 »
Thanks guys!

All posts were very helpful!  :)

I think I'm learning!  Yay! 8)