Home Tutorials Download Beta Store Forum Documentation KnowledgeBase Wiki Blog

ShiVa3D

Return to Game programming

Tagged Objects

All about the StoneScript

Tagged Objects

Postby rusty » 20 Oct 2011, 20:12

Hi... For some reason I can't get a tagged object!

Yesterday I seemed to solve the issue by restarting the editor. Now i'm getting a nil variable.

I've tried both these methods:
Code: Select all
this.hBall( application.getCurrentUserSceneTaggedObject("ball") )


and

Code: Select all
local hScene = application.getCurrentUserScene ( )
this.hBall( scene.getTaggedObject ( hScene, "ball" ) )



before trying to use it in this:

Code: Select all
local x, y, z = object.getTranslation(this.hBall(), object.kGlobalSpace )


I've even used the first variation in that...


This is only my second day so it's probably linking the AI to the scene or similar, but it's getting called... so?
rusty
Expert Boarder
Expert Boarder
 
Posts: 106

Re: Tagged Objects

Postby rusty » 20 Oct 2011, 23:40

I think my issue is to do with scene loading, reloading and AI initialisation...

More tests...
rusty
Expert Boarder
Expert Boarder
 
Posts: 106

Re: Tagged Objects

Postby RedQueen » 20 Oct 2011, 23:45

What you coded should work. I don't see why it is returning nil. I could look at your file if you want.
RedQueen
Platinum Boarder
Platinum Boarder
 
Posts: 328

Re: Tagged Objects

Postby rusty » 21 Oct 2011, 19:45

I think my issue is similar to this:
http://www.stonetrip.com/developer/forum/viewtopic.php?f=13&t=24351&sid=9ecc119aaa8ac326e46e13c13ef19c2d


Basically I used log.message() to indicate when AI's start running and they all (except object AI's) start running straight away...

I seem to have solved it in another test, even though I haven't even tried states yet, even though i'm using a variable as a state... probably wrong (ish) but it's doing the job for now.


Can anyone point me towards a good tutorial on using states please?
rusty
Expert Boarder
Expert Boarder
 
Posts: 106


Return to Game programming