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 → Need help passing some triggers...
Need help passing some triggers...
2001-05-18, 7:36 AM #1
I have a history of having unsolvable problems on this board...

Anyway, I'm trying to pass a trigger from one cog to another. It works perfectly in singleplayer but it doesn't pass in multiplayer. The trigger is specific to the player (this isn't a client\server thing) however, I've also tried making the destination -1 as well.
I've tried making the cogs completely local (flag 0x404) but that didn't help either.

Here's a sample of the code:
Code:
code
activated:
	player = GetSenderRef();
	SendTrigger(-1, 1001, 0, 0, 0, 0);
	print("fire Sent");
	return;
end

#-------------------------
Other cog...
#-------------------------
trigger:
	if(GetSourceRef() == 1001)  //if this is fire
		{
		print("Trigger Received");
		F = F + 1;
		printflex(F);
		if((F + E + A + W + S) > 5)
			{
			Print("Weave too complex. Try again...");
			F = 0;
			E = 0;
			A = 0;
			W = 0;
			S = 0;
			return;
			}
		}



[This message has been edited by Ping_Me (edited May 18, 2001).]
2001-05-19, 2:32 PM #2
Trigger 1001 may be used by the CTF main cog.
Try passing another ID.

------------------
http://millennium.massassi.net/ - Millennium
2001-05-20, 7:41 AM #3
I tried it, no change unfortunatly.

I tried the following ID's:
-1001
2147483648
5612305
12350
2
1

Still nothing works.

I'll giv you the cogs in thier entirety.
Code:
# Fire thread sender
flags=0x404
symbols

int	player		local

message activated
end

code
activated:
	print("Fire Sent");
	player = GetSenderRef();
	SendTrigger(player, 12350, 0, 0, 0, 0);
	return;
end


Code:
flags=0x404
symbols
template	beacon=+beacon		local
flex		onepower		local
flex		F			local
flex		E			local
flex		A			local
flex		W			local
flex		S			local
int		inhib1			local
int		inhib2			local
int		shielded		local
int		stilled			local
int		player			local
message		startup
message 	activated
message		trigger
end

code
Startup:
	player = GetSenderRef();
	SetInvAvailable(player, 21, 1);    // Make sure hotkeys are available
	SetInvAvailable(player, 22, 1); 
	SetInvAvailable(player, 23, 1); 
	SetInvAvailable(player, 24, 1); 
	SetInvAvailable(player, 25, 1); 
	SetInvAvailable(player, 26, 1); 
	SetInvAvailable(player, 27, 1); 
	SetInvAvailable(player, 28, 1); 
	SetInv(player, 14, 0);
	F = 0;
	E = 0;
	A = 0;
	W = 0;
	S = 0;
	return;

Activated:
	print("is cog working at all?");
	if(stilled == 1 || shielded == 1) return;
	CreateThingatPos(beacon, GetThingSector(player), player, '0 0 0');
	SetInv(player, 14, GetInv(player, 14) + 25);
	PrintFlex(GetInv(player, 14));
	onepower = GetInv(player, 14);
	if(GetCurWeapon(player) == 9) return;
	else if(GetCurWeapon(player) == 5 && onepower > 300)
		{
		DamageThing(player, 9999999, 0, player);
		Print("Drew too much of the One Power...");
		return;
		}
	else if(onepower > 300)
		{
		DamageThing(player, 9999999, 0, player);
		Print("Drew too much of the One Power...");
		return;
		}
	else if(inhib2 == 1 && onepower > 100)
		{
		DamageThing(player, 9999999, 0, player);
		Print("Drew too much of the One Power...");
		return;
		}
	else if(inhib1 == 1 && onepower > 50)
		{
		DamageThing(player, 9999999, 0, player);
		Print("Drew too much of the One Power...");
		return;
		}
	else return;

trigger:
	//First set up threads...
	if(GetSourceRef() == 12350)  //if this is fire
		{
		print("Trigger Received");
		F = F + 1;
		printflex(F);
		if((F + E + A + W + S) > 5)
			{
			Print("Weave too complex. Try again...");
			F = 0;
			E = 0;
			A = 0;
			W = 0;
			S = 0;
			}
		return;
		}
	else if(GetSourceRef() == 1002)  //if this is earth
		{
		E = E + 1;
		if((F + E + A + W + S) >= 6)
			{
			Print("Weave too complex. Try again...");
			F = 0;
			E = 0;
			A = 0;
			W = 0;
			S = 0;
			}
		return;
		}
	else if(GetSourceRef() == 1003)  //if this is air
		{
		A = A + 1;
		if((F + E + A + W + S) >= 6)
			{
			Print("Weave too complex. Try again...");
			F = 0;
			E = 0;
			A = 0;
			W = 0;
			S = 0;
			}
		return;
		}
	else if(GetSourceRef() == 1004)  //if this is water
		{
		W = W + 1;
		if((F + E + A + W + S) >= 6)
			{
			Print("Weave too complex. Try again...");
			F = 0;
			E = 0;
			A = 0;
			W = 0;
			S = 0;
			}
		return;
		}
	else if(GetSouceRef() == 1005)  //if this is spirit
		{
		S = S + 1;
		if((F + E + A + W + S) >= 6)
			{
			Print("Weave too complex. Try again...");
			F = 0;
			E = 0;
			A = 0;
			W = 0;
			S = 0;
			}
		return;
		}
	else if(GetSourceRef() == 2) //releases all threads
		{
		F = 0;
		E = 0;
		A = 0;
		W = 0;
		S = 0;
		return;
		}
// ----------------------------------------------------------------------------------
	else if(GetSourceRef() == 1) //This section is for the primary execution of all powers
		{
		print("exe command received");
		if(F == 1 && E == 0 && A == 0 && W == 0 && S == 0) 
			{
			Print("Rand is the man.");
			F = 0;
			E = 0;
			A = 0;
			W = 0;
			S = 0;
			SetInv(player, 14, 0);
			return;
			}
		}
end
2001-05-20, 11:41 AM #4
What is the flag 0x404?
I think if you want to make it local you need to make it 0x240, or just take the whole thing off if you want to make it work in multiplayer, because I believe the target -1 to send information to all players will not work.

The player value will not be retrieved as GetSenderRef() in the startup message, so make it GetLocalPlayerThing()

As for trigger ID, use something lower than 100, so it won't get confused with LEC cogs, or you'll send triggers to some CTF cogs just in case or something...

------------------
http://millennium.massassi.net/ - Millennium
2001-05-20, 4:14 PM #5
New ID list:
15
30
99
98
97
90
91

Still no change.

The local flag thing was an experiment to see if making the cog run independant of the network would solve my problem. I got the flags=0x404 from one of your MP weapons tutorials Hideki.
2001-05-20, 7:15 PM #6
Does it print the print commands fine?

And I think my tutorial had it 0x240, if you do a search for 404 on the main page, it only returns a link that's different from the mp weapon tutorial.

------------------
http://millennium.massassi.net/ - Millennium
2001-05-21, 6:57 AM #7
When I activate the first cog in multiplayer only the message "fire sent" appears.

If the trigger was actually being sent (or recieved, it could be either) I would see "fire sent" then "Trigger recieved" and then "1.000000" like I do in singleplayer.

(rhetorical question)If something works in singleplayer why shouldn't it work in multiplayer?

↑ Up to the top!