Jump to content
Sign in to follow this  
Eddie Haskel

Creating a group (using a trigger)

Recommended Posts

I've been able to set a trigger to create a unit using a game logic (as per instructions in the great Mission Editing FAQ). A single person, unreachable, using a game logic, etc. etc.

What I need to do however, is find a way to create a group. As the mission starts, the units are NOT on the map, but are first formed after a trigger is reached. I'm thinking a script is more appropriate, triggered by a trigger (duh!wink_o.gif. Can Anyone clue me in here please?

The groups would be created for east (first group is named Yankee, 2nd Group Zulu). If possible, could someone point me in the right direction. I'm a NOOB at editing. THNX!!!!

Eddie

Share this post


Link to post
Share on other sites

You can't create a whole new group: a newly created unit MUST join an existing group or will not be created!

However you can place a unit far from where you want to create the rest of the group and then make the first unit you're going to create to join grpnull and then make the following units to join him.

Rough example:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

"SoldierWB" createUnit [getMarkerPos "marker_1", groupAlpha, "loon1 = this; this addweapon {binocular}", 0.6, "sergeant"]

~0.1

[Loon1] join grpnull

NewgroupOne = group loon1

NewgroupOne setgroupid ["Yankee","Groupcolor0"]

~0.1

"SoldierWB" createUnit [getMarkerPos "marker_1", Newgroup, "loon2 = this;", 0.6, "private"]

~0.1

"SoldierWB" createUnit [getMarkerPos "marker_1", Newgroup, "loon3 = this;", 0.4, "private"]

~0.1

.....and so on

Hope this help

Klavan

Share this post


Link to post
Share on other sites
You can't create a whole new group: a newly created unit MUST join an existing group or will not be created!

However you can place a unit far from where you want to create the rest of the group and then make the first unit you're going to create to join grpnull and then make the following units to join him.

Rough example:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

"SoldierWB" createUnit [getMarkerPos "marker_1", groupAlpha, "loon1 = this; this addweapon {binocular}", 0.6, "sergeant"]

~0.1

[Loon1] join grpnull

NewgroupOne = group loon1

NewgroupOne setgroupid ["Yankee","Groupcolor0"]

~0.1

"SoldierWB" createUnit [getMarkerPos "marker_1", Newgroup, "loon2 = this;", 0.6, "private"]

~0.1

"SoldierWB" createUnit [getMarkerPos "marker_1", Newgroup, "loon3 = this;", 0.4, "private"]

~0.1

.....and so on

Hope this help

Klavan

ok, lemme see if i get this right.

SoldierWB is the unit/vehicle Id. Check!

getMarkerPos "marker_1" is where unit will be created! Check!

groupAlpha is the Group name that was made when you made the unit far from where you want to create the rest. Alpha=Group This in the INIT of that man. Check!

Loon1, Loon2, and Loon3 are going to be the newly created units. Check!

The grpnull I DON'T understand, as I haven't created any group called null, but will take your word for it as I saw something before about a grpnull (It's like a "wayover station" between Alpha and NewGroupOne maybe?)

~0.1 is the pause between creating the units. Check!

0.4, 0.6 and the ranks are the skill level and ranks. Check!

setgroupID ["Yankee", "Groupcolor0"] is new to me. The group color I know, but not group ID Yankee. The radio callsigns don't go that high if I remember right. And I think I could replace the getMarkerPos with a game logic.

If you could let me know how I did, I would appreciate it. If this all checks I will add this to the editing FAQ. Thnx klavan!

Eddie

Share this post


Link to post
Share on other sites

The line

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

[Loon1] join grpnull

Means that Loon1 leaves the group called groupAlpha, thus becoming ready to be the leader of a new group. Groupnull means no group.

Follows the list (i'm quite sure they're all here) of the availables group names in OFP

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

ALPHA

BRAVO

CHARLIE

DELTA

ECHO

FOXTROT

GOLF

HOTEL

NOVEMBER

KILO

YANKEE

ZULU

BUFFALO

TWO

THREE

GUARDIAN

CONVOY

About the last question try this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

"SoldierWB" createUnit [getPos gamelogicname, groupAlpha, "loon1 = this; this addweapon {binocular}", 0.6, "sergeant"]

Hope this help

Klavan

Share this post


Link to post
Share on other sites

Got it! And tried it out!

1) create Game Logic, name it: ENFORCE. Place it in the area where the units should appear.

2) create 1 man, on an unreachable part of the map

In his INIT add: Zulu=Group This

3) create a trigger, activated from West (in my case), and put in the On Activation line: this exec "ZRE.sqs" (This is the sqs file I made!wink_o.gif

The ZRE.sqs file looks like this:

; My first attempt at creating a scripting, so anything is possible.

; BIS, Codemasters and myself are NOT responsible is your computer does an

; this setdammage 1 on you!

"z_priest1" createUnit [getPos ENFORCE, Zulu,"Z3=this"]

~0.1

[Z3] join grpnull

Kilo = group Z3

Kilo setgroupid ["Whiskey","Groupcolor0"]

~0.1

"basezman" createUnit [getPos ENFORCE, Kilo,"Z4=this"]

~0.1

"z_Girl" createUnit [getPos ENFORCE, Kilo,"Z5=this"]

~0.1

"z_executive" createUnit [getPos ENFORCE, Kilo,"Z6=this"]

~0.1

"z_worker" createUnit [getPos ENFORCE, Kilo,"Z7=this"]

~0.1

"z_Farmer" createUnit [getPos ENFORCE, Kilo,"Z8=this"]

~0.1

"z_Security" createUnit [getPos ENFORCE, Kilo,"Z9=this"]

~0.1

"z_worker" createUnit [getPos ENFORCE, Kilo,"Z10=this"]

~0.1

"z_Farmer" createUnit [getPos ENFORCE, Kilo,"Z11=this"]

~0.1

"z_newman" createUnit [getPos ENFORCE, Kilo,"Z12=this"]

~0.1

Exit

note, no " " around ENFORCE, and I dropped the skill, weapons and rank as these are zombies!

Thnx again for the help!!

Eddie

Share this post


Link to post
Share on other sites

Since they're zombies and it's not supposed they can use a radio it's all OK, but for future pourpouse take in mind that you can name a group as you like (eg: abracadabra = group this).

The group's name list i've posted above is intended to be used with setgroupid command only. If you want your units to appears as Guardian when it says someting on the radio channels you have to type:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

Abracadabra = group Z3

Abracadabra setgroupid ["Guardian","Groupcolor0"]

You can change Guardian with one of the names listed above, but only with 'em.

In your case Whiskey wouldn't works as a radio ID for your group.

Klavan

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×