Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » LuaTT Function
LuaTT Function [message #490814] Wed, 10 June 2015 07:03 Go to next message
[-HOH-]szymek777 is currently offline  [-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 Go to previous messageGo to next message
sla.ro(master) is currently offline  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
Re: LuaTT Function [message #490816 is a reply to message #490814] Wed, 10 June 2015 14:29 Go to previous message
[-HOH-]szymek777 is currently offline  [-HOH-]szymek777
Messages: 45
Registered: June 2013
Location: Poland
Karma: 0
Recruit
OK thanks i'll try to make this work
Previous Topic: Notes on lighting/vertex solve features in scripts 4.x
Next Topic: Capturable buildings
Goto Forum:
  


Current Time: Wed Dec 18 01:23:12 MST 2024

Total time taken to generate the page: 0.01114 seconds