-
12-05-2003, 06:12 PM #1
Scripting Technique - Using Groups
Scripting Technique - Using Groups
After getting used to the basics of Igor scripting, there are many options to explore. One of them is the effective use of groups. Once I discovered this feature, I explored the possibilities.
Groups are basically named script blocks and are disabled by default. They are created by going to Tags... where you create variables or in a script block at the top of the dialog. There are responses that can be used in script blocks to enable and disable groups. Groups allow you to use the QueueCall response to a specified group. This is not where the power of groups lie. They can be used in much better ways such as enabling and disabling them. In this example, is one way of using groups for an interesting method of extracting Intel during a mission.
The goal is to allow the player to pick up the Intel at a certain location and have that specific player bring it to another location. We want to track who has the Intel and allow for other players to pick it up if the Intel carrier dies. By using groups, we can implement the checks required to see who has the Intel and whether to allow players to take the Intel from the body. We use ActorRef variables to keep track of the Intel carrier and the dead player carrying the Intel.
The first group is simple: it allows the player to get the Intel from the specified location. Note the bolded response that enables another group. This will allow the Intel Carrier Death Check responses to run if the event is triggered. We set the IntelCarrier variable to the player actor that is closest to the Intel location.
Another simple group that checks if the player carrying the Intel is at Extraction. We disable the Intel Carrier Death Check group because the objective is complete and it does not matter if the player dies.Group: Intel Objective Check
Comment:
Trigger Event:
A member of PlayerPlatoon is within 0 meter(s) of Intel Location.
Responses:
Display ((The owner of (The actor nearest Intel Location)) + " has the intel.") to all players for 5 second(s).
Set IntelCarrier to (The actor nearest Intel Location).
Enable the Intel Carrier Death Check script blocks.
Prevent this block from being reactivated.
Our first named group. It is triggered by the death of the IntelCarrier. The wonderful part of using groups is it does not require much scripting to do the job. The first response will disable its own group and the second will enable the check to allow players to retrieve the Intel from the dead body. Neat, huh? Of course, we need to set the DeadCarrier variable to the IntelCarrier so we know who to check is near the dead body.Group: <Default>
Comment:
Intel at extraction check
Trigger Event:
IntelCarrier is within 0 meter(s) of Extraction.
Responses:
Mark Objective 2 complete in the objective list.
Decrement Counter - Objectives Left.
Disable the Intel Carrier Death Check script blocks.
Prevent this block from being reactivated.
Our second named group. It is triggered by a player coming near the location of the dead Intel carrier. This block can only run if the IntelCarrier has died in the first place. Once this block has run, we can disable this group and enable the Intel Carrier Death Check again. This sets the groups up so they enable and disable each other, allowing players to grab the Intel of each other's dead bodies until they all die.Group: Intel Carrier Death Check
Comment:
Trigger Event:
IntelCarrier has been killed.
Responses:
Disable the Intel Carrier Death Check script blocks.
Enable the Gather Intel from Carrier Check script blocks.
Display ((The owner of IntelCarrier) + " has died. Retrieve intel from the body.") to all players for 5 second(s).
Allow this block to be reactivated.
Set DeadCarrier to IntelCarrier.
Using groups is a powerful feature of Igor scripting. It allows for recursive scripting, as shown here, meaning groups can enable and disable each other like a loop. A perfect way of handling dynamic situations such as the death of our Intel carrier. This can be advantageous over the QueueCall response because you can allow the script block to use a trigger event. Use your imagination and you may find other methods of utilizing the group feature.Group: Gather Intel from Carrier Check
Comment:
Trigger Event:
A member of PlayerPlatoon is within 2.5 meter(s) of DeadCarrier.
Responses:
Disable the Gather Intel from Carrier Check script blocks.
Display "Intel recovered!" to all players for 3 second(s).
Set IntelCarrier to (The actor nearest DeadCarrier).
Enable the Intel Carrier Death Check script blocks.
Allow this block to be reactivated.Last edited by =Sarc=; 05-05-2004 at 04:15 PM.
-
12-07-2003, 01:32 PM #2
- Join Date
- May 2003
- Posts
- 1,353
one quick question sarc.
In the last section (Gather Intel from Carrier Check), is there a reason that you disable the block that is running before moving the intelcarrier?
I'm sure this works fine, just trying to understand the sequence.
Would it work if the disable statement was the last one in the block?
-
12-07-2003, 03:13 PM #3
It has to disable itself because of the block reactivate response. If left running, the intel will be passed to the next player that passes by the dead body when the intel has already been picked up. Also, without the block reactivate response the block can't be executed again if the next intel carrier is killed.
-
12-08-2003, 09:31 AM #4
- Join Date
- May 2003
- Location
- DuBois, PA
- Age
- 46
- Posts
- 586
I made a stab of this with the help of Jack57 in my first mission. It worked but only one time. Seems you've ironed it all perfectly Sarc..Nice Job.
I began to use blocks ALOT in my scripting...not only powerful but also a nice way to organize your mission scripting and reduce processing power and hopefully lag? as you only have the needed blocks running when you need them and you can disable them as the mission progresses.
Am I correct in my assumption that this scripting method reduces lag?
-
12-08-2003, 12:12 PM #5
I honestly don't know the effects of script blocks that require intensive processing. I try to keep it to a minimum though and these script blocks do deactivate themselves to reduce processing. Some say that using proximity triggers are constant polls and does increase processing but I've never tested if it makes a difference.
-
12-10-2003, 07:02 PM #6
- Join Date
- Jun 2003
- Posts
- 19
A brilliant group tutorial.
-
12-10-2003, 07:07 PM #7
It should be! I got the idea from an Alpha mission.
-
12-11-2003, 06:29 AM #8
- Join Date
- Jun 2003
- Posts
- 19
I Know - Used that in SSL2003 week1 "Farm Infiltration".
Originally Posted by =Sarc=
It's a nice touche instead of having anyone just walking the evidence into the EZ. Have some more inputs for you in SR2004 mission1 wich is the current one I'm working on
Keep it up.
Using groups are a very good way of scripting tasks that would have turned rather complex an disorganiced if the group options wasn't available.
-
12-14-2003, 12:55 PM #9
- Join Date
- Dec 2003
- Posts
- 1
Very nice tutorial. Well written and accessible
Thanks.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)



Reply With Quote

Bookmarks