OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: ryankaplan on 29 Sep 2005, 20:18:52

Title: Another freeking create unit command error
Post by: ryankaplan on 29 Sep 2005, 20:18:52
"ukf_infantry_lawWBb" createunit [getpos _enforce5, _assault9,"wahman2=this","corporal",1]

doesn't bloody work, as in there is something wrong with the syntax. Any idea what the correct version is supposed to be? Thanks in advance to anyone who helped, or tryed to help.
Title: Re:Another freeking create unit command error
Post by: klavan on 29 Sep 2005, 20:40:15
What's _enforce5?
Klavan
Title: Re:Another freeking create unit command error
Post by: dmakatra on 29 Sep 2005, 20:43:04
Shouldn't rank be before skill? ComRef says so at least.

Anyway, it's always a good idea to post what the error says. I know it looks like gibberish at first, but you'll learn what it means in a kick.

:beat: *Gets Shot* :beat:
Title: Re:Another freeking create unit command error
Post by: Kyle Sarnik on 29 Sep 2005, 20:43:17
ryankaplan, please don't assume that we know what your variables are. Please provide us with a little more information rather than posting 1 line and walking off...
Title: Re:Another freeking create unit command error
Post by: ryankaplan on 30 Sep 2005, 12:49:45
sorry about that, i thought it was probably a simple syntax error which you guys could spot in a second...apparently not(no offence meant).

here is the whole script: called via [logictospawnat, grouptojoin] exec "spawnshite.sqs"

_ENFORCE2 = _this Select 0
_ASSAULT2 = _this Select 1

"ukf_infantry_lawWBb" createunit [getpos _ENFORCE2, _ASSAULT2,"wahman1=this","corporal",0.9]
~2
"ukf_infantryWBb" createunit [getpos _ENFORCE2, _ASSAULT2,"corporal",0.9 ]
~1
"ukf_infantryWBb" createunit [getpos _ENFORCE2, _ASSAULT2,"corporal",0.9 ]
~1
"ukf_infantryWBv" createunit [getpos _ENFORCE2, _ASSAULT2,"corporal",0.9 ]
~2
"ukf_infantryWBr" createunit [getpos _ENFORCE2, _ASSAULT2,"corporal",0.9  ]
~1
"ukf_infantry_rlgWBb" createunit [getpos _ENFORCE2, _ASSAULT2,"corporal", 0.9 ]
~1
"ukf_infantry_lswWBb" createunit [getpos _ENFORCE2, _ASSAULT2,"corporal",0.9  ]
~1
"ukf_infantry_lswWBb" createunit [getpos _ENFORCE2, _ASSAULT2,"corporal", 0.9 ]
~2
"ukf_infantry_lawWBb" createunit [getpos _ENFORCE2, _ASSAULT2,"corporal",0.9  ]
~1
"ukf_infantry_gmpgaWBb" createunit [getpos _ENFORCE2, _ASSAULT2,"corporal", 0.9 ]
~1
_ASSAULT2 setformation "wedge"
_ASSAULT2 allowfleeing 0
wahman1 removeweapon "UKF_LAW80Launcher"
wahman1 removemagazine "UKF_LAW80"
wahman1 removemagazine "JAM_W556_30mag"
wahman1 addmagazine "AALauncher"
wahman1 addweapon "AALauncher"


It gives the error "ukf_infantry_lawWBb" createunit [getpos _ENFORCE2, _ASSAULT2,"wahman1=this","corporal",0.9]l#l error type number, expected string

I tried putting it at the bottom, and all the other units get created without A problem (other than the slight mini second freeze) until it comes to wahman1.
Title: Re:Another freeking create unit command error
Post by: ryankaplan on 30 Sep 2005, 13:12:05
Quote
sorry about that, i thought it was probably a simple syntax error which you guys could spot in a second...apparently not(no offence meant).

Or maybe you can. Yes, apparently the skill does come before the rank, but only if you put an init field down. If not you have to put the rank before skill. So the 2 correct versions are:

"ukf_infantry_lawWBb" createunit [getpos _ENFORCE2, _ASSAULT2,"wahman1=this",0.9,"corporal"]

AND

"ukf_infantry_lawWBb" createunit [getpos _ENFORCE2, _ASSAULT2,"corporal",0.9]

Thanks alot dmakatra
Title: Reply to: Another freeking create unit command error
Post by: Trapper on 30 Sep 2005, 15:30:14
(in reply to solved topic http://www.ofpec.com/yabbse/index.php?board=6;action=display;threadid=25800)

In the last reply it's said that the correct syntax for createunit is:
Quote
"ukf_infantry_lawWBb" createunit [getpos _ENFORCE2,_ASSAULT2,"wahman1=this",0.9,"corporal"]
AND
"ukf_infantry_lawWBb" createunit [getpos _ENFORCE2, _ASSAULT2,"corporal",0.9]
I think the second example is wrong.
The only reason no error message appears, is because "corporal" is just used for the init line (always _this select 2 position). And not because you can change the positions of array items under any circumstances.
Though, I'm not sure, didn't test it.