can i pass a scheduled function to another behavior?
by rennie moffat · in Torque Game Builder · 02/22/2010 (9:48 pm) · 6 replies
Hi, I am wondering, can I create a schedule with a call for a function that will be set in another behavior?
so...
behaviorX::functionSomething()
{
%this.schedule(5000, passThisFunctionToAnotherBehavior);
}
:?
so...
behaviorX::functionSomething()
{
%this.schedule(5000, passThisFunctionToAnotherBehavior);
}
:?
About the author
My thanks to Garage Games and the Garage Games Community combined with owned determination I got one game up, Temple Racer and I am looking to build more interesting, fun games for the mass market of the iOS app store.
#3
would be...
$starsStar1.schedule(5000, loadStar);
me thinks.
02/22/2010 (10:24 pm)
%this.schedule(5000, loadStar);would be...
$starsStar1.schedule(5000, loadStar);
me thinks.
#4
however, this may be related or not...
I am in essence juggling 3 objects, all identical , except in name, 1, 2, 3.
when one is mounted
I pass the schedule to starsStar2, loadStar2. this works.
I then of course do the same again, so when starsStar2 is mounted...
however this does not work.
my $starsStar3 is declared as = to %this in my onBehaviorAdd just like the rest. What could be the problem?
02/22/2010 (10:51 pm)
Ok, so I have used a global call and it works, however, this may be related or not...
I am in essence juggling 3 objects, all identical , except in name, 1, 2, 3.
when one is mounted
function starsStar1Behavior::mountStar(%this)
{
%this.owner.mount($star, %this.mountX, %this.mountY, %this.mountForce, true);
$starsStar2.schedule(2000, loadStar2);
}I pass the schedule to starsStar2, loadStar2. this works.
I then of course do the same again, so when starsStar2 is mounted...
function starsStar2Behavior::mountStar(%this)
{
%this.owner.mount($star, %this.mountX, %this.mountY, %this.mountForce, true);
$starsStar3.schedule(2000, loadStar3);
}however this does not work.
my $starsStar3 is declared as = to %this in my onBehaviorAdd just like the rest. What could be the problem?
#6
02/23/2010 (1:12 am)
No, that's not normal. In fact, it is virtually impossible for a reboot to cause code to start working. I can promise you that something else caused the code to work.
Torque 3D Owner Marc Dreamora Schaerer
Gayasoft
otherwise you have to pass in the other object and alter a value on it, thats naturally possible too