Gravity on a specific entity

Posted By: khanoftruth

Gravity on a specific entity - 12/17/06 17:59

I am trying to create a gravity script that only effects the targeted entity, so it can't be a global var. How should I do this?
Posted By: TWO

Re: Gravity on a specific entity - 12/17/06 18:54

Why do you treat yourself with MP? Learn doing everything with c-script and than think about looking at that devil stuff.
Posted By: fastlane69

Re: Gravity on a specific entity - 12/17/06 22:22

What does this have to do with MP? Be more specific please.
Posted By: khanoftruth

Re: Gravity on a specific entity - 12/18/06 21:14

Well, for normal gravity, I would just set a universal force.z. Here, if I modify the force.z at all, every player will be affected. That doesn't work.
Posted By: PrenceOfDarkness

Re: Gravity on a specific entity - 12/18/06 23:32

DUDE BE MORE SPECIFIC. Is this a local or global entity. Do want this 2 effect all clients or just 1 specific client (meaning locally on his machine alone like a menu).

If u want something to happen to a specific "player" but be seen on all machines what you can do is have a function that runs only once when the game starts, and have a variable holding the current number of players assigned to the player (if there are 5 players now that this new player has joined then he is player 5). Make sure this runs only once, and set it to that entity's skill at the start of the function. Now you can check the entities to find the one with a specific id and manipulate just that player. Here is a way you could assign a player id to all players (this is rough scripting might contain errors)

define skill1, id;
var Num_players;
//put this in your main function

function server_called
{
if(connection != 1)
{
num_players += 1;
send_var(num_players,send_all);
}
}
on_server server_called;

function player_func
{
var do_once;
while(my==null){wait(1);}
while(1)
{
wait(1);
if(do_once != 1)
{
do_once = 1;
my.id = num_players;
}
}
}

This was a 2 minute rough job and looking at it even know i see a few mistakes but that was just for conceptional perposes, just to give you an idea of a way it could be done. If you have no idea what I'm talking about then your probably not ready for MP anywayz
© 2024 lite-C Forums