Jump to content

GRAW SP Scripting 7


GRIN_Wolfsong
 Share

Recommended Posts

Of course you can set up multiple different conditions to trigger an event in GR:AW.

Note: What you can't do is use NOT, as in is something hasn't yet happened. But this can be solved with some ugly scripting if it's absolutly needed.

AND & OR Conditioned Triggers

AND Condition:

It's easy to create AND conditioned triggers in GR:AW, as I showed in Scripting 3 you can just stack conditions, but I'll include that here as well.

Example: You want "tank01" AND "tank02" to be destroyed AND have "vip" in "helicopter_01" as a trigger condition for the "objective1_completed" event to run.

<!--Condition 1, 2 AND 3-->

<user name="tanks_gone_and_vip_out" type="once">

<trigger type="Vehicle">

<vehicle id="tank01"/>

<vehicle id="tank02"/>

</trigger>

<trigger type="TeamInTransport" vehicle_id="helicopter_01" group_id="vip"/>

<event name="objective1_completed"/>

</user>

<!--Event To Run-->

<event name="objective1_completed">

<element type=".....

<element type=".....

</event>

OR Condition:

To make an OR conditioned trigger there is a little more work, but it's still very simple. All you need is 1 trigger for each OR condition and set the event they trigger to only run once.

Example: You want "tank01" OR "tank02" to be destroyed OR have "vip" in "helicopter_01" as a trigger condition for the "objective1_completed" event to run.

<!--Condition 1-->

<user name="tank1_gone" type="once">

<trigger type="Vehicle">

<vehicle id="tank01"/>

</trigger>

<event name="objective1_completed"/>

</user>

<!--OR Condition 2-->

<user name="tank2_gone" type="once">

<trigger type="Vehicle">

<vehicle id="tank02"/>

</trigger>

<event name="objective1_completed"/>

</user>

<!--OR Condition 3-->

<user name="vip_out" type="once">

<trigger type="TeamInTransport" vehicle_id="helicopter_01" group_id="vip"/>

<event name="objective1_completed"/>

</user>

<!--Event To Run-->

<event name="objective1_completed" once="true">

<element type=".....

<element type=".....

</event>

Note: The important part, as I wrote above, is to add the once="true" part in the event declaration so that it only can be used once everytime the mission is run. When the first condition is triggered it will will the event. The other two will still trigger when they occur, but as the event can only run once, nothing else will happen.

AND OR Condition:

Of course you see how to combine these, but I'll write an example on this anyhow.

Example: You want "tank01" to be destroyed AND have "vip" in "helicopter_01" OR you want "tank02" to be destroyed to be the trigger condition for the "objective1_completed" event to run.

<!--Condition 1 & 2-->

<user name="tank1_gone_and_vip_out" type="once">

<trigger type="Vehicle">

<vehicle id="tank01"/>

</trigger>

<trigger type="TeamInTransport" vehicle_id="helicopter_01" group_id="vip"/>

<event name="objective1_completed"/>

</user>

<!--OR Condition 2-->

<user name="tank2_gone" type="once">

<trigger type="Vehicle">

<vehicle id="tank02"/>

</trigger>

<event name="objective1_completed"/>

</user>

<!--Event To Run-->

<event name="objective1_completed" once="true">

<element type=".....

<element type=".....

</event>

Simple as that. Enjoy.

Link to comment
Share on other sites

  • 8 months later...

Hi, I have a problem. I want to trigger an event by killing 3 groups, but nothing works :wall:

I tried these scripts:

1) <area_group name="area1" area_name="area1" group="mp_players" interval="0.3" condition="1"/>

<user name="user" type="once">

<trigger type="UnitInArea" area="area1"/>

<event name="event1"/>

</user>

<user name="killed" type="once">

<trigger type="EnemyGroup" name="1">

<enemy group_id="1" condition="all"/>

</trigger>

<trigger type="EnemyGroup" name="2">

<enemy group_id="2" condition="all"/>

</trigger>

<trigger type="EnemyGroup" name="3">

<enemy group_id="3" condition="all"/>

</trigger>

<event name="activate_killed"/>

</user>

<event name="start_game">

<element type="UnitInArea" area="area1" state="activate" start_time="0.1"></element>

</event>

<event name="event1">

<element type="ActivateGroup" group_id="1" start_time="2"/>

<element type="ActivateGroup" group_id="2" start_time="2"/>

<element type="ActivateGroup" group_id="3" start_time="2"/>

</event>

<event name="activate_killed">

<element type="ActivateVehicle" group_id="car" start_time="0"/>

</event>

In this case nothing works, no triggering action. but this script is written in the first mission but not used (<!-- ...-->)

Then I tried this:

2)

....

<user name="killed" type="once">

<trigger type="EnemyGroup" name="1">

<enemy group_id="1" condition="all"/>

<enemy group_id="2" condition="all"/>

<enemy group_id="3" condition="all"/>

</trigger>

<event name="activate_killed"/>

</user>

....

In this case the event triggers but already when team 1 is killed, the others are irrelevant... :wacko:

What I do wrong???

Link to comment
Share on other sites

It should work like this:

<user name="killed" type="once">

<trigger type="EnemyGroup" name="abc">

<enemy group_id="group_01" condition="all"/>

<enemy group_id="group_02" condition="all"/>

<enemy group_id="group_03" condition="all"/>

</trigger>

<event name="activate_killed"/>

</user>

I'm a bit rusty on GRAW1 scripting as I didn't really deal with it long. After I had written the guide I was taken in by Grin to work on GRAW2 and the condition system is totally rewritten now to make more sense and be easier to use.

Link to comment
Share on other sites

It should work like this:

<user name="killed" type="once">

<trigger type="EnemyGroup" name="abc">

<enemy group_id="group_01" condition="all"/>

<enemy group_id="group_02" condition="all"/>

<enemy group_id="group_03" condition="all"/>

</trigger>

<event name="activate_killed"/>

</user>

I'm a bit rusty on GRAW1 scripting as I didn't really deal with it long. After I had written the guide I was taken in by Grin to work on GRAW2 and the condition system is totally rewritten now to make more sense and be easier to use.

Yes, i think thats the right scripting, but the problem was: the groups together should not be more than 8 bots !!! :hmm: however....

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...