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 → One problem solved, another comes, and one is yet unanswered.
One problem solved, another comes, and one is yet unanswered.
2004-06-13, 11:49 AM #1
Hi!
I have here an unfinnished code, so much unused, so I can't use Parsec on it.
Code:
# WAZZUUUUUUUUUUUUUUUUUUUUUUUUP!
#
# By Edward
symbols

message		startup
message		pulse

thing		ug
thing		zup1
thing		zup2
thing		zup3
thing		aahz

thing		ugcam
thing		ugcampiv
thing		zup1cam
thing		zup2cam
thing		zup2cam2
thing		zup3cam
thing		aahzcam

thing		tvlight
thing		backlight1
thing		backlight2

surface		callswitch1
surface		callswitch2

surface		tv

model		bottlezup2
model		phonezup2
model		bottlezup3
model		phonezup3
model		bottleug
model		phoneug
model		bottleandphonezup2

keyframe	ug_chillin
keyframe	ug_takephone
keyframe	ug_phone
keyframe	ug_WAZZUP1
keyframe	ug_WAZZUP2
keyframe	ug_WAZZUP3
keyframe	ug_saywhat

keyframe	zup1_chillinphone

keyframe	zup2_enter
keyframe	zup2_walk
keyframe	zup2_takephone
keyframe	zup2_phone
keyframe	zup2_phoneWAZZUP
keyframe	zup2_walkphone
keyframe	zup2_takecall
keyframe	zup2_call
keyframe	zup2_callWAZZUP
keyframe	zup2_letin

keyframe	zup3_chillin
keyframe	zup3_takephone
keyframe	zup3_phone
keyframe	zup3_phoneWAZZUP

keyframe	aahz_WAZZUP

sound		ug_hello
sound		ug_watsup
sound		ug_game
sound		ug_true
sound		ug_WAZZUP
sound		ug_pickupphone
sound		ug_AAAAAA
sound		ug_que

sound		zup1_watsup
sound		zup1_game
sound		zup1_who
sound		zup1_WAZZUP
sound		zup1_ehduke
sound		zup1_AAAAAA
sound		zup1_bud

sound		zup2_WAZZUP
sound		zup2_yo
sound		zup2_wheresduke
sound		zup2_AAAAAA
sound		zup2_hangon

sound		zup3_yo
sound		zup3_WAZZUP
sound		zup3_AAAAAA

sound		aahz_WAZZUP1
sound		aahz_AAAAAA1
sound		aahz_WAZZUP2
sound		aahz_AAAAAA2

sound		phonerings
sound		phoneclickup
sound		phoneclickdown
sound		callerbeep
sound		callerclick1
sound		callerclick2

sound		saberfighting0
sound		saberfighting1
sound		saberfighting2
sound		saberfighting3
sound		saberfighting4
sound		saberfighting5
sound		saberfighting6
sound		saberfighting7
sound		saberfighting8
sound		saberfighting9
sound		saberfighting10
sound		saberfighting11
sound		saberfighting12
sound		saberfighting13
sound		saberfighting14
sound		saberfighting15
sound		saberfighting16
sound		saberfighting17
sound		saberfighting18

material	ugsface
material	zup1sface
material	zup2sface
material	zup3sface

int		ugk=-1			local
int		zup1k=-1		local
int		zup2k=-1		local
int		zup3k=-1		local
int		aahzk=-1		local
int		ugface=0		local
int		zup1face=0		local
int		zup2face=0		local
int		zup3face=0		local
int		aahzface=0		local
int		ugaaa=1			local
int		zup1aaa=2		local
int		zup2aaa=3		local
int		zup3aaa=4		local
int		aahzaaa=5		local

end
#
code
startup:
	SetActorFlags(GetLocalPlayerThing(),0x800000);
	SetCurrentCamera(0);
	SetCameraFocus(0,ugcam);
	AttachThingToThing(ugcam,ugcampiv);
	sleep(1);
	ugk=PlayKey(ug,ug_chillin,1,0x0);
	zup1k=PlayKey(zup1,zup1_chillinphone,1,0x0);
	SetThingRotVel(ugcampiv,'0 90 3');
	SetThingModel(zup3,bottlezup3);
	sleep(1);
	StopThing(ugcampiv);
	ThingLight(tvlight,.1,1);
	ThingLight(backlight1,1,1);
	ThingLight(backlight2,1,1);
	SetThingRotVel(ugcampiv,'0 -30 -1');
	sleep(1);
	SetPulse(0.1);
	sleep(2);
	StopThing(ugcampiv);
	sleep(1);
	PlaySoundLocal(phonerings,1,0,0x0);
	sleep(1);
	StopKey(ug,ugk,1);
	ugk=PlayKey(ug,ug_takephone,1,0x4);
	sleep(GetKeyLen(ug_takephone)/2.00000000);
	SetThingModel(ug,phoneug);
	PlaySoundLocal(phonerings,1,0,0x0);
	sleep(GetKeyLen(ug_takephone)/2.00000000);
	StopKey(ug,ugk,1);
	ugk=PlayKey(ug,ug_phone,1,0x0);
	PlaySoundLocal(ug_hello,1,0,0x0);
	ugface=1;
	print("Hello?");
	sleep(GetSoundLen(ug_hello));
	ugface=0;
	SetCameraFocus(0,zup1cam);
	zup1face=1;
return;
pulse:
	SetWallCel(tv,rand()*8);
	if(rand()>.5) { ThingLight(tvlight,1,0.1); } else { ThingLight(tvlight,.1,1); }
	PlaySoundPos(saberfighting0[rand()*18],GetSurfaceCenter(tv),.25,0,10,0x0);
	if(ugface==1)
	{
		SetMaterialCel(ugsface,rand()*1);
	}
	else if(ugface==2)
	{
		SetMaterialCel(ugsface,2);
	}
	else
	{
		SetMaterialCel(ugsface,0);
	}
	if(zup1face==1)
	{
		SetMaterialCel(zup1sface,rand()*13);
	}
	else if(zup1face==2)
	{
		SetMaterialCel(zup1sface,16);
	}
	else
	{
		SetMaterialCel(zup1sface,0);
	}
	if(zup2face==1)
	{
		SetMaterialCel(zup2sface,rand()*13);
	}
	else if(zup2face==2)
	{
		SetMaterialCel(zup2sface,16);
	}
	else
	{
		SetMaterialCel(zup2sface,0);
	}
	if(zup3face==1)
	{
		SetMaterialCel(zup3sface,rand()*13);
	}
	else if(zup3face==2)
	{
		SetMaterialCel(zup3sface,2);
	}
	else
	{
		SetMaterialCel(zup3sface,0);
	}
return;
end

I believe you know what this code is all about... Anyway, the problem lies in the pulse. First off, the sound... When I play a random lightsaber sound, it doesn't play a random lightsaber sound, but plays the first sound it gets it's hands on. At first, when I had only come to SetPulse(0.1); and there were quite a few gaps in the keyframes and what people were going to say, instead of lightsaber sounds that I had picked out, there was the activate01.wav playing all the time. I decided to fill in all gaps, with temporary stuff like a tuskan sound for him, reeyee sounds for him, etc. and random keyframes, the sound changed but not to the sabers, but to a tuskan. I gave tuskan sounds to Mr. zup3. Could someone help me find why the connection? I think it's in zup3_WAZZUP, but why? All other sounds are OK.

/Edward
Edward's Cognative Hazards
2004-06-13, 11:52 AM #2
And there seems to be a problem with the SetMaterialCel();. The folk's faces won't move. Yes, I've given them new faces with new cels. What's wrong?
Edward's Cognative Hazards
2004-06-13, 12:53 PM #3
In the pulse message, try this:
Code:
index = rand() * 18;   // Make this an int in the symbols
PlaySoundPos(saberfighting0[index],GetSurfaceCenter(tv),.25,0,10,0x0);

...instead of your current PlaySoundPos. Might be a problem with the random array index...

------------------
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2004-06-13, 12:59 PM #4
No affect...
Edward's Cognative Hazards
2004-06-13, 4:31 PM #5
I've found the problem... I think... JK apparently doesn't do automatic conversions like most other languages. When you put rand()*18 in, JK still treats it as a float. Even if you set assign it to an int, it maintains it as a floating point number.

I believe this is because both are 4-byte numbers, JK simply dumps in the flex information, without any modification.

Try this code...

(modified from zagibu's to save time...)

Code:
index = ((rand()*19)%18);   // Make this an int in the symbols
PlaySoundPos(saberfighting0[index],GetSurfaceCenter(tv),.25,0,10,0x0);


This is an alternate method for getting a number from a rand, that I just now remembered. (The * 18 was modified to *19, otherwise, the first sound would never be played) The reason this should work is modulo always returns an integer. So the indexing should work properly.

------------------
_ _ _____________ _ _
Wolf Moon
Cast Your Spell On Me
Beware
The Woods At Night
The Wolf Has Come

[This message has been edited by LKOH_SniperWolf (edited June 13, 2004).]
_ _ _____________ _ _
Wolf Moon
Cast Your Spell On Me
Beware
The Woods At Night
The Wolf Has Come
2004-06-13, 10:07 PM #6
It's a good idea, but it has to be rand()*19%19. This returns numbers 0 - 18. Your version returns 0 - 17 and a final 0 (since 18 % 18 = 0).
And BTW, for those who don't know about the modulo operator: it divides the numbers and delivers the rest of the division. So 5%2=1, 7%4=3, etc.
Rand()*19%19 delivers values 0 (0%19) to 18 (18%19), since rand()*19 can never be 19 (0 <= rand() < 1).
I'm not sure if that solves the problem, but it's worth a try.

------------------
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2004-06-13, 11:51 PM #7
The float to int problem is easy to fix:

Code:
float val_float
int   val_int

.....get your float values

val_float = val_int


Pretty sure I used that back on a racing mod I was doing 5 or 6 years ago.

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

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

Tazz
2004-06-14, 4:33 AM #8
Tazz, do you mean
Code:
    float val_floatint
    val_int
    .....get your float values
    val_int = val_float           //reversed vars


------------------
nytfyre m0d || f33l t3h p0w3r || t3h l0st c0gz || OMF > *
May the mass times acceleration be with you.
2004-06-14, 7:26 AM #9
Hm... So many solutions, and some look like they won't work... But strainge, isn't it? I've made so many COGs where I use random values as you see
Code:
i=CreateThing(type0[rand()*15],place0[rand()*26]); 
nummer=rand()*100; 
PlaySoundThing(panic0[rand()*20],place,.75,-1,50,0x80); 
etc...

without problems, and the all of a sudden, it won't work! Has that ever happen to you?

I'll try the Modulo method, and if that doesn't work...

/Edward
Edward's Cognative Hazards
2004-06-14, 8:10 AM #10
OK, Modulo didn't work. But now, why just zup3_WAZZUP? The only time one sound wouldn't play as it should and play something else is if I have misspelt it.

/Edward
Edward's Cognative Hazards
2004-06-14, 10:42 AM #11
Hmm, I thought mine should work, but I see the mistake. For some reason, I was thinking 0%18 would yield 18. Heh, despite the listed time, I did that math much later at night (for me anyways) and so was very tired, lol.

And val_int=val_float; wouldn't work. Apparently, JK will change the int to a float. I did some tests where I did just that (int=float). Running PrintFlex() on the int, I could see it still retained floating point info...
There's something to this point in DataMaster as well, though he wasn't very clear. Apparently, since they're both 4-byte types, JK just converts what you listed in symbols as an int, to a float to hold the new information, I think anyways. Either way, PrintFlex() showed that even though I listed them as ints, they still retained flex data...

------------------
_ _ _____________ _ _
Wolf Moon
Cast Your Spell On Me
Beware
The Woods At Night
The Wolf Has Come

[This message has been edited by LKOH_SniperWolf (edited June 14, 2004).]
_ _ _____________ _ _
Wolf Moon
Cast Your Spell On Me
Beware
The Woods At Night
The Wolf Has Come
2004-06-14, 10:53 AM #12
Quote:
<font face="Verdana, Arial" size="2">Originally posted by Darth Slaw:
Tazz, do you mean
Code:
    float val_floatint
    val_int
    .....get your float values
    val_int = val_float           //reversed vars


Ya, basically that can change back and forth

[/b]</font>




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

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

Tazz

↑ Up to the top!