Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (Ayumi, NewbieZorro, TipmyPip), 13,888 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
MP door opening on client not working #103394
12/22/06 03:28
12/22/06 03:28
Joined: Jul 2004
Posts: 74
Inside Maya
S
Sichlid Offline OP
Junior Member
Sichlid  Offline OP
Junior Member
S

Joined: Jul 2004
Posts: 74
Inside Maya
hi,

I am trying to work in the multiplayer code starting from locoweeds tutorial ( the best tutorial
one can fine anywhere- thanks for the great job).

I have a door which is opened when player presses x.
It open fine when the player is from server and is seen updated
on all the clients , but when the player from the client presses
x , the door does not open.

the code is as follows :


function open_door();
function playersneededfortasks();

var indicator = 0;
define _COUNTER skill28; // use a meaningful name for SKILL28


//var my_pos[5];


function scan_me
{

my_pos.X = CAMERA.X;
my_pos.Y = CAMERA.Y;
my_pos.Z = CAMERA.Z;
my_pos.PAN = CAMERA.PAN;
my_pos.TILT = CAMERA.TILT;
temp.PAN = 180;
temp.TILT = 180;
temp.Z = 1000; // Reichweite des Scan - 200 Quants
indicator = 1; // Scan zum Türöffnen
SCAN_ENTITY(my_pos,temp);
}



function open_door
{
if (indicator != 1) { return; } // must be right kind of scan
if (my._COUNTER <= 0) // if door was closed, open it
{
//ent_playsound(MY,open_snd,66);
while (my._COUNTER < 90)
{
my.PAN -= 3*TIME; // rotate clockwise
my._COUNTER += 3*TIME;
//ent_sendnow(my);
//send_var(me);
send_skill(my._COUNTER,SEND_ALL);
wait(1);
}
my.PAN += my._COUNTER-90; // correct the overshoot
my._COUNTER = 90;
//ent_sendnow(my);
}
else // otherwise close it
{
//ent_playsound(MY,close_snd,66);
while (my._COUNTER > 0)
{
my.PAN += 3*TIME; // rotate counterclockwise
my._COUNTER -= 3*TIME;
// ent_sendnow(my);
send_skill(my._COUNTER,SEND_ALL);
wait(1);
}
my.PAN += my._COUNTER; // correct the overshoot
my._COUNTER = 0;
//ent_sendnow(my); //send the updated door to the server and all clients.
}
}




action door
{

my.enable_scan = on;
my.event = open_door;
playersneededfortasks();
}



on_x = scan_me;




I have been trying t owork around this issue for a long time but in vain ..can anyone help me out
in this.

thanks ,
Sichlid

Last edited by Sichlid; 12/22/06 03:28.
Re: MP door opening on client not working [Re: Sichlid] #103395
12/22/06 10:43
12/22/06 10:43
Joined: Aug 2004
Posts: 1,305
New York
PrenceOfDarkness Offline
Serious User
PrenceOfDarkness  Offline
Serious User

Joined: Aug 2004
Posts: 1,305
New York
try including this...
function scan_me
{

my_pos.X = CAMERA.X;
my_pos.Y = CAMERA.Y;
my_pos.Z = CAMERA.Z;
my_pos.PAN = CAMERA.PAN;
my_pos.TILT = CAMERA.TILT;
temp.PAN = 180;
temp.TILT = 180;
temp.Z = 1000; // Reichweite des Scan - 200 Quants
indicator = 1; // Scan zum Türöffnen

send_var(indicator); //.. this is the only change i made and should work

SCAN_ENTITY(my_pos,temp);
}


"There is no problem that can't be solved with time and determination." -me
prenceofdarkness for instant messages on AIM.

Looking for a model designer
PLEASE, SEND ME A PRIVATE MESSAGE OR EMAIL IF YOU'RE INTERESTED.
Re: MP door opening on client not working [Re: PrenceOfDarkness] #103396
12/23/06 06:53
12/23/06 06:53
Joined: Jul 2004
Posts: 74
Inside Maya
S
Sichlid Offline OP
Junior Member
Sichlid  Offline OP
Junior Member
S

Joined: Jul 2004
Posts: 74
Inside Maya
thanks a lot Prenceof Darkness for the help , i put the change that you said but still door isnt opening from the client window ..

anything else i can do to make this work ..?

REgards,
Sichlid


Best Regards, Sichlid
Re: MP door opening on client not working [Re: Sichlid] #103397
01/01/07 02:03
01/01/07 02:03
Joined: Oct 2002
Posts: 2,256
Oz
L
Locoweed Offline
Expert
Locoweed  Offline
Expert
L

Joined: Oct 2002
Posts: 2,256
Oz
Hi Sichlid, this should be close,

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

function open_door();
function playersneededfortasks();

var indicator = 0;
define _COUNTER skill28; // use a meaningful name for SKILL28
define _OPEN_ME, skill 29;


//var my_pos[5];

// ran on owner's computer, host or client
function scan_me
{

my_pos.X = CAMERA.X;
my_pos.Y = CAMERA.Y;
my_pos.Z = CAMERA.Z;
my_pos.PAN = CAMERA.PAN;
my_pos.TILT = CAMERA.TILT;
temp.PAN = 180;
temp.TILT = 180;
temp.Z = 1000; // Reichweite des Scan - 200 Quants
indicator = 1; // Scan zum Türöffnen
SCAN_ENTITY(my_pos,temp);
}


// ran on host/server
function open_door
{
if (my._COUNTER <= 0) // if door was closed, open it
{
//ent_playsound(MY,open_snd,66);
while (my._COUNTER < 90)
{
my.PAN -= 3*TIME; // rotate clockwise
my._COUNTER += 3*TIME;
//ent_sendnow(my);
//send_var(me);
//send_skill(my._COUNTER,SEND_ALL); // don't need to send this
wait(1);
}
my.PAN += my._COUNTER-90; // correct the overshoot
my._COUNTER = 90;
//ent_sendnow(my);
}
else // otherwise close it
{
//ent_playsound(MY,close_snd,66);
while (my._COUNTER > 0)
{
my.PAN += 3*TIME; // rotate counterclockwise
my._COUNTER -= 3*TIME;
// ent_sendnow(my);
//send_skill(my._COUNTER,SEND_ALL); // don't need to send this
wait(1);
}
my.PAN += my._COUNTER; // correct the overshoot
my._COUNTER = 0;
//ent_sendnow(my); //send the updated door to the server and all clients.
}
}

// event for scan to open door, set skill _open_me = 1, if called from client function send to server
function set_open_door()
{
if (indicator != 1) { return; } // must be right kind of scan
indicator = 0;
my._OPEN_ME = on;
// client?
if(my.connection == 2)
{
send_skill(my._OPEN_ME, 0); // send skill to server
}
}

// door function ran on clients, set enable_scan & event locally on all the client computers for this door
function door_local()
{
my.enable_scan = on;
my.event = set_open_door;
playersneededfortasks();
}

// door action ran on server/host
action door
{
proc_local(my, door_local); // start a function running locally on clients
my.enable_scan = on;
my.event = set_open_door;
playersneededfortasks();
while(my)
{
// if this door was scanned on host or a client open the door
if (my._OPEN_ME)
{
my._OPEN_ME = off; // turn off needs to open
open_door(); // open the door on server, which opens on all clients also
}
wait(1);
}
}


on_x = scan_me; // scan on the owner's computer

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

Not sure what is happening in playersneededfortasks(); so that might need tweaked for the client in door_local().

Happy New Year,
Loco


Professional A8.30
Spoils of War - East Coast Games
Re: MP door opening on client not working [Re: Locoweed] #103398
01/01/07 07:08
01/01/07 07:08
Joined: Jul 2004
Posts: 74
Inside Maya
S
Sichlid Offline OP
Junior Member
Sichlid  Offline OP
Junior Member
S

Joined: Jul 2004
Posts: 74
Inside Maya
thanks a lot locoweed for the help . it is working now perfect .. thanks for the great MP tutorial and the help .. and yes happy new year too !

Regards,
Sichlid


Best Regards, Sichlid
Re: MP door opening on client not working [Re: Sichlid] #103399
01/01/07 08:01
01/01/07 08:01
Joined: Oct 2002
Posts: 2,256
Oz
L
Locoweed Offline
Expert
Locoweed  Offline
Expert
L

Joined: Oct 2002
Posts: 2,256
Oz
Groovy man. Now I can disappear into obscurity until the next new year with a clear conscious.

Loco


Professional A8.30
Spoils of War - East Coast Games

Moderated by  HeelX, Spirit 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1