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 → Global tint
Global tint
2003-04-18, 1:01 AM #1
Hi!
How do I change this so that everyone gets it?
AddDynamicAdd(GetLocalPlayerThing(), 255, 0, 0);

[JK MP]

/Edward


[This message has been edited by Edward (edited April 18, 2003).]
Edward's Cognative Hazards
2003-04-18, 6:35 AM #2
Try this:
Code:
SomeMessage:
        AddDynamicAdd(jkGetLocalPlayer(), 255, 0, 0);
	SendTrigger(-1, 0, 0, 0, 0, 0);
	return;

Trigger:
	if(GetSenderID() == 0)
	{
		AddDynamicAdd(jkGetLocalPlayer(), 255, 0, 0);
		Return;
	}


I'm not a MP cogger, so I don't know if this is right. Get someone to test it on line.
And instead of just giving you a code snippet, let me explain what it (is supposed to) do.
SendTrigger - The 1st number is a destination of some sort. -1 sends it to all players. (Naturally, all players must have this cog.)
The first 0 is an ID, which can be referenced using "GetSenderID()" in the Trigger section.
The next 4 0s are parameters. You can use them to pass information to another cog, such as a thing number, and retrieve it using "GetParam(#)" (0-4).

You might want to get a MP cogger to check this out, though, and don't forget to use whatever message instead of "SomeMessage". [http://forums.massassi.net/html/tongue.gif]

------------------
May the forks be with you.
There is a great disturbance in my shorts...

[This message has been edited by DogSRoOL (edited April 18, 2003).]
Catloaf, meet mouseloaf.
My music
2003-04-18, 8:33 AM #3
I think I'll wait for a pro... [http://forums.massassi.net/html/tongue.gif]
What I'm trying to do is a Red Alert so it will blink red for all players. I'm using a pulse for the blinking.
HECK! I'll give you the whole COG:
Code:
# RED ALERT
#
# By Edward
symbols

message	activated
message	pulse

surface	alerter

sound		ALERT

int		i=0	local

end
#
code
activated:
	if(GetSenderRef()!=alerter) return;
	if(on==0)
	{
		jkStringConcatAsciiString("RED ALERT!");
		jkStringOutput(-3, -1);
		jkStringClear();
		on=1;
		SetPulse(GetSoundLen(ALERT));
	}
	Else
	{
		Print("Clear!");
		jkStringConcatAsciiString("Clear!");
		jkStringOutput(-3, -1);
		jkStringClear();
		on=0;
		SetPulse(0);
	}
Return;
pulse:
	PlaySoundGlobal(ALERT,1,0,0xC0);
	AddDynamicAdd(GetLocalPlayerThing(), 255, 0, 0);
return;
end

/Edward
Edward's Cognative Hazards
2003-04-18, 10:35 AM #4
here this might work, i edited Edward's cog a bit
Code:
# RED ALERT
#
# By Edward
# Edited By DSLS_DeathSythe
flags=0x240
symbols
#=====
message   startup
message   activated
message   pulse
surface   alerter
sound     ALERT
int       on=0     local
thing     player=-1     local
#Trigs
int       flash_trig=1
#-----
end
#=====
code
#-----
startup:
  player = GetLocalPlayerThing();
return;
#-----
activated:
  if(GetSenderRef() != alerter) return;
  if(on == 0)
    {
    on = 1;
    SendTrigger(-1, flash_trig, on, 0, 0, 0);
    return;
    }
  Else
    {
    on = 0;
    SendTrigger(-1, flash_trig, on, 0, 0, 0);
    return;
    }
Return;
#-----
pulse:
  if(IsServer())
    SendTrigger(-1, flash_trig, 2, 0, 0, 0);
return;
#-----
trigger:
  if(GetSourceRef() != flash_trig) return;
  if(GetParam(0) == 0)  //-STOP alarm...
    {
    on = GetParam(0);
    Print("Clear");
    SetPulse(0);
    return;
    }
  if(GetParam(0) == 1)  //-START alarm...
    {
    on = GetParam(0);
    Print("RED ALERT!");
    SetPulse(GetSoundLen(ALERT));
    return;
    }
  if(GetParam(0) == 2)  //-MAKE flash & play sound...
    {
    PlaySoundLocal(ALERT, 1.0, 0, 0xC0);
    AddDynamicAdd(player, 255, 0, 0);
    return;
    }
return;
#=====
end

DogSRoOL was on the right track but you cant use GetSenderID() for triggers, you have to use GetSourceRef().

btw: Edward if you look in the cog you posted, you listed an 'i' instead of 'on' in the symbols. (just thought id let you know)
oh and remember to make the flash_trig different from any other trig in any other cogs other wise funny things might happen. [http://forums.massassi.net/html/smile.gif]

------------------

[This message has been edited by DSLS_DeathSythe (edited April 18, 2003).]
Famous last words - "It seemed like a good idea at the time."
2003-04-18, 10:59 AM #5
OK... Do you think you could explain this a bit. When I look at the COG it looks like all I need to add is Top flags, and get all players in the begginning. But I could be wrong...
You know what I need, as I'm going to spend a lot of my days making MP levels (since I can't seem to be able to think of good story lines for SP) I think I'll be needing a nice good lesson when it comes to MP COGging.
Why I don't just take the COG that has been handed to me and leave you all alone? Simply because I'm too polite...
Quote:
<font face="Verdana, Arial" size="2">
btw: Edward if you look in the cog you posted, you listed an 'i' instead of 'on' in the symbols.
</font>

No i in code, and no on in symbols? Hm... And it still works? GREATE!!! I think I'll introduce you to intagers that don't need preloading!
But now it will be hard to... Breake a habbit... Oh well, if I forget it is not the whole world, unless the COG won't work.

/Edward
Edward's Cognative Hazards
2003-04-18, 11:12 AM #6
getting all the players at the beginning isnt something you have to do its just the way i prefer to do it.
for some reason i find it easier to write 0x240 cogs for mp. the JK Chess mod that i just released all its cogs are like that.

sorry, i forgot that you were just asking how to make it do this not asking someone to do it for you. i get carried away.

------------------
Famous last words - "It seemed like a good idea at the time."
2003-04-18, 11:27 AM #7
It's ok... I also make COGs for people, when I know what I'm doing. But if I don't know how to make the COG but I know what is needed, I write descriptions.
E.G.
"How do I make an object move from frame 1 to 10 and take pauses at frames 2, 4, and 7?"
"You'll need a COG like this: [ code ]..."
or
"How do I do this Complex structure?"
"Well, you start off by creating this, then you make a COG that will allow you to do this, then you'll probebly need these items in it, and so on..."

So all I need is... A COG manual!

/Edward
Edward's Cognative Hazards

↑ Up to the top!