PDA

View Full Version : Ladder cog doesn't work in Multiplaying, please help me fix this...



Gilgalad
06-12-2002, 08:06 PM
here it is

symbols
message activated
message touched
message exited
message entered
message pulse

sector ClimbSector1=-1 linkid=4
sector ClimbSector2=-1 linkid=4
sector ClimbSector3=-1 linkid=4
sector ClimbSector4=-1 linkid=4
sector ClimbSector5=-1 linkid=4
sector Climbsector6=-1 linkid=4

int climbing=0 local
int player local
int x local

end

code


exited: //get off ladder, left the ladder sector
if(climbing==0) return;
player=GetLocalPlayerThing();

//Make sure player did not enter another climbing sector
for(x=0; x<6; x=x+1)
{
if(ClimbSector1[x]!=-1)
if(getthingsector(player)==ClimbSector1[x]) return;
}

ClearPhysicsFlags(player, 0x2000);
SetPhysicsFlags(player, 0x1);
detachthing(player);
climbing=0;
return;

entered: //at top of ladder (note: called when reached from top area or when climbing ladder)
if(climbing==1) return;
player=GetLocalPlayerThing();
detachthing(player);
ClearPhysicsFlags(player, 0x1);
SetPhysicsFlags(player, 0x2002);
if(Ladder3DO > -1) attachthingtothing(player,Ladder3DO);
if(LadderTexture > -1) attachthingtosurface(Player, LadderTexture);
climbing=1;
setpulse(0.5);
return;

pulse:

if(climbing==0)
{
setpulse(0);
return;
}
stopthing(getlocalplayerthing());

//Failsafe--make sure player is in a climb sector
for(x=0; x<6; x=x+1)
{
if(ClimbSector1[x]!=-1)
if(getthingsector(player)==ClimbSector1[x]) return;
}
ClearPhysicsFlags(player, 0x2000);
SetPhysicsFlags(player, 0x1);
detachthing(player);
climbing=0;
return;

end

gbk
06-12-2002, 09:43 PM
Your problem is simple:

Player = Getlocalplayerthing();


That command doesnt work correctly in MP. It seems to return the host, instead of the actual 'local' player.


Use 'Newplayer' instead, and make Player equal the senderref.

In other words,


Newplayer:
Player = Getsenderref();
Stop;



Bingo, problems solved... http://forums.massassi.net/html/wink.gif

------------------
I used to believe that we only want what we can't have. I was wrong. The truth is, the wonderful truth is, we only want what we think we can't have.

JK editing resources (http://www.tbns.net/GBK/ol/index.htm).

Gilgalad
06-13-2002, 08:34 PM
Ok, I did what you wanted me to do, but i must of done somthing wrong, because now it doesn't even work, here is the edited one:

symbols
message activated
message touched
message exited
message entered
message pulse

sector ClimbSector1=-1 linkid=4
sector ClimbSector2=-1 linkid=4
sector ClimbSector3=-1 linkid=4
sector ClimbSector4=-1 linkid=4
sector ClimbSector5=-1 linkid=4
sector Climbsector6=-1 linkid=4

int climbing=0 local
int player local
int x local

end

code


exited: //get off ladder, left the ladder sector
if(climbing==0) return;
player=Getsenderref();

//Make sure player did not enter another climbing sector
for(x=0; x<6; x=x+1)
{
if(ClimbSector1[x]!=-1)
if(getthingsector(player)==ClimbSector1[x]) return;
}

ClearPhysicsFlags(player, 0x2000);
SetPhysicsFlags(player, 0x1);
detachthing(player);
climbing=0;
return;

entered: //at top of ladder (note: called when reached from top area or when climbing ladder)
if(climbing==1) Newplayer;
Player=Getsenderref();
detachthing(player);
ClearPhysicsFlags(player, 0x1);
SetPhysicsFlags(player, 0x2002);
if(Ladder3DO > -1) attachthingtothing(player,Ladder3DO);
if(LadderTexture > -1) attachthingtosurface(Player, LadderTexture);
climbing=1;
setpulse(0.5);
return;

pulse:

if(climbing==0)
{
setpulse(0);
return;
}
stopthing(Getsenderref());

//Failsafe--make sure player is in a climb sector
for(x=0; x<6; x=x+1)
{
if(ClimbSector1[x]!=-1)
if(getthingsector(player)==ClimbSector1[x]) return;
}
ClearPhysicsFlags(player, 0x2000);
SetPhysicsFlags(player, 0x1);
detachthing(player);
climbing=0;
return;

end

Gilgalad
06-13-2002, 08:36 PM
was i only suppsed to change one of the:

Player = Getlocalplayerthing();
??????????????????????????????????

Descent_pilot
06-13-2002, 08:51 PM
newplayer is a message, not a command like GetThingFlags(thing); http://forums.massassi.net/html/rolleyes.gif I also don't think that GetSenderRef() in the pulse returns the 'player'. replace it with player and try it out. http://forums.massassi.net/html/smile.gif

------------------
The Sniper Missions. Current project, The Sniper Missions

[edit - bad punctuation]

[This message has been edited by Descent_pilot (edited June 15, 2002).]

SaberMaster
06-15-2002, 10:12 AM
GBK, How sure are you of that? I thought GetLocalPlayerThing() worked correctly in MP.

Gilgalad, I skimmed over it, and saw a few things there:

GetSenderRef() only returns a thing value in a pulse if you used SetThingPulse() to start it.
AttachThingToSurf() - not surface - does not work properly.
ladder3do is undefined.
laddertexture is undefined.

You need to carefully review your code.

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

[This message has been edited by SaberMaster (edited June 15, 2002).]

gbk
06-15-2002, 12:32 PM
MP code isnt my area of expertise, but as far as I know, Getlocalplayerthing() returns the host, reguardless of what machine the query is run on.

------------------
I used to believe that we only want what we can't have. I was wrong. The truth is, the wonderful truth is, we only want what we think we can't have.

JK editing resources (http://www.tbns.net/GBK/ol/index.htm).

TheTwistedSpasm
06-16-2002, 10:15 PM
Didn't you guys already have this arguement?

Gilgalad
06-16-2002, 10:49 PM
Could some one please fix this cog for me? I'm having no luck at all... If you want to mess with the origanal please email me at: mailto:adm4him@aol.comadm4him@aol.com</A>