Home   Help Search Login Register  

Author Topic: creating units  (Read 559 times)

0 Members and 1 Guest are viewing this topic.

Offline penguinman

  • Contributing Member
  • **
  • Money is worthless, just paper, ink, and threads
creating units
« on: 02 Dec 2004, 03:52:06 »
hello,
when u spawn a unit lets say,

Code: [Select]
#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




Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:creating units
« Reply #1 on: 02 Dec 2004, 05:04:53 »
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"

Offline penguinman

  • Contributing Member
  • **
  • Money is worthless, just paper, ink, and threads
Re:creating units
« Reply #2 on: 02 Dec 2004, 05:29:25 »


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

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:creating units
« Reply #3 on: 02 Dec 2004, 05:31:53 »
all units have to be in a group afaik, sorry, but theres no way around that, i don't think

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:creating units
« Reply #4 on: 02 Dec 2004, 12:45:27 »
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.
Plenty of reviewed ArmA missions for you to play

Offline penguinman

  • Contributing Member
  • **
  • Money is worthless, just paper, ink, and threads
Re:creating units
« Reply #5 on: 03 Dec 2004, 03:35:18 »
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.

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:creating units
« Reply #6 on: 03 Dec 2004, 04:19:01 »
Quote
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

I know a little about a lot, and a lot about a little.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:creating units
« Reply #7 on: 03 Dec 2004, 11:09:56 »
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.
Plenty of reviewed ArmA missions for you to play

Offline penguinman

  • Contributing Member
  • **
  • Money is worthless, just paper, ink, and threads
Re:creating units
« Reply #8 on: 04 Dec 2004, 04:18:07 »
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

Quote
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

CrashnBurn

  • Guest
Re:creating units
« Reply #9 on: 05 Dec 2004, 19:59:44 »
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.