OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: j-man on 24 Jul 2004, 15:36:08

Title: something wrong with this script
Post by: j-man on 24 Jul 2004, 15:36:08
createUnit.sqs
Code: [Select]
_createTime = (random 15)

_unittype = _this select 0
_createPos = _this select 1
_init = _this select 2

?(_unittype == "basic") : _unittype = "fin_Jaeger"; goto "check"
?(_unittype == "NCO") : _unittype = "fin_JaegerNCO"; goto "check"
?(_unittype == "sniper") : _unittype = "fin_JaegerSniper"; goto "check"
?(_unittype == "MG") : _unittype = "fin_JaegerMGkvkk62"; goto "check"
?(_unittype == "medic") : _unittype = "fin_Medic"; goto "check"
?(_unittype == "grenade") : _unittype = "fin_JaegerRK95RG"; goto "check"
?(_unittype == "officer") : _unittype = "fin_JaegerOfficer"; goto "check"
?(_unittype == "AT") : _unittype = "fin_JaegerATkes88"; goto "check"
?(_unittype == "radio") : _unittype = "fin_JaegerRadioman"; goto "check"


#check
~1
?(count Units dummygroup == 12) goto "check"

#create
~_createTime

_unittype createUnit [getMarkerPos _createPos, dummygroup, _init, 0.5, "PRIVATE"]

exit

executed with:
Code: [Select]
["radio","unitmark1","[this] join grpnull; this setbehaviour ""SAFE"""] exec "createunit.sqs"

The unit is created just fine. The problems are: he does not detach from the dummygroup (which is a real group), he is not created exactly where the marker is, and he is not is safe mode >:(

What can I do to fix these things ???
Title: Re:something wrong with this script
Post by: macguba on 24 Jul 2004, 16:43:37
Do you really  need all those " " around safe?    Also, try { } instead of some of the " ".
Title: Re:something wrong with this script
Post by: j-man on 24 Jul 2004, 16:57:25
Do you really  need all those " " around safe?    Also, try { } instead of some of the " ".

I think all the " " are necessary, not sure though. Also, where should I place the  {}  ???
Title: Re:something wrong with this script
Post by: olseric on 24 Jul 2004, 17:02:25
Code: [Select]
_createTime = (random 15)

_unittype = _this select 0
_createPos = _this select 1
_init = _this select 2

?(_unittype == "basic") : _unittype = "fin_Jaeger"; goto "check"
?(_unittype == "NCO") : _unittype = "fin_JaegerNCO"; goto "check"
?(_unittype == "sniper") : _unittype = "fin_JaegerSniper"; goto "check"
?(_unittype == "MG") : _unittype = "fin_JaegerMGkvkk62"; goto "check"
?(_unittype == "medic") : _unittype = "fin_Medic"; goto "check"
?(_unittype == "grenade") : _unittype = "fin_JaegerRK95RG"; goto "check"
?(_unittype == "officer") : _unittype = "fin_JaegerOfficer"; goto "check"
?(_unittype == "AT") : _unittype = "fin_JaegerATkes88"; goto "check"
?(_unittype == "radio") : _unittype = "fin_JaegerRadioman"; goto "check"


#check
~1
?(count Units dummygroup == 12) goto "check"

Well, right there, you're missing a : between the condition and result...

Code: [Select]
#create
~_createTime

_unittype createUnit [getMarkerPos _createPos, dummygroup, _init, 0.5, "PRIVATE"]

exit

Just scanning it quick, that's all I see...
Title: Re:something wrong with this script
Post by: j-man on 24 Jul 2004, 17:50:38
Nevermind, I managed to get it fixed :)

Topic solved