Home   Help Search Login Register  

Author Topic: ECP scripts  (Read 1673 times)

0 Members and 1 Guest are viewing this topic.

Ball Zack

  • Guest
ECP scripts
« on: 15 Nov 2003, 05:25:45 »
I have a question about the new ECP OFP enhancement pack.  I noticed that ECP works with all of the official addons and some of my unofficial addons.  For example the Dragonfly now has dust at low altitude, but other unofficial addons don't have the new dust script.  Why is this?  Also is it possible to rewrite the ECP script so that it will be activated by any vehicle that is of a certain class?  This way it may be possible to make it work for all addons.  For example if you made the dust script activated by all vehicles that are classed as helicopters, it should work for unofficial addons as well.  Likewise if the blood script was activated by all classes of people (east west res, civ), then even unofficial addons should work with the blood script.  Or people who create new addons could just include these features automatically with their addons negating the need for rewriting the ECP script.  For example new soldier addons could be released with their own built in blood script.

Offline Killswitch

  • Members
  • *
  • Peace, cheese and ArmA
Re:ECP scripts
« Reply #1 on: 15 Nov 2003, 08:20:59 »
ECP works its magic by defining event handlers in the base class "AllVehicles" that all vehicles and units are "descendants" of.

However, BIS, for reasons unknown but that defy sanity, made it so that the only way to add event handlers to a vehicle means that any class EventHandlers in classes above it (ECP:s EH:s in AllVehicles, for example) will be lost.  :noo:

This means that a lot of addons will lose the ECP features, just as you have noticed.

Unless BIS gives us a method/syntax for the config.cpp to add/modify, not just replace the set of EH:s already defined, this is how things will remain. I can only hope they do a serious re-work of that system for  OFP2, because right now, its rather lacking, to say the least.


« Last Edit: 15 Nov 2003, 08:32:24 by Killswitch »

Ball Zack

  • Guest
Re:ECP scripts
« Reply #2 on: 16 Nov 2003, 10:13:50 »
Well that sucks...  It seems that the only alternative is that anyone who creates a new addon should include these features (blood splatter for troops, and dust script for choppers) into the code.  As for the addons that are already out, is it possible to add these into the list of vehicles that ECP recognises?

Offline snYpir

  • BIS Team
  • ****
  • OFPEC Jedi Master
    • OFPEC
Re:ECP scripts
« Reply #3 on: 18 Nov 2003, 04:09:26 »
I have a solution, well - sort of. In the latest ECP version (to be released later this week) I define a superclass ECP_EventHandlers.

Then in addons, people need to do the following:

Code: [Select]
class ECP_EventHandlers {};

class cfgVehicles
{
      class MyVehicle
      {
              class EventHandlers : ECP_EventHanders
              {
                     hit = "hint {ouch!}";
              }
       }
}

The MyVehicle class would automatically have the ECP fired and killed eventhandlers, but because the hit eventhanlder has been redefined blood won't be enabled for this new unit.

Unfortunately only one EH of each type can be defined per unit.

The above fix will work with or without the ECP being present (there will be no change to the way the addon works).

And why do we hardcode the EHs I hear you ask? Why not just use AddEventHandler? Because AddEventHandler causes HUGE problems when loading a saved mission.
Bohemia Interactive Simulations

Offline Dinger

  • Contributing Member
  • **
  • where's the ultra-theoretical mega-scripting forum
Re:ECP scripts
« Reply #4 on: 19 Nov 2003, 06:31:15 »
Hi snYpir.  Good to hear from you again.
Just out of curiosity, what problems does a scripted EH have that a .cpp EH doesn't?
When I was testing .cpp EHs, "Killed" were still translating into "Fired" after a savegame.  I assume this will be fixed in the next patch though.


Hmmm... you know through ECP, you could enable child class- and type-based EHs.
I assume that you have a master ECP init script somewhere (perhaps called by an init EH, if it isn't already running).

To that you could add a series of initialization lines:

if (format ["%1", ECPClassFiredHandlers] == "scalar bool array ... ") then {ECPClassFiredhandlers = []}

if (format ["%1", ECPTypeFiredHandlers] == "scalar bool array ... ") then {ECPTypeFiredhandlers = []}

...

Then in the one master EH for each type or class, you could have something like:
;FiredEH
_unit = _this select 0
_type = _typeof _unit
{if ([_unit] counttype (_x select 0)) then {_this call (_x select 1)}} ForEach ECPClassFiredHandlers
{if (_type == (_x select 0)) then {_this call (_x select 1)}} ForEach ECPTypeFiredHandlers


Then if I wanted to add some effect to all Air units, or to say all SoldierWBs, I could do it.  Heck, you could even handle default effects this way.

But I'm sure you guys have your hands full ;)
Dinger/Cfit

Offline Killswitch

  • Members
  • *
  • Peace, cheese and ArmA
Re:ECP scripts
« Reply #5 on: 19 Nov 2003, 13:39:58 »
The problem with event handlers and savegames is outlined here:
Bug: event handlers broken after reload/resume and is fixed in 1.94, at least for addEventHandler added EH:s.

« Last Edit: 19 Nov 2003, 15:26:13 by Killswitch »

Offline Dinger

  • Contributing Member
  • **
  • where's the ultra-theoretical mega-scripting forum
Re:ECP scripts
« Reply #6 on: 19 Nov 2003, 18:32:59 »
My understanding of the exact nature of the problem seems to differ from yours slightly.  For example, I had init and killed cpp EHs on a unit, and after a save, the killed EH became a fired.  Yet units with Init and Fired EHs worked fine (and work fine) after saves.
In any case, that's an academic discussion, since it boils down to: EHs don't work right after saves in 1.91.  In 1.94 it will be fixed.
Still I like academic discussions :)
Dinger/Cfit

Offline Killswitch

  • Members
  • *
  • Peace, cheese and ArmA
Re:ECP scripts
« Reply #7 on: 19 Nov 2003, 21:46:48 »
My understanding of the exact nature of the problem seems to differ from yours slightly.  For example, I had init and killed cpp EHs on a unit, and after a save, the killed EH became a fired.  Yet units with Init and Fired EHs worked fine (and work fine) after saves.
In any case, that's an academic discussion, since it boils down to: EHs don't work right after saves in 1.91.  In 1.94 it will be fixed.
Still I like academic discussions :)
Too few academic disscussions around here, so lets get started, shall we ;D

By "the killed EH became a fired" do you mean "the killed EH was called with the parameters for a fired EH" as soon as the unit fired after a reload? If so, then that is the symptom I saw and tried to describe in the posting referenced.  If not,  I'd be interested in more details.

Ball Zack

  • Guest
Re:ECP scripts
« Reply #8 on: 21 Nov 2003, 07:06:48 »
A few suggestions for next generation ECP versions:

1).  Engine start up sounds for vehicles and aircraft.

2). Above ground craters (different sizes for bigger/smaller explosions) spawned where an explosion occurs.

3). Engine failure alarm when aircraft lose engine power (like the DKM Commanche).

4). Shock waves from explosions.

Thats all I can think of for now....

Ball Zack

  • Guest
Re:ECP scripts
« Reply #9 on: 26 Nov 2003, 20:54:39 »
A few more ideas:

1) stall warning sound for aircraft (when airspeed is low).

2) automatic countermeasures (flares) from aircraft (except civilian)  when AA missiles are launched within 1km of an aircraft.
The flares could be just for looks they don't really have to spoof missiles (OFP missiles suck so they will probably miss anyway).

3) Audible lock-on tone when you have a missile lock with Stinger, SA-9, Maverick, AT-6.

TJ

  • Guest
Re:ECP scripts
« Reply #10 on: 02 Dec 2003, 03:20:40 »
A few more ideas:

1) stall warning sound for aircraft (when airspeed is low).

2) automatic countermeasures (flares) from aircraft (except civilian)  when AA missiles are launched within 1km of an aircraft.
The flares could be just for looks they don't really have to spoof missiles (OFP missiles suck so they will probably miss anyway).

3) Audible lock-on tone when you have a missile lock with Stinger, SA-9, Maverick, AT-6.

As you many know I scripted many of the effects you describe for various BAS choppers.
These things differ greatly in personal preference and taste, but be assured we will add as much as we can to ake OFP more realistic,

Cheers
TJ
BAS
ECP team