Hiding the initial spawn and delaying AI's
by Andy Hawkins · in Torque Game Engine · 10/26/2006 (7:33 am) · 9 replies
1. When my skeletons spawn, I want some of them to climb out of the ground. I have created an animation called "climbUp" which does this, but when I spawn the skeleton it appears showing the root pose or frame 0 or something as in pic A and a few frames later it changes to the climbup anim pic B. I want to hide this initial state, so the skeleton spawns using the climbup anim when it is first seen. At the moment it appears standing on the ground for a second then runs the climbup anim. Can this be done in script? Can I hide some frames or something? I would prefer it to be in script so people who use this mission don't need to mod their source. I've shown the code where I set the anims.
2. Also when my avatar eventually spawns into the game, the skeletons on a path sometimes have already started and are part way round already. How can I delay the AI's until I have spawned into the game?
[plug]
PS. These pics show some of the objects I've made as part of the Skeleton Pack upgrade (coming soon) if you were wondering.
[/plug] ;-)
Pic A

Pic B

Code

2. Also when my avatar eventually spawns into the game, the skeletons on a path sometimes have already started and are part way round already. How can I delay the AI's until I have spawned into the game?
[plug]
PS. These pics show some of the objects I've made as part of the Skeleton Pack upgrade (coming soon) if you were wondering.
[/plug] ;-)
Pic A

Pic B

Code

#2
10/26/2006 (10:04 am)
The best place actually to 'activate' your spawns would be (on the server) GameConnection::onClientEnterGame(); I'd kick off a short schedule (maybe 2 sec) to give the player a chance to get oriented, then start your skellie spawns.
#3
10/26/2006 (10:05 am)
I'm not sure you will be able to get the effect you want without going into the source, Andy. I could very well be wrong, but script is only updated so much. There might be a few milliseconds between your spawn and the next update.
#4
@Stephen - I'll check it out, thanks.
@Stefan - that's what i'm thinking. Maybe I could hide the character at root pose by offseting the pivot???
Problem is if I mod the root pose, then I have manually manage the idle pose right?
10/26/2006 (3:45 pm)
@Caleb - send me an email as a reminder - I'll tell you what I know rather than go off topic on this thread.@Stephen - I'll check it out, thanks.
@Stefan - that's what i'm thinking. Maybe I could hide the character at root pose by offseting the pivot???
Problem is if I mod the root pose, then I have manually manage the idle pose right?
#5
10/26/2006 (3:59 pm)
Sounds hacky. I would try and just make an exception in Player::onAdd just after it has been added to the scene, before the initialUpdate is being sent to the client. Much like the current Root/Idle animations are dealt with, I think.
#6
From what I can tell, after running the code below, it's spawning the player in the Da Vinci pose I have as the models original pose without bones affecting it then blends to frame 0 of the root anim, then it starts the climbup anim.
10/26/2006 (7:44 pm)
I tried adding this onAdd to the script but if I chose %obj.playThread(0,"climbup"); it crashes TGE and if I use %this.playThread(0,"climbup"); it says "unknown command" in the console.log.datablock PlayerData(DemoPlayer : PlayerSkeletonWithFireball)
{
shootingDelay = 100;
};
function DemoPlayer::onAdd(%this, %obj)
{
%obj.playThread(0,"climbup");
}From what I can tell, after running the code below, it's spawning the player in the Da Vinci pose I have as the models original pose without bones affecting it then blends to frame 0 of the root anim, then it starts the climbup anim.
// Create the demo player object
%player = new AIPlayer() {
dataBlock = DemoPlayer;
...
scale = "1.3 1.3 1.3";
};
MissionCleanup.add(%player);
%player.playThread(0,"climbup");
#7
10/28/2006 (8:59 pm)
To avoid modding the engine, I'm going to try spawning them miles away, and let them do their init stuff. Then after a few seconds I'll move them back to the spawn I intended them to start from - their animations should have resolved by then.
#8
10/30/2006 (1:17 am)
Grrr.. When I do this, for a split second the skeleton falls into the climbup position so you see it fall into place. This is annoying - how can I stop the "fall into play / morph to the anim I actually want" behaviour?
#9
@Caleb - I'll send you an email now.
11/02/2006 (12:39 am)
Well I got it to work. I created out-of-mission spawn points, to let the anims do their startup, then I shift the skelly's to a spawn point just above the terrain (probably put it in a dump mound on release) and the skelly's climb out the ground. Cool!!!!!@Caleb - I'll send you an email now.
Torque Owner Caleb
Default Studio Name
P.S. I noticed this in your code, "fov = $AI_PLAYER_FOV;", do you have a field of view setup in your game?
If so, I would like to know how you did this, if you used a resource for it, could you please show me where?