LuaTT Function [message #490814] |
Wed, 10 June 2015 07:03 |
|
[-HOH-]szymek777
Messages: 45 Registered: June 2013 Location: Poland
Karma: 0
|
Recruit |
|
|
Can anyone tell me which function checks distance from PT. I need it for buying weapons in PT via commands
|
|
|
Re: LuaTT Function [message #490815 is a reply to message #490814] |
Wed, 10 June 2015 13:17 |
|
sla.ro(master)
Messages: 610 Registered: September 2010 Location: Romania
Karma: 0
|
Colonel |
|
|
Hello, I don't remember any function who could've done that, but you can manually check. For example:
function Get_Closest_PT(pObject) -- not tested, it should work I guess, don't forget to replace 'PT_Name_Here' with PT's name from Leveleditor. Every team have a different PT name.
local closest = 1000
for i,v in ipairs(Get_All_Objects()) do
if Get_Preset_Name == "PT_Name_Here" and Get_Distance(Get_Position(pObject), Get_Position(v)) < closest then
closest=Get_Distance(Get_Position(pObject), Get_Position(v))
end
end
return closest
end
I'm not sure if this works, haven't tested, you can tweak it to make it work. if the function already exists in TT/4.2, I will add it, but can't this month, I'm busy learning for my final exam.
Creator of Mutant Co-Op
Developer of LuaTT
|
|
|
|