Home   Help Search Login Register  

Author Topic: Anyone out there?????? :)  (Read 3709 times)

0 Members and 1 Guest are viewing this topic.

CptBravo

  • Guest
Re:Anyone out there?????? :)
« Reply #15 on: 03 Feb 2004, 05:21:34 »
Event handlers
    Event handlers can be defined in unit config or by function addEventHandler. Multiple handlers can be attached at one time. Event handler types are defined below. Each handler receives arguments in _this, argument types and meaning are defined below.
   
      "Hit" object:causedBy,scalar:howMuch


This was the first thing I looked up when I started. It made no sense what so ever! It looks Japanese to me as far as I am concerned.

Anyway the editor does not really explain it well enough in "plain" English to us commoners.

Not all OFP players are Guru Scripters as some have assumed. Some are accountants, lawyers and strippers! Your usual midwest mix!  ;D

So not everyone is going to understand the above that I "copied and pasted"!

Have a great day!



 
« Last Edit: 03 Feb 2004, 05:22:27 by CaptainBravo »

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Re:Anyone out there?????? :)
« Reply #16 on: 03 Feb 2004, 15:47:57 »
Just for info: i also wasn't born as an OFP scripter  :)

OK, you've copied and pasted what i told you and now
i'm goin to do what i've promised to you.

First off: i just noticed that i've been talking about the
wrong eventhandler (i said "HIT", but meant "FIRED")   :-[  ;D

However that's no prob for now:

Just one more thing:

if you scroll down to the bottom in the comref, where there
are the eventhandlers, you will also find a nice entry by
General Barron: more info about eventhandlers

http://www.ofpec.com/editors/resource_view.php?id=543

Also if you do not understand a command in the comref, at least
you know then how it's correct spelling, so that you could click
on the "search" button, just to have a look if somebody else may have been asking the about the same stuff yet (believe
me, there were already plenty of them).

There are also unofficial comrefs, where you will find even
more informations about commands, based upon experiences
by others.


OK, now to your problem:

First you need to create an array of all units, you want to
monitor, wether they fired or not, and then you need to add
them the mentioned eventhandler. Also you need to initialize
a variable, which you will set to true, once somebody started
firing.

You could do that by placing a trigger:


Size: as big as it covers all those units at the start of the mission.

Activation: anybody present - once

condition: this

onActivation:  shotfired = false; shooters = thislist; {_x AddEventHandler ["fired",{shotfired = true; publicVariable {shotfired}}] forEach shooters


Now you need one more trigger, that will be waiting for the variable, and will remove all eventhandlers from these guys.
This is also the trigger, which you should use to do whatever
you wanted to do, once they started firing:


Size: 0/0

Activation: none - once

condition: shotfired

onActivation: {_x removeAlleventhandlers "fired"} forEach shooters; hint "oh no the box of Pandora has been opened"

:note - the second command (the hint message) in the onActivation field represents what you want to do there - just exchange it by whatever you.

That's it  :)

~S~ CD
« Last Edit: 03 Feb 2004, 15:50:32 by Chris Death »
Dont argue with idiots....they will bring you down to their level and beat you there with experience.

How to use Waypoint type Scripted

CptBravo

  • Guest
Re:Anyone out there?????? :)
« Reply #17 on: 03 Feb 2004, 23:30:06 »
Thanks Chris for the help. It works now!
Only question is .. well I am trying to get each group leader to report firing "seperatly" "every time" he fires. So I am assuming I'll do 20 trigs for the 10 groups. Now how do you make the trig report only that specific group instead of Anybody or West side?

Thanks

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Re:Anyone out there?????? :)
« Reply #18 on: 04 Feb 2004, 16:00:31 »
Well Captain Crunch, looks like you can't get enough  ;D

As you could see, that thingy about detecting the first few
shots wasn't really that complicated to be solved.

What you want to do now, won't be easy, and to be honest
it will require using scripts aswell.

Also it will require more variables than only one.

If you want to go further now, let me know - but as i already
said: it might happen that the solution will not fit onto only
one single A4 page.

The need for scripts here comes from the fact that you need
to avoid getting a message for each single shot, or your
screen in OFP will be filled with a lot of messages.

Also using a lot of triggers may cause your game to slow down
a little bit.

As i said: let me know if you want to go further, but don't
expect this to be solved after 5 minutes of work.

~S~ CD
Dont argue with idiots....they will bring you down to their level and beat you there with experience.

How to use Waypoint type Scripted

CptBravo

  • Guest
Re:Anyone out there?????? :)
« Reply #19 on: 04 Feb 2004, 19:03:01 »
Captain Crunch??????????? Care to explain? lol

Anyway this looks to be a bit more complicated than I thought and I hate complications!! :)

And honestly the one thing I hate more is LAAAAG and with 10-15 groups it will cause a bit of lag I think.

I wonder is there an easyway around it to know when a groupd at least spots an enemy or something so as a commander you get some sort of feed back from your different groups.

Anyway thanks for the help.

CAPTAIN BRAVO (Crunch Free!)  ;)

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Re:Anyone out there?????? :)
« Reply #20 on: 05 Feb 2004, 03:49:24 »
 :o off course you're Captain Bravo - soz - been answering
summit for Captain Crunch also somewhere, so i've mixed
that part a bit then  ;D

Yeah, as i said: it's possible, even without lag, but also it's
gonna be complicated then. It will not work by just simply
duplicating a trigger, as you want that to be seperately happen
for each group and it's leader.

~S~ CD
Dont argue with idiots....they will bring you down to their level and beat you there with experience.

How to use Waypoint type Scripted

CptBravo

  • Guest
Re:Anyone out there?????? :)
« Reply #21 on: 05 Feb 2004, 16:10:11 »
Hi Chris,

It would have been been nice to have it but not crucial to the mission design. Maybe there is another way to get reprots back from groups..

Anyway how is your MOTAG going? Almost finished??! Is it going to be more than 2 players compatible?

Also did you get a chance to look at the tamplate I sent you? Anyway you can show me how to make it 2 players compatible?

Thanks again.