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 → Cluttering up the COG forum with new problems!
Cluttering up the COG forum with new problems!
2004-04-10, 6:43 AM #1
Hi!
I have here a piece of a modified weap_fists.cog. The problem being that when the Inv 120 is on (1), I'm supposed to produce 18 grenades or mines (depending on mode). BUT, when I fire, I only get ONE grenade or ONE mine. Why is that?
Code:
fire:
   // Check that the player is still alive.
   if(GetThingHealth(player) <= 0)
   {
      Return;
   }

if(mode==0)
{
	for(i=0; i<18; i=i+1) {
		if(GetInv(player,120)==1) {
		dummy=FireProjectile(GetInv(player,122), grenades, fireSound1, 18, '0.02 0.15 0.0', '0 0 0', 1.0, 0x00, 0,0);
		SetThingVel(dummy,spreadvec0);
		sleep(0.01);
	return; }	}
}
else if(mode==1)
{
	for(i=0; i<18; i=i+1) {
		if(GetInv(player,120)==1) {
		dummy=FireProjectile(GetInv(player,122), mines, fireSound2, 18, '0.02 0.15 0.0', '0 0 0', 1.0, 0x00,0, 0);
		SetThingVel(dummy,spreadvec0);
		sleep(0.01);
	return; }
	}
}
   // Alternate fists.
   if(nextAnim == 0)
   {
      SetPOVShake('-0.01 -.01 0.0', '1.0 0.0 0.0', .05, 80.0);
      PlaySoundThing(fireSound1, player, 1.0, 0.5, 2.5, 0x80);
      FireProjectile(player, projectile, -1, 8, '-0.02 0.03 0', '0 0 0', 1.0, 0, 0.0, 0.0);
      SetFireWait(player, leftWait);
   }
   else
   {
      SetPOVShake('0.01 -.01 0.0', '1.0 0.0 0.0', .05, 80.0);
      PlaySoundThing(fireSound1, player, 1.0, 0.5, 2.5, 0x80);
      FireProjectile(player, projectile, -1, 18, '0.02 0.03 0', '0 0 0', 1.0, 0, 0.0, 0.0);
      SetFireWait(player, rightWait);
   }

   jkPlayPOVKey(player, povfireAnim1[nextAnim], 1, 0x0a);
   nextAnim = 1-nextAnim;

   Return;

Did I hit the thing limit already?

/Edward
Edward's Cognative Hazards
2004-04-10, 6:49 AM #2
How are we supposed to know if you've hit the thing limit?
Cordially,
Lord Tiberius Grismath
1473 for '1337' posts.
2004-04-10, 7:00 AM #3
Cause this is a mod, and I've tried it in JK levels 01, and 02.
Edward's Cognative Hazards
2004-04-10, 7:47 AM #4
I hate myself for saying this again and simply annoyting ppl, but try removing the sleep() lines.

[edit]D'oh! I just found your problem. Remove the "Return"s from the blocks following your "if(GetInv(player,120)==1)" statements.

------------------
Bond, Power, CA, The Force, Saber, IC, Epic, Oily Mexican Food, BG, /\ |> /\ /\/\, Sentences.
Now you know where I've been.

[This message has been edited by Darth Slaw (edited April 10, 2004).]
May the mass times acceleration be with you.
2004-04-10, 9:08 AM #5
Ah... That might work... Thanks!
Edward's Cognative Hazards
2004-04-10, 11:06 AM #6
OK, another problem, unrelated to the previous one, just don't feel like making another topic, and not cluttering up the COG forum with my name.
Inv 120:
Code:
# Internal View Thing
#
# By Edward
flags=0x240
symbols

message		startup
message		newplayer
message		activated
message		pulse
message		removed

thing		player		local
thing		looker		local

end
#
code
startup:
newplayer:
	SetInv(GetSenderRef(),120,0);
	SetPulse(0);
return;
activated:
	if(GetInv(GetSourceRef(),120)==0)
	{
		SetPulse(.1);
		player=GetSourceRef();
		looker=GetInv(GetSourceRef(),122);
		CaptureThing(looker);
		SetCameraFocus(0,GetInv(GetSourceRef(),122));
		print("Internal Cam elsewhere.");
		SetInv(GetSourceRef(),120,1);
	}
	else
	{
		SetPulse(0);
		SetCameraFocus(0,GetSourceRef());
		print("Internal Cam here.");
		SetInv(GetSourceRef(),120,0);
	}
return;
pulse:
	SetCameraFocus(0,GetInv(GetSourceRef(),122));
return;
removed:
	SetPulse(0);
	SetCameraFocus(0,player);
	print("Destroyed.");
	SetInv(player,120,0);
return;
end

Inv 122:
Code:
# Internal View Thing
#
# By Edward
flags=0x240
symbols

message		startup
message		activated
message		pulse
message		deactivated

thing		player		local

end
#
code
startup:
	SetInv(GetSourceRef(),122,0);
return;
activated:
	player=GetSourceRef();
	SetPulse(0.1);
return;
pulse:
	jkEndTarget();
	jkSetTargetColors(63,25,45,47,38);
	ChangeInv(player,122,1);
	if(GetInv(player,122)>GetThingCount())
		SetInv(player,122,0);
	printint(GetInv(player,122));
	jkSetTarget(GetInv(player,122));
return;
deactivated:
	player=GetSourceRef();
	SetPulse(0);
return;
end

Now, the removed message doesn't seem to work in Inv 120, I want a faster responding Inv 122 (tried to set a fire message but didn't work), and Inv 122 seems to go above the number of things when I asked it to stop at thingcount() (I set the item for 0-65535).

/Edward
Edward's Cognative Hazards

↑ Up to the top!