Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   custom kills system (https://forums.graalonline.com/forums/showthread.php?t=60569)

raiden0899 08-17-2005 11:11 PM

custom kills system
 
How would I script a custom kills system? I can't find a way to check if the player you attack dies. Any ideas?

Maniaman 08-17-2005 11:14 PM

Why not just use the built in playerkills/playerdeaths vars? They can be edited via script.

raiden0899 08-17-2005 11:19 PM

On Galactic Nations we use custom weapons. The deaths register but the kills don't. I'm trying to find a way to fix that.

Polo 08-18-2005 01:20 AM

Classic uses a totally custom hit detection/killing system that emulates the built in stuff. We do ours by doing hit detection via the server, thus the server handles when ach player is hit, and as a result, when they die or kill someone.

Lance 08-18-2005 06:21 AM

If you follow Stefan's suggestions for a hitpoint system, you could (would) just code it into your hpfunctions class when the player's hurt. :)

Sacred Shadow 08-20-2005 08:51 PM

If the player hp'sstring is: client.playerhp this would work.
if (actionserverside) {
if (strequals(#p(0),stats)) {
setstring clientr.deaths,#v(strtofloat(#s(clientr.deaths)) + 1);
with(getplayer(#p(1))) {
setstring clientr.kills,#v(strtofloat(#s(clientr.kills)) + 1);
}
}
}
//#CLIENTSIDE
if (actionWEAPONACTION) {
if (strtofloat(#s(client.playerhp)) == 0) {
triggeraction 0,0,serverside,WEAPON-NAME,stats,#p(1),;
}
}

so the weapon trigger should be something like this:
triggeraction playerx + 1.5 + vecx(playerdir)*2,playery + 1.5 + vecy(playerdir)*2,WEAPONACTION,#a;
when the weapon is fired. I'm not possitive this will work, and I didn't test it offline.

raiden0899 08-20-2005 10:18 PM

It works. Thanks :D.

Python523 08-21-2005 04:33 AM

Quote:

Originally Posted by Sacred Shadow
stuff.

It is not advisable to do it that way... as Lance said, Stefan's way (doing it serverside with the hpfunctions class, etc) is the best and your way can be insecure depending on how one would impliment it

raiden0899 08-21-2005 04:50 AM

Quote:

Originally Posted by Python523
It is not advisable to do it that way... as Lance said, Stefan's way (doing it serverside with the hpfunctions class, etc) is the best and your way can be insecure depending on how one would impliment it

How would it be insecure?

konidias 08-21-2005 04:53 AM

Because anything on the clientside can be edited with memory editing programs. Including the triggeraction parameters. You have to do it serverside.

raiden0899 08-21-2005 05:00 AM

Quote:

Originally Posted by konidias
Because anything on the clientside can be edited with memory editing programs. Including the triggeraction parameters. You have to do it serverside.

That's not a good enough reason not to do it that way. If scripts that use clientside are insecure then how am I supposed to make a secure server? It's not possible because most scripts need clientside to work so why worry about this one script? Anyone else have a reason?

konidias 08-21-2005 05:12 AM

You're a fool if you think that it's not important to have a serverside damage system. Important things like damage to players, dealing with items, and dealing with stats all need to be serverside. If this concept is too hard for you to grasp, then give up and stop asking stupid questions.

raiden0899 08-21-2005 06:58 AM

Quote:

Originally Posted by konidias
You're a fool if you think that it's not important to have a serverside damage system. Important things like damage to players, dealing with items, and dealing with stats all need to be serverside. If this concept is too hard for you to grasp, then give up and stop asking stupid questions.

Instead of telling me I'm wrong, try helping. The only way I can think of is to have some of the script clientsided and use triggeraction. If thats too insecure then tell me how I could do it serverside.

ForgottenLegacy 08-21-2005 09:03 AM

Quote:

Originally Posted by konidias
You're a fool if you think that it's not important to have a serverside damage system. Important things like damage to players, dealing with items, and dealing with stats all need to be serverside. If this concept is too hard for you to grasp, then give up and stop asking stupid questions.

Konidas, instead of insulting the poor fellow, offer him some advice such as why you think it's important and don't cut his ego down to size. Pretty much, that's what scripters ride on--their ego. So yeah. Offer some help instead of cutting him to shreds?

And I honestly do think a damage system, by someone who knows EXACTLY what their doing, can be done mostly clientside aside from the setting the strings and vars for the other player, but even then, this can be a trigger to the other player and done serverside. o-o Thousands of ways to script one thing, all of them are right, not all of them are efficient. Depends on the scripter and the use. :D

xAndrewx 08-21-2005 01:33 PM

Quote:

Originally Posted by konidias
Because anything on the clientside can be edited with memory editing programs. Including the triggeraction parameters. You have to do it serverside.

That's more then enough advice for him to change it.

What more can you say to help him understand it?

konidias 08-21-2005 03:56 PM

Quote:

Originally Posted by raiden0899
Instead of telling me I'm wrong, try helping. The only way I can think of is to have some of the script clientsided and use triggeraction. If thats too insecure then tell me how I could do it serverside.

Instead of telling me that isn't a good enough reason, like you are the all knowing scripter, maybe you should have asked me why it's a good enough reason. :rolleyes:

Everything doesn't have to be serverside, just the important stuff. Stuff like a GUI is going to be clientside, but it should be reading from clientr variables for the stats it displays.

If you're going to have weapons that do various damage, you can't have those damages set as parameters in the triggeraction. You have to detect what type of attack it is serverside. Otherwise a cheater could edit the damage value of the clientside damage trigger to make the weapon more powerful.

You should also never use client. strings for storing important data. You HAVE to use clientr., the r being "read only" which means the client can only read a clientr string, but cannot edit it.

raiden0899 08-21-2005 05:59 PM

I said it wasn't a good enough reason because most scripts need clientside. No script with clientside is going to be 100% secure. If I can't use triggeraction in this script because it's too insecure what should I use? I never said I was an all knowing scripter. I just don't see any other way to do it. Maybe if you told me what you would do we could make some progress here.

konidias 08-21-2005 08:42 PM

I would use a system similar to what Stefan has posted. I think you're confused about what I mean involving clientside being unsafe...

I realize a lot of scripts need to be clientside. But those scripts are not going to affect other players. Sure, someone could use a memory editing program to change their GUI display, or change some signs and stuff, but they should not be able to change important variables like weapon damage and health and stuff. That's all I'm saying. Obviously you can't script EVERYTHING serverside. Only the stuff that is important.

In fact, if you come across a situation where something NEEDS to be serverside and you can't figure out how to make it serverside, you should STILL figure out how to do it serverside, because resorting to clientside is not an option if you care about your server.

But by all means, you can script it all clientside and then deal with hackers ruining your server in a matter of days.

raiden0899 08-21-2005 09:07 PM

I just finished the script and the only triggeraction parameter I used was #a. The rest of the script (calculating the damage, hurting the player, and changing kills/deaths) is serverside.


All times are GMT +2. The time now is 09:31 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.