Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 09-01-2007, 06:36 PM
PrinceOfKenshin PrinceOfKenshin is offline
That guy with a beard
PrinceOfKenshin's Avatar
Join Date: May 2004
Location: Ontario, Canada
Posts: 819
PrinceOfKenshin has a spectacular aura aboutPrinceOfKenshin has a spectacular aura about
TNT script not working

Ok so the tnt will only work if you equip it then unequip it and say /tnt
PHP Code:
function onActionServerside()
{
if (
params[1] == "use"){

  if (
clientr.toolcount == NULLclientr.toolcount 0;
  
this.ok 0;

  for (
0clientr.toolcount++) {
    if (
makevar("clientr.tool" i)[1] == "Tools/TNT"this.ok 1;
  }
  if (
this.ok == 0) return;
  if (!
player.level.name.starts("at_mine")) return;
  
serverr.tntlayer player.account;
  
putnpc2(player.xplayer.y"").join("tnt");

  
this.temp = { 1"Tools/TNT""tnt","at_tnt-icon.png"""""1,};
  if (
clientr.toolcount == ""clientr.toolcount 0;
  if (
this.temp[5] == 1) {
    for (
0clientr.toolcount++) {
      if (
makevar("clientr.tool" i)[1] == this.temp[1]) {
        if (
makevar("clientr.tool" i)[4] == this.temp[4]) {
          
makevar("clientr.tool" i)[0] -= 1;
          if (
makevar("clientr.tool" i)[0] <= 0) {
            
makevar("clientr.tool" i) = "";
            for (
i<= clientr.toolcountj++) {
              
makevar("clientr.tool" j) = makevar("clientr.tool" 1);
            }
            
clientr.toolcount--;
          }
        }
      }
    }
  }
}
}

//#CLIENTSIDE
function onCreated() setTimer(.05);

function 
onPlayerChats()
{
  if (
player.chat == "/tnt") {
    if (
this.timer <= 0) {
      
triggeraction(0,0,"serverside",Tools/TNT,"use");
      
this.timer 2;
    } else 
player.chat "You must wait " this.timer "seconds!";
  }
}


function 
onTimeout()
{
  if (
this.timer 0this.timer -=.05;
  else if (
this.timer 0this.timer 0;
  
  
setTimer(.05);

__________________


Quote:
Game Master (Server): Greetings PrinceOfKenshin, there are new posts on the forums that demand your urgent attention! God speed, the fate of the world is in your hands. If you fail, middle earth will forever be in the darkness and your children will be enslaved by McKain.
Reply With Quote
  #2  
Old 09-01-2007, 09:30 PM
Googi Googi is offline
A Serious Epidemic
Googi's Avatar
Join Date: Oct 2001
Location: Canada
Posts: 18,866
Googi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud of
Send a message via AIM to Googi
When it doesn't work, does it not execute at all or does it do something like say that the player still has to wait when it shouldn't? From the looks of your script the this.temp[5] in the if statement should be this.temp[6].
__________________
Reply With Quote
  #3  
Old 09-01-2007, 09:40 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 Googi View Post
When it doesn't work, does it not execute at all or does it do something like say that the player still has to wait when it shouldn't? From the looks of your script the this.temp[5] in the if statement should be this.temp[6].
Googi is right, change
PHP Code:
if (this.temp[5] == 1) { 
into
PHP Code:
if (this.temp[6] == 1) { 
__________________
Reply With Quote
  #4  
Old 09-05-2007, 12:35 AM
PrinceOfKenshin PrinceOfKenshin is offline
That guy with a beard
PrinceOfKenshin's Avatar
Join Date: May 2004
Location: Ontario, Canada
Posts: 819
PrinceOfKenshin has a spectacular aura aboutPrinceOfKenshin has a spectacular aura about
It still isn't working. It will work if you equip it then unequip it and reconnect. And even after you log off. I don't know it is confusing to me and this is the only script i need to fix for Atrius to get hosted and no one else on the staff team is helping
__________________


Quote:
Game Master (Server): Greetings PrinceOfKenshin, there are new posts on the forums that demand your urgent attention! God speed, the fate of the world is in your hands. If you fail, middle earth will forever be in the darkness and your children will be enslaved by McKain.
Reply With Quote
  #5  
Old 09-05-2007, 08:04 AM
Googi Googi is offline
A Serious Epidemic
Googi's Avatar
Join Date: Oct 2001
Location: Canada
Posts: 18,866
Googi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud of
Send a message via AIM to Googi
Quote:
Originally Posted by PrinceOfKenshin View Post
It still isn't working. It will work if you equip it then unequip it and reconnect. And even after you log off. I don't know it is confusing to me and this is the only script i need to fix for Atrius to get hosted and no one else on the staff team is helping
As I said before, tell us what you mean by "not working". Does it execute partially? Does it not execute at all? Which parts don't execute when they should? Debug by having the script produce something visual after each if statement.
__________________
Reply With Quote
  #6  
Old 09-05-2007, 09:01 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
Ya, the best way to fix scripts is to debug the crap out of them. Start by assuming what's the problem, where the script isn't working. Do this by echo'ing variables and other important information. Repeat this process until you figure out what isn't working correctly, what isn't doing what you want it to do, and change it.
Also:
triggeraction(0,0,"serverside",Tools/TNT,"use");
should be:
triggeraction(0,0,"serverside","Tools/TNT","use");
though it's preferred you do:
triggerserver("gui","Tools/TNT","use");

Also, it might be "/tnt", for some reason I have problems getting stuff like player.chat=="/..." to work, but if I remove the /, it works perfectly fine(I doubt this is the problem, but could be... that's what debugging is for). And going along with what everyone else has said, parameters, like array, start their index at 0. so basically subtract 1 from every params[x].
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 11:58 AM.


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