Author Topic: Adding Health and Velocity w/ code?  (Read 3275 times)

Typed that into console, could not call the function 'dump'
Replace "playerObject" with an actual player object
It lists every method of the player class so you can answer simple questions like this yourself

Replace "playerObject" with an actual player object
It lists every method of the player class so you can answer simple questions like this yourself

I feel really stupid right now, but is there any way to get your player's object's id?
You can't really /getid yourself.

The first thing that comes to mind is echo(findclientbyname("your name").player);

Answering all of your questions below:

For the health thing, do not create a datablock with a huge amount of health, sure it works, but it's very sloppy and the player will get a red vignette and the damage sound every time they spawn.

Instead scale damage inside the damage function, it works great.



For relative velocity, I have little knowledge of the methods used in TS, but you'd find the player objects rotation, and use that to get the correct x,y,z to use inside of either applyImpulse or setVelocity.



For the database thing, you'll want to just save every variable to a global array then export it to a file, and reexecute it when the server starts up.

Players won't need to /saveme or /loadme, it will be done automatically when they join the server

For the database thing, you'll want to just save every variable to a global array then export it to a file, and reexecute it when the server starts up.

Players won't need to /saveme or /loadme, it will be done automatically when they join the server
Yea, here are the functions I use for my Level Up RPG Database:

function GameConnection::AutoAdminCheck(%this) //Finding the database to load when they connect

function gameconnection::oncliententergame(%this) //When they spawn, it fully loads it

function gameconnection::onclientleavegame(%this) //When they leave, it saves their profile in a config/server/LevelUp/Profiles folder.

Note that these three functions must be packaged.

Yea, here are the functions I use for my Level Up RPG Database:

function GameConnection::AutoAdminCheck(%this) //Finding the database to load when they connect

function gameconnection::oncliententergame(%this) //When they spawn, it fully loads it

function gameconnection::onclientleavegame(%this) //When they leave, it saves their profile in a config/server/LevelUp/Profiles folder.

Note that these three functions must be packaged.

uh no
if you use an array and export the array you don't need to load each time a player joins

For velocity, use applyImpulse(%player.position, "x y z");. Not sure if that's relative or not; if not, you'll need to figure out how to convert world rotation to local rotation.

What's wrong with addVelocity?

What's wrong with addVelocity?
Nothing, I just didn't want to assume it existed, as I've never tested it before. Good to know it does.

Unable to find function addVelocity
I did addVelocity("2");
Maybe I am not formatting it right...

Unable to find function addVelocity
I did addVelocity("2");
Maybe I am not formatting it right...
it's not relative.

it's an "x y z" format

and I'm pretty sure it's setVelocity.
and make sure you're calling it on a player object

I did 19365.dump(); and I figured it out.
Did you know you could do obj.startSkiing(); ?

Guys! I did a dump and I found it!
It was addRelativeVelocity

Guys! I did a dump and I found it!
It was addRelativeVelocity
this is not a default function afaik, and is added by an addon

this is not a default function afaik, and is added by an addon

Yeah, it's an output event add-on on RTB named the same thing.

Lol, guys. The reason the function doesn't exist is because it's %player.addVelocity("X Y Z") not just addVelocity("X Y Z").