Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (AbrahamR, wdlmaster, 7th_zorro, dr_panther, 1 invisible), 764 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
The rejoin problem #84649
08/05/06 09:51
08/05/06 09:51
Joined: Aug 2005
Posts: 56
Taiwan
A
anfuncy Offline OP
Junior Member
anfuncy  Offline OP
Junior Member
A

Joined: Aug 2005
Posts: 56
Taiwan
Hi, all.
I have a strange problem. I finished a "clientA click clientB and show clientB's health on clientA's screen" code.
I tested the code with a host and a client, When they join the game first time, they can click each other and show correct health.
But when the client leave and rejoin the game, he can't click the host anymore.
In other words, it can't trigger the enable_click event while clicking.
At the same time, I let a third player join the game(the second client), and the first client can click the second client, but the second client can't click anyone.

The problem let me so confused and has taken me so much time.
I hope someone can help me, thanks very much

my code :
Code:

entity* ent_you;

panel pan_show
{
pos_x = 500;
pos_y = 0;
digits = 20, 10, 5, _a4font,1,ent_you.health;
layer = 20;
flags = refresh, d3d;
}


action move_player1 //three player actions, I just paste one
{
actor = 1;
wait(1);
proc_client(my,move_player_local);

if(connection == 3)
{
move_player_local();
}
}


function move_player_local()
{
player_move();
}

function player_events()
{
if(event_type == event_click)
{
ent_you = me;
pan_show.visible = on;
}
// client disconnected
if (EVENT_TYPE == EVENT_DISCONNECT)
{
ent_remove(me); // remove ent of player that quit
}
}

function fun_LocalEvent()
{
// this area isn't executed when the client rejoin
ent_you = me;
pan_show.visible = on;
}

function fun_ClickLocal()
{
// this area is executed
if(connection == 2)
{
// this area is executed
my.enable_click = on;
my.event = fun_LocalEvent;
}
}
function player_move()
{
my.enable_disconnect = ON;
my.enable_click = ON;
my.event = player_events;

my.nosend_frame = on; // don't send animation

sleep(.3); // this can be left at .3 no matter what
ent_sendnow(my);
sleep(.3); // sleep(3); // high latency solution for now

proc_local(my,fun_ClickLocal);

if(actor == 1)
{
my.health = 50;
}
if(actor == 2)
{
my.health = 40;
}
if(actor == 3)
{
my.health = 30;
}
send_skill(my.health,send_all);

while(1)
{
......//movement code
}
}




Last edited by anfuncy; 08/05/06 09:55.
Re: The rejoin problem [Re: anfuncy] #84650
08/06/06 13:58
08/06/06 13:58
Joined: Aug 2005
Posts: 56
Taiwan
A
anfuncy Offline OP
Junior Member
anfuncy  Offline OP
Junior Member
A

Joined: Aug 2005
Posts: 56
Taiwan
Today I finally know why the client can't trigger the enable_click event
after rejoining.
The answer is I use two local procedure in the same entity.
How fool I am!
But three is still problem, the health after clicking is always zero after the player rejoin the game. Just as before.
Hope someone can help me.
I will keep trying.

Re: The rejoin problem [Re: anfuncy] #84651
08/08/06 13:38
08/08/06 13:38
Joined: Aug 2005
Posts: 56
Taiwan
A
anfuncy Offline OP
Junior Member
anfuncy  Offline OP
Junior Member
A

Joined: Aug 2005
Posts: 56
Taiwan
No suggestion?
Sometimes I doubt that the problem shoudn't occur.
I searched the forum, it seems that no one faced the strange problem.
Recently, I found a new thing. When clientA clicks clientB, the clientB's entity pointer indeed pass to the clientA.
Code:

function fun_LocalEvent()
{
my.transparent = on;
ent_you = me;
pan_show.visible = on;
}

function fun_ClickLocal()
{
if(connection == 2)
{
my.enable_click = on;
my.event = fun_LocalEvent;
}
}


After testing, the clientB become transparent after the clientA click it.
But just as before, the health is always zero only when the client rejoin the game.
Why on earth the clientB's health can't pass to clientA correctly?
It's always zero, zero, zero......:(
I'm tired although, I will keep trying.

Last edited by anfuncy; 08/08/06 13:48.

Moderated by  HeelX, Spirit 

Gamestudio download | chip programmers | 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