Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   A tip for you all (https://forums.graalonline.com/forums/showthread.php?t=19495)

jeff335 12-23-2001 11:04 PM

A tip for you all
 
Instead of using real hardcoded death in your health systems, use the following in your timeout:

if(playerhearts<playerfullhearts){
playerhearts=playerfullhearts;
hitpoints--;
if(hitpoints<1){
disabledefmovement;
setani dead;
sleep 5;
setani idle;
enabledefmovement;
}
}

grim_squeaker_x 12-23-2001 11:07 PM

Using variables for such things wouldn't work, since those aren't stored after the player has logged off of the server.
And if (playerhurt) is more effective then playerhearts<playerfullhearts.

mikepg 12-24-2001 01:33 AM

hmm, another thing wrong with that script, it would hurt the player the same if the pker was using a sword or an axe.

you'd have to do something along the lines of
NPC Code:

if (playerhearts<playerfullhearts||playerhurt) {
this.hptake=playerfullhearts-playerhearts;
this.hp=strtofloat(#s(client.hp));
this.hp-=this.hptake;
setstring client.hp,#v(this.hp);

if (strtofloat(#s(client.hp))<=0) {
<dying stuff here>
}
}


that should work, but a lot of the time its more efficient if you have things like that in a timeout loop.

jeff335 12-24-2001 02:00 AM

Oh...yeah, but the exact script wasn't my point. My point was that using disabledefmovement and setani make death work better.

btedji 12-24-2001 04:27 AM

It is possible to make something like that but why wouldnt you just use the hard coded flags?


All times are GMT +2. The time now is 11:23 PM.

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