Home   Help Search Login Register  

Author Topic: About MP Killed Messages  (Read 2658 times)

0 Members and 1 Guest are viewing this topic.

Offline haroon1992

  • Members
  • *
  • My life is hopeless...
About MP Killed Messages
« on: 10 Mar 2011, 09:08:48 »
I've been trying to implement the message system that displays "Someone killed someone" in my First Strike mission.
Just because I'm going to make it an MP mission.

And I am stuck figuring out how to do that because the message kept popping up only at the server.

I am kinda confused with those "polling scripts" and the publicVariable command.

I think just a snippet or a little example mission would solve the problem.

Just as to save forum space, I'll ask my other one question here.

How do I remove those hand-grenades and Ak-47 mags from the Urals?
(or how do I make so that players cannot rearm at the Urals or 5t Trucks?)

Regards,
Haroon1992
Very busy with life, business, and other stuff. Away from OFP for months. Not sure if I could get back onto it. :(

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: About MP Killed Messages
« Reply #1 on: 10 Mar 2011, 09:43:45 »
Moved this here since it's MP related mostly.

Quote
How do I remove those hand-grenades and Ak-47 mags from the Urals?
Lock them, or clearMagazineCargo
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline haroon1992

  • Members
  • *
  • My life is hopeless...
Re: About MP Killed Messages
« Reply #2 on: 10 Mar 2011, 11:52:12 »
I don't think "locking" them would remove the magazines.
But I haven't tried the "clearmagazinecargo" command yet.Thanks for that.
So far , I've tried it with "removeammocargo" and "removemagazinecargo".

Again, thanks for that and I'll try it out.


Regards,
Haroon1992
Very busy with life, business, and other stuff. Away from OFP for months. Not sure if I could get back onto it. :(

Offline j0e

  • Members
  • *
    • j0e's home
Re: About MP Killed Messages
« Reply #3 on: 07 Apr 2011, 17:48:14 »
I'll try to drive you to the right dir.

First, you have to trap the kill event.
To do that, use the event handler for the kill and
append it to the units you want check.

Tip: the event handler is LOCAL to the machine,
so you must monitor it on each machine.

When the killed handler is fired, it will return you
both the dead unit and the shooter.

No need of the PublicVariable, because it is supposed
that all connected players are syncronized and
updated on the kill event.

Offline haroon1992

  • Members
  • *
  • My life is hopeless...
Re: About MP Killed Messages
« Reply #4 on: 08 Apr 2011, 08:11:52 »
Thanks for your reply j0e

I meant I was trying to display a custom radio message like this :

[west,"HQ"] sideChat format ["%1 killed %2",_killer, _killed]


But the message won't show on other machines, except the server. :(

1. Do I need to put add the eventhandlers to the units on all computers?
2. If so, what is the locality of the script.sqs called by the eventhandler when someone is killed?
3. Is it local to the killer? OR the killed?

4. How can I transmit radio messages from the server or a client through all clients?

Regards,
Haroon1992
Very busy with life, business, and other stuff. Away from OFP for months. Not sure if I could get back onto it. :(

Offline j0e

  • Members
  • *
    • j0e's home
Re: About MP Killed Messages
« Reply #5 on: 08 Apr 2011, 10:09:51 »
Today I'll close an eye, uha.

<UNIT> AddEventHandler ["KILLED",{_THIS Exec "unitkilled.sqs"}]

Where <UNIT> is the unit to monitor.

When the <UNIT> is killed, the EH is fired
and "unitkilled.sqs" is called.
The machines, where EH was added on <UNIT>,
will provide you the killer and the killed.

In the "unitkilled.sqs" script you should start as follow:

_target=(_THIS Select 0)
_killer=(_THIS Select 1)

and try this radio message:

Player GlobalChat Format ["%1 killed %2",_killer,_target]

Only by viewing yours, I think the problem is "SideChat"
(if Player is NOT on the WEST side will not see the radio of course!).

If you don't want that the radio message is shown transmitted
by the Player, create a logic and use it instead.

<LOGIC> GlobalChat ..

1. Yes.
2. Scripts haven't locality.
You should worry about the effects of the inside code, instead.
3. Senseless.
4. No need to transmit.

Offline ThE cRaCkEr

  • Members
  • *
Re: About MP Killed Messages
« Reply #6 on: 08 Apr 2011, 15:01:59 »
Only by viewing yours, I think the problem is "SideChat"
(if Player is NOT on the WEST side will not see the radio of course!).

That's not right. globalChat and SideChat are both local commands, so they have to be executed on all machines. This is the reason why haroon1992 's method only showed a message on the server.

Offline j0e

  • Members
  • *
    • j0e's home
Re: About MP Killed Messages
« Reply #7 on: 08 Apr 2011, 16:21:42 »
You misunderstood my reply.

I'm not saying it is wrong because of the "locality".
I know it has local effects.

It is wrong when he use the [WEST,"HQ"] and SideChat, because must consider the side of the player where the machine execute the command. If it is on east side, won't see anything.

I read again haroon1992's questions and I realized he's expecting the SideChat transmits something on the net, isn't?

Offline ThE cRaCkEr

  • Members
  • *
Re: About MP Killed Messages
« Reply #8 on: 09 Apr 2011, 00:02:28 »
I read again haroon1992's questions and I realized he's expecting the SideChat transmits something on the net, isn't?

Yes, that's what I wanted to emphasize. He has to consider both, locality and the side of the player. But who would blaim him to think a command named "..Chat" would send a message to other players...  :)

Offline haroon1992

  • Members
  • *
  • My life is hopeless...
Re: About MP Killed Messages
« Reply #9 on: 09 Apr 2011, 16:31:38 »
I think there is a little misunderstanding between you experts and me newbie.  :D

I (Server), a West machine gunner, can see "Player 2 killed a dummy", but I (Client) a West soldier, can't see it.

I know all the things about sideChat, groupChat, globalChat etc.

But I can say that I know realize the truth, yes, what a dumb I was. I can just put the killed ev on all machines, and let the message show. Yes, there is no need to transmit.

About script locality

Sorry, I am a bit weak in English, I should've asked (I was suddenly confused script execution with locality) :
3. "On which computer will the script be executed?"
4. "Is it on killed? or the killer?"

Stupid Mission

I've attached the mission with the script which I've written in hope of achieving what I want.

The mission was done quite a couple of months ago. And I can't test it at the moment, it's just the one that I found in my memory stick.
But i found that i used Killer and Killed global variables there.

I'm just uploading it so that I might get some valuable advise from you experts.

Thanks for your replies. I hope to see your expert advises soon.

Regards,
Haroon1992
Very busy with life, business, and other stuff. Away from OFP for months. Not sure if I could get back onto it. :(

Offline j0e

  • Members
  • *
    • j0e's home
Re: About MP Killed Messages
« Reply #10 on: 11 Apr 2011, 09:02:53 »
Quote
>3. "On which computer will the script be executed?"
>4. "Is it on killed? or the killer?"

An example should clearify.

Let's have: Klr kills Vic.

The machines where you initialized (I suggest in "init.sqs") this:

Vic AddEventHandler ["KILLED",{_THIS Exec "unitkilled.sqs"}]

will call the script giving the array: [Vic,Klr].

When you think to the locality discussions, you have to consider
that all machines are updated -by game design- with:

"the bullet fired by Klr hit and killed Vic".

So the locality is referred to the event handler trap.

The machine without the EH will know about the kill, but will not
execute any script because you didn't tell it to do that.

The <type_of>Chat will manage a text only on the machine is executed.
Stop.
The way -it will do- depends on the <type_of>:
if you use SideChat and you are not on the same side of the speaker
you will not read anything.