Home   Help Search Login Register  

Author Topic: Detecting trigger activator  (Read 854 times)

0 Members and 1 Guest are viewing this topic.

sans-pareil

  • Guest
Detecting trigger activator
« on: 23 Dec 2002, 15:13:01 »
Hello everyone, I'm fairly new here and have been fiddling with some scripts. My current projects are making targetted artillery, and a creeping barrage script.

In both cases, I need a way to detect who activated a certain trigger. I know there must be someway to do this (with the list-thingy command maybe?), and I would appreciate some help with this.

Thankyou, Sans-pareil

mpbm

  • Guest
Re:Detecting trigger activator
« Reply #1 on: 23 Dec 2002, 21:46:02 »
Hi, iÂ'm new but could be something like:

anything=getnearestobject   ???

sans-pareil

  • Guest
Re:Detecting trigger activator
« Reply #2 on: 23 Dec 2002, 21:54:10 »
Interesting... kind of run the risk that my artillery trigger starts shooting at guys from the wrong side I think... I wonder if there is some way to specify... find the closest West unit or something. Hmmm....

Plus, ofcourse, in the case of the creeping barrage, which will be radio-activated, the caller may be nowhere near the trigger...

But it's certainly food for thought in the right direction. If I can list all units nearby and filter out it would certainly work for targetted artillery scripts.

mpbm

  • Guest
Re:Detecting trigger activator
« Reply #3 on: 23 Dec 2002, 23:59:56 »
Forget my first post!  There is no "getnearestobject".

What we got is:

"   nearestObject pos
Operand types:
    pos: Array
Type of returned value:
    Object
Description:
    Nearest building of given type to given position or object. pos may be [x,y,z, "type"] or [object, "type"].

Example:
    nearestObject [player, "StreetLamp"]      "


Offline uiox

  • Contributing Member
  • **
Re:Detecting trigger activator
« Reply #4 on: 24 Dec 2002, 13:22:44 »
From BIS ComRef:

Quote
Triggers
    Condition expression is used to determine when the trigger is activated. Boolean variable this is set during evaluation of condition expression to primary sensor activation condition. Array variable thisList is set to list of all vehicles that would satisfy primary sensor activation condition. Condition must return boolean value.
    On Activation and On Deactivation expressions define action that is peformed when trigger condition changes to true or false. Expression must either be an assignment or return nothing (see type none).
    Variable denoting trigger can be created by filling in name field.

And for count

Quote
unit countEnemy array
Operand types:
    unit: Object
    array: Array
Type of returned value:
    Number
Description:
    Count how many units from the array are considered enemy by unit.

Example:
    player countEnemy list triggerOne

So you create a trigger for detect and other for condition

In condition field : (player counEnemy list triggerDetect) != 0

sans-pareil

  • Guest
Re:Detecting trigger activator
« Reply #5 on: 24 Dec 2002, 13:32:11 »
Cool guys,

With these two bits I ought to be able to make an on activation command that will send the position of the nearest (if perhaps not the exact triggering) enemy to my artillery script so they get targetted artillery fire on their heads.

For my creeping barrage I think I am going to have to work with named units I think. It would be nice If I couls impyl detect which exact unit made the radio call, but I suppose it's just going to have to be done with names.