Game Development Community

Script ::onAdd()

by Ron Yacketta · in Torque Game Engine · 08/07/2003 (10:18 am) · 5 replies

I just noticed a little oddity and was wondering if this is FAD (Functioning As Designed)

I added a errof() at the beginning of an ::create and a subsequent ::onAdd and noticed this

::create
::onAdd()
::onAdd()

why if blue blazes is ::onAdd being called twice???

-Ron

#1
02/02/2004 (6:23 am)
I *think* that this is the onAdd()-code of the object's parent object that you see here, hence the two calls. They are still two different functions though.
#2
02/02/2004 (6:28 am)
Yes... depends on where you put the errorf but Josef is hopefully right. :)
#3
02/07/2004 (3:24 am)
Not only that but onAdd is called server and client side. If you weren't joining a server then that would be the reason for the second call.
#4
02/07/2004 (4:55 am)
Yeah, I discovered that after many headaches. The first one would be server, the second client.
#5
02/07/2004 (6:11 am)
I agree with Robert, happens also when you just fire up TGE and run a mission from your local computer. In essense that is a local client connecting to a loacal server which calls onAdd() twice.

Same goes of onSleep()

-Ron