Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 11-16-2008, 10:45 PM
Pelikano Pelikano is offline
Registered User
Pelikano's Avatar
Join Date: Oct 2008
Posts: 1,133
Pelikano has a little shameless behaviour in the past
Boots

Hello, once again I need some help.
I am trying to script my own boots.. but it doesn't work for some reason:

NPC Code:
//#CLIENTSIDE
function onWeaponFired() {
if (this.disabled == false) {
disabledefmovement();
this.disabled = true;
setTimer(0.05);
}elseif (this.disabled = true)
enabledefmovement();
setTimer(0);
}
function onTimeout() {
for (i = 0; i < 4; i++) {
if (keydown(i)) {
player.dir = i;
player.x += vecx(player.dir);
player.y += vecy(player.dir);
}
}
setTimer(0.05);
}



Any idea why?
Reply With Quote
  #2  
Old 11-16-2008, 11:03 PM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Quote:
Originally Posted by Pelikano View Post
Hello, once again I need some help.
PHP Code:
//#CLIENTSIDE

function onWeaponFired() {

  if (
this.disabled == false) {

    
disabledefmovement();

    
this.disabled true;

    
setTimer(0.05);

   }elseif (
this.disabled == true) {

      
enabledefmovement();

      
setTimer(0);
  }

}

function 
onTimeout() {

  for (
04i++) {

    if (
keydown(i)) {

      
player.dir i;

      
player.+= vecx(player.dir);

      
player.+= vecy(player.dir);

    }

  }

      
setTimer(0.05);


__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #3  
Old 11-16-2008, 11:22 PM
LoneAngelIbesu LoneAngelIbesu is offline
master of infinite loops
LoneAngelIbesu's Avatar
Join Date: May 2007
Location: Toldeo, Ohio
Posts: 1,049
LoneAngelIbesu has a spectacular aura aboutLoneAngelIbesu has a spectacular aura about
Send a message via AIM to LoneAngelIbesu
To reiterate your mistake, you omitted a necessary bracket at the end of onWeaponFired().
__________________
"We are all in the gutter, but some of us are looking at the stars."
— Oscar Wilde, Lady Windermere's Fan
Reply With Quote
  #4  
Old 11-18-2008, 07:27 AM
Bl0nkt Bl0nkt is offline
Era Developer
Bl0nkt's Avatar
Join Date: Mar 2005
Location: Pennsylvania
Posts: 1,589
Bl0nkt will become famous soon enough
Send a message via AIM to Bl0nkt
Quote:
Originally Posted by Pelikano View Post
Hello, once again I need some help.
I am trying to script my own boots.. but it doesn't work for some reason:

NPC Code:
//#CLIENTSIDE
function onWeaponFired() { 1
if (this.disabled == false) { 2
disabledefmovement(); 3
this.disabled = true; 4
setTimer(0.05); 5
}elseif (this.disabled = true) 6
enabledefmovement(); 7
setTimer(0); 8
} 9
function onTimeout() { 10
for (i = 0; i < 4; i++) { 11
if (keydown(i)) { 12
player.dir = i; 13
player.x += vecx(player.dir); 14
player.y += vecy(player.dir); 15
} 16
} 17
setTimer(0.05); 18
} 19



Any idea why?
Okay, I've added numbers to each of the lines so I can explain easier.

Problem 1: On line 6, you only have "=" when the operator should be "==". I figure this is more of a typo than a mistake though, since you did fine at the top.

Problem 2: You do not set "this.disabled" back to false after line 6. You're going to need to add another line of code to set this variable, which also means you're going to need brackets to support the new number of operations (more than one, which is currently only the function "enabledefmovement();")

Other than that, it seems fine. You might also want to replace the animation "push" with "walk" so that you don't start pushing the wall as you run.
Reply With Quote
  #5  
Old 11-18-2008, 06:43 PM
Pelikano Pelikano is offline
Registered User
Pelikano's Avatar
Join Date: Oct 2008
Posts: 1,133
Pelikano has a little shameless behaviour in the past
Thanks for all your help guys!
It works fine now.. I've also added some stuff

NPC Code:
//#CLIENTSIDE
function onCreated() {
this.speed = 1;
this.disabled = true;
}

function onWeaponFired() {
if (this.disabled)
player.chat = "Boots on!";
this.speed = 1;
this.disabled = false;
setTimer(0.05);
}

function onTimeout() {
if (!this.disabled) {
for (i = 0; i < 4; i++) {
if (keydown(i)) {
player.dir = i;
player.x += vecx(player.dir)*this.speed;
player.y += vecy(player.dir)*this.speed;
}
setTimer(0.05);
}
}
}
function onKeyPressed(code, key) {
if (key == "f" && player.weapon.name == "Personal/Pelikano/Wall") {
this.disabled = true;
player.chat = "Boots off!";
}
if (key == "1" && player.weapon.name == "Personal/Pelikano/Wall" && this.disabled == false) {
this.speed = 1;
player.chat = "Speed 1!";
}
if (key == "2" && player.weapon.name == "Personal/Pelikano/Wall" && this.disabled == false) {
this.speed = 2;
player.chat = "Speed 2!";
}
if (key == "3" && player.weapon.name == "Personal/Pelikano/Wall" && this.disabled == false) {
this.speed = 2;
player.chat = "Speed 3!";
}
}



As I said above it works fine, thanks
Reply With Quote
  #6  
Old 11-18-2008, 06:45 PM
Deas_Voice Deas_Voice is offline
Deas
Deas_Voice's Avatar
Join Date: Jun 2007
Location: Sweden
Posts: 2,264
Deas_Voice is a jewel in the roughDeas_Voice is a jewel in the rough
Send a message via AIM to Deas_Voice Send a message via MSN to Deas_Voice Send a message via Yahoo to Deas_Voice
for future notice pelikano, use PHP tags
__________________
.
WTF is real life, and where do I Download it?
There is no Real Life, just AFK!
since 2003~
I Support~
ღAeonღ | ღTestbedღ | ღDelteriaღ

if you are going to rep me, don't be an idiot, leave your name!
I got nothing but love for you
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:15 PM.


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