OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: 456820 on 07 Mar 2005, 20:47:24

Title: new group
Post by: 456820 on 07 Mar 2005, 20:47:24
i was wondering at what the line of code or 2 would be for once a group has only the player left he joins a new group?
Title: Re:new group
Post by: SilentHunter on 07 Mar 2005, 21:10:32
In a script / trigger put this, what ever floats ya boat.

((count(units group player))<2)
[player] join (group newgroupleader)


where newgroupleader is the new group leader (needed to be said)
Title: Re:new group
Post by: 456820 on 07 Mar 2005, 21:13:55
right i think i get that just alot of brackets so would it be
(count units group1)<2)
[player name] join (group2 newleadername)

and would {alive_x} count units group1 == 1 work as that would check if the group the player is in has one person left wich would obdviously be the player
Title: Re:new group
Post by: Garcia on 07 Mar 2005, 21:26:52
not (count units group1)<2)

but

((count(units group player))<2)
Title: Re:new group
Post by: 456820 on 07 Mar 2005, 21:59:21
thanks i will try that sometime
Title: Re:new group
Post by: 456820 on 09 Mar 2005, 19:50:55
right im about to test but alittle problem
((count(units group player))<2)
do i place my group where it says group and player name where it says player
same with
[player name] join (group2 newleadername)
does it need to be player name new group and then the group leader
Title: Re:new group
Post by: bedges on 09 Mar 2005, 20:21:43
if you take a look in the comref you'll see units, group and player are all commands, or rather they're built-in references to things.

units grp
Operand types:
    grp: Group
Type of returned value:
    Array
Description:
    Arrays of all units in the group.

group obj
Operand types:
    obj: Object
Type of returned value:
    Group
Description:
    Group in which given unit is assigned.

player
Type of returned value:
    Object
Description:
    person controlled by player.

so, ((count(units group player))<2) is pretty self-explanatory, although the 'player' part of that line could be the name of any unit leading a group.

similarly, [ player ] join (group newgroupleader) means the player unit will join the group led by newgroupleader, who again could be any unit leading a group.

hope that clears things up :)
Title: Re:new group
Post by: 456820 on 12 Mar 2005, 15:14:11
right i have only just managed to get the computer working again and i tried this and it seems to work but when it joins it says 10 follow 10
where 10 is the number of the player.
the way i have used it is
[off1] join (newgroup)
where off1 is the name of the player
and newgroup is the new group i tried it with the name of the group leader but didnt work i thnk because he is usually killed
Title: Re:new group
Post by: THobson on 12 Mar 2005, 16:52:34
Don't use the name of the leader, as you say he might get killed.  Give the group a name say AlphaGrp and then have:

[loon1,loon2 etc.] join AlphaGrp
Title: Re:new group
Post by: 456820 on 12 Mar 2005, 19:05:31
right i dont know why but it doesnt seem to be working the second group is definately alive and i switched the command to
[off1] join (grp1)
and i tried
[off1] join grp1
both didnt work it says
10 follow 10 when it activates
so i was wondering if anything was as effective like 10 follow 1 from bravo squad or something.
Title: Re:new group
Post by: THobson on 12 Mar 2005, 21:21:42
do you have:
grp1 = group this
in the init field of one of the units in the group you want to call grp1?
Title: Re:new group
Post by: 456820 on 12 Mar 2005, 21:53:51
right i will walk you through what i have done
my player is called = off1
players original group is = grp2
the group he will move to is called = grp1

in a trigger i have is
condition = ((count(units group off1))<2)
on activation = [] exec "newgroup.sqs"

then in new group.sqs i have

Code: [Select]
~1
off1 sidechat "PAPABEAR THIS IS ALPHA WE I HAVE LOST ALL UNITS IN MY SQUAD. OVER."
~5
papabear sidechat "JOIN UP WITH BRAVO SQUAD AND CONTINUE WITH THE MISSION PLAN. OUT."
~1
[off1] join (grp1)
obj21=true

thats it

i know the trigger fires as the side text shows but instead of joining me to grp2 it says
10 follow 10

any ideas
Title: Re:new group
Post by: Kyle Sarnik on 12 Mar 2005, 22:00:01
10 follow 10 means he joined himself, which means your join command is wrong. Instead, try this:

[off1] join leader grp1


simple as that.
Title: Re:new group
Post by: 456820 on 12 Mar 2005, 22:01:20
leader grp1 ? does that mean the leader of grp1 as i saif before he always die in combat
unless you know of a script wich can check wich unit is alive and is the leader
Title: Re:new group
Post by: Planck on 12 Mar 2005, 23:08:46
If the leader of the group dies, the next in command takes over......so

leader grp1

Means.....whoever is leader at the time.


Planck
Title: Re:new group
Post by: THobson on 13 Mar 2005, 11:03:03
Leader grp1 should work.  But also so should grp1 if it is correctly defined.

I repeat my question:
Quote
do you have:
grp1 = group this
in the init field of one of the units in the group you want to call grp1?
Title: Re:new group
Post by: 456820 on 13 Mar 2005, 11:08:09
yes i do i have tried to test it but the mission its in my group just survived so i will try again sometime