PDA

View Full Version : The Ugnaut won't stand up!



Edward
03-13-2003, 02:03 PM
Hi!
I would like it if you could have a look at a code for me and tell me why my Ugnaut won't stand up once I StopKey!


# Ugnaut reads and sings
#
# By Edward
symbols

message startup

thing ug
thing t8

keyframe sit

thing lights
thing camera

thing door

thing officer

thing door2
thing droid2

sound UgSing
sound t8GetToWork
sound UgOK

int inturupt=1 local

model book
model normal

end
#
code
startup:
ThingLight(lights,0,0.01);
SetThingModel(ug,book);
PlayKey(ug,sit,1,0x000);
SetActorFlags(GetLocalPlayerThing(),0xA00000);
SetCurrentCamera(0);
SetCameraFocus(0,camera);
sleep(2);
ThingLight(lights,0.25,3);
MoveToFrame(camera,1,1);
PlaySoundLocal(UgSing,1,0,0xC0);
sleep(GetSoundLen(UgSing)+1);
inturupt=PlaySoundLocal(UgSing,1,0,0xC0);
sleep(3);
StopSound(inturupt,1);
MoveToFrame(door,1,8);
ThingLight(lights,5,1);
WaitForStop(door);
PlaySoundLocal(t8GetToWork,1,0,0xC0);
Print("t8: Ugnaut 4145, you have work to do at sector 1414.");
sleep(Getsoundlen(t8GetToWork));
StopKey(ug,sit,0.1);
PlaySoundLocal(UgOK,1,0,0xc0);
SetThingModel(ug,normal);
Print("Uggy: OK...");
sleep(GetSoundLen(UgOK));
AISetLookPos(ug,GetThingPos(GetLocalPlayerThing()) );
AISetMovePos(ug,GetThingPos(GetLocalPlayerThing()) );
sleep(2);
AISetMovePos(ug,GetThingPos(camera));
AISetMovePos(t8,GetThingPos(officer));
SetCameraFocus(0,GetLocalPlayerThing());
ClearActorFlags(GetLocalPlayerThing(),0xA00000);
MoveToFrame(door,0,8);
sleep(1);
MoveToFrame(door2,1,8);
WaitForStop(door2);
AISetMoveFrame(droid2,1);
AISetLookPos(droid2,GetThingPos(officer));
sleep(2);
AISetMoveFrame(droid2,2);
sleep(1);
MoveToFrame(door2,0,8);
return;
end

He sings, the t8 comes and says WORK! Then the Ugnaut is supposed to get up and say OK... and walk off. Now the OK is fine, the moving to the door is fine, but the Ugnaut remains sitting. This really becomes a problem for when he comes in another door. To see him slide in on his butt doesn't really give the level good quallity.
The template:

# DESC: Ugnaut Sitting
# BBOX: -.035186 -.01745 -.100835 .035171 .022972 .063971
ug2sit _civilian thingflags=0x20000400 model3d=u2altx.3do puppet=ky.pup size=0.064000 movesize=0.064000 soundclass=ug.snd cog=actor_ug.cog mass=60.000000 maxvel=0.400000 health=1000.00 maxthrust=0.50 maxrotthrust=60.00 aiclass=peddefault.ai

and the ky.pup:


# puppet control file for ugnaut

Mode=0
stand ugidle.key 0x00 0 0 # 0 = Standing
walk ugwalk.key 0x01 2 2 # 1 = Walking
run ugrun.key 0x01 2 2 # 2 = Running
walkback ugwalk.key 0x01 2 2 # 3 = walk backwards
strafeleft ugwalk.key 0x01 2 2 # 4 = strafe left
straferight ugwalk.key 0x01 2 2 # 5 = strafe right
death ugdie.key 0x14 5 5 # 6 = death 1
death2 ugdie.key 0x14 5 5 # 7 = death 2
fire ughita.key 0x28 1 3 #
fire2 ughitb.key 0x28 1 3 #
hit ughit.key 0x28 1 4 # 9 = hit
rising ugfall.key 0x00 2 2 # 10 = jump
drop ugfall.key 0x00 2 2 # 11 = drop
fall ugfall.key 0x00 2 2 # 12 = fall
activate uguse.key 0x28 1 3 #

Mode=1, basedon=0

Mode=3, basedon=0
stand ugfall.key 0x00 0 0
walk ugfall.key 0x00 2 2
run ugfall.key 0x00 2 2
walkback ugfall.key 0x00 2 2
strafeleft ugfall.key 0x00 2 2
straferight ugfall.key 0x00 2 2
rising ugfall.key 0x00 2 2

Mode=4, basedon=3



/Edward

Edward
03-14-2003, 04:57 AM
Hello? Any one out there?

/Edward

Tazz
03-14-2003, 01:32 PM
The code looks fine to me, I'd say the best thing you could do it create another standing Ug at a ghost position, and delete the old one. If you can fix it, it's almost always best to work around it.

*edit*

You may want to check the syntax for the StopKey() verb, and also see how it is used in other cogs. I think they set it as a variable to use it ie key = StopKey(ug, sit, .1) --but I could be wrong.

------------------
-There are easier things in life than finding a good woman, like nailing Jello to a tree, for instance

-Tazz

[This message has been edited by Tazz (edited March 14, 2003).]

Sabre_Wulf
03-14-2003, 04:41 PM
Your PlayKey() and StopKey's are messed up.

When you use PlayKey, instead of using the variable name for the keyframe, you take your PlayKey command and assign IT to a variable. Like this...

UgSit = PlayKey(ug,sit,1,0x000);
then after that you use StopKey like this:

StopKey(ug, UgSit, 0.1);


You took your variable name for the keyframe...

keyframe sit
(SIT is what you used)
Instead of assigning the PlayKey command to a variable and using THAT.


here's your new code....




# Ugnaut reads and sings
#
# By Edward
symbols
message startup
thing ug
thing t8
keyframe sit
thing lights
thing camera
thing door
thing officer
thing door2
thing droid2
sound UgSing
sound t8GetToWork
sound UgOK
int inturupt=1 local
model book
model normal
end
#
code
startup:
ThingLight(lights,0,0.01);
SetThingModel(ug,book);
UgSit = PlayKey(ug,sit,1,0x000);
SetActorFlags(GetLocalPlayerThing(),0xA00000);
SetCurrentCamera(0);
SetCameraFocus(0,camera);
sleep(2);
ThingLight(lights,0.25,3);
MoveToFrame(camera,1,1);
PlaySoundLocal(UgSing,1,0,0xC0);
sleep(GetSoundLen(UgSing)+1);
inturupt=PlaySoundLocal(UgSing,1,0,0xC0);
sleep(3);
StopSound(inturupt,1);
MoveToFrame(door,1,8);
ThingLight(lights,5,1);
WaitForStop(door);
PlaySoundLocal(t8GetToWork,1,0,0xC0);
Print("t8: Ugnaut 4145, you have work to do at sector 1414.");
sleep(Getsoundlen(t8GetToWork));
StopKey(ug,UgSit,0.1);
PlaySoundLocal(UgOK,1,0,0xc0);
SetThingModel(ug,normal);
Print("Uggy: OK...");
sleep(GetSoundLen(UgOK));
AISetLookPos(ug,GetThingPos(GetLocalPlayerThing()) );
AISetMovePos(ug,GetThingPos(GetLocalPlayerThing()) );
sleep(2);
AISetMovePos(ug,GetThingPos(camera));
AISetMovePos(t8,GetThingPos(officer));
SetCameraFocus(0,GetLocalPlayerThing());
ClearActorFlags(GetLocalPlayerThing(),0xA00000);
MoveToFrame(door,0,8);
sleep(1);
MoveToFrame(door2,1,8);
WaitForStop(door2);
AISetMoveFrame(droid2,1);
AISetLookPos(droid2,GetThingPos(officer));
sleep(2);
AISetMoveFrame(droid2,2);
sleep(1);
MoveToFrame(door2,0,8);
return;
end


------------------

Edward
03-15-2003, 04:00 AM
Funny... In another COG I use StopKey(thing,keyfile,.1) and it was OK! The Ugnaut slid in on his but, got up to fix something, then I stopped that key with what you see and he remains sitting. Oh well, I'll try your sug.s.

/Edward

Edward
03-15-2003, 05:53 AM
OK! That worked. My ugnaut is "behaving"! THANKS!

/Edward

zagibu
03-15-2003, 06:57 AM
You should give people more than a day to reply to your threads.You can bring it up again after two days, when it's out of the standard topic list, but not any earlier, ok?

------------------
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)