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 07-28-2007, 12:41 AM
theHAWKER theHAWKER is offline
**FLIP OUT**
theHAWKER's Avatar
Join Date: Mar 2006
Location: canada, vancouver
Posts: 768
theHAWKER is an unknown quantity at this point
Money for all!

I am trying to make a target system where you have to shoot the targets...

BUT when ever i lose or gain money it dose the same for all the other players in the room...

so this is my script:
PHP Code:
//NPC Made By *theHAWKER
function onCreated(){
  
this.chat "Shoot Me!";
  
setTimer(.1);
}
function 
onActionAdd(){
  
with(findplayer(params[0])){
    
player.rupees += int(random(0,20));
  }
}
function 
onTimeout(){
  
this.+= random(0,1);
  
this.-= random(0,1);
  
setTimer(.3);
}
//#CLIENTSIDE
function onWasShot(){
  
this.chat "Hit!";
  
triggeraction(x,y,"add",player.account);
  
sleep(.5);
  
this.chat "Shoot Me!";

can someone tell me whats wrong, i think its the player.account part in the triggeraction...
__________________
**FLIP OUT**
Reply With Quote
  #2  
Old 07-28-2007, 12:54 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
triggeraction a WNPC(like have a money handling section or such) or DNPC to handle the money, don't do it inside the level NPC.
Reply With Quote
  #3  
Old 07-28-2007, 06:43 PM
theHAWKER theHAWKER is offline
**FLIP OUT**
theHAWKER's Avatar
Join Date: Mar 2006
Location: canada, vancouver
Posts: 768
theHAWKER is an unknown quantity at this point
Quote:
Originally Posted by DustyPorViva View Post
triggeraction a WNPC(like have a money handling section or such) or DNPC to handle the money, don't do it inside the level NPC.
so i should make them a class?
__________________
**FLIP OUT**
Reply With Quote
  #4  
Old 07-28-2007, 09:16 PM
WanDaMan WanDaMan is offline
Master Tux
WanDaMan's Avatar
Join Date: Aug 2002
Location: England, United Kingdom
Posts: 5,571
WanDaMan is a jewel in the roughWanDaMan is a jewel in the rough
Send a message via MSN to WanDaMan
you need to add setshape to the serverside, inside onCreated
__________________
V$:CONFL16T
Reply With Quote
  #5  
Old 07-28-2007, 09:40 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Exactly what Wan said. To explain that a bit: an npc needs a shape (setshape or setshape2) so it can be triggered.
Reply With Quote
  #6  
Old 07-28-2007, 09:59 PM
theHAWKER theHAWKER is offline
**FLIP OUT**
theHAWKER's Avatar
Join Date: Mar 2006
Location: canada, vancouver
Posts: 768
theHAWKER is an unknown quantity at this point
Quote:
Originally Posted by Crow View Post
Exactly what Wan said. To explain that a bit: an npc needs a shape (setshape or setshape2) so it can be triggered.
ok, i have done all of this and i put it in a class, but it still gives money to other players...

here is my script:
PHP Code:
//NPC Made By *theHAWKER
function onCreated(){
  
setshape(1,32,48);
  
setimg("gl_target.png");
  
this.chat "Shoot Me!";
  
setTimer(.1);
}
function 
onActionAdd(){
  
with(findplayer(params[0])){
    
player.rupees += int(random(0,20));
  }
}
function 
onTimeout(){
hide();
sleep(random(1,3));
show();
sleep(random(1,3));
  
setTimer(.3);
}
//#CLIENTSIDE
function onWasShot(){
  
this.chat "Hit!";
  
triggeraction(x,y,"add",player.account);
  
sleep(.5);
  
this.chat "Shoot Me!";

__________________
**FLIP OUT**
Reply With Quote
  #7  
Old 07-28-2007, 11:23 PM
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
No, what I meant was have a WNPC like a "-System" weapon, and on the serverside:
PHP Code:
function onActionserverside() {
if (
params[0]=="addrupees"findplayer(params[1]).rupees+=params[2];

Then in the level NPC, do something along the lines of:

PHP Code:
//#CLIENTSIDE
function onWasShot(){
  
this.chat "Hit!";
  
triggerserver("gui","-System","addrupees",player.account,int(random(0,20)));
  
sleep(.5);
  
this.chat "Shoot Me!";

I THINK you can triggerserver from a clientside of a level NPC, I'm not sure though.
Reply With Quote
  #8  
Old 07-29-2007, 08:10 PM
theHAWKER theHAWKER is offline
**FLIP OUT**
theHAWKER's Avatar
Join Date: Mar 2006
Location: canada, vancouver
Posts: 768
theHAWKER is an unknown quantity at this point
Quote:
Originally Posted by DustyPorViva View Post
No, what I meant was have a WNPC like a "-System" weapon, and on the serverside:
PHP Code:
function onActionserverside() {
if (
params[0]=="addrupees"findplayer(params[1]).rupees+=params[2];

Then in the level NPC, do something along the lines of:

PHP Code:
//#CLIENTSIDE
function onWasShot(){
  
this.chat "Hit!";
  
triggerserver("gui","-System","addrupees",player.account,int(random(0,20)));
  
sleep(.5);
  
this.chat "Shoot Me!";

I THINK you can triggerserver from a clientside of a level NPC, I'm not sure though.
omg, so freaking complicated x.x

Quote:
I THINK you can triggerserver from a clientside of a level NPC, I'm not sure though.
nope
__________________
**FLIP OUT**
Reply With Quote
  #9  
Old 07-29-2007, 08:16 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by theHAWKER View Post
omg, so freaking complicated x.x
Uhm? You just need a weapon npc (The scripts that are listed when you click the weapons list) that can recieve the trigger from the other level npc (the target)
__________________
Reply With Quote
  #10  
Old 07-29-2007, 09:58 PM
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
Quote:
Originally Posted by theHAWKER
omg, so freaking complicated x.x
It's not that complicated when you consider that once you make that one bit in the WNPC, you can triggerserver it from any NPC that needs to give the player money.
Reply With Quote
  #11  
Old 07-30-2007, 02:26 AM
theHAWKER theHAWKER is offline
**FLIP OUT**
theHAWKER's Avatar
Join Date: Mar 2006
Location: canada, vancouver
Posts: 768
theHAWKER is an unknown quantity at this point
Quote:
Originally Posted by DustyPorViva View Post
It's not that complicated when you consider that once you make that one bit in the WNPC, you can triggerserver it from any NPC that needs to give the player money.
right, but it wont work with that strip of code in the npc x.x

dose it have to be in a class, or can it not be in a class?
__________________
**FLIP OUT**
Reply With Quote
  #12  
Old 07-30-2007, 09:01 AM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
You could use a class.. and then trigger serverside in the class..
and from there using something like System.giveMoney() etc..
__________________
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 05:48 PM.


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