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 01-23-2008, 04:04 PM
[email protected] gamerfreakie@hotmail.com is offline
Registered User
gamerfreakie@hotmail.com's Avatar
Join Date: Nov 2007
Location: Holland
Posts: 77
gamerfreakie@hotmail.com is an unknown quantity at this point
Send a message via AIM to gamerfreakie@hotmail.com Send a message via MSN to gamerfreakie@hotmail.com
can soemone help me with this Basic Gun Script



Script :



//#CLIENTSIDE
function onWeaponFired() {
if (this.on == false) {
this.on = true;
client.gani_idle = "light-old_rifle-idle";
onTimeout();
}
else{
this.on = false;
showsword(1);
player.chat = "Gun Deactivated!";
client.gani_idle = "idle";
client.gani_walk = "walk";
}
}
function onTimeout()
{
if (this.on == true)
{
hidesword(1);
player.chat = "Gun Activated!";
client.gani_idle = "light-old_rifle-idle";
client.gani_walk = "light-old_rifle-walk";
}
}
function onKeyPressed( code, key )
{
if ( key == "s" )
{
hidesword(1);
setani("light-old_rifle-fire", "");
freezeplayer(0.1);
setshootparams("Rifle", player.account);
shoot(player.x, player.y, 0, player.dir,0 ,0 , "utopia_bullet", "0.5");
}
}
function onPlayerChats(){
if (player.chat == "Reload"){
{
client.gani_idle = "light-old_rifle-reload";
sleep(0.25);
client.gani_idle = "light-old_rifle-idle";
}
}
}
Reply With Quote
  #2  
Old 01-23-2008, 04:12 PM
Dan Dan is offline
Daniel
Join Date: Oct 2007
Posts: 383
Dan is an unknown quantity at this point
Send a message via MSN to Dan
Please use the PHP tags and style your scripting. This way it is easier to read through your script. Also tell us what exactly is wrong in your script.

(example of styling and using PHP tags)
PHP Code:
function onCreated() {
  
condition false;
  
stuffHere();
}

function 
stuffHere() {
  if (
condition) {
    
doMoreStuff();
  }
}

function 
doMoreStuff() {
  
condition = {"one","two"};

__________________
Reply With Quote
  #3  
Old 01-23-2008, 05:42 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
Could you please explain what's not working, what you're trying to get to, and as stated by Dan, use PHP tags?
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #4  
Old 01-23-2008, 09:03 PM
[email protected] gamerfreakie@hotmail.com is offline
Registered User
gamerfreakie@hotmail.com's Avatar
Join Date: Nov 2007
Location: Holland
Posts: 77
gamerfreakie@hotmail.com is an unknown quantity at this point
Send a message via AIM to gamerfreakie@hotmail.com Send a message via MSN to gamerfreakie@hotmail.com
Quote:
function onCreated() {
condition = false;
replaceani "walk","light-old_rifle-walk"();
replaceani "idle","light-old_rifle-idle"();
replaceani "sword","light-old_rifle-fire"();
}

function stuffHere() {
if (condition) {
replaceani "walk","walk"();
replaceani "idle","idle"();
replaceani "sword","sword"();
}
}

function doMoreStuff() {
condition = {"one","two"};
}
??
Reply With Quote
  #5  
Old 01-23-2008, 09:48 PM
Dan Dan is offline
Daniel
Join Date: Oct 2007
Posts: 383
Dan is an unknown quantity at this point
Send a message via MSN to Dan
Proper styling

This one's better styled (how it should be);

PHP Code:
//#CLIENTSIDE
function onWeaponFired() {
  if (
this.on == false) {
    
this.on true;
    
client.gani_idle "light-old_rifle-idle";
    
onTimeout();
  }
  else{
    
this.on false;
    
showsword(1);
    
player.chat "Gun Deactivated!";
    
client.gani_idle "idle";
    
client.gani_walk "walk";
  }
}

function 
onTimeout() {
  if (
this.on == true) {
    
hidesword(1);
    
player.chat "Gun Activated!";
    
client.gani_idle "light-old_rifle-idle";
    
client.gani_walk "light-old_rifle-walk";
  }
}

function 
onKeyPressed(code,key) {
  if (
key == "s") {
    
hidesword(1);
    
setani("light-old_rifle-fire","");
    
freezeplayer(0.1);
    
setshootparams("Rifle",player.account);
    
shoot(player.x,player.y,0,player.dir,0,0,"utopia_bullet","0.5");
  }
}

function 
onPlayerChats(){
  if (
player.chat == "Reload"){
    
client.gani_idle "light-old_rifle-reload";
    
sleep(0.25);
    
client.gani_idle "light-old_rifle-idle";
  }

It looks like stuff from 4 different scripts though, lol.. and I personally never heard of hidesword and showsword either xD Did you just think of some commands that sound cool?
__________________
Reply With Quote
  #6  
Old 01-23-2008, 09:48 PM
[email protected] gamerfreakie@hotmail.com is offline
Registered User
gamerfreakie@hotmail.com's Avatar
Join Date: Nov 2007
Location: Holland
Posts: 77
gamerfreakie@hotmail.com is an unknown quantity at this point
Send a message via AIM to gamerfreakie@hotmail.com Send a message via MSN to gamerfreakie@hotmail.com
PHP Code:
function onCreated() {
condition false;
replaceani "walk","light-old_rifle-walk"();
replaceani "idle","light-old_rifle-idle"();
replaceani "sword","light-old_rifle-fire"();
}

function 
stuffHere() {
if (
condition) {
replaceani "walk","walk"();
replaceani "idle","idle"();
replaceani "sword","sword"();
}
}

function 
doMoreStuff() {
condition = {"one","two"};

Reply With Quote
  #7  
Old 01-23-2008, 10:50 PM
NightmareNight NightmareNight is offline
Nyte Magus
NightmareNight's Avatar
Join Date: Apr 2003
Posts: 119
NightmareNight is an unknown quantity at this point
Send a message via AIM to NightmareNight
Quote:
Originally Posted by [email protected] View Post
PHP Code:
function onCreated() {
condition false;
replaceani "walk","light-old_rifle-walk"();
replaceani "idle","light-old_rifle-idle"();
replaceani "sword","light-old_rifle-fire"();
}

function 
stuffHere() {
if (
condition) {
replaceani "walk","walk"();
replaceani "idle","idle"();
replaceani "sword","sword"();
}
}

function 
doMoreStuff() {
condition = {"one","two"};

Where did you get that from o.o?
Reply With Quote
  #8  
Old 01-23-2008, 10:55 PM
Dan Dan is offline
Daniel
Join Date: Oct 2007
Posts: 383
Dan is an unknown quantity at this point
Send a message via MSN to Dan
Rofl, this thread is hilarious.
__________________
Reply With Quote
  #9  
Old 01-23-2008, 11:23 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
God help you.

Function parameters go inside the parenthesis.

replaceani("idle", "mycustomani");
__________________
Reply With Quote
  #10  
Old 01-23-2008, 11:26 PM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
You definitely have to be more specific....what about it doesn't work? Does the gun 'equip'? Shoot bullets which don't damage players? Doesn't shoot bullets? Spawns a ferret of mass unholy destruction which feasts on the sorrows of 7 2/6 year old children?

Also, do you actually work for Utopia or did you just 'source' this script without any understanding of it?
Reply With Quote
  #11  
Old 01-24-2008, 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
Not from Utopia lol.
Chris made our gun system (Thanks again!)
__________________
Trying to be nice now...
Reply With Quote
  #12  
Old 01-24-2008, 03:42 PM
MysticX2X MysticX2X is offline
Prince
MysticX2X's Avatar
Join Date: Sep 2005
Posts: 2,529
MysticX2X will become famous soon enough
LOL he took Dans example of styling a bit too literal and tried to make a script of that.

Why is there a timeout to begin with
__________________
-Mystic

former acc: mystic2k


RIP Matt (NBK)
Reply With Quote
  #13  
Old 01-24-2008, 06:57 PM
Bell Bell is offline
Registered User
Bell's Avatar
Join Date: Feb 2007
Posts: 1,824
Bell has much to be proud ofBell has much to be proud ofBell has much to be proud ofBell has much to be proud ofBell has much to be proud ofBell has much to be proud ofBell has much to be proud of
He came here asking for help, not to be insulted for trying to learn something. If he knew exactly what he was doing chances are he wouldn't be here to begin with.
__________________
For support contact
http://support.toonslab.com/
Reply With Quote
  #14  
Old 01-24-2008, 07:19 PM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
Quote:
Originally Posted by Dan View Post
It looks like stuff from 4 different scripts though, lol.. and I personally never heard of hidesword and showsword either xD Did you just think of some commands that sound cool?
Hidesword was a command from gs1 made ages ago so you could literally, hide your sword (for a set time). With the appearance of ganis though, it's become very obsolete.
__________________
Do it with a DON!
Reply With Quote
  #15  
Old 01-25-2008, 12:54 AM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Quote:
Originally Posted by Bell View Post
He came here asking for help, not to be insulted for trying to learn something. If he knew exactly what he was doing chances are he wouldn't be here to begin with.
If I wanted to learn a new programming language I would find a tutorial and try to understand the basics, not take source code and try different combinations until it works or my computer doesn't. I would also be specific about what I wanted to know.

http://wiki.graal.net/index.php/GScript

If you want to learn how to script then read this.
__________________
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 02:10 PM.


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