Programming & Scripting

View unanswered posts | View active topics


Post a new topicPost a reply
Previous topic | Next topic 

User avatar   Beginner BeginnerMember since: 19.06.2012, 19:38Posts: 59 Likes: 0
 

 Post Topic: [help] Register TacticalPointQuery
PostPosted 27.06.2012, 19:33 
Hi,
I am a beginner on both Lua script and TPS, and feel a little confused when going through the official documentation and the example files in TPS folder.

There are two different methods for registering TacticalPointQuery, what is the difference between them?

1) Call AI.RegisterTacticalPointQuery inside OnInit() function:
Code:
AI.TacticalPositionManager.Grunt = AI.TacticalPositionManager.Grunt or {};
function AI.TacticalPositionManager.Grunt:OnInit()
       ...
end

2) Directly create a "AI.RegisterTacticalPointQuery" function call in lua file:
Code:
Game\Scripts\AI\TPS/CivilianQueries.lua


Thank you for any help!

/ed

User avatar   Hardcore Modder Hardcore ModderMember since: 11.10.2011, 18:41Posts: 903Location: Germany Likes: 10
 

 Post Topic: Re: [help] Register TacticalPointQuery
PostPosted 28.06.2012, 09:24 
Hi,

well the difference is the way of how these functions are called. When AI.RegisterTacticalPointQuery is outside of a function (in this case OnInit) its called right after the lua script is executed. The ones inside an OnInit function are only called by the TPS manager when his OnInit method got called. So basically it does not really matter...they all get loaded. I usually prefer the non-function way (like CivilianQueries.lua).

so long,
Oliver
User avatar   Beginner BeginnerMember since: 19.06.2012, 19:38Posts: 59 Likes: 0
 

 Post Topic: Re: [help] Register TacticalPointQuery
PostPosted 28.06.2012, 18:18 
Thank you for the reply! Indeed, both of them can be loaded correctly when initializing Initialising TPS. There is also no limited scope when using the first method, and the only benefit is showing the table name in logs when registering.