OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: 24Gamer on 01 Jun 2004, 20:15:15

Title: Create Unit
Post by: 24Gamer on 01 Jun 2004, 20:15:15
I wanted to put a General into my mission, and i was told that i could put one in with the editor upgrade but that kept disconnecting people. so now im trying to do it with a script, i have pretty good experience with scripting but for some reason i can't get it to work:

GEN = "GeneralE" createunit ["1600, 1400, 0", Null]
but this does't work, come up with generic error :-/
i've also tried
GEN = "GeneralE" createunit [getpos GENie, solbase]
"You need to have an east soldier on the map called 'solbase' (no quotes) for the above to work"
all i want to do i create a general with the name GEN, not sure how the group parameter works :-X
Title: Re:Create Unit
Post by: rhysduk on 01 Jun 2004, 21:24:25
According to the COMREF you dont need the GEN = part of the syntax.

Is this the correct class name for the general? if u dont know it put the general on the map, save it and open the mission.sqm file. Look and find the soldier (general) you placed, use this class name for the CreateUnit command.


"GeneralE" createunit ["1600, 1400, 0", Null] This wont work becaus you have the pos and group wrong. Null is not a group, becoz its null (i think) the position i dont think you can have x,y,z etc even though u have " around it.

So taing that GENERALE is a class name for a unit.. use this..

"GeneralE" CreateUnit [getpos player, player]

Want me to explain it?

getpos player is the position of the player and
player is the group that you want the unit to become attached to..

You have to attach the unit to a group i think... This part of the command can be changed to what u like.. just make sure you have a named group in the mission.. even if its just a single unit.. name it as a group for hte unit u spawn to become attached to.

(You can always delete the unit u named as a group after the GENERAL hsa spwaned if you want the General to be on his own)

Sry if i lost u in all that.

Rhys
Title: Re:Create Unit
Post by: Artak on 01 Jun 2004, 21:36:22
Lots and lots of threads about the createunit command in the forums.  ;) (http://www.ofpec.com/yabbse/YaBBImages/search.gif)
Title: Re:Create Unit
Post by: 24Gamer on 02 Jun 2004, 02:22:51
o nevermind, i used createvehicle and it worked fairly easily
Title: Re:Create Unit
Post by: rhysduk on 02 Jun 2004, 12:35:01
 ???
Title: Re:Create Unit
Post by: macguba on 02 Jun 2004, 18:05:38
I think he meant "Hey rhysduk & Artak, thanks for your help guys."   At least I hope that's what he meant.
Title: Re:Create Unit
Post by: 24Gamer on 02 Jun 2004, 23:31:13
lol, thanks anyway  8)