Author Topic: Specialtarget Triggers  (Read 1451 times)

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Specialtarget Triggers
« on: January 02, 2008, 02:51:49 AM »
I updated my copy of Outpost2DLL\Functions.h slightly.

Code: [Select]
OP2 class Trigger __fastcall CreateSpecialTarget(int boolEnable, int boolNoRepeat, class Unit & specialTarget /* Lab */, enum map_id sourceUnitType /* mapScout */, char const *triggerFunction);
OP2 void __fastcall GetSpecialTargetData(class Trigger & specialTargetTrigger, class Unit & sourceUnit /* Scout */);


You create the SpecialTarget trigger much like any other trigger. The Unit is the target that may need to be scanned, or otherwise moved next to, such as a Lab or Command Center. The map_id is the type of unit that activates this trigger when it is brough next to the specified unit.

When the trigger is fired, you can find out which unit caused it to activate by calling GetSpecialTargetData. It will return the unit that approached the target unit and thus activated the trigger, such as a scout or evacuation transport. (So if you had multiple units of the same type (scouts, evacuation transports, etc.), it'll tell you which one was responsible for activating the trigger).
 

Offline Sirbomber

  • Hero Member
  • *****
  • Posts: 3238
Specialtarget Triggers
« Reply #1 on: January 02, 2008, 08:11:56 AM »
Good job Hooman.
Now excuse me while I use your hard work to bring untold pain and suffering to New Terra.

Edit: It works just fine.
« Last Edit: January 02, 2008, 08:58:44 AM by Sirbomber »
"As usual, colonist opinion is split between those who think the plague is a good idea, and those who are dying from it." - Outpost Evening Star

Outpost 2 Coding 101 Tutorials

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Specialtarget Triggers
« Reply #2 on: January 02, 2008, 04:14:49 PM »
Well, I would hope so. I noticed it was used in p12.dll.