Jump to content

Bug or not Bug ? whith GetTarget LE2.5


Gabriel
 Share

Recommended Posts

Hello

 

 

I have few object in my scene, and i link the Horse1 with Horse2 with Link(0)

 

I try with this code and the responce stay the same "not linked" :%

 

 

 

function class:CreateObject(model)
....
for n=0,7 do
chemin = model:GetTarget(n)
if chemin == nil then
	Notify("Not Linked")
else
	Notify(";-)")
end
end
....

 

the responce stay the the same :-) Not Linked,Not Linked,Not Linked,Not Linked,Not Linked,Not Linked,Not Linked

 

Please Help me ;-)

 

Gabriel

post-4049-0-57791900-1320283929_thumb.png

Link to comment
Share on other sites

the target is not set immediately after creation of the class... if you create the local object and then place the code inside an object function like 'object:UnlockKeys()' that would normally get called automatically, it would work...

 

but thats just a guess on what is happening because you are apparently removing code from the script, so it is hard to guess... also your explanation is confusing... if it finds the link in any of the possible 8 available targets, it should return ;-)

 

and you said this is what it returns:

:-) Not Linked,Not Linked,Not Linked,Not Linked,Not Linked,Not Linked,Not Linked

which is correct... the '0' link returns ;-) and the other 7 that have no targets return 'Not Linked'

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

the target is not set immediately after creation of the class... if you create the local object and then place the code inside an object function like 'object:UnlockKeys()' that would normally get called automatically, it would work...

 

but thats just a guess on what is happening because you are apparently removing code from the script, so it is hard to guess... also your explanation is confusing... if it finds the link in any of the possible 8 available targets, it should return ;-)

 

and you said this is what it returns:

 

which is correct... the '0' link returns ;-) and the other 7 that have no targets return 'Not Linked'

 

Hi macklebee

 

Oup you are right, the smilies was ironic, but you guessed it.

The application does not find the links and then goes 8 times by the MessageBox ("pfff").

 

I tried your solution, if you are right then I think the event "UnlockKey" come too soon!

 

In the tutorial, I see that using this method in an event "Update", so I do have'm also without success :-(

 

To overcome this problem, I try another method "GetChild" which works perfectly in "C / C + +" because I instantiate the object "scene".

example:

TEntity LoadScene scene = ("abstract:: test.sbx");
Entity = cheval1 FindChild (scene, "ch1"); "

 

But in Lua in my model, I do not know how to have access to the object "scene", I even assumed that the parent object was the scene, but in return I have a nice access violation: - (

 

Is there an event for the end of the creation of the scene?

 

If you have an idea it is welcome.

Link to comment
Share on other sites

this works for me when i link to another object...

 

require("scripts/class")
local class=CreateClass(...)

function class:CreateObject(model)
       local object=self.super:CreateObject(model)

function object:UnlockKeys()
	for n=0,7 do
		chemin = model:GetTarget(n)
		if chemin == nil then
		else
			Notify(";-)")
		end
	end
end

end

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

Hi macklebee

 

It works great :huh:,

 

But I thought it would give me the "TEntity" with GetTarget function :-( i think it gives me the "TModel", type(GetTarget(0)) return "userdata"

 

could you tell me how to retrieve the object "TSurface" starting from a model?

 

Thank you for your invaluable help, Gabriel

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...