OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started 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?
-
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)
-
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
-
not (count units group1)<2)
but
((count(units group player))<2)
-
thanks i will try that sometime
-
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
-
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 :)
-
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
-
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
-
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.
-
do you have:
grp1 = group this
in the init field of one of the units in the group you want to call grp1?
-
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
~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
-
10 follow 10 means he joined himself, which means your join command is wrong. Instead, try this:
[off1] join leader grp1
simple as that.
-
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
-
If the leader of the group dies, the next in command takes over......so
leader grp1
Means.....whoever is leader at the time.
Planck
-
Leader grp1 should work. But also so should grp1 if it is correctly defined.
I repeat my question:
do you have:
grp1 = group this
in the init field of one of the units in the group you want to call grp1?
-
yes i do i have tried to test it but the mission its in my group just survived so i will try again sometime