Feature #2915

Init events available in missions

Added by Spooner almost 8 years ago. Updated over 7 years ago.

Status:Closed Start date:07/19/2009
Priority:Normal Due date:
Assignee:killswitch % Done:


Target version:v0.2.0 Estimated time:2.00 hours
Component: Affected Version:
Close Reason:


Although XEH allows config-based init events for other addons, mission-makers and mission-scripters do not have access to such an event. One or both of these options will allow mission-makers to take advantage of init

Option 1: Custom events

"CBA_initVehicle" (AllVehicles except Man)
"CBA_initUnit" (CaManBase)
"CBA_initAnimal" (CaAnimalBase)

This is a bit more complex, since the user would have to first use 1 allUnits or 1 vehicles to see what objects had already been created, then add the general handler to be informed of future object creation. Also can't find already existing animals, so again a little limited.

We don't need to add custom events for all other types of event, since once you get the init, it is easy enough to add the other scripted event handlers.

Option 2: Mission XEH

Allow XEH events to be added to description.ext (1 missionConfigFile) as well as addon config.cpp (1 configFile). This has the advantage of also opening up every other XEH event to mission-makers.

Associated revisions

Revision c023722b
Added by killswitch over 7 years ago

~ADDED: one can now define per-campaign and per-mission extended event handlers in the description.ext file. Resolves: 2915

Revision 0e4570f0
Added by killswitch over 7 years ago

ADDED: the PreInit/PostInit/InitPost handlers are now available to mission makers through the mission and/or campaign description.ext file. Refs: 2915

Revision f4192ab1
Added by killswitch over 7 years ago

CHANGED: read PostInit's from mission, campaign and addon configs. Refs: 2915

Revision fd151f81
Added by killswitch over 7 years ago

FIXED: do it the other way around - process the mission config XEH:s last. Refs: 2915.


Updated by Sickboy almost 8 years ago

  • Assignee changed from Sickboy to killswitch

Option 2 has my vote definately!

Updated by killswitch almost 8 years ago

Agree, #2 looks like a good way to go about this.

Updated by killswitch almost 8 years ago

  • Category set to XEH

Set category.

Updated by killswitch over 7 years ago

  • Status changed from Feedback to Assigned
  • Target version set to v0.3.x
  • % Done changed from 0 to 50
  • Estimated time set to 2.00

Updated by Sickboy over 7 years ago

I like the addition of missionConfig, altough personally I will never use it (addon-whore).
The custom events option is something people can accomplish themselves and should not belong in our core features I believe.

Updated by killswitch over 7 years ago

  • Status changed from Assigned to Resolved
  • Target version changed from v0.3.x to v0.2.0
  • % Done changed from 50 to 100

Updated by killswitch over 7 years ago

I've added the option 2 feature to XEH now. This enables mission makers to define extended event handlers on a per-mission or per-campaign basis
by adding normal XEH event classes to the mission or campaign description.ext file.

As an example, if you have this in a mission's description.ext, a normal USMC rifleman will spit out something every time he fires his rifle:
1 class Extended_Fired_EventHandlers 2 { 3 class USMC_Soldier 4 { 5 kls_test_fired="(_this select 0)sideChat str(_this)"; 6 }; 7 };
Works just fine :-)

Updated by killswitch over 7 years ago

  • Status changed from Resolved to Closed

The extended fired event above works fine in a mission description.ext, as does this XEH init event handler example:
1 class Extended_Init_EventHandlers 2 { 3 class USMC_Soldier 4 { 5 class kls_usmc_init 6 { 7 init="(_this select 0)setVariable['pi',3.14]"; 8 }; 9 }; 10 };

Updated by killswitch over 7 years ago

Let's not forget the PreInit, PostInit and InitPost trio. This works in a mission's _description.ext:
1 class Extended_PreInit_EventHandlers 2 { 3 kls_mission_preinit="if(isNil'kls_pre')then{kls_pre=0};kls_pre=kls_pre+1"; 4 }; 5 class Extended_PostInit_EventHandlers 6 { 7 kls_mission_postinit="if(isNil'kls_post')then{kls_post=0};kls_post=kls_post+1"; 8 }; 9 class Extended_InitPost_EventHandlers 10 { 11 class USMC_Soldier 12 { 13 kls_mission_initpost="if(isNil'kls_initpost')then{kls_initpost=0};kls_initpost=kls_initpost+1"; 14 }; 15 };

Also available in: Atom PDF