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 08-28-2007, 10:24 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
Beer Me ;D

I am making a beer barrel where when you grab it 10 times you get a beer, then u can give it to a man for cash. So when the grab count reaches 0 it should but a beer in front of you to give to the man, but when it reaches 0 it goes to -1, then back to 9 with out doing any of the clientside functions which is laying the beer...

here is the script me and Takap2p made:
PHP Code:
//NPC By theHAWKER & Taka
function onCreated(){
this.grabs 10;
setTimer(.05);
}
function 
onTimeout(){
if (
this.grabs 1){
sleep 1;
onCreated();
}
setTimer(0.05);
}
function 
onActiongrabbed() {
this.grabs -= 1;
player.chat = @ this.grabs " grabs left..";
}
//#CLIENTSIDE
function onActiongrabbed() {
player.ani pull,;
}
function 
onTimeout(){
if (
this.grabs == 0){
say2("I Made A Beer!");
putnpc(1,beer,"beer.png",49.3,20);
setTimer(0.05);
}

__________________
**FLIP OUT**
Reply With Quote
  #2  
Old 08-28-2007, 10:43 PM
Horrified Horrified is offline
Rediculously inactive
Join Date: Jul 2007
Posts: 961
Horrified is on a distinguished road
Send a message via ICQ to Horrified Send a message via AIM to Horrified Send a message via MSN to Horrified Send a message via Yahoo to Horrified
I see GS1 (sleep float; should be sleep(float)...I doubt it makes a difference though, considering they compile the same.
Reply With Quote
  #3  
Old 08-29-2007, 02:56 AM
bscharff bscharff is offline
Bloo
bscharff's Avatar
Join Date: Sep 2006
Location: San Antonio, Texas
Posts: 185
bscharff has a little shameless behaviour in the past
Send a message via AIM to bscharff Send a message via MSN to bscharff Send a message via Yahoo to bscharff
putnpc Cannot Be Clientside.
The System I Added To Graal Legacy Triggers onActionGrab. (If It Wasn't Deleted - If It Wasn't, Keep It!)
You should use putnpc2(x,y,"join beer;");

Perhaps:

PHP Code:

//NPC By theHAWKER & Taka (Bloo Loves Them)
function onCreated(){
this.grabs 10;
onTimeout();
}

function 
onTimeout(){
if (
this.grabs 1){
sleep(1);
onCreated();
}
sleep(.05);
onTimeout();
}

function 
onActionGrabbed() { //Possibly onActionGrab ?
this.grabs -= 1;
player.chat this.grabs " Grabs Left!";
}

function 
onActionGrabbed() {
setani("pull",NULL);
}

function 
onTimeout(){
if (
this.grabs <= 0){
say2("I Made A Beer!");
putnpc2(49.5,20,"join beer;"); //Might Be Easier To Round Coordinates To The Nearest .5
setTimer(0.05);
}

__________________
Trying to be nice now...
Reply With Quote
  #4  
Old 08-29-2007, 06:05 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Ack, bleh, urgh... such a CPU intensive script for something so simple.



PHP Code:
function onActiongrabbed() {
  
this.grabs ++;
  if (
this.grabs 10) {
    
say2("I Made A Beer!");  // might not work serverside, dont remember
    
temp.npc putnpc2(49.320"join(\"beer\");");
    
temp.npc.setimg("beer.png");
  } else 
player.chat this.grabs SPC "grabs left..";
  
setAni("pull""");

__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #5  
Old 08-29-2007, 06:29 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
Thx guys, ill try the both
__________________
**FLIP OUT**
Reply With Quote
  #6  
Old 08-29-2007, 07:29 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 xXziroXx View Post
Ack, bleh, urgh... such a CPU intensive script for something so simple.



PHP Code:
function onActiongrabbed() {
  
this.grabs ++;
  if (
this.grabs 10) {
    
say2("I Made A Beer!");  // might not work serverside, dont remember
    
temp.npc putnpc2(49.320"join(\"beer\");");
    
temp.npc.setimg("beer.png");
  } else 
player.chat this.grabs SPC "grabs left..";
  
setAni("pull""");

that worked tyvm
__________________
**FLIP OUT**
Reply With Quote
  #7  
Old 08-29-2007, 09:45 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
PHP Code:
function onActiongrabbed() {
  
this.grabs ++;
  if (
this.grabs == 10) {
    
say2("I Made A Beer!");  // might not work serverside, dont remember
    
temp.npc putnpc2(49.320"join(\"beer\");");
    
temp.npc.setimg("beer.png");
    
this.grabs NULL;
  } else 
player.chat this.grabs SPC "grabs left..";
  
setAni("pull""");

Oops
__________________
Follow my work on social media post-Graal:Updated august 2025.
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 12:40 PM.


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