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 04-11-2003, 05:40 PM
GoZelda GoZelda is offline
Mister 1,000,000
GoZelda's Avatar
Join Date: Jan 2003
Location: Brussels, capital of Europe.
Posts: 5,396
GoZelda will become famous soon enough
Send a message via AIM to GoZelda Send a message via MSN to GoZelda
Thumbs down I need some help with this...

I'm having some problems with the following script, i don't see what's wrong, please help me...

// NPC made by Cyrin
setimg beer.png
if (playertouchsme) toweapons Dagger;
if (weaponfired) {
if (strequals(#s(client.equipment),fists)){
setstring client.equipment,dagger;
setplayerprop #c,Equipped Dagger;
setstring client.weaponpower,2;}
if (strequals(#s(client.equipment),dagger)){
setstring client.equipment,fists;
setplayerprop #c,Unequipped Dagger;
setstring client.weaponpower,1;}}

The beer stuff isn't in th original script >.>
And you also need to set a flag "client.equipment=fists".
__________________

Quote:
Originally Posted by Lance
stefan is satan
I am the best.
[URL removed]Music or aural pollution?
Reply With Quote
  #2  
Old 04-11-2003, 08:13 PM
Dach Dach is offline
call me Chad, it's cooler
Dach's Avatar
Join Date: Aug 2002
Posts: 1,899
Dach is on a distinguished road
you don't need those "#s()"s around the string, I don't remember if that'll kill the script or not, but don't use them there
__________________
Scripting Documents:Old Script Documentation-Movement Tutorial
Reply With Quote
  #3  
Old 04-11-2003, 08:56 PM
CheeToS2 CheeToS2 is offline
That Guy
CheeToS2's Avatar
Join Date: Dec 2001
Location: Seattle, WA
Posts: 2,528
CheeToS2 will become famous soon enough
Send a message via AIM to CheeToS2
Re: I need some help with this...

Quote:
Originally posted by GoZelda
setimg beer.png
missing a ;

Quote:
Originally posted by Dach
you don't need those "#s()"s around the string, I don't remember if that'll kill the script or not, but don't use them there
yes you do :x (last time I checked at least)
__________________

Reply With Quote
  #4  
Old 04-11-2003, 09:37 PM
GoZelda GoZelda is offline
Mister 1,000,000
GoZelda's Avatar
Join Date: Jan 2003
Location: Brussels, capital of Europe.
Posts: 5,396
GoZelda will become famous soon enough
Send a message via AIM to GoZelda Send a message via MSN to GoZelda
That didn't help, it even stopped the script from working :o
__________________

Quote:
Originally Posted by Lance
stefan is satan
I am the best.
[URL removed]Music or aural pollution?
Reply With Quote
  #5  
Old 04-11-2003, 10:04 PM
GrowlZ1010 GrowlZ1010 is offline
defunct
Join Date: May 2002
Posts: 187
GrowlZ1010 is on a distinguished road
Nobody else spotted this?

NPC Code:

if (weaponfired) {
if (strequals(#s(client.equipment),fists)){
setstring client.equipment,dagger;
setplayerprop #c,Equipped Dagger;
setstring client.weaponpower,2;
}
// Hey, look! client.equipment, at this point, equals dagger!
if (strequals(#s(client.equipment),dagger)){
// So let's get rid of the dagger and bring the fists back,
// despite the fact that we've just got rid of the fists!
setstring client.equipment,fists;
setplayerprop #c,Unequipped Dagger;
setstring client.weaponpower,1;
}
}



Use some kind of small modification like this to check whether or not the equipment has already been changed. Oh, and have the default weapon set automatically.
NPC Code:

if (weaponfired) {
this.check=0;
if (strequals(#s(client.equipment),fists)){
this.check=1;
// dagger equip stuff..
}
if (strequals(#s(client.equipment),dagger) && this.check=0){
// fist equip stuff..
}
if (strequals(#s(client.equipment),)){
// default weapon setting stuff..
}
}

Reply With Quote
  #6  
Old 04-12-2003, 09:57 AM
Projectshifter Projectshifter is offline
The David
Projectshifter's Avatar
Join Date: Apr 2002
Location: USA
Posts: 912
Projectshifter is an unknown quantity at this point
Send a message via ICQ to Projectshifter Send a message via AIM to Projectshifter Send a message via MSN to Projectshifter Send a message via Yahoo to Projectshifter
OMG, other than the two obvious facts:
(1) You didn't even put if (created). That is like a BIG no-no to put just setimg like that x-x
(2) It's a flat out bish to read, you didnt' really use any formatting! x-x

But other than that, I thought it would be obvious. If you tell it if you are using fists, then it switches to a dagger, but then directly underneath it checks it to switch a dagger to a fist. It changes it to a dagger, but then right back. There is a little thing known as return; that is very helpful x-x
---Shifter
__________________
Who has time for life these days?
Reply With Quote
  #7  
Old 04-12-2003, 04:21 PM
Dude6252000 Dude6252000 is offline
More often known as Karsh
Dude6252000's Avatar
Join Date: May 2002
Location: USA.
Posts: 2,603
Dude6252000 is on a distinguished road
Send a message via AIM to Dude6252000
Re: I need some help with this...

Quote:
Originally posted by GoZelda
// NPC made by Cyrin
setimg beer.png
if (playertouchsme) toweapons Dagger;
if (weaponfired) {
if (strequals(#s(client.equipment),fists)){
setstring client.equipment,dagger;
setplayerprop #c,Equipped Dagger;
setstring client.weaponpower,2;}
if (strequals(#s(client.equipment),dagger)){
setstring client.equipment,fists;
setplayerprop #c,Unequipped Dagger;
setstring client.weaponpower,1;}}
if (playertouchsme) { toweapons Dagger; }
__________________
BEING AWAY FROM THE FORUMS RULES

http://www.livejournal.com/users/karsheth/
Reply With Quote
  #8  
Old 04-12-2003, 05:29 PM
Ningnong Ningnong is offline
Registered User
Ningnong's Avatar
Join Date: Nov 2002
Location: < -- way
Posts: 262
Ningnong is on a distinguished road
Re: Re: I need some help with this...

Quote:
Originally posted by Dude6252000

if (playertouchsme) { toweapons Dagger; }
You don't need brackets for a single command.
__________________
Former Global Scripting Team Member


Reply With Quote
  #9  
Old 04-12-2003, 06:19 PM
GoZelda GoZelda is offline
Mister 1,000,000
GoZelda's Avatar
Join Date: Jan 2003
Location: Brussels, capital of Europe.
Posts: 5,396
GoZelda will become famous soon enough
Send a message via AIM to GoZelda Send a message via MSN to GoZelda
I followed the aid of Growlz and... succeeded!
__________________

Quote:
Originally Posted by Lance
stefan is satan
I am the best.
[URL removed]Music or aural pollution?
Reply With Quote
  #10  
Old 04-13-2003, 01:57 AM
Dach Dach is offline
call me Chad, it's cooler
Dach's Avatar
Join Date: Aug 2002
Posts: 1,899
Dach is on a distinguished road
Re: Re: I need some help with this...

Quote:
Originally posted by CheeToS2

yes you do :x (last time I checked at least)
HOLY CRAP!!
I just realized I have not once had to check my own strings in any script I have ever made!!! Gyayayaya, and to think I've scripted for almost 3 years now!
__________________
Scripting Documents:Old Script Documentation-Movement Tutorial
Reply With Quote
  #11  
Old 04-13-2003, 02:12 AM
CheeToS2 CheeToS2 is offline
That Guy
CheeToS2's Avatar
Join Date: Dec 2001
Location: Seattle, WA
Posts: 2,528
CheeToS2 will become famous soon enough
Send a message via AIM to CheeToS2
Re: Re: Re: I need some help with this...

Quote:
Originally posted by Dach


HOLY CRAP!!
I just realized I have not once had to check my own strings in any script I have ever made!!! Gyayayaya, and to think I've scripted for almost 3 years now!
maybe its time you did.. doesn't work without the #s
__________________

Reply With Quote
  #12  
Old 04-13-2003, 02:16 AM
Dude6252000 Dude6252000 is offline
More often known as Karsh
Dude6252000's Avatar
Join Date: May 2002
Location: USA.
Posts: 2,603
Dude6252000 is on a distinguished road
Send a message via AIM to Dude6252000
Re: Re: Re: I need some help with this...

Quote:
Originally posted by Ningnong


You don't need brackets for a single command.
Er, oh. This is what I get for trying to correct people, when I can barely script myself
__________________
BEING AWAY FROM THE FORUMS RULES

http://www.livejournal.com/users/karsheth/
Reply With Quote
  #13  
Old 04-13-2003, 02:18 AM
CheeToS2 CheeToS2 is offline
That Guy
CheeToS2's Avatar
Join Date: Dec 2001
Location: Seattle, WA
Posts: 2,528
CheeToS2 will become famous soon enough
Send a message via AIM to CheeToS2
Re: Re: Re: Re: I need some help with this...

Quote:
Originally posted by Dude6252000

Er, oh. This is what I get for trying to correct people, when I can barely script myself
It doesn't hurt to have them, & putting brackets around stuff (not sure if this holds true in gscript or not) speeds up processing of the script (barely, but still :P)
__________________

Reply With Quote
  #14  
Old 04-13-2003, 02:36 AM
CheeToS2 CheeToS2 is offline
That Guy
CheeToS2's Avatar
Join Date: Dec 2001
Location: Seattle, WA
Posts: 2,528
CheeToS2 will become famous soon enough
Send a message via AIM to CheeToS2
Re: Re: Re: Re: Re: Re: I need some help with this...

Quote:
Originally posted by Kaimetsu
I don't see why it would speed up the compilation?
its easier for it to determine what is being typed is (a command/evaluation/etc).. again, i'm not saying it holds true for gscript, because I wouldn't know :P
__________________

Reply With Quote
  #15  
Old 04-13-2003, 08:30 AM
HoudiniMan HoudiniMan is offline
Playerworld Administrator
HoudiniMan's Avatar
Join Date: Dec 2001
Location: Calfiornia - USA
Posts: 3,512
HoudiniMan will become famous soon enough
if (created) variable=5*5;

evaluation?
__________________
-HoudiniMan (Chief Playerworld Administrator)
Compulsive Support Center Checker - 5 Years and Change
Graal Support Center

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 01:55 PM.


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