Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/24/24 20:04
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Data from CSV not parsed correctly
by EternallyCurious. 04/20/24 21:39
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (vicknick, howardR, sleakz), 674 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
click other client and show some informations #82633
07/23/06 15:13
07/23/06 15:13
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 want my client click other client and show some informations.
Suppose that clientA clicks clientB, and clientA's screen will
show clientB's health.
I tried some ways but it doesn't work.
Can someone help me?
Thanks very much!!

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 fun_show_health(ent)
{
ent_you = ent;
pan_show.visible = on;
}



function player_events()
{
if(event_type == event_click)
{
proc_client(you,fun_show_health(me));
}


// client disconnected
if (EVENT_TYPE == EVENT_DISCONNECT)
{
ent_remove(me); // remove ent of player that quit
}
}


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

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; 07/23/06 15:21.
Re: click other client and show some informations [Re: anfuncy] #82634
07/23/06 16:14
07/23/06 16:14
Joined: Sep 2005
Posts: 159
The Netherlands
D
Dutchie666 Offline
Member
Dutchie666  Offline
Member
D

Joined: Sep 2005
Posts: 159
The Netherlands
maybe you can use on a client:

function mouse_check(){
while(1){
wait(1);
if(mouse_left && mouse_ent){
ent_you = mouse_ent;
}
}
}

it just checks if you press left mouse button and if a mouse entity is active and than sets the ent_you to mouse_ent

Re: click other client and show some informations [Re: Dutchie666] #82635
07/24/06 16:21
07/24/06 16:21
Joined: Aug 2005
Posts: 56
Taiwan
A
anfuncy Offline OP
Junior Member
anfuncy  Offline OP
Junior Member
A

Joined: Aug 2005
Posts: 56
Taiwan
Thanks for your reply
But the skill(health) what it get is always zero,
my entities' health are all above zero.

Re: click other client and show some informations [Re: anfuncy] #82636
07/24/06 19:41
07/24/06 19:41
Joined: Sep 2005
Posts: 159
The Netherlands
D
Dutchie666 Offline
Member
Dutchie666  Offline
Member
D

Joined: Sep 2005
Posts: 159
The Netherlands
maybe you could test if the model you press is really changed to the ent_you model... ty change the function to:
function mouse_check(){
while(1){
wait(1);
if(mouse_left && mouse_ent){
ent_you = mouse_ent;
ent_you.transparent = on;
}
}
}

Re: click other client and show some informations [Re: Dutchie666] #82637
07/27/06 06:11
07/27/06 06:11
Joined: Aug 2005
Posts: 56
Taiwan
A
anfuncy Offline OP
Junior Member
anfuncy  Offline OP
Junior Member
A

Joined: Aug 2005
Posts: 56
Taiwan
Thanks for your tip.
Unfortunately, the pointer doesn't send to server.
Yesterday I tried another way, it worked but still have some problems.

I tested the code by a host and two clients.
In the first time, three players enter the game in sequence,
and all players can click each other and get correct health.
But when a client leaves the game and enter again, he can't click anyone anymore.
In other words, his click can't trigger the enable_click event.

I thinks it's because the new client can't get others' pointer,
so I have to resend all the entity pointers.
The problem is : How to resend pointer so that the new client can receive?
Can someone help me? Thanks very much.

My new code is as following :
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()
{
ent_you = me;
pan_show.visible = on;
}

function fun_ClickLocal()
{
if(connection == 2)
{
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; 07/27/06 06:15.

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