Home   Help Search Login Register  

Author Topic: Config.cpp Eventhandlers and MP  (Read 1025 times)

0 Members and 2 Guests are viewing this topic.

Offline snYpir

  • BIS Team
  • ****
  • OFPEC Jedi Master
    • OFPEC
Config.cpp Eventhandlers and MP
« on: 01 Jun 2003, 13:42:28 »
Myself and a few others are working on the ultimate config.bin mod for OFP, including just about every effect script ever made (and a few that have never been seen) :D

Obviously, in order to implement these effect scripts automatically, for every mission, you need to run a script for every unit in a given mission right at the start via the config.bin file.

I have been doing this via an 'init' eventhandler defined in the 'AllVehicles' class (calling a seperate script).

This looks as follows:

Code: [Select]
class AllVehicles : All
{
     icon="unknown_move";

     class EventHandlers
     {
          init="_this exec {\ECP_Effects\init.sqs}";
     };
};

The problem is that in MP the init eventhandler doesn't fire on clients.

The fuel eventhandler workaround doesn't suffice either, because i need this to work on 'Man' class objects as well that don't have fuel.

I assume that this is some sort of anti-cheat mechanism. It is really screwing me over, though.

Anyone know of a work-around? I need a script to run for every unit, every mission, automatically.

I am all out of ideas :-X
Bohemia Interactive Simulations

Offline rom

  • Members
  • *
  • . . .
Re:Config.cpp Eventhandlers and MP
« Reply #1 on: 01 Jun 2003, 23:00:46 »
What about including CoC network services and then start the script on every client with the client send function in the init EH script?

You could even start the CoC network services with the init EH of a special gamelogic that createUnit another gamelogic and starts the client side part of the network services with the init of the createUnit command.
Using the createUnit command here wouldn't be a problem since you allready have a gamelogic on the server where you can group this second gl to.
I only experienced problems when createUnit a gl into a non gl-group.

So you wouldn't even have to include the CoC network scripts in every mission but just place this special gamelogic.
« Last Edit: 01 Jun 2003, 23:02:19 by rom »

Rubble_Maker

  • Guest
Re:Config.cpp Eventhandlers and MP
« Reply #2 on: 03 Jun 2003, 18:48:57 »
The COCN requires you to call some routines from the init.sqs
As far as I know, the init.sqs is the only script that is guaranteed to run on all clients.


Offline Dinger

  • Contributing Member
  • **
  • where's the ultra-theoretical mega-scripting forum
Re:Config.cpp Eventhandlers and MP
« Reply #3 on: 03 Jun 2003, 19:51:52 »
Last I heard, bn880 was working on an "Addonized" version of CoC_NS that would be entirely self-contained.

I strongly support including CoC_NS in any "standard mod" of the basic game.  For a mission editor, getting info on individual players and to individual players, using publicarrays and the rest are just good things to have.

Okay snYpir, I finally decided to get off my butt and tell you the answer you're looking for:

A) Create a vehicle off of say the M2_Static class (If M2 doesn't work, use a BMP or something), call it CoC_MPWidget or something --
scope = private;
hasgunner = false;
fuel = 10000;

set detectability to zero

eventhandlers:

init = "if ({_x in [_x]} count CoC_MPStart == 0) then {CoC_MPStart = true; (_this select 0) setfuel 0}";
fuel = "if ({_x in [_x]} count CoC_MPStart == 0) then {CoC_MPStart = true; [] exec "Addondirectory\InitClient.sqs";

B) in one of the base classes (or all the mannable base classes if you like, put the following EH:

init = "if ({_x in [_x]} count CoC_MPWidget == 0) then {CoC_MPWidget = "CoC_MPWidget" CreateVehicle [-20000, -20000, 0]; publicvariable "CoC_MPWidget"};

The {_x in [_x]} count   trick should work. if it doesn't, tell me and I'll give you another.
Now come on, you know OFPEC isn't the place for answers to cutting edge stuff like this :P

Dinger/Cfit