Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Help: Making a weapon (https://forums.graalonline.com/forums/showthread.php?t=134257191)

Dnegel 12-04-2009 02:06 PM

Help: Making a weapon
 
The best way to learn to script is to ask the ones that knows it, that's what i've learned so here we go, im gonna be using Testbed as server.

I have made a GFX of a Weapon, and I have also made a GANI for Reload, Idling, Walking / Running and Firing.

So, what's left is the script.

And here is it when your help comes in; Do you maybe know a perfect thread for this, tutorial or maybe you can just explain it easily in a post?

It's your choice, and if your here to be an idiot then you can just press the X button in the north-east corner of your Web Browser.

I want this to be a serious thread, im here to learn, not to waste time.

Thanks.
~ Rjax S.

Samposse 12-04-2009 02:29 PM

if ur Learning ur self to script so shoud u maybe give it an try of making the script by your self :)
you will alot of help on the forums for that

firefighter 12-04-2009 02:37 PM

Each server has its own weapon system ;)

GScript Guide

Dnegel 12-04-2009 06:17 PM

Quote:

Originally Posted by Samposse (Post 1542385)
if ur Learning ur self to script so shoud u maybe give it an try of making the script by your self :)
you will alot of help on the forums for that

I know that I need to find it out by myself, but I was mostly wanting like, a good start. And that's why I made this thread, it would maybe help others to that need help with such scripts?

Quote:

Originally Posted by firefighter (Post 1542387)
Each server has its own weapon system ;)

GScript Guide

Thanks for the site, though I know about it already, and I have read it. But of course, im not gonna stop reading, I will go read now anyways so yeh.

And thanks for the replies. :)

Note: But it's right that I need to make a Weapon System in Classes right?

Kyranki 12-04-2009 10:09 PM

Umm, well usually you would start off by making a Weapon System in...weapons. :p But maybe you know you should start on a lot of smaller things to cover all the basics and make sure you understand some of the most simple yet confusing things.

Dnegel 12-04-2009 10:18 PM

Quote:

Originally Posted by Kyranki (Post 1542470)
Umm, well usually you would start off by making a Weapon System in...weapons. :p But maybe you know you should start on a lot of smaller things to cover all the basics and make sure you understand some of the most simple yet confusing things.

I understand a little, but I still need a little push to get started.

Kyranki 12-04-2009 10:47 PM

Quote:

Originally Posted by Dnegel (Post 1542472)
I understand a little, but I still need a little push to get started.

Honestly, if you don't have any prior coding experience...and that was an assumption which could possibly be wrong, it's going to hard to try and teach yourself. Like it was for me. If you can find a good teacher to try and show you the path and things then you will learn Gscript relatively easily. Gah...where's Hell Raven when you need him. :cry:

Dnegel 12-04-2009 11:49 PM

Mhmmm yes, I can of course try to do it all alone.

But that will take alot of time, and I dont wanna use that much time. I mostly just wanna learn some basics in scripting.

Sage_Shadowbane 12-05-2009 09:25 AM

Quote:

Originally Posted by Dnegel (Post 1542489)
Mhmmm yes, I can of course try to do it all alone.

But that will take alot of time, and I dont wanna use that much time. I mostly just wanna learn some basics in scripting.

Best way to learn, is to practice on your own. You're really not going to learn how to script by depending on other people on the forums to "guide" you in the right direction.

Dnegel 12-05-2009 04:48 PM

Quote:

Originally Posted by Sage_Shadowbane (Post 1542629)
Best way to learn, is to practice on your own. You're really not going to learn how to script by depending on other people on the forums to "guide" you in the right direction.

I knwo your right, and I would try to practice.

First I need to make a way to show the weapon when I click a button, D for example.

Codein 12-05-2009 05:13 PM

Experiment, experiment and experiment! When you find out about a function you didn't know about, work with it. Pinch and pull every part of GScript until you know what it can do and what it can't do.

If you need someone to help you when you get stuck, send a message my way on MSN, AIM or on here.

Looking at other people's scripts also help quite a lot.

I also agree that you're jumping in at the deep end here. Take small projects, and build on them. Then choose a slightly bigger project, so on and so forth.

Dnegel 12-05-2009 06:14 PM

Quote:

Originally Posted by Codein (Post 1542667)
Experiment, experiment and experiment! When you find out about a function you didn't know about, work with it. Pinch and pull every part of GScript until you know what it can do and what it can't do.

If you need someone to help you when you get stuck, send a message my way on MSN, AIM or on here.

Looking at other people's scripts also help quite a lot.

I also agree that you're jumping in at the deep end here. Take small projects, and build on them. Then choose a slightly bigger project, so on and so forth.

Thanks, I will try to do so then. :)

Switch 12-05-2009 10:44 PM

PHP Code:

//#CLIENTSIDE 

Go.

Dnegel 12-05-2009 11:19 PM

Lol, I know that one.

I guess it will start with
PHP Code:

//#CLIENTSIDE
 
functionTest(); 


Skyld 12-06-2009 02:06 AM

Quote:

Originally Posted by Dnegel (Post 1542724)
Lol, I know that one.

I guess it will start with
PHP Code:

//#CLIENTSIDE
 
functionTest(); 


If you do not have your function call inside a function block then it will result in unusual behaviour (being called every time an event occurs perhaps, which would get very messy and use a lot of CPU time). Instead you should call your function from specific events (i.e. onCreated being called when the NPC is updated or the script is first loaded):
PHP Code:

//#CLIENTSIDE

function onCreated()
{
  
functionTest();



Dnegel 12-06-2009 01:29 PM

Ahhh, many thanks for that reminder. :)

Im thinking about making a script, when you press a button, you shoot.

Im currently now sitting left with this, but the ani wouldnt show, im sure it's something to do with the
if (buttonpressed) (d); .

PHP Code:

//#CLIENTSIDE

function onCreated()
{
  
functionTest();
   if (
buttonpressed)(d);
   
setani ("mp7-fire","");



Sage_Shadowbane 12-07-2009 10:21 PM

Quote:

Originally Posted by Dnegel (Post 1542880)
Ahhh, many thanks for that reminder. :)

Im thinking about making a script, when you press a button, you shoot.

Im currently now sitting left with this, but the ani wouldnt show, im sure it's something to do with the
if (buttonpressed) (d); .

PHP Code:

//#CLIENTSIDE

function onCreated()
{
  
functionTest();
   if (
buttonpressed)(d);
   
setani ("mp7-fire","");



You do know that making up your own events isn't going to work, correct? Like almost everyone has already told you, stop trying to depend on us. It's pretty obvious that you haven't even attempted to learn Gscript or you wouldn't be posting silly things like if (buttonpressed)(d);. That doesn't exist, and I'm pretty sure that it never will. So please, go and try to take atleast 10 minutes out of your time and read some scripting tutorials that are posted everywhere on these forums, than come back with a half way reasonable script which we can attempt to help me with. As for your script atm:

PHP Code:

//#CLIENTISIDE
function onKeyPressedkeycodekeyname ) {
  if ( 
keyname == "D" ) {

    
setani ("mp7-fire","");
  }


Something along the lines of that would be more suitable for what you're looking for. But please, don't just use the script I've posted for you, go and edit it adding two lines, than coming back here and asking for help again. ^^

Dnegel 12-08-2009 04:44 PM

Ahhh, finally someone wrote something * Puts hands togheter *

Great respond to. :)

Well, I guess your right, because you know this more than me. But I have actually read alot, but I guess I didn't have it all scheduled.

Now I got it all scheduled though, and I will actually find scripts lines that works.

Im starting fresh again.

Twinny 12-08-2009 05:09 PM

Quote:

Originally Posted by Dnegel (Post 1543235)
and I will actually find scripts lines that works.

If you only ever take lines of code without ever understanding how they work, you will just become another player world parasite destined to detriment future development. Read the Graal Bible, read the tutorials out there and learn to help yourself.

The graal forums do not support parasitic developers very long....Jigga is a good example of this.

Riot 12-08-2009 05:23 PM

Important thing to note: Do not have a space before the parenthesis.

setani ("mp7-fire",""); will invoke the GS1 form and attempt to set your ani to ("mp7-fire".gani

Remove the space so it becomes: setani("mp7-fire","");

Dnegel 12-08-2009 07:57 PM

Ahhh, thank you very much Riot for that fix.

And to you Twinny, I have read the tutorials. ;)

Samposse 12-10-2009 12:06 PM

Quote:

Originally Posted by Dnegel (Post 1543260)
Ahhh, thank you very much Riot for that fix.

And to you Twinny, I have read the tutorials. ;)


ye, i did to but didnt understand it so mutch :p


All times are GMT +2. The time now is 04:30 PM.

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