OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: CptBravo on 30 Nov 2004, 20:34:37

Title: Ughhh I have given up! :(
Post by: CptBravo on 30 Nov 2004, 20:34:37
Hey,

I know how to creat (respawn) AI controlled units/groups using "Spawnmanager2". What I could not find however is how to get these units to join existing groups?

So for example, I have a mission where there are 5 AI controlled squads, so everytime one of them drops below 7 soldiers, AI respawns 5 soldiers to join squad to replace casualties.

Any hints are greatly appreciated :)
Title: Re:Creat units with atwist
Post by: Triggerhappy on 01 Dec 2004, 05:29:28
just use the join command
NameOfSpawnedUnit join group NameOfExistingUnitToJoin
Title: Re:Creat units with atwist
Post by: CptBravo on 02 Dec 2004, 02:45:28
The question is HOW do you name respawned units/groups?? SpawnManager2 does not give that option ?

Thanks
Title: Re:Creat units with atwist
Post by: Triggerhappy on 02 Dec 2004, 03:44:28
if they respawn at the same place everytime its easy, just put a trigger that can activate repeatedly and use thislist

"_x join group Someunit" foreach thislist

or you could run a loop to keep a list of units on the map, and then when it spawns new people subtract the old list from the new, and then you have a list of new people, and then use the above code. not very easy, but doable
Title: Re:Creat units with atwist
Post by: CptBravo on 02 Dec 2004, 17:35:54
Hey thanks for the reply.

I have tried the trig you mentioned  but kept getting error msg.

I have attached the respawn tamplate mission. If you could it illustrate how to name/group  spawned AI groups I'd be grateful :)  
Title: Re:Creat units with atwist
Post by: Triggerhappy on 02 Dec 2004, 23:44:10
well i just looked at the respawn script in your mission and it makes them joined to the group already, so i don't know what you're trying to do exactly, but i think it is done for you by the script:
it uses the createunit command, which requires a group for the unit and it makes them in the group of the leader of the group you run it for. you shouldn't need anything.
BTW the script is called respawnsquad2.sqs
Title: Re:Creat units with atwist
Post by: CptBravo on 03 Dec 2004, 02:02:39
Hey TriggerHappy,

Maybe I should explain what I am trying to do:

I have a mission and I am using an AIR units attack ground script which needs group (infantry units) names that will be attacked by air units specified in a Trigger. So I need the ability to name each of the groups something I am not sure how to do? How do you "name" groups that are spawning?

Cheers.

 
Title: Re:Any Guru Scripters out there??! :)
Post by: CptBravo on 04 Dec 2004, 17:05:58
I'm a no Guru Scripter but I'm guessing this is a lot harder to do than I thought  ???

If anytone knows of a way to name groups spawned please do share.

Cheers.
Title: Re:Any Guru Scripters out there??! :)
Post by: Planck on 04 Dec 2004, 21:39:59
Try placing a unit somewhere on your map, somewhere out of the way......a small island perhaps.

In his init field put:

GroupWun = group this; deletevehicle this

What this does is make this unit a group called GroupWun, then it deletes him.

The point being, the group now exists and you can spawn more units to join this group, because spawned units can only join an existing group otherwise they will not be created.

Something like:

"SoldierWB" createUnit [_pos, GroupWun]

I hope I read your problem correctly.   ::)


Planck
Title: Re:Any Guru Scripters out there??! :)
Post by: Triggerhappy on 05 Dec 2004, 00:41:57
your basic idea is right, but it needs to be implemented differently
in each group leader's init field, put:
someName(different for each) = group this

and then call the script with those groupnames
Title: Re:Any Guru Scripters out there??! :)
Post by: CptBravo on 05 Dec 2004, 19:43:44
hey,


Basically what I am trying to is have the ability to name groups spawning.  :(

In the exmaple tample attached in above post, AI groups SPAWN with options of where, how many times, after how many soldiers in group killed and where to patrol and range. It called from a logic unit.
All I want to do is add one extra option .. name that spawing group.
If you could illustrate it in the tamplate example above I'd be very greatefull :)  
Title: Re:Any Guru Scripters out there??! :)
Post by: Planck on 05 Dec 2004, 21:31:13
You cannot spawn a new group.

Units must be spawned to join an existing group.....AFAIK

If the group to spawn into is not specified the unit/units will not be created.


Planck
Title: Re:Any Guru Scripters out there??! :)
Post by: CptBravo on 05 Dec 2004, 21:52:34
Hey Planck,

Sounds good. Only thing is ..  I am not sure how.

If you could use the tamplate mission to give example that would be great!

As I said I like many .. clueless when it comes to scripting! :)

Thanks.
Title: Re:Any Guru Scripters out there??! :)
Post by: h- on 05 Dec 2004, 23:09:59
Hi!

Just correcting this (it's wrong):
Code: [Select]
"_x join group Someunit" foreach thislistto
Code: [Select]
"[_x] join group Someunit" foreach thislist
Bye!
Title: Re:Ughhh I have given up! :(
Post by: CptBravo on 06 Dec 2004, 17:14:33
Ughhh I have given up!  :(

if someone figures out a way to name the groups in example thats great if not then ohh well ..

Thanks to all those who responded.

Cheers.
Title: Re:Ughhh I have given up! :(
Post by: Planck on 06 Dec 2004, 22:20:07
Quote
What I could not find however is how to get these units to join existing groups?

It has already been written above anyway,  but I'll try again:

"SoldierType" createUnit [PositionToCreate, NameOfExistingGroupToJoin]

SoldierType being the type of soldier you are creating.
PositionToCreate being the position you wish him to be created at.
NameOfExistinGroupToJoin being the name of the existing group he is to join.

I can't see what else you can possibly mean.


Planck
Title: Re:Ughhh I have given up! :(
Post by: Triggerhappy on 06 Dec 2004, 22:52:03
name all the groups with the leader's init:
Somename = group this

and have a different name, only need this in the init, the game will keep track of who is in the group, so exec the script with those group names, and you should get what you want, i said this halfway up the thread but you weren't paying much attention it seems, you've been getting all the right answers and dismissing, them. if someone gives you help, it usually means they know what they are talking about, so test it before you tell them it won't work.  :(

i need an aspirin...
Title: Re:Ughhh I have given up! :(
Post by: CptBravo on 06 Dec 2004, 23:43:55
First of all thanks for the responses.

Maybe I was not clear what I needed. So here it is ..

I am using Spawn Manager. So I need to name the groups spawning a group name. So its not just about spawning a unit and have it join a group ..

The spawn manager groups works as follow:

The spawned groups have Many parameters that can create general or very specific groups & behaviour .

SO when creating a group you place say a tent name  it "tent" and put this in init field:
["west","BAS_Deltas", tent,12,150,20,3,4,getpos house] exec "spawnman.sqs"

West is side of group
BAS_Deltas is type of soldiers
Tent is location of spawn
12 how many soldiers are in group  
150 patrol radius around patrolposition
20 how many seconds group will pause between patrols
3 how many dead in a group to trigger a respawn
getpos house patrolposition that is patrolled around
3 how many respawns

So my simple question is .. where exactly above do you add the group name in this??

Looking at the tamplate mission mihgt help.

Again thanks.

Title: Re:Ughhh I have given up! :(
Post by: Triggerhappy on 06 Dec 2004, 23:53:32
the group is pre-existing yes?
if so, then give the group a name by putting:
name = group this
in the leader's init.
if not.. i'll b right back, gotta check out the mission
Title: Re:Ughhh I have given up! :(
Post by: Planck on 06 Dec 2004, 23:56:48
OK.....I think I understand what you mean now.

Not having looked at this script I can't comment further yet. except to say that I would have thought Spawn Manager had some form of documentation which explained this.

Anyway I will download it and have a look.


Planck
Title: Re:Ughhh I have given up! :(
Post by: Triggerhappy on 07 Dec 2004, 00:02:26
I've noticed one huge problem already.
the mission is execing scripts that aren't in the folder... ???
there is no spawnman.sqs nor is there the folder it is supposedly in
Title: Re:Ughhh I have given up! :(
Post by: Planck on 07 Dec 2004, 00:05:27
And I note the readme states that each script has instructions on how to use them inside the script themselves.


@TriggerHappy
spawnman.sqs is in the SpawnMan folder



Planck
Title: Re:Ughhh I have given up! :(
Post by: Planck on 07 Dec 2004, 00:18:56
Ok.........I looked inside the respawnsquad.sqs and found this instruction:

Quote
; easy example: write in the init-field of leader of group:
;       [this, 2, 100] exec "respawnSquad.sqs"
;        the group will be respawned twice at original position of the leader and will patrol around
;        this position with a radius of 100. respawn will occur if they are fewer than 3 members.

and this:

Quote
; complex example: write in the init-field of leader of group:
;       [this, 2, 100,patrolpos,spawnpos,3] exec "respawnsquad.sqs"
;        the group of "this" will be respawned 2 times at spawnpos, patrouling around patrolpos
;        in a radius of 100, and the group respawns if the group is lower
;          than 4 members. respawn will occur three times.
;        you would have to set two objects somewhere on the map. one you would have to name patrolpos,
;        the other spawnpos...
; parameters: [unit, j, range, patrolpos, spawnpos, number] exec "RespawnSquad.sqs"
;       unit should be leader of group
;       j = number of respawns
;      range = range of patrol around patrolpos
;      patrolpos is optional! no value means, patrouling will ocurr around original position.
;      spawnpos is optional! no value means respawn will occur at original position.
;      number is optional! no value means they respawn if they are fewer than 3 people...

Does this help you?


Planck
Title: Re:Ughhh I have given up! :(
Post by: Triggerhappy on 07 Dec 2004, 00:33:30
odd, i don't have the spawnman folder or script in what i d/l'ed
Title: Re:Ughhh I have given up! :(
Post by: Planck on 07 Dec 2004, 00:56:46
Try here TH:

http://www.ofpec.com/editors/browse.php?browsewhat=2&category=2_7

Look for spawnman2 + AI UPDATE


Planck
Title: Re:Ughhh I have given up! :(
Post by: CptBravo on 08 Dec 2004, 15:24:03
Hey guys,

Thanks forthe responses and help so far.
The Spawning script has two methods of spawning groups.
a) Place a group onmap and have in its init field.
b) Place an object on map (tent,house,truck) and group spawn from it.
I'm interested in b) since it gives more felexibilty in terms of spawning units only when needed. So they will spawn by a trigger when certain conditins are met.
Now its this option I am having a hard time figuring out hot name the group.

This is what goes in the init field of the object:
["west","BAS_Deltas", tent,12,150,20,3,4,getpos house] exec "spawnman.sqs"  

Where exactly do you place the group name in the above?
Remeber with this option soldiers will not be spawned till later ..

Thanks
Title: Re:Ughhh I have given up! :(
Post by: Triggerhappy on 08 Dec 2004, 22:34:21
you can add arguments, that won't do anything.
I looked at the spawnman.sqs script, and it uses "dummy" groups, where there is a useless unit somewhere remote to the mission, and they spawn into his group. So in that units init field, as i said before, name the group:
name = group this

then you can call you script with that group name

the dummy unit is absolutely nessecary for both scripts (spawnman and your other one), because 1) spawnman uses createunit (only command it can use) which requires a group. and 2) you need a group name for your airstrike script
i would recommend making him as far away as possible, and in a place where your airstikes won't be able to hit him, because there is a good chance he may get attacked as well
Title: Re:Ughhh I have given up! :(
Post by: Triggerhappy on 08 Dec 2004, 23:26:51
hmm.. i see, it has him join a null group... scratch what i said earlier.

I believe the only way you can do this is with a trigger right on where they will spawn and do something like this:
condition: (whateverside) present
delay of a second or 2

... no that won't work either...
hmm.. wow, I don't have a clue as to how you could do this  ???
Title: Re:Ughhh I have given up! :(
Post by: CptBravo on 09 Dec 2004, 15:21:40
I assume it is impossible to name a null group ???

Anyway of naming a group after it spawns by maybe having a trig above spawn object that is activated by when spawn happens, and groups and name soldiers in trig area ??? total shot in the dark here :)
Title: Re:Ughhh I have given up! :(
Post by: Triggerhappy on 10 Dec 2004, 23:16:15
1) i think you may have misunderstood me, by joining a null group he becomes his own group

2)thats what i was thinking of, but then everybody would be the same group
Title: Re:Ughhh I have given up! :(
Post by: CptBravo on 11 Dec 2004, 21:37:01

2)thats what i was thinking of, but then everybody would be the same group


But if we have 3 different trigs over 3 different spawn objects in different locations  .. can we name soldiers spawning in each trig point a different group name?

Thanks
Title: Re:Ughhh I have given up! :(
Post by: Triggerhappy on 12 Dec 2004, 04:30:59
whoa! my bad, the group name is a global variable, so you would only have the name of the group of the last person to spawn there.
maybe something like:
activation:counter = counter + 1;call format ["group%1",counter] = group this

then everytime a unit spawns they will have their own group name, i think.
group1
group2
etc

you would need to give counter a value of zero in init so that will work