View Full Version : Global tint
Edward
04-18-2003, 04:01 AM
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).]
DogSRoOL
04-18-2003, 09:35 AM
Try this:
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).]
Edward
04-18-2003, 11:33 AM
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:
# 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
DSLS_DeathSythe
04-18-2003, 01:35 PM
here this might work, i edited Edward's cog a bit
# 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).]
Edward
04-18-2003, 01:59 PM
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...
<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
DSLS_DeathSythe
04-18-2003, 02:12 PM
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.
------------------
Edward
04-18-2003, 02:27 PM
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
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.