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 → Urgent! Two days left...
Urgent! Two days left...
2002-03-24, 10:17 AM #1
Ok. I just modified the Force lightning cog. I tried to make it so it fires a lightning bolt for each star you have assigned to it. It uses sendtrigger so I'll tell you what the values are. The SendTrigger for 320 fires 1 bolt and the Sendtrigger for 321 fires two bolts. You probably figure out them math. Anyway, no matter how many stars I have, it shoots 4 bolts. Not a clue why. Here's the cog.

Code:
#================================================================================================#
# Jedi Knight Cog Script									 #
#												 #
# FORCE_CHAINLIGHt.COG										 #
#												 #
# FORCEPOWER Script - Lightning									 #
#  Dark Side Power										 #
#  Bin 39											 #
#												 #
# Lord XT 2002										 #
#================================================================================================#

symbols

thing       player                           local

sound       fireSound=ForceLitning02.wav     local

flex        cost=20.0                        local

int         rank                             local
int         mana                             local
int         bin                              local
int         fireChannel=-1                   local
int         modeTrack=-1                     local

message     startup
message     activated
message     deactivated
message     fire
message     killed
message     selected
message     shutdown

end

#================================================================================================#

code

startup:

   	player = GetLocalPlayerThing();
   	SetInvActivated(player, 39, 0);

   Return;

#................................................................................................#

fire:

   	mana = GetInv(player, 14);

   	if((mana >= cost) && (GetThingHealth(player) > 0))
   	{
         	if(!IsInvActivated(player, 23)) AddDynamicTint(player, 0.0, 0.0, 0.0);

      		if(GetInv(player, 64) != 1) ChangeInv(player, 14, -cost);

      		if(fireChannel == -1) fireChannel = PlaySoundThing(fireSound, player, 1.0, -1, -1, 0x81);

      		if(rank = 4)
      		{
         		SendTrigger(-1, 321, player, 0, 0, 0);
                        SendTrigger(-1, 321, player, 0, 0, 0);
      		        PlayMode(player, 24);
                }
      		else
      		if(rank = 3)
		{
	 		SendTrigger(-1, 321, player, 0, 0, 0);
                        SendTrigger(-1, 320, player, 0, 0, 0);
      		        PlayMode(player, 24);
                }
      		else
      		if(rank = 2)
		{
                         SendTrigger(-1, 321, player, 0, 0, 0);
		         PlayMode(player, 24);
		}
      		else
      		if(rank = 1)
		{
                         SendTrigger(-1, 320, player, 0, 0, 0);
		         PlayMode(player, 24);
                }

   	}
   	else
   	{
      		if(fireChannel != -1)
      		{
         		StopSound( fireChannel, 0.1);
         		fireChannel = -1;
      		}
   	}

   Return;

#................................................................................................#

activated:

	bin = GetSenderRef();
   	rank = GetInv(player, 39);

   	if(rank == 1) cost = 20.0;
   	else 
	if(rank == 2) cost = 30.0;
   	else 
	if(rank == 3) cost = 40.0;
   	else 
	if(rank == 4) cost = 50.0;

   	ActivateBin(player, 0.3, bin);

   Return;

#................................................................................................#

selected:

   	jkPrintUNIString(player, 39);

   Return;

#................................................................................................#

deactivated:

   	bin = GetSenderRef();
   	DeactivateBin(player, bin);
   	call stop_power;

   Return;

#................................................................................................#

killed:

   	if(GetSenderRef() != player) Return;
   	call stop_power;

   Return;

#................................................................................................#

stop_power:

   	if(fireChannel != -1)
   	{
      		StopSound( fireChannel, 0.1);
      		fireChannel = -1;
   	}

   	if(modeTrack != -1)
   	{
      		StopKey(player,modeTrack,0.5);
      		modeTrack = -1;
   	}

   Return;

#................................................................................................#

shutdown:

   	call deactivated;

   Return;

end

#================================================================================================#
Ohh Crap! - Darien Fawkes (The Invisible Man)
2002-03-24, 11:26 AM #2
you have to use two == in conditions. Correct was (if rank==4) and so on. You have just one.
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2002-03-24, 11:57 AM #3
I added the second equal sign and it still doesnt work properly. No matter how many stars I have it shoots 4 bolts.
Ohh Crap! - Darien Fawkes (The Invisible Man)
2002-03-25, 4:31 AM #4
'=' is an assignment operator. The value on the right is assigned to the variable on the left.

'==' is a relational operator. It returns 1 if the values on either side are true or zero if they are not.

Anyway, if you fixed that operator problem, your error should be fixed. Post the new code.

------------------
Author of the Jedi Knight DataMaster.
Visit Saber's Domain.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.

↑ Up to the top!