PDA

View Full Version : Absolute MP problems!



Edward
09-18-2003, 06:59 AM
Hi!
I've got here COGs that aren't synced or won't work as I wish. This is JK MP.


# Bulls Eye!
#
# By Edward
flags=0x240
symbols

message entered

sector middle

sound tada

end
#
code
entered:
If(GetSenderRef()!=middle) return;
PlaySoundGlobal(tada,1,0,0xC0);
SetPlayerKills(GetLocalplayerThing(), GetPlayerKills(GetLocalplayerThing()) + 1);
SetPlayerScore(GetLocalplayerThing(), GetPlayerScore(GetLocalplayerThing()) + 1);
jkStringClear();
jkStringConcatPlayerName(GetLocalplayerThing());
jkStringConcatAsciiString(" made a Bulls Eye and has resieved 1 extra point!");
jkStringOutput(-3, -1);
jkStringClear();
return;
end

Text prints locally (yes I know, flags 0x240) and no points go to any players (server or client). But the name is right!


# Done Lap!
#
# By Edward
flags=0x240
symbols

message crossed

surface crossit

sound done

end
#
code
crossed:
If(GetSenderRef()!=crossit) return;
PlaySoundGlobal(done,1,0,0xC0);
SetPlayerKills(GetLocalplayerThing(), GetPlayerKills(GetLocalplayerThing()) + 10);
SetPlayerScore(GetLocalplayerThing(), GetPlayerScore(GetLocalplayerThing()) + 10);
jkStringClear();
jkStringConcatPlayerName(GetLocalplayerThing());
jkStringConcatAsciiString(" has crossed the finish line! 10 points!");
jkStringOutput(-3, -1);
jkStringClear();
return;
end

Name is correct, but only local text, and the points go to Server.


# Grenades at Jump challange!
#
# By Edward

symbols

message activated
message pulse
message timer

surface lever

sound announce

thing place0
thing place1
thing place2
thing place3
thing place4
thing place5
thing place6
thing place7
thing place8
thing place9
thing place10
thing place11
thing place12
thing place13
thing place14
thing place15

template grenades

int i=0 local
int z=0 local
int go=0 local

end
#
code
activated:
If(GetSenderRef()!=lever) return;
if(go==0) {
PlaySoundGlobal(announce,1,0,0xC0);
Print("A challange is being thrown at the oily bronze corse.");
i=0;
SetPulse(0.01);
SetWallCel(lever,1);
go=1;
SetTimer(5);
} else {
print("Grenades have stopped...");
SetPulse(0);
SetWallCel(lever,0);
go=0; }
return;
pulse:
# DSLS_DeathSythe
CreateThing(grenades,place0[i]);
i=i+1;
if(i>15) i=0;
return;
timer:
# SaberMaster
print("Can you jump through a grenade field?");
return;
end

All works but the text prints localy...


# Staff Only (Server)
#
# By Edward
flags=0x240
symbols

message activated

thing door

end
#
code
activated:
If(GetSenderRef()!=door) return;
If(!IsServer(GetLocalPlayerThing()))
{
print("Staff Only!");
return;
}
else
{
MoveToFrame(door,1,8);
sleep(3);
MoveToFrame(door,0,8);
}
return;
end

OK, before I put up flags=0x240, anyone could open the door. After I put in the 0x240, only server could open it, but what the client saw was when I went forwards, he saw me stuck, and disappear. When I came out, client saw nothing. I punched client, and he said ouch on my side, but he didn't budge on his side.

/Edward

DSLS_DeathSythe
09-18-2003, 02:32 PM
hope you dont mind me just posting a working version instead of trying to explain what all the problems were. because i dont know exactly what the problems were, (other than the GetLocalPlayerThing all over the place) i just fix them. http://forums.massassi.net/html/redface.gif
i also changed some other little things, just a habbit of mine. http://forums.massassi.net/html/smile.gif

your first two have the same kind of problem.
just needed a trigger to make the stuff print on all the comps and set the score for the right person.

#####################
# Bulls Eye!
#
# By Edward
#####################
flags=0x240
symbols
#--------------------
message entered
message trigger

sector middle_sec=-1

sound tada_snd=-1

int enter_trig=1
#--------------------
end
#====================
code
#--------------------
entered:
if(GetSenderRef() != middle_sec)
return;
player = GetSourceRef();
SendTrigger(-1, enter_trig, player, 0, 0, 0);
return;
#--------------------
trigger:
if(GetSourceRef() != enter_trig)
return;
PlaySoundLocal(tada_snd, 1, 0, 0x0);
SetPlayerKills(GetParam(0), GetPlayerKills(GetParam(0)) + 1);
SetPlayerScore(GetParam(0), GetPlayerScore(GetParam(0)) + 1);
Print(" ");
jkStringClear();
jkStringConcatPlayerName(GetParam(0));
jkStringConcatAsciiString(" made a Bulls Eye and has recieved 1 extra point!");
jkStringOutput(-3, -1);
jkStringClear();
return;
#####################
end

####################
# Done Lap!
#
# By Edward
####################
flags=0x240
symbols
#-------------------
message crossed
message trigger

surface finish_surf=-1

thing player=-1 local

sound done_snd=-1

int lap_trig=1
#-------------------
end
#===================
code
#-------------------
crossed:
if(GetSenderRef() != finish_surf)
return;
player = GetSourceRef();
SendTrigger(-1, lap_trig, player, 0, 0, 0);
return;
#-------------------
trigger:
if(GetSourceRef() != lap_trig)
return;
PlaySoundLocal(done_snd, 1.0, 0.0, 0x0);
SetPlayerKills(GetParam(0), GetPlayerKills(GetParam(0)) + 10);
SetPlayerScore(GetParam(0), GetPlayerScore(GetParam(0)) + 10);
Print(" ");
jkStringClear();
jkStringConcatPlayerName(GetParam(0));
jkStringConcatAsciiString(" has crossed the finish line! 10 points!");
jkStringOutput(-3, -1);
jkStringClear();
return;
####################
end

for the grenade one just go through to all the Prints and change them to use jkStringConcatAsciiString and that should fix it.
so the first one should look like this:

jkStringClear();
jkStringConcatAsciiString("A challange is being thrown at the oily bronze corse.");
jkStringOutput(-3, -1);
jkStringClear();
the staff door one kind of just needs a trigger to tell the door to open on all the computers.
i also added a surface crossed thing so that people who arent the server cant follow the server through the door once he opens it, you can disable the feature if you want by setting the svr_only int to 0. if you use it 'door_surf' should be the surface on the outside of the door.

####################
# Staff Only (Server)
#
# By Edward
####################
flags=0x240
symbols
#-------------------
message activated
message trigger
message crossed

thing player=-1 local

thing door=-1
surface door_surf=-1

int srv_only=1

int staffact_trig=1
#-------------------
end
#===================
code
#-------------------
activated:
if(GetSenderRef() != door)
return;
if(IsServer())
{
SendTrigger(-1, staffact_trig, 1, 0, 0, 0);
return;
}
Print("STAFF ONLY!!!");
return;
#--------------------
trigger:
if(GetSourceRef() != staffact_trig)
return;
if(GetParam(0) == 1)
{
MoveToFrame(door, 1, 8.0);
Sleep(3.0);
MoveToFrame(door, 0, 8.0);
}
return;
#--------------------
crossed:
//-If SRV_ONLY == 1 then only allow the server to cross the
//-DOOR_SURF, this will prevent anyone from being able to
//-follow the server through the door once he has opened it.
if(srv_only != 1)
return;
if(GetSenderRef() != door_surf)
return;
if(IsServer())
return;
player = GetSourceRef();
StopThing(player);
SetThingVel(player, VectorScale(GetSurfaceNormal(door_surf), 2.0));
Print("SERVER ONLY!!!");
return;
#####################
end
hope that helps you.

------------------
Famous last words - "It seemed like a good idea at the time."

[This message has been edited by DSLS_DeathSythe (edited September 18, 2003).]

Edward
09-19-2003, 08:59 AM
OK, all works apart from this one:


# Done Lap!
#
# By Edward
# Trigger by DSLS_DeathSythe
flags=0x240
symbols

message crossed
message trigger

surface crossit

thing player local

sound done

int trig=10 local

end
#
code
crossed:
If(GetSenderRef()!=crossit) return;
player = GetSourceRef();
SendTrigger(-1, trig, player, 0, 0, 0);
return;
trigger:
if(GetSourceRef()!=trig) return;
PlaySoundLocal(done,1,0,0xC0);
SetPlayerKills(GetParam(0), GetPlayerKills(GetParam(0)) + 10);
SetPlayerScore(GetParam(0), GetPlayerScore(GetParam(0)) + 10);
jkStringClear();
jkStringConcatPlayerName(GetParam(0));
jkStringConcatAsciiString(" has crossed the finish line! 10 points!");
jkStringOutput(-3, -1);
jkStringClear();
return;
end

When sever crosses the finish line, the trigger is triggered twice! In other words, Server gets double score.

/Edward

lucky_jackpot
09-19-2003, 11:16 AM
Hi there http://forums.massassi.net/html/smile.gif

I haven't got time to test it, but just as a suggestion (without altering the flags info at the top of the cog), if it is just the server that gets double the score, why not try implementing the "isServer()" cog verb (it returns a boolean value), so you should be able to get a handle on it and subsequently, alter the points allocation http://forums.massassi.net/html/wink.gif http://forums.massassi.net/html/biggrin.gif

I know it's not definitive, but it's a temporary work-around (proposed) solution, until I have more time to look at the code... http://forums.massassi.net/html/redface.gif

-Jackpot

[EDIT]
Just another quick after-thought - there's no check to see whether or not the "race" has been completed --> ie: if one player crosses the adjoin and then another player crosses the adjoin - you need something like:
"if (alreadyFinishedRace) return" (forgive the pseudo-code http://forums.massassi.net/html/wink.gif )...
[/EDIT

------------------
Are you feeling lucky, cuz if you are, get your hands off me... http://forums.massassi.net/html/wink.gif

"Life is mostly froth and bubble,
But two things stand in stone,
Kindness in another's trouble,
Courage in your own"
("Ye Wearie Wayfarer" - by Adam Lindsay Gordon)

[This message has been edited by lucky_jackpot (edited September 19, 2003).]

Edward
09-19-2003, 12:19 PM
Thanks, but I've managed to do another aproche (simply because I didn't know where to put the IsServer). I made an int, and turned it on when I went through and turned it off after 1 second.
And this race is basically like the Rolling Race. Make as many laps as you wish!

I think I have a problem (or dillema)... I want to make MP levels simply they are just about fighting and maybe a place for people to gather, have a drink, chat, etc. But making the COGs for the special effects is quite a pain in the butt.
SP special effects COGs are nice and easy, but I don't have a good story behind the mission, and it sure gets quite boring with the same old "Go here, fight that, kill boss, and get out" without a good storyline.

/Edward