PDA

View Full Version : Requireing MP cogs!



Edward
04-05-2003, 02:22 AM
Hi!
I reqire COGs that work in MP. And it's JK...

1 - A goal COG: How do I do so that when a specific object (a ball) enters a sector, there will be an increas in score, and any player that arrives a little later his "score value" will compensate?

2 - Spinning ball: How do I make an object spin accordingly to the speed and direction it's moving in (like a ball)?

Gah... Just remembered one more COG question. How do I make the players Always Invul?

/Edward
------------------
ATM2: Blippidadooda...
Creepio: I give up, what is gold and goes Bump Bump Bump...

[This message has been edited by Edward (edited April 05, 2003).]

SaberMaster
04-05-2003, 02:37 PM
1) Write a cog for the sector that has an entered message. Give the sector variable a mask of 0xfff. In the entered message, test to see if the entering thing is your ball. If it is, set a variable (eg, on) to 1. Also in the entered message test to see if on is 1 and if the entering thing is a player. If true, give the entering player however many more kills you want to give him.

2) It's possible, but difficult to do...

3) SetActorFlags(player, 0x8);

------------------
Author of the JK DataMaster (http://www.geocities.com/sabersdomain/fileframe.html), Parsec (http://www.geocities.com/sabersdomain/fileframe.html), Scribe (http://www.geocities.com/sabersdomain/fileframe.html), and the EditPlus Cog Files (http://www.geocities.com/sabersdomain/fileframe.html).

Edward
04-05-2003, 03:41 PM
OK... I understood half of what you said about #1... Up until Also...

#2... Ok... If it is too difficult to make it spin like a ball, is there a way to make it rotate all the time?

#3... SetActorFlags(player, 0x8)... Ok... That didn't work... I typed it straight from the Super Shield Powerup COG. Nothing!


# Always Invul
#
# By Edward
symbols

message startup
message newplayer
message pulse
int bin=62 local

int i=0 local

end
#
code
startup:
SetActorFlags(GetLocalPlayerThing(), 0x8);
SetThingFlags(GetLocalPlayerThing(), 0x4);
SetInvActivated(GetLocalPlayerThing(), bin, 1);
jkSetSuperFlags(2);
SetPulse(1);
return;
pulse:
If(i=1)
{
jkClearSuperFlags(2);
i=0;
}
else if(i=0)
{
jkSetSuperFlags(2);
i=1;
}
return;
newplayer:
SetActorFlags(GetLocalPlayerThing(), 0x8);
SetThingFlags(GetLocalPlayerThing(), 0x4);
SetInvActivated(GetLocalPlayerThing(), bin, 1);
jkSetSuperFlags(2);
SetPulse(1);
Return;
end


/Edward
------------------
ATM2: Blabidabiboop!
Creepio: What cannon fodder? NOOOOOOOO!

Hell Raiser
04-05-2003, 09:28 PM
Y'know, if SetThingRotVel() used a Heading vector and not P/Y/R, you could just set it to it's Velocity. If there's a way to convert a heading vector into P/Y/R then you'd have it made in the shade.

------------------
-Hell Raiser
Remember kiddies, trial and error.
Without struggles there is no progress
DBZ: The Destruction is Real (http://tdir.hellraiser64.com)

Edward
04-06-2003, 09:34 AM
Just figured out what was wrong with 3! I needed a delay! Now about 2 and 1...
------------------
ATM2: Blapidedibadoo!
Creepio: You wouldn't dare play quidich with me, would you?

[This message has been edited by Edward (edited April 06, 2003).]

Edward
04-06-2003, 12:12 PM
OK! Number one completed! All I needed was the mask, and Parsec to take away the faults! Now number 2 is all that is left! That one's going to be hard...

/Edward
------------------
ATM2: Blicpoolabeen...
Creepio: Yes, being able to look straight up is quite a new sensation...

Edward
04-07-2003, 07:08 AM
Ah! No wait! Number one isn't totally complete! I haven't added anything that would compensate the score for the other players that come in an hour late. Some one HELP!!!


# GOAL! MÅL! WHATEVER! SKITSAMMA!
#
# By Edward
symbols

message startup
message entered

sector rgoal mask=0xfff
sector ggoal mask=0xfff

thing ball

int rscore=0 local
int gscore=0 local
int s=0 local
int m=0 local
int h=0 local

message pulse

sound GoldMore
sound RedMore
sound Tada

end
#
code
startup:
SetPulse(1);
return;
entered:
If(GetSourceRef()!=ball) return;
PlaySoundGlobal(Tada,1,0,0xC0);
If(GetSenderRef()==rgoal)
{
gscore=gscore+1;
print("Goal in Red!");
printint(gscore);
printint(rscore);
if(rscore>gscore)
{
PlaySoundGlobal(RedMore,1,0,0xC0);
}
Else if(rscore<gscore)
{
PlaySoundGlobal(GoldMore,1,0,0xC0);
}
Else
{
print("EQUAL...");
}
}
Else if(GetSenderRef()==ggoal)
{
rscore=rscore+1;
print("Goal in Gold");
printint(gscore);
printint(rscore);
if(rscore>gscore)
{
PlaySoundGlobal(RedMore,1,0,0xC0);
}
Else if(rscore<gscore)
{
PlaySoundGlobal(GoldMore,1,0,0xC0);
}
Else
{
print("EQUAL...");
}
}
return;
pulse:
s=s+1;
If(s>=60)
{
m=m+1;
s=0;
}
If(m>=60)
{
h=h+1;
m=0;
}
return;
end


/Edward
------------------
ATM2: Blapoodopeeda
Creepio: No way are you playing soccer with me!

[SF]pjb
04-07-2003, 08:59 AM
couldent you jsut randomly change the direction of the roll, just by setting its vector in a cog? no one would notice, ither that or you could use some kind of key-pup thing, so if it moves forwards it rolles the right way (useing a key), and left right or backwards you could do the same. you could also make it throwable, that would be easyer to move in teh level like a ball.

------------------
I am pjb.
Another post......
another moment of my life wasted.....

[SF]pjb
04-07-2003, 09:04 AM
edward you double posted that, delite on o them please.

------------------
I am pjb.
Another post......
another moment of my life wasted.....

[SF]pjb
04-07-2003, 09:06 AM
edward you double posted that, delite on o them please.

------------------
I am pjb.
Another post......
another moment of my life wasted.....

Edward
04-07-2003, 10:38 AM
<font face="Verdana, Arial" size="2">
edward you double posted that, delite on o them please.
</font>
Your no better... But hay! Sometimes the server is slow and when my browser says time out the server might have picked up all the info. Oh well. Let's just delete our copies...

<font face="Verdana, Arial" size="2">
couldent you jsut randomly change the direction of the roll, just by setting its vector in a cog? no one would notice, ither that or you could use some kind of key-pup thing, so if it moves forwards it rolles the right way (useing a key), and left right or backwards you could do the same. you could also make it throwable, that would be easyer to move in teh level like a ball.
</font>
Hmmm. Pup... Key... I'll try that!
And have my ball as a thowable. Already done!
Now... About syncronizing the score between the player who hosted and the player that came an hour too late?

/Edward
------------------
ATM2: Bluuurp...
Creepio: Yes, I know... It's, a roid's, head...

[This message has been edited by Edward (edited April 07, 2003).]

Edward
04-07-2003, 11:28 AM
Hm... The puppet didn't work.


# Puppet file for the ball.
# Suggested by [SF]pjb
# Made by Edward

Mode=0
# action key flag ? ?
walk rollf.key 0x01 2 2
walkback rollb.key 0x01 2 2
strafeleft rolll.key 0x01 2 2
straferight rollr.key 0x01 2 2
fall rolld.key 0x01 2 2
hit rollh.key 0x28 1 4

Mode=1, basedon=0

Mode=2, basedon=0

Mode=3, basedon=0

Mode=4, basedon=0


/Edward
------------------
ATM2: MeepMoopMap!
Creepio: No, you may NOT sell me as a hood onament...

[SF]pjb
04-08-2003, 03:52 AM
Thats odd, you set the pup in the template? and then placed the item in your level? and asighend the sector? and put the key's in the gob?

i got a nifty four armed charicter to work last night, if you want i will make the ball for you.

------------------
I am pjb.
Another post......
another moment of my life wasted.....

SaberMaster
04-08-2003, 12:05 PM
The reason SetActorFlags(player, 0x8) didn't work is because kyle.cog makes a player invul for a few seconds and then turns it off when a player spawns. So it won't work right away on startup and MP spawning will turn it off.


<font face="Verdana, Arial" size="2"> About syncronizing the score between the player who hosted and the player that came an hour too late?</font>

From the DM:


<font face="Verdana, Arial" size="2">The engine does not allow client computers to change the scores - only the server can. And when the server modifies a score, it will send the new scores to the clients.</font>

And it follows that the server will give a joining client the current scores - so just make sure your scoring cog runs on the server.



------------------
Author of the JK DataMaster (http://www.geocities.com/sabersdomain/fileframe.html), Parsec (http://www.geocities.com/sabersdomain/fileframe.html), Scribe (http://www.geocities.com/sabersdomain/fileframe.html), and the EditPlus Cog Files (http://www.geocities.com/sabersdomain/fileframe.html).

Edward
04-08-2003, 12:16 PM
I know nothing about server COGging... I will require LOTS of help! If you look further up this topic you'll see what I've got so far. (8 replies to be exact.)

/Edward
------------------
ATM2: Blapidoobeip
Creepio: Blapidoobeip

SaberMaster
04-09-2003, 06:35 PM
Don't worry about syncing the scores or client/server issues. You shouldn't have to worry about that. A cog without flags runs on the server only and syncs its changes with clients - just remember that class and item cogs have default flags.

As for the puppet, I'm not sure. It's probably your implementation.

------------------
Author of the JK DataMaster (http://www.geocities.com/sabersdomain/fileframe.html), Parsec (http://www.geocities.com/sabersdomain/fileframe.html), Scribe (http://www.geocities.com/sabersdomain/fileframe.html), and the EditPlus Cog Files (http://www.geocities.com/sabersdomain/fileframe.html).

Edward
04-15-2003, 12:35 PM
<font face="Verdana, Arial" size="2">Originally posted by SaberMaster:
Don't worry about syncing the scores or client/server issues. You shouldn't have to worry about that. A cog without flags runs on the server only and syncs its changes with clients - just remember that class and item cogs have default flags.

</font>
So, what you are saying is that I can have a COG with the value gscore, I do something so that this value increeses, and when a player comes in when the value is 10, the other player's gscore value is 10? Sounds almost too obvious... But just to make sure you haven't missunderstood, I'll post my COG once again...


# GOAL! MÅL! WHATEVER! SKITSAMMA!
#
# By Edward
symbols

message startup
message entered

sector rgoal mask=0xfff
sector ggoal mask=0xfff

thing ball
thing fornow

int rscore=0 local
int gscore=0 local
int s=0 local
int m=0 local
int h=0 local

message pulse

sound GoldMore
sound RedMore
sound Tada
sound creating

thing new
thing x
template poof
template sh

end
#
code
startup:
SetPulse(1);
return;
entered:
If(GetSourceRef()!=ball) return;
PlaySoundGlobal(Tada,1,0,0xC0);
If(GetSenderRef()==rgoal)
{
gscore=gscore+1;
print("Goal in Red!");
printint(gscore);
printint(rscore);
if(rscore&gt;gscore)
{
PlaySoundGlobal(RedMore,1,0,0xC0);
}
Else if(rscore&lt;gscore)
{
PlaySoundGlobal(GoldMore,1,0,0xC0);
}
Else
{
print("EQUAL...");
}
}
Else if(GetSenderRef()==ggoal)
{
rscore=rscore+1;
print("Goal in Gold");
printint(gscore);
printint(rscore);
if(rscore&gt;gscore)
{
PlaySoundGlobal(RedMore,1,0,0xC0);
}
Else if(rscore&lt;gscore)
{
PlaySoundGlobal(GoldMore,1,0,0xC0);
}
Else
{
print("EQUAL...");
}
}
CreateThing(poof,ball);
StopThing(ball);
TeleportThing(ball,fornow);
sleep(1);
PlaySoundThing(creating,new,1,-1,50,0xC0);
sleep(1);
CreateThing(sh,new);
sleep(0.05);
CreateThing(sh,new);
sleep(0.05);
CreateThing(sh,new);
sleep(0.05);
CreateThing(sh,new);
sleep(0.05);
CreateThing(sh,new);
sleep(0.05);
CreateThing(sh,new);
sleep(0.05);
CreateThing(sh,new);
sleep(0.05);
CreateThing(sh,new);
sleep(0.05);
CreateThing(sh,new);
sleep(0.05);
CreateThing(sh,new);
sleep(0.05);
CreateThing(sh,new);
sleep(0.05);
CreateThing(sh,new);
sleep(0.05);
CreateThing(sh,new);
sleep(0.05);
CreateThing(sh,new);
sleep(0.05);
CreateThing(sh,new);
sleep(0.05);
CreateThing(poof,ball);
StopThing(ball);
TeleportThing(ball,new);
CreateThing(poof,x);
CreateThing(sh,new);
sleep(0.05);
CreateThing(sh,new);
sleep(0.05);
CreateThing(sh,new);
sleep(0.05);
CreateThing(sh,new);
sleep(0.05);
CreateThing(sh,new);
sleep(0.05);
CreateThing(sh,new);
sleep(0.05);
return;
pulse:
s=s+1;
If(s&gt;=60)
{
m=m+1;
s=0;
}
If(m&gt;=60)
{
h=h+1;
m=0;
}
return;
end

/Edward
------------------
http://sevtrek.vinyamar.com/archives/s599.jpg (http://cartoons.sev.com.au/archivepage.php?cartoonid=s599)

Edward
04-16-2003, 01:28 PM
HELLO? IS ALL WELL WITH THIS COG?

DSLS_DeathSythe
04-16-2003, 07:08 PM
if it is the cog keeping score then that cog is fine. if you want it to really change the teams score that the game keeps track of then that cog wouldnt do it.

one other thing. if you are going to want it to print those goal messages to everyone you'll need to change it. the print verb only prints to the hosts computer. to make it print the message to everyone it would need to be like this.


jkStringClear();
jkStringConcatAsciiString("GOAL");
jkStringOutput(-3, -1);
jkStrintClear();

you will need one of those for each print message.

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

Edward
04-17-2003, 01:09 AM
So tell me... What do I use instead of PrintInt?
And how do I change the Game Score like that?

/Edward

DSLS_DeathSythe
04-17-2003, 04:31 PM
jkStringClear();
jkStringConcatInt(int);
jkStringOutput(-3, -1);
jkStringClear();

thats how you would print an int in mp.

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

[This message has been edited by DSLS_DeathSythe (edited April 17, 2003).]