OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: LAPD on 29 Jun 2003, 21:57:27

Title: CreateUnit Waypoint
Post by: LAPD on 29 Jun 2003, 21:57:27
Hello.

I created a unit using a trigger while mid game, but how can I tell the created soldier to go where I want? I mean, how can I make him a waypoint?
I can't make him a waypoint in the editor while mid game ...

One more question. I want to add a bmp (using CreateUnit) and connect him to a group (East2 is the name of the group).

I've done this:
Code: [Select]
_units2 = units east2
"_x setunitpos up" foreach _units2
"_x allowfleeing 0" foreach _units2

"OfficerE" CreateUnit [getpos G2, East2, "E10 = this", 1, "SERGEANT"]
"SoldierEG" CreateUnit [getpos G2, East2, "E11 = this", 1, "CORPORAL"]
"SoldierEB" CreateUnit [getpos G2, East2, "E12 = this", 1, "CORPORAL"]
"SoldierELaw" CreateUnit [getpos G2, East2, "E13 = this", 1, "CORPORAL"]
"SoldierEMG" CreateUnit [getpos G2, East2, "E14 = this", 1, "PRIVATE"]
"SoldierEB" CreateUnit [getpos G2, East2, "E15 = this", 1, "PRIVATE"]
"SoldierEB" CreateUnit [getpos G2, East2, "E16 = this", 1, "PRIVATE"]
"BMP" CreateUnit getpos G2

But it gives an error on the BMP. What is wrong?

Thanks :).

Edit: oh, I think i got the bmp thing. It's createvehicle not createunit. Just how to connect him to a group :) (and the question about the waypoints).
Title: Re:CreateUnit Waypoint
Post by: Tomb on 29 Jun 2003, 22:11:25
You could create a gameLogic or just ONE trooper & then make all kinds of WP's for THAT unit.
Then delete him right away (deleteVehicle This.... in his INIT field), and use his groupName as the group for yer new created units! :thumbsup:


 Create some unit on the map far away from the real action, and in the init field write:
 
  :)  groupAlpha = group this; deleteVehicle this
 
 Now you have an empty group. Be aware that you can not put more then 12 soldiers to this group.  :o
Make whatever WAYPOINTS for this particular unit!!!!!!

And you're ready to delete him & create the squad :


 "SoldierWB" CreateUnit [getpos "F1",groupalpha,"Bob=this",0.5,"Corporal"]
 "SoldierWG" CreateUnit [getpos "F1",groupalpha,"Rob=this",0.3,"Private"]

 etc.

Then they will pop up on "F1" (which is just some named gameLogic or a named invisible helipad),
and they will start to follow the WP's of the alphagroup!  :-*


Title: Re:CreateUnit Waypoint
Post by: Chris Death on 29 Jun 2003, 23:41:24
Tomb - just a thinking - for the gamelogic's waypoints there may be one problem:

gamelogic's waypoints offer only two types: AND / OR

This is for syncronizing those waypoints with multiple
events (triggers or other waypoints).

AND = all syncronized events must happen to let the
condition become true

OR = only one of those events has to happen to let it
become true


Therefore this could be a problem when trying to let units
move along gamelogic's waypoints.

Anyway - i haven't tried this yet, so i can only say this upon
logical assumptions (cooked in me brain).

~S~ CD
Title: Re:CreateUnit Waypoint
Post by: LAPD on 30 Jun 2003, 02:16:33
Ok, I got it. It's working. Thanks  :).

But another question came to my mind:
My mission is that a group had to conquer a base, and after the base have been conquerd (=all enemies at base are dead) enemy reinforcements come to take it back.
The enemy reinforcements are the ones which I use as CreateUnit and CreateVehicle.

The problem is that the end of the mission, the #End1 trigger, is activated by east - not present trigger on a big area. The reinforcements are activated by a trigger that complete the first objective and create the reinforcements.
Since the reinforcements are created by the trigger (so it takes half a second until it will load them, until the trigger activates itself) and the end trigger is activated by East - not present, the mission will end after the first objective, until the createunit/vehicle will load. How can I delay it so the created units will show up and the mission won't end because there is no east presented until they are created?

It's hard for me to explain this. Hope you'll understand.  8)
Title: Re:CreateUnit Waypoint
Post by: LCD on 30 Jun 2003, 02:22:54
dont (nd never) use not present triger as mision ender - if u look @ som of da reviews here u wil c dats 1 of da badest things (havin 2 search tilll da last soldiers - dat hides inside bush usualy - is quiet pisin :P)

as 4 ur prob - just make anoder variable dat wil come true after  da squad is created - nd put in da condition field

this and variablename

LCD OUT
Title: Re:CreateUnit Waypoint
Post by: Tomb on 30 Jun 2003, 08:49:27
you could COUNT the # of enemy units at the base,
and when a certain number is left alive, the trigger could fire.


EAST CountSide ThisList <=5

or alike...

That way ya don't have to search the whole area, even though you HAVE conquered the base, but a few hostile morons are still alive - calling for help maybe?

Title: Re:CreateUnit Waypoint
Post by: LAPD on 30 Jun 2003, 14:49:17
It's working. Thanks :).