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
4 registered members (degenerate_762, AbrahamR, AndrewAMD, ozgur), 667 guests, and 8 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
Local functions iteracting with server entitys?? THE QUESTION. #251967
02/15/09 19:55
02/15/09 19:55
Joined: Nov 2006
Posts: 193
England
RyuShinji Offline OP
Member
RyuShinji  Offline OP
Member

Joined: Nov 2006
Posts: 193
England
Hi,

Quote:
IN SHORT
How would you get a local entity to interact with a server bot?



SORRY ABOUT MY REALLY BAD EXAMPLE

I'm trying to find out ho to do the following.
(I will use a crosshair as an example) a client
joins a dedicated server, the server generates a entity (sign, enemy,item ect.) the client sees this entity walks up to it and presses the lock on button. the client's crosshair entity jumps to the position of the entity created by the server.

this would be easy if the object doesn't move. if the object moves on the other hand.

I assume that the best way would be to give the object a pointer like "targeted_ent" then tell the crosshair to jump to the position of the entity like so,
Quote:

vec_set(my.x,targeted_ent.x);


Now here's where the problem starts it doesnt happen the cross hair doesnt move..!

:::QUESTION:::::::::::::::::::::::::::::::::::::::::
Quote:
How would you get a local entity to interact with a server bot?


Re: Local functions iteracting with server entitys?? THE QUESTION. [Re: RyuShinji] #252084
02/16/09 11:15
02/16/09 11:15
Joined: Nov 2002
Posts: 913
Berlin, Germany
S
SchokoKeks Offline
User
SchokoKeks  Offline
User
S

Joined: Nov 2002
Posts: 913
Berlin, Germany
Generally, it works like you described.

Important: Every client should have his own crosshair, right? that should not be visible to the other player?
I'll just assume that's what you want!

So you have to be carefull that all that code you wrote for selecting the enemy/object only runs the the local client, not on the server.

How do you do that?
When creating the crosshair as an entity, use ent_createlocal (...) !
This way, the entity is a local entity, and it's function is only executed on the system you run ent_createlocal on.
You still have to take care that ent_createlocal itself is run on the client that selects the target and wants to have the crosshair over it, but that's up to you.


if you are currently using ent_create for creating the crosshair, the following happens: the function you have given ent_create as an argument is started on the server, no matter where you execute ent_create.
Let's assume that this function is using "vec_set(my.x,targeted_ent.x);". But on the server, targeted_ent is not the same as on the client. It might move the crosshair somewhere where you don't see it, or you should be getting an "emtpy pointer" error.

Maybe you are using ent_create, but you are running "vec_set(my.x,targeted_ent.x);" on the client, though proc_client or something like it. Then, the crosshair is indeed set to the position of the targeted_ent, but the server does not know this. He still thinks that the crosshair is where you have created it, and sends this view to all the clients. He is always forcing the clients to see what he sees. Because of this, the crosshair does not follow the targeted_ent, no matter how often you call vec_set(..);. The server will always set it back to where he thinks the crosshair is.

Hope this helped you, ask me if some of the stuff I wrote wasn't clear enough.


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