OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: penguinman on 02 Dec 2004, 03:52:06
-
hello,
when u spawn a unit lets say,
#loop
camcreate"East Machine Gunner"
this setpos getpos hole
this domove getpos GL
~10
goto: loop
i want to know if you can use "this" instead of naming the Machine gunner.
the part in question is
this setpos getpos hole
this domove getpos GL
can this work or somthing like it maby" that" or "last"
if that wont work that what can i do to get it to work.
thanks
-
first off, you should use createunit:
type createUnit unitInfo
Operand types:
type: String
unitInfo: Array
Compatibility:
Version 1.34 required.
Type of returned value:
Nothing
Description:
Create unit of given type . Format of unitInfo is: [pos (Position),group (Group), init (String), skill (Number), rank (String)] Note: init, skill, and rank are optional, default values are "", 0.5, "PRIVATE".
Example:
"SoldierWB" createUnit [getMarkerPos "barracks", groupAlpha]
and you need to find a list of accepted names for this command, which can be found in the comref
then put for the init:
"this domove getpos GL"
-
so i get create unit but as u can see that wouldnt work because it is in a loop and the group part wouldnt aloow that do coulnt i just have it be w/ out a group.
thanks
-
all units have to be in a group afaik, sorry, but theres no way around that, i don't think
-
Every unit is in a group.
You can put your commands, using "this" in the init field of the unit. There is an example in the online version of the comref.
-
cant i just leave the group part blank and it will auto assign it to a group like in the editor.
i know about "this" but how do i put it in the init field of a unit if the unit hasent even been created yet
its a spawning loop
maby if you could make a demo mission for me of a spawning loop because I just cant grasp this stuff.
-
cant i just leave the group part blank and it will auto assign it to a group like in the editor.
If you don't specify the group the unit will not be created.
You can create a group at the start of your mission by placing a single unit somewhere.........maybe a small island somewhere. In his init field put:
grp1 = group this ; deletevehicle this
He will be a group......all by himself with the name of grp1, then he will be deleted.
The point to all that is, the group grp1 will now exist and you can spawn units to join this group..........probably
Planck
-
Planck is right.
Don't try to fight OFP code: never wish that a command did something different, or that a non-existent command exists. It's just a frustrating waste of time. Go with the flow, be flexible and relaxed, but remember that the comref is utter gospel. The comref is one of the most precious and rare things on Earth: an absolute. These are the commands that work, and that's it. These are the only ones that work, and they only work in this way.
Treasure it, don't whinge about it. It is a pole of certainty in a bewildering universe.
-
uhhh.. ok ???
sacred comrefs and all that stuff are great but i need to learn how to make a spawn loop.
maby if you could whip up a quick demo mission or point me to one in a tut or somthing. ;D
but remember that the comref is utter gospel. The comref is one of the most precious and rare things on Earth: an absolute.
so like you guys worship ofp and the comref is like your bible or your 10 commandments
so then ofp 2 will be like a greator god then ofp1 and it will banish the ofp1 god to the clearance bin. and then u guys worship ofp2 and edit your "bible"/comref with new added sacred values, booleans, and many new guidlines for worshiping your new god.
I think i get it ;D
its no wonder you guys r so good at this stuff: you eat, sleep, breathe, and crap out ofp editing.
thanks
-
There's already a demo mission with scripts that spawns groups in a loop. Look in the editors depot for createunit tutorial. I know it's there... I wrote it.