Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   plz help me wtih this noob script plz (https://forums.graalonline.com/forums/showthread.php?t=134262661)

k_killar 04-03-2011 01:53 AM

plz help me wtih this noob script plz
 
plz plz i beg.. im tryin to make it so if the hat is on it changes the speed and if its off it goes back to normal, but so far it is only turning on and staying on and wont go off

Quote:

//#CLIENTSIDE
function onCreated()
{
join("hatsys");
this.hatimg = "ha2.png";
}
function onWeaponFired()
{
triggerserver( "weapon", "-System/Movement", "setSpeed", 2.9 );
}

fowlplay4 04-03-2011 02:14 AM

Quote:

Originally Posted by NPC Scripting Forum Rules
1. Be clear on your ability level. In other words, do not post asking for scripts, or asking people to fix scripts that are above your ability level. If you are writing a script to aid learning, then try writing a simpler script. If you are looking for a script for a server, then the best solution is probably to hire a scripter.

...

Demisis_P2P 04-03-2011 02:36 AM

Can you post the contents of -System/Movement

nullify 04-03-2011 04:59 AM

I honestly hate this subforum 95% of the time.

Fulg0reSama 04-03-2011 05:14 AM

Wouldn't it make more sense to give this guy a tutorial?

fowlplay4 04-03-2011 05:38 AM

Quote:

Originally Posted by Fulg0reSama (Post 1640910)
Wouldn't it make more sense to give this guy a tutorial?

An old thread of his:
http://forums.graalonline.com/forums...ad.php?t=79612

If he really wanted to get help and learn he would have done it by now, so if he's not even going to make the effort why should he be given the how-to.

Not to mention the way he's going about things is the wrong way, and is only going to lead to terrible habits and entirely broken systems down the line.

cbk1994 04-03-2011 05:46 AM

Quote:

Originally Posted by fowlplay4 (Post 1640911)

wow i'm an ass

MattKan 04-03-2011 06:26 AM

Meh, in the future use PHP tags instead of QUOTE...

Also do indents, please!

PHP Code:

//#CLIENTSIDE
function onCreated() {
  
join("hatsys");
  
this.hatimg "ha2.png";
}

function 
onWeaponFired() {
  
triggerserver"weapon""-System/Movement""setSpeed"2.9 );


This may or may not be the problem, but it says "ha2.png". Is this supposed to be "hat2.png"?

Quote:

Originally Posted by Demisis_P2P (Post 1640888)
Can you post the contents of -System/Movement

That would probably be your best bet.

Quote:

Originally Posted by cbk1994 (Post 1640914)
wow i'm an ass

If you go through life without being one at one point in time, then you are probably a horrible person.

fowlplay4 04-03-2011 07:22 AM

...

The problem is that there's absolutely no logic!

There are two blatantly obvious scenarios that need to be addressed:

1. Player changes hat
2. Player is wearing hat already

PHP Code:

//#CLIENTSIDE
function onCreated() {
  
// Check if player is wearing hat
  
if (player.attr[1] == "hat.png") {
    
speedUP();
  }
}

function 
onWeaponFired() {
  
// Check if player is wearing the hat already
  
if (player.attr[1] == "hat.png") {
    
// Remove hat
    
player.attr[1] = "nohat.png";
    
speedDOWN();
  } else {
    
// Put on hat
    
player.attr[1] = "hat.png";
    
speedUP();
  }


That being said the problem is that the speed changing is being done primarily in each hat weapon (and the obvious security issue with the triggerserver). This work would be better off calculated in the movement system or through a "buff" system that the movement system interacts with.

Please also read and search through:
http://wiki.graal.net/index.php/Creation/Dev/GScript

k_killar 04-03-2011 07:34 PM

omg fowl play it work!! u pro..

i am no worthy

http://assets.aarp.org/www.aarp.org_/cs/misc/dgar.jpg

WhiteDragon 04-03-2011 08:30 PM

Quote:

Originally Posted by k_killar (Post 1641009)
omg fowl play it work!! u pro..

i am no worthy

I think you should focus more on learning to script instead of trying to make people on this forum script stuff for you.

Continue down your current path long enough and eventually no one will answer you, even though people on this subforum are pretty damn nice.

k_killar 04-03-2011 09:11 PM

Quote:

Originally Posted by WhiteDragon (Post 1641027)
I think you should focus more on learning to script instead of trying to make people on this forum script stuff for you.

Continue down your current path long enough and eventually no one will answer you, even though people on this subforum are pretty damn nice.

l0l stfu b4 i pwn u 3zly wif my lvl 60 m0nk

Twinny 04-03-2011 09:27 PM

Quote:

Originally Posted by k_killar (Post 1641038)
l0l stfu b4 i pwn u 3zly wif my lvl 60 m0nk

...

Please don't post such nonsense. This is a scripting forum: not a forum for your spam.

k_killar 04-03-2011 09:42 PM

Quote:

Originally Posted by Twinny (Post 1641040)
...

Please don't post such nonsense. This is a scripting forum: not a forum for your spam.

l0l i pwn u 2 n00b

swimdude 04-04-2011 05:35 AM

Lmao killer is the biggest troll i ever seen since lavaman

WhiteDragon 04-04-2011 05:58 AM

Quote:

Originally Posted by k_killar (Post 1641038)
l0l stfu b4 i pwn u 3zly wif my lvl 60 m0nk

I didn't mean to come across as confrontational, sorry if I did.

I think that learning how to script properly is the logical choice for you. It'll help you get stuff done on your server a lot faster, will be more interesting than just copy/pasting stuff, and you'll definitely get more help here if you're looking to improve your skills.

Tricxta 04-04-2011 11:03 AM

I think you should've explained the logic of fixing the script instead of just giving a fixed script. Not only does it take not as long to write it also helps the recipient more. Just my thoughts on this thread though haha

cbk1994 04-04-2011 12:56 PM

Quote:

Originally Posted by Tricxta (Post 1641156)
I think you should've explained the logic of fixing the script instead of just giving a fixed script. Not only does it take not as long to write it also helps the recipient more. Just my thoughts on this thread though haha

You can't teach someone how to script in one post. Jer's script was commented enough that anyone with a basic understanding of GScript should be able to comprehend it.

salesman 04-04-2011 01:45 PM

Quote:

Originally Posted by Tricxta (Post 1641156)
I think you should've explained the logic

He did


All times are GMT +2. The time now is 01:25 PM.

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