Home   Help Search Login Register  

Author Topic: detect if player did it  (Read 3630 times)

0 Members and 1 Guest are viewing this topic.

Offline 456820

  • Contributing Member
  • **
Re:detect if player did it
« Reply #15 on: 04 Jun 2005, 16:57:47 »
ive already got the right place on the screen im just trying to resize the pic so its not as blury
also thanks for your help

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:detect if player did it
« Reply #16 on: 04 Jun 2005, 17:00:43 »
Well, try a resize to 512 X 32.

But I think the same might happen, but try it anyway



Planck
I know a little about a lot, and a lot about a little.

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:detect if player did it
« Reply #17 on: 04 Jun 2005, 17:11:53 »
For the zero divisor thing, it seems that there is no value returned 'in' the _this select 1...

You by any completely odd reason happen to use pre- 1.90 OFP?
Because if that's the case I don't think the eventHandlers work...
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline 456820

  • Contributing Member
  • **
Re:detect if player did it
« Reply #18 on: 04 Jun 2005, 17:18:28 »
ive got V1.96

also now ive resized everything but have ran into a problem its saying it can load my texture

Offline 456820

  • Contributing Member
  • **
Re:detect if player did it
« Reply #19 on: 04 Jun 2005, 17:28:41 »
okay ive fixed the dimensions just stuck with the event handler thing is there any other alternate ways checking if the player killed him?

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:detect if player did it
« Reply #20 on: 04 Jun 2005, 17:58:48 »
you could try assigning a variable first.

_badboy = _this select 1

hint format ["Badboy is - %1", _badboy]


or someting like that to check what select 1 contains, if anything.


Planck
« Last Edit: 04 Jun 2005, 17:59:11 by Planck »
I know a little about a lot, and a lot about a little.

Offline 456820

  • Contributing Member
  • **
Re:detect if player did it
« Reply #21 on: 04 Jun 2005, 18:18:52 »
i just though of something im running a script through the event handler so is it not returing anything becuase its in a script like that ?

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:detect if player did it
« Reply #22 on: 04 Jun 2005, 18:31:24 »
If you are running the script from an eventhandler then the script will receive its values from the eventhandler:

For a 'killed' eventhandler it would be select 0 according to the comref.

And maybe there lies your problem......you are using select 1..........possibly   ::)


Planck
I know a little about a lot, and a lot about a little.

Offline 456820

  • Contributing Member
  • **
Re:detect if player did it
« Reply #23 on: 04 Jun 2005, 20:12:07 »
in the editors depot theres a tutorial on event handlers and it says that a kiiled eh
has the following
this select 0 = whos dead
this select 1 = who killed him
or thats what i am to beleive people have been saying theres no select 1 so im not totaly sure if this is right
so if you know of another way please say ?
thanks for all help so far aswell

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:detect if player did it
« Reply #24 on: 04 Jun 2005, 20:17:32 »
It's not entirely impossible that the comref is wrong, any way you could always try select 0 to see what you get, if anything.

What line are you using to set the eventhandler?


Planck
« Last Edit: 04 Jun 2005, 20:17:58 by Planck »
I know a little about a lot, and a lot about a little.

Offline 456820

  • Contributing Member
  • **
Re:detect if player did it
« Reply #25 on: 04 Jun 2005, 20:25:32 »
im using this in the units init field

this AddEventHandler ["killed", {[] exec "court.sqs"}]

and these are what (or suposebly) what is returned by it

"killed" (addable to men or vehicles) :
_this select 0 : who's dead ;
_this select 1 : whodunnit (say, the killer) ;

but i think this is wrong and your right becuase ive had trouble with this before
so this leads me to have one option the long way around wich always seems to be the easy way for ofp lol.

#loop
officer addEventHandler ["hit",{goto "CheckDead"}]}
~2
goto "loop"
#checkdead
? (_dammage >= 1) : [] exec "court" && goto exit
? (_dammage < 1): goto "loop"
#exit

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:detect if player did it
« Reply #26 on: 04 Jun 2005, 20:28:44 »
Try this:

this AddEventHandler ["killed", {_this exec "court.sqs"}]


Planck
I know a little about a lot, and a lot about a little.

Offline 456820

  • Contributing Member
  • **
Re:detect if player did it
« Reply #27 on: 04 Jun 2005, 20:30:14 »
but when i do that i cant check if the player killed him or if a russian did

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:detect if player did it
« Reply #28 on: 04 Jun 2005, 20:35:38 »
Eventhandlers return their values in _this according to the comref.

So, when your script says:

_this select 0:  It takes the first returned value which might be the person killed.

_this select 1:  It takes the second returned value which might  be the person who did the killing.

Thats the way I understand it anyway.


Planck   ;D ;D
« Last Edit: 04 Jun 2005, 20:36:11 by Planck »
I know a little about a lot, and a lot about a little.

Offline 456820

  • Contributing Member
  • **
Re:detect if player did it
« Reply #29 on: 04 Jun 2005, 20:44:41 »
well i have this in my script
? _this select 1 == player : goto "court_martial"
but it says nothing is returned so therfore im pretty sure the tut im reading is wrong as well as someone else who used _this select 1 as the killer also had trouble