OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Triggerhappy on 18 Sep 2005, 19:10:33

Title: Dynamic varibles with format...
Post by: Triggerhappy on 18 Sep 2005, 19:10:33
I'm trying to make variables using call, format, and a counter... unfortunately, ofp spits out an unknown operator at me...
here's the code:
Code: [Select]
(call format ["TRG_fakepilot%1",_counter]) = this
and this is done in the init line of createunit:
Code: [Select]
"SoldierWB" createUnit [[0,0,0], group _pilot, {(call format ["TRG_fakepilot%1",_counter]) = this}, 1, "corporal"]
and here is the error message:
Code: [Select]
(call format ["TRG_fakepilot%1",_counter]) |#|= this:error unknown operator
what am i not doing? or doing wrong?
Title: Re:Dynamic varibles with format...
Post by: THobson on 18 Sep 2005, 19:51:49
Jusr passing so this is quick thought:

Try:

Code: [Select]
"SoldierWB" createUnit [[0,0,0], group _pilot, {(call format ["TRG_fakepilot%1 = this",counter]) }, 1, "corporal"]
Note also that I have made counter a global variable
Title: Re:Dynamic varibles with format...
Post by: Triggerhappy on 18 Sep 2005, 20:15:26
well i need it as a local varible because i use it later on, and the global counter could have been changed if the event happens in close succession. I assume that wouldn't make a difference....