Game Development Community

DragonTemplate not showing in Spawn Point Behaviour

by Matt Van Gorkom · in TGB Platformer Kit · 03/12/2008 (7:01 pm) · 8 replies

At last! A platformer starter kit! YES! Now my plans for world domination will at long last come to fruition!

However, I've run into a snag. I've been going through the demo level tutorial and have arrived at the point where we create the player. The first method of creating the player works fine. The second, using the SpawnPoint behaviour and setting "TargetObject" to "DragonTemplate", does not work. "DragonTemplate" does not show up in the behaviour's menu. "DragonTemplate" does, however, show under the "Scripting" tab in the "Config Datablock" pulldown.

This is also the case with the PlatformerDemo which works until the "SpawnPoint" behaviour is touched. The "DragonTemplate" is not there and only "None" is selectable. Then the player will no longer spawn.

I'm not sure what I'm doing wrong but I'd like some help. I am truly excited about this starter kit. It's my birthday present to me! I'm so happy!

#1
03/12/2008 (9:07 pm)
Happy birthday!

What you are experiencing is a fault on my behalf. When I wrote the tutorial, I didn't use the project as a resource, I had everything loaded into the managed datablockset, but lets not go there.

What the problem is, is TGB's Behaviors have a hard time recognising resource datablocks. To correct this, you can have to add the "DragonTemplate" to the managed datablock set.

Open up the "game/gamescripts/datablocks.cs" file and add these lines of code to the bottom of the file:
if ($managedDatablockSet.isMember(DragonTemplate)) $managedDatablockSet.remove(DragonTemplate);
if ($managedDatablockSet.isMember(DragonTemplate)) $managedDatablockSet.remove(DrillTemplate);
if ($managedDatablockSet.isMember(DragonTemplate)) $managedDatablockSet.remove(PepperTemplate);

$managedDatablockSet.add(DragonTemplate);
$managedDatablockSet.add(DrillTemplate);
$managedDatablockSet.add(PepperTemplate);

This should do it.

You may also encounter a problem with the falling platform section, another flaw in TGB's ability to load resources.

Open up the "game/behaviors/FallingPlatformBehavior.cs" file and replace the following lines:

// Replace
    %template.addBehaviorField( FallAnimation, "Animation played while falling", OBJECT, "", t2dAnimationDatablock);
    %template.addBehaviorField( RecoverAnimation,  "Animation played while recovering", OBJECT, "", t2dAnimationDatablock);

// With
    %template.addBehaviorField( FallAnimation, "Animation played while falling", DEFAULT, "");
    %template.addBehaviorField( RecoverAnimation,  "Animation played while recovering", DEFAULT, "");

Behaviors will load datablocks from the managed set, but not resources. When this little problem is fixed, you'll be able to put those lines back in, but for now just remove the OBJECT property from the behavior.

Once you do all this, close down TGB and reload it.

If you have any problems, let me know.
#2
03/13/2008 (1:09 pm)
Yup, that fixed it. Thank you.
#3
03/16/2009 (6:21 pm)
Awesome, thanks. I was having the same problem.
#4
01/06/2010 (4:12 am)
I tried this fix.. However when i go and hit "play" the actor does not appear.. Help.. Im stumped on this and have no idea how to fix
#5
06/05/2010 (5:20 pm)
Yep I tried it too, but It doesn't work. With this fix I still not see the TargetObject class for my spawnpoint.
I tried in the platformerdemo too, and I can't change any targetObject :/

Is it anything else that we can do because I cant work on my project, and it's not possible to realize the tutorial... An important thing is missing.

--> I succeed to have my TargetObject class by adding it manually in the level.t2d (game/data/Levels/levelname.t2d) but it's still not appear in TGB.
But it's a little bit boring to this like that. We have chance to have a nice Game Editor, and I think it's sad to not use it for this.
#6
06/06/2010 (1:14 am)
Cedric, do you own licenses for TGB and the PSK?
#7
09/01/2010 (8:59 am)
I'm also experiencing this problem. I added the codes at the bottom of the file game.cs but the only template that shows is the peppertemplate.
#8
09/01/2010 (9:30 pm)
Leonard, if you own a license for TGB and the PSK you can repost your question in the PSK private forum.