Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 11-29-2009, 07:21 AM
GULTHEX GULTHEX is offline
Registered User
Join Date: Jul 2008
Posts: 148
GULTHEX can only hope to improve
Exclamation 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?
Reply With Quote
  #2  
Old 11-29-2009, 08:20 AM
Jman9912 Jman9912 is offline
Registered User
Join Date: Jun 2001
Location: North Carolina
Posts: 114
Jman9912 is on a distinguished road
Send a message via AIM to Jman9912
First off, it seems you have an extra bracket.

}{

function dead() {

Second, //#CLIENTSIDE
Reply With Quote
  #3  
Old 11-29-2009, 08:27 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by GULTHEX View Post
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.
__________________

Last edited by cbk1994; 11-29-2009 at 08:28 PM.. Reason: oops
Reply With Quote
  #4  
Old 11-30-2009, 12:49 AM
GULTHEX GULTHEX is offline
Registered User
Join Date: Jul 2008
Posts: 148
GULTHEX can only hope to improve
Exclamation 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

Last edited by Tigairius; 11-30-2009 at 12:56 AM.. Reason: Merged new thread into this thread since it's practically the same problem.
Reply With Quote
  #5  
Old 11-30-2009, 12:55 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
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
__________________
Quote:
Reply With Quote
  #6  
Old 11-30-2009, 01:22 AM
GULTHEX GULTHEX is offline
Registered User
Join Date: Jul 2008
Posts: 148
GULTHEX can only hope to improve
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"); 
Reply With Quote
  #7  
Old 11-30-2009, 01:40 AM
Switch Switch is offline
o.o
Switch's Avatar
Join Date: Jan 2007
Location: Philadelphia
Posts: 3,038
Switch has a spectacular aura about
Send a message via MSN to Switch
Quote:
Originally Posted by GULTHEX View Post
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.
__________________
Oh squiggly line in my eye fluid. I see you lurking there on the peripheral of my vision.
But when I try to look at you, you scurry away.
Are you shy, squiggly line?
Why only when I ignore you, do you return to the center of my eye?
Oh, squiggly line, it's alright, you are forgiven.
Reply With Quote
  #8  
Old 11-30-2009, 01:40 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
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.
__________________
Quote:
Reply With Quote
  #9  
Old 11-30-2009, 02:37 AM
GULTHEX GULTHEX is offline
Registered User
Join Date: Jul 2008
Posts: 148
GULTHEX can only hope to improve
ok i just followed ckb's guide but im not sure how to make a gun with it

can sombody give me an example?
Reply With Quote
  #10  
Old 11-30-2009, 04:02 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
You already have a gun script..

http://forums.graalonline.com/forums...99&postcount=3
__________________
Quote:
Reply With Quote
  #11  
Old 11-30-2009, 04:18 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
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.
Reply With Quote
  #12  
Old 11-30-2009, 06:14 AM
GULTHEX GULTHEX is offline
Registered User
Join Date: Jul 2008
Posts: 148
GULTHEX can only hope to improve
ok how do i set the params in it do i just put setparams(20)

after the shoot?
Reply With Quote
  #13  
Old 11-30-2009, 06:17 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
setshootparams(x,y,z);
before you use shoot();
Reply With Quote
  #14  
Old 11-30-2009, 06:42 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by GULTHEX View Post
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.
__________________
Reply With Quote
  #15  
Old 11-30-2009, 07:03 AM
Switch Switch is offline
o.o
Switch's Avatar
Join Date: Jan 2007
Location: Philadelphia
Posts: 3,038
Switch has a spectacular aura about
Send a message via MSN to Switch
...
setshootparams(param, moreparams, lastparam);
shoot(blahblah);
...
function onActionProjectile(param, moreparams, lastparam) {
...
__________________
Oh squiggly line in my eye fluid. I see you lurking there on the peripheral of my vision.
But when I try to look at you, you scurry away.
Are you shy, squiggly line?
Why only when I ignore you, do you return to the center of my eye?
Oh, squiggly line, it's alright, you are forgiven.

Last edited by Switch; 11-30-2009 at 11:32 PM.. Reason: shoot not shot
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 09:25 AM.


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