Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   on death warp not working (https://forums.graalonline.com/forums/showthread.php?t=134257115)

GULTHEX 11-29-2009 07:21 AM

on death warp not working
 
NPC Code:
if(actionprojectile){
newhp = strtofloat(#s(clientr.hp)) - client.attackpower;
if (newhp<=0) {
newhp = 100;
setani dead,;
dead;
} else {
setani hurt,;
clientr.hp =-20;
}
setstring clientr.hp,#v(newhp);
}{
function dead() {
setlevel2 onlinestartlocal.nw,21,55;
}
}


why wont it warp them?

Jman9912 11-29-2009 08:20 AM

First off, it seems you have an extra bracket.

}{

function dead() {

Second, //#CLIENTSIDE

cbk1994 11-29-2009 08:27 AM

Quote:

Originally Posted by GULTHEX (Post 1541085)
NPC Code:
if(actionprojectile){
newhp = strtofloat(#s(clientr.hp)) - client.attackpower;
if (newhp<=0) {
newhp = 100;
setani dead,;
dead;
} else {
setani hurt,;
clientr.hp =-20;
}
setstring clientr.hp,#v(newhp);
}{
function dead() {
setlevel2 onlinestartlocal.nw,21,55;
}
}


why wont it warp them?

Why are you using GS1?

PHP Code:

function onActionServerSide(cmddamage) {
  if (
cmd == "hit") {
    
this.hitPlayer(damage);
  }
}

function 
hitPlayer(damage) {
  
player.clientr.hp max (0player.clientr.hp damage); // max() chooses the largest of the two values
  
  
if (player.clientr.hp <= 0) {
    
this.playerDead();
  } else {
    
player.setAni("hurt"NULL);
  }
}

function 
playerDead() {
  
player.setAni("dead"NULL);
  
player.setlevel2("onlinestartlocal.nw"2155);
  
// now you'll need eventually to heal them
  
}
//#CLIENTSIDE
function onActionProjectile(damage) {
  
triggerServer("gui"this.name"hit"damage);


When you're shooting the projectile, you can do something like

PHP Code:

setShootParams(20); 

before the shoot() command, which will allow you to give guns different damages.

GULTHEX 11-30-2009 12:49 AM

on death warp not working
 
PHP Code:

//#CLIENTSIDE
function onActionProjectile()
{
if (
clientr.hp>=0) {
    
setani hurt,;
    
clientr.hp -= 20;
    }
    else
    {
    
dead;

}  
function 
Dead() {
  
player.setAni("dead"NULL);
  
player.setlevel2("milgmap_ab-ae.nw"960);
  
clientr.hp == 100


everything works besides the player.setlevel2


ps

and sorry about me nagging you about the scripts

im doing major development for my server

fowlplay4 11-30-2009 12:55 AM

When you open brackets "{"'s you have to close them, and you're still doing GS1.5.

PHP Code:

function dead() {
  
player.setAni("dead"NULL); 
  
player.setlevel2("milgmap_ab-ae.nw"960); 
  
clientr.hp == 100


To call the functions you make you have to include () in the function call not just..

dead; when it should be dead();

That's the same case for both GS1 and GS2 except that you can pass parameters in GS2.

You use one = when you're assigning a value and two ='s when you're making a comparison.

You need to use triggerserver, so you can setlevel2 and alter the clientr flag on the server-side. You've already made a thread about this and it's solution is listed in there you just need to do some work to make it work.

http://forums.graalonline.com/forums...=triggerserver

GULTHEX 11-30-2009 01:22 AM

this is new :P
 
havent learned a new concept in a long time so heres what i got

i tried this but still wont set the level




PHP Code:

function onActionServerSide() {  
  if (
params[0] == "respawn") {  
    
player.setlevel2("milgmap_ab-ae.nw"960); 
      
player.setAni("dead"NULL); 
       
clientr.hp == 100
  }  
}  
//#CLIENTSIDE 
function onActionProjectile() 

if (
clientr.hp>=0) { 
    
setani hurt,; 
    
clientr.hp -= 20
    } 
    else 
    { 
    
dead
}  
}   
function 
Dead() { 
  
triggerserver("gui"this.name"respawn"); 


Switch 11-30-2009 01:40 AM

Quote:

Originally Posted by GULTHEX (Post 1541269)
havent learned a new concept in a long time so heres what i got

i tried this but still wont set the level




PHP Code:

function onActionServerSide() {  
  if (
params[0] == "respawn") {  
    
player.setlevel2("milgmap_ab-ae.nw"960); 
      
player.setAni("dead"NULL); 
       
clientr.hp == 100
  }  
}  
//#CLIENTSIDE 
function onActionProjectile() 

if (
clientr.hp>=0) { 
    
setani hurt,; 
    
clientr.hp -= 20
    } 
    else 
    { 
    
dead
}  
}   
function 
Dead() { 
  
triggerserver("gui"this.name"respawn"); 


RC should come up with an error message. Try reading it.

fowlplay4 11-30-2009 01:40 AM

Do you even read what people write, or can you only see the contents of code and php tags? There's more than enough that's been said to solve your problem.

cbk even posted a complete working script that would work in your situation.

GULTHEX 11-30-2009 02:37 AM

ok i just followed ckb's guide but im not sure how to make a gun with it

can sombody give me an example?

fowlplay4 11-30-2009 04:02 AM

You already have a gun script..

http://forums.graalonline.com/forums...99&postcount=3

DustyPorViva 11-30-2009 04:18 AM

The point is to make a weapon that specifically handles damage and only damage(along with the projectile functions). Guns will be separate weapons. The point is that everyone will have the damage system, thus everyone will have the script needed to process damage, while everyone will not have the guns.

GULTHEX 11-30-2009 06:14 AM

ok how do i set the params in it do i just put setparams(20)

after the shoot?

DustyPorViva 11-30-2009 06:17 AM

setshootparams(x,y,z);
before you use shoot();

cbk1994 11-30-2009 06:42 AM

Quote:

Originally Posted by GULTHEX (Post 1541324)
ok how do i set the params in it do i just put setparams(20)

after the shoot?

Shoot parameters are basically information that is sent with the bullet. By setting the first parameter to the damage, then when you are hit, you can tell what damage the bullet should do. This lets you have different guns with different damages.

And no, you set it before you shoot.

Switch 11-30-2009 07:03 AM

...
setshootparams(param, moreparams, lastparam);
shoot(blahblah);
...
function onActionProjectile(param, moreparams, lastparam) {
...


All times are GMT +2. The time now is 06:45 PM.

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