JonBons
Aug 15 2011, 18:04
My goal is to compare the type of an object and if it is of "Tank" then it selects the vector with the position.
I'm just having trouble applying the new syntax and some of the things I'm used to being able to do easily in the Lua scripting language.
I have an array set up like this
_CustomAttach = [
["Car", [0,1.2,-1.8]],
["Truck", [0,1.8,-2]],
["Wheeled_APC", [0,2.6,-2]],
["Tank", [0,2.8,-2]],
["Tracked_APC", [0,2,-2.4]]
];
In the Lua scripting language you could just do this:
local _CustomAttach = {}
_CustomAttach["Tank"] = Vector(0,2.8,-2)
_CustomAttach["Truck"] = Vector(0,1.8,-2)
And then to select you could do this:
local entClass = ent:GetClass()
if not _CustomAttach[entClass] then return; end
local attachToPos = _CustomAttach[entClass]
I'm just having trouble applying the new syntax and some of the things I'm used to being able to do easily in the Lua scripting language.
I have an array set up like this
_CustomAttach = [
["Car", [0,1.2,-1.8]],
["Truck", [0,1.8,-2]],
["Wheeled_APC", [0,2.6,-2]],
["Tank", [0,2.8,-2]],
["Tracked_APC", [0,2,-2.4]]
];
In the Lua scripting language you could just do this:
local _CustomAttach = {}
_CustomAttach["Tank"] = Vector(0,2.8,-2)
_CustomAttach["Truck"] = Vector(0,1.8,-2)
And then to select you could do this:
local entClass = ent:GetClass()
if not _CustomAttach[entClass] then return; end
local attachToPos = _CustomAttach[entClass]