Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → Why not SetThingModel?
Why not SetThingModel?
2005-10-21, 1:45 PM #1
Hi!
Somewhere in this big cutscene cog I've added a SetThingModel() to give the illusion of something being very big. But, the new model refuses to be set. Why?

Code:
# Time to dock with the Monster
#
# By Edward
symbols

message		startup
message		pulse
message		activated

thing		ISD
thing		DEST

thing		enterCam
thing		ISDPovCam
thing		DESTHoleCam
thing		DESTSideCam

thing		Ky
thing		windowView
thing		frontConsole

thing		ST1
thing		ST2
thing		ST2_WalkTo
thing		crossCam
thing		backDoor
thing		backElev

vector		ISDNextToLastFrame
vector		ISDLastFrame

vector		CrCFrame1
vector		CrCFrame2

vector		lv		local
vector		lvr		local

sound		enterISD
sound		ISDStops
sound		ISDCrash
sound		rumbles
sound		confirmClick
sound		bleep
sound		codeClicks
sound		clampOnDock1
sound		clampOnDock2
sound		clampOnDock3

sound		lockedDoor

sound		ky_Permission
sound		cc_Granted
sound		cc_Prepare
sound		cc_Mark
sound		ky_hohum
sound		ky_whoa
sound		cc_RequestCode
sound		cc_RptRequestCode
sound		ky_sorry
sound		ky_ThingsBIG

sound		ST2_Problem
sound		ST1_DoorsWelded
sound		ST2_ShouldGetTourch
sound		ST1_YeahYouGo

model		ky_Normal
model		ky_WideEyed
model		ky_Blink

model		smallerISD

keyframe	ky_StandThere
keyframe	ky_TappingConsole
keyframe	ky_LookingUp
keyframe	ky_TappingCode

keyframe	ST1_KnockDoor

int		ch1=1		local
int		ch2=2		local
int		ch3=3		local
int		ch4=4		local
int		k=-1		local

surface		skipper0	linkid=3
surface		skipper1	linkid=3
surface		skipper2	linkid=3
surface		skipper3	linkid=3
surface		skipper4	linkid=3
surface		skipper5	linkid=3

surface		blurfx4
surface		blurfx5

cog		beginplay
cog		musicstop

int		skipping=0	local

flex		i		local
int		j		local

end
#
code
startup:
	MoveToFrame(ISD, 0, 1000);
	k=PlayKey(Ky, ky_standThere, 1, 0x0);
	SetActorFlags(GetLocalPlayerThing(), 0x840000);
	if(skipping==0) { sleep(1); }
	SetFaceType(blurfx4, 0x2);
	SetFaceType(blurfx5, 0x2);
	SetCameraFocus(0, enterCam);
	SetCameraFocus(1, enterCam);
	MoveToFrame(ISD, 1, 100);
	ch1=PlaySoundLocal(enterISD, 0, 0, 0x1);
	ch4=PlaySoundThing(rumbles, ISD, 1, -1, 100, 0x81);
	ChangeSoundPitch(ch1, .5, 1);
	ChangeSoundVol(ch1, 1, 1);
	sleep(1);
	AttachThingToThing(ISDPovCam, ISD);
	ch2=PlaySoundThing(ISDStops, ISD, 1, -1, 100, 0x80);
	ChangeSoundPitch(ch2, .5, 0.05);
	MoveToFrame(ISD, 2, 1);
	if(skipping==0) { sleep(0.25); }
	ChangeSoundPitch(ch1, 0.1, 1);
	StopSound(ch1, 1);
	ch2=PlaySoundThing(ISDCrash, ISD, 1, -1, 100, 0x80);
	ChangeSoundPitch(ch2, 0.25, 0.05);
	if(skipping==0) { sleep(2); }
	SetCameraFocus(0, windowView);
	SetCameraFocus(1, Ky);
	ClearFaceType(blurfx4, 0x2);
	ClearFaceType(blurfx5, 0x2);
	if(skipping==0) { sleep(1); }
	StopKey(Ky, k, 1);
	k=-1;
	k=PlayKey(Ky, ky_TappingConsole, 1, 0x0);
	PlaySoundThing(ky_Permission, Ky, 1, -1, -1, 0x80);
	PlaySoundThing(ky_Permission, ISD, 1, -1, -1, 0x80);
	PlaySoundThing(bleep, frontConsole, 1, -1, -1, 0x80);
	print("Kyle: Um, hi. Uh, is there any space in the garage for one extra ship?");
	if(skipping==0) { sleep(GetSoundLen(ky_Permission)); }
	StopKey(Ky, k, 1);
	k=-1;
	k=PlayKey(Ky, ky_StandThere, 1, 0x0);
	MoveToFrame(ISD, 2, 1000);
	if(skipping==0) { WaitForStop(ISD); }
	PlaySoundThing(cc_Granted, frontConsole, 1, -1, -1, 0x80);
	PlaySoundThing(cc_Granted, ISD, 1, -1, -1, 0x80);
	print("C&C: Roger that, we've got all the space in the world");
	if(skipping==0) { sleep(GetSoundLen(cc_Granted)); }
	PlaySoundThing(cc_Prepare, frontConsole, 1, -1, -1, 0x80);
	PlaySoundThing(cc_Prepare, ISD, 1, -1, -1, 0x80);
	print("C&C: Please surrender control of your vessel to us on my mark.");
	if(skipping==0) { sleep(GetSoundLen(cc_Prepare)-1); }
	StopKey(Ky, k, 1);
	k=-1;
	k=PlayKey(Ky, ky_TappingConsole, 1, 0x0);
	if(skipping==0) { sleep(2); }
	PlaySoundThing(cc_Mark, frontConsole, 1, -1, -1, 0x80);
	PlaySoundThing(cc_Mark, ISD, 1, -1, -1, 0x80);
	print("C&C: Mark!");
	if(skipping==0) { sleep(1); }
	PlaySoundThing(confirmClick, frontConsole, 1, -1, -1, 0x80);
	PlaySoundThing(confirmClick, ISD, 1, -1, -1, 0x80);
	StopKey(Ky, k, 1);
	k=-1;
	k=PlayKey(Ky, ky_StandThere, 1, 0x0);
	if(skipping==0) { sleep(1); }
	SetCameraFocus(0, ISDPovCam);
	SetCameraFocus(1, ISD);
	if(skipping==0) { sleep(1); } Else { sleep(0.1); }
	for(i=.01; i<1; i=i+.01)
	{
		MoveToFrame(ISD, 3, i);
		if(skipping==0) sleep(0.01);
		AttachThingToThing(ISDPovCam, ISD);
	}
	MoveToFrame(ISD, 3, 1);
	if(skipping==0) { sleep(5); }
	SetCameraFocus(0, windowView);
	if(skipping==0) { sleep(1); } Else { sleep(0.1); }
	if(skipping==0) { PlaySoundLocal(ky_hohum, 1, 0, 0x0); }
	print("Hi ho, hi ho, this thing sure turns very slow...");
	if(skipping==0) { sleep(GetSoundLen(ky_hohum)); }
	StopKey(Ky, k, 1);
	k=-1;
	k=PlayKey(Ky, ky_TappingConsole, 1, 0x0);
	if(skipping==0) { sleep(2); }
	SetCameraFocus(0, ISDPovCam);
	if(skipping==0) { sleep(40); } Else { sleep(0.1); }
	SetCameraFocus(0, windowView);
	if(skipping==0) { sleep(2); }
	StopKey(Ky, k, 1);
	k=-1;
	k=PlayKey(Ky, ky_LookingUp, 1, 0x4);
	if(skipping==0) { sleep(GetKeyLen(ky_LookingUp)+2); }
	SetCameraFocus(0, ISDPovCam);
	if(skipping==0) { sleep(2); }
	if(skipping==0) { PlaySoundLocal(ky_whoa, 1, 0, 0x0); }
	SetThingModel(Ky, ky_WideEyed);
	print("Whoa...");
	if(skipping==0) { sleep(3); } Else { sleep(0.1); }
	SetCameraFocus(0, windowView);
	if(skipping==0) { sleep(2); } Else sleep(0.1);
	PlaySoundThing(cc_RequestCode, frontConsole, 1, -1, -1, 0x80);
	PlaySoundThing(cc_RequestCode, ISD, 1, -1, -1, 0x80);
	print("C&C: Scuse me, could you perhaps send the security clearance?");
	if(skipping==0) { sleep(GetSoundLen(cc_requestCode)+3); }
	PlaySoundThing(cc_RptRequestCode, frontConsole, 1, -1, -1, 0x80);
	PlaySoundThing(cc_RptRequestCode, ISD, 1, -1, -1, 0x80);
	print("C&C: Hello? Awake? Or are you just gazing att the marvel?");
	if(skipping==0) { sleep(2); }
	StopKey(Ky, k, 1);
	k=-1;
	k=PlayKey(Ky, ky_TappingCode, 1, 0x4);
	SetThingModel(Ky, ky_Blink);
	if(skipping==0) { sleep(1); }
	SetThingModel(Ky, ky_WideEyed);
	if(skipping==0) { sleep(.5); }
	SetThingModel(Ky, ky_Blink);
	if(skipping==0) { sleep(.5); }
	SetThingModel(Ky, ky_Normal);
	PlaySoundThing(ky_sorry, Ky, 1, -1, -1, 0x80);
	PlaySoundThing(ky_sorry, ISD, 1, -1, -1, 0x80);
	print("Kyle: Uh, sorry... Stand by to recieve.");
	for(i=0; i<8; i=i+1)
	{
		PlaySoundThing(codeClicks, frontConsole, 1, -1, -1, 0x80);
		if(skipping==0) { sleep(0.25000000+(rand()*0.50000000)); }
	}
	PlaySoundThing(confirmClick, frontConsole, 1, -1, -1, 0x80);
	if(skipping==0) { sleep(2); }
	MoveToFrame(ISD, 3, 100);
	if(skipping==0) { WaitForStop(ISD); }
	SetCameraFocus(0, ISDPovCam);
	StopKey(Ky, k, 1);
	k=-1;
	k=PlayKey(Ky, ky_StandThere, 1, 0x0);
	MoveToFrame(ISD, 4, VectorDist(GetThingPos(ISD), ISDNextToLastFrame)/10.00000000);
	if(skipping==0) { sleep(10); } Else { sleep(0.1); }
	SetCameraFocus(0, DESTSideCam);
	SetCameraFocus(1, DESTHoleCam);
	MoveToFrame(ISD, 4, VectorDist(GetThingPos(ISD), ISDNextToLastFrame)/5.00000000);
	if(skipping==0) { sleep(10); } Else { sleep(0.1); }
	
        SetThingModel(ISD, smallerISD);
    
	SetCameraFocus(0, DESTHoleCam);
	SetCameraFocus(1, ISDPovCam);
	if(skipping==0)
	{
		while(VectorDist(GetThingPos(ISD), ISDNextToLastFrame)>.1)
		{
			MoveToFrame(ISD, 4, VectorDist(GetThingPos(ISD), ISDNextToLastFrame));
			sleep(0.01);
		}
	}
	if(skipping==0) PlaySoundLocal(ky_ThingsBIG, 1, 0, 0x0);
	print("This thing's BIG!");
	WaitForStop(ISD);
	SetPulse(0.01);
	if(skipping==0) { sleep(1); }
	ChangeSoundPitch(ch4, 0.1, 10);
	StopSound(ch4, 10);
	if(skipping==0)
	{
		for(i=0.01; i<1.00; i=i+0.01)
		{
			MoveToFrame(ISD, 5, i);
			if(skipping==0) { sleep(0.01); }
		}
	}
	if(skipping==0)
	{
		while(VectorDist(GetThingPos(ISD), ISDLastFrame)>.16)
		{
			MoveToFrame(ISD, 5, 1);
			sleep(0.01);
		}
	}
	if(skipping==0)
	{
		for(i=1.00; i>0.01; i=i-0.01)
		{
			if(IsMoving(ISD))
			{
				MoveToFrame(ISD, 5, i);
				if(skipping==0) { sleep(0.01); }
			}
		}
	}
	WaitForStop(ISD);
	AttachThingToThing(ISD, DEST);
	ch1=PlaySoundThing(clampOnDock1, ISD, 0, -1, 100, 0x80);
	ch2=PlaySoundThing(clampOnDock2, ISD, 0, -1, 100, 0x80);
	ch3=PlaySoundThing(clampOnDock3, ISD, 0, -1, 100, 0x80);
	ChangeSoundPitch(ch1, .5, 0.05);
	ChangeSoundVol(ch1, 1, 0.1);
	ChangeSoundPitch(ch2, .1, 0.05);
	ChangeSoundVol(ch2, 1, 0.1);
	ChangeSoundPitch(ch3, .25, 0.05);
	ChangeSoundVol(ch3, 1, 0.1);
	if(skipping==0) { sleep(5); }
	SetCameraFocus(0, crossCam);
	SetCameraFocus(1, crossCam);
	if(skipping==0) { sleep(1); }
	AISetMoveThing(ST2, ST2_WalkTo);
	if(skipping==0) { sleep(1); }
	if(skipping==0)
	{
		while(VectorDist(GetThingPos(ST2), GetThingPos(ST2_WalkTo))>.1)
			sleep(0.01);
	}
	PlaySoundThing(ST2_Problem, ST2, 1, -1, -1, 0x80);
	print("STm: Is there a problem?");
	if(skipping==0) { sleep(GetSoundLen(ST2_Problem)); }
	PlaySoundThing(ST1_DoorsWelded, ST1, 1, -1, -1, 0x80);
	print("STfm: Yeah, the door seems to be welded shut.");
	if(skipping==0) { sleep(1); }
	PlayKey(ST1_KnockDoor, ST1, 1, 0x38);
	PlaySoundThing(lockedDoor, ST1, 1, -1, -1, 0x80);
	if(skipping==0) { sleep(GetSoundLen(ST1_DoorsWelded)-1); }
	PlaySoundThing(ST2_ShouldGetTourch, ST2, 1, -1, 100, 0x80);
	print("STm: That's odd... We should probebly get a tourch and burn ourselves in.");
	MoveToFrame(crossCam, 1, 1);
	if(skipping==0) { sleep(GetSoundLen(ST2_ShouldGetTourch)); }
	PlaySoundThing(ST1_YeahYouGo, ST1, 1, -1, 1000, 0x80);
	print("STfm: Yeah... You go get it. I'll be standing guard here...");
	if(skipping==0) { WaitForStop(crossCam); }
	StopKey(Ky, k, 1);
	AISetMoveThing(Ky, backElev);
	AISetLookPos(Ky, GetThingPos(backElev));
	if(skipping==0)
	{
		for(i=1; i<VectorDist(CrCFrame1, CrCFrame2)*2; i=i+1)
		{
			MoveToFrame(crossCam, 2, i);
			if(skipping==1) { MoveToFrame(crossCam, 2, 100); }
			AISetMoveThing(Ky, backElev);
			AISetLookPos(Ky, GetThingPos(backElev));
			sleep(0.01);
		}
		while(VectorDist(GetThingPos(crossCam), CrCFrame2)>1)
		{
			if(skipping==1) { MoveToFrame(crossCam, 2, 100); }
			AISetMoveThing(Ky, backElev);
			AISetLookPos(Ky, GetThingPos(backElev));
			sleep(0.01);
		}
		for(i=i; i>1; i=i-1)
		{
			MoveToFrame(crossCam, 2, i);
			if(skipping==1) { MoveToFrame(crossCam, 2, 100); }
			AISetMoveThing(Ky, backElev);
			AISetLookPos(Ky, GetThingPos(backElev));
			sleep(0.01);
		}
	}
	else
	{
		AISetMoveThing(Ky, backElev);
		AISetLookPos(Ky, GetThingPos(backElev));
		MoveToFrame(crossCam, 2, 100);
	}
	WaitForStop(crossCam);
	AISetMoveThing(Ky, backElev);
	AISetLookPos(Ky, GetThingPos(backElev));
	while(IsMoving(Ky))
	{
		if(VectorDist(GetThingPos(Ky), GetThingPos(backDoor))<.30)
		{
			MoveToFrame(backDoor, 1, 8);
		}
		sleep(1);
	}
	MoveToFrame(backDoor, 0, 8);
	WaitForStop(backDoor);
	SetCameraFocus(0, GetLocalPlayerThing());
	SetCameraFocus(1, GetLocalPlayerThing());
	ClearActorFlags(GetLocalPlayerThing(), 0x840000);
	SendMessage(beginplay, user0);
	SendMessage(musicstop, user0);
	AutoSaveGame();
return;
activated:
	if(GetSenderID()!=3) return;
	if(skipping!=0) return;
	skipping=1;
	print(">>>>SKIPPING>>>>");
	j=1;
	SetPulse(0.01);
return;
pulse:
	if(skipping==1)
	{
		MoveToFrame(ISD, GetCurFrame(ISD)+1,j);
		j=j+1;
		AISetMoveThing(Ky, backElev);
		AISetLookPos(Ky, GetThingPos(backElev));
	}
	lv=VectorSub(GetThingPos(DESTHoleCam), GetThingPos(ISD));
	lvr=VectorSet(-VectorX(lv), -VectorY(lv), -VectorZ(lv));
	SetThingLook(DESTHoleCam, lvr);
return;
end


The SetThingModel is highlighted in red. You'll find it. And please help! Why won't it set new model? Thanks.

/Edward
Edward's Cognative Hazards
2005-10-22, 8:47 PM #2
Frankly I don't have a clue why it shouldn't work. Instead of directly referencing ISD try referencing another variable that gets the ISD thing's reference/ID. Also I don't like your use of if and else statements, put {} brackets to clean things up.
2005-10-23, 3:35 AM #3
try referencing another variable that gets the ISD thing's reference/ID? Hm... Not sure how to do that...

Hang on... I'm looking at this in JED now. I selected it, and now I got myself a
Warning: D3DRMERR_BADVALUE in ThingtoMesh when adding group
I resized this ISD through Joke. Why not in JED was because this is a GoZ model in which if I resized it in JED there would be invalid things that would turn it into a DFLT box. Could this have anything to do with it?

PS. I decided to replace the object in JED and test it. I got DFLT box now. What program should I use to resize a GoZ ISD model?

/Edward
Edward's Cognative Hazards
2005-10-23, 4:03 PM #4
For the referencing, declare a variable: int refID. Then define the variable, refID = GetThingSignature(ISD); and pass that instead of ISD.

If it was the 3do, I would think that the model would have turned into the dflt box.
2005-10-23, 4:09 PM #5
Use JOKE to resize it, then import it into JED and reexport it. (JOKE messes something up in the 3do file, but a simple import/export from JED will fix it.)
Sam: "Sir we can't call it 'The Enterprise'"
Jack: "Why not!"
2005-10-24, 8:25 AM #6
Originally posted by SG-fan:
Use JOKE to resize it, then import it into JED and reexport it. (JOKE messes something up in the 3do file, but a simple import/export from JED will fix it.)


OK. Into Joke, resize, save. Into JED, and export. Result: no problems in JED, but not visable in JK! Well, at least the SetThingModel works. The ship becomes invisable at the right moment. Which is not what I want! I should be seeing a pixel or 4 out of place, but I don't.

/me kills
Edward's Cognative Hazards
2005-10-24, 9:20 AM #7
Originally posted by Edward:
PS. I decided to replace the object in JED and test it. I got DFLT box now. What program should I use to resize a GoZ ISD model?

/Edward


GoZ's models, while detailed and 'pretty' for the use in the days of yor, were built using the traditional modeling practice of the time. This practice is not good for where JK is now (nor is it good for more current games). I've had lots of problems with GoZ's models in the past, so I stopped using them altogether.

You'd seriously would be better off to recreate the 3do then to use GoZ's (unless you have the time and patience to modify GoZ's such that the meshes don't overlap each other).
"The solution is simple."

↑ Up to the top!