Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   selectedweapon (https://forums.graalonline.com/forums/showthread.php?t=66505)

Omini 06-06-2006 05:17 PM

selectedweapon
 
Does selected weapon weapon-id; still work in GS2?

If so - how? I can't get it to work.

If not - what's the GS2 equilivant?

ApothiX 06-06-2006 05:27 PM

This should be in the gscript2 section.

The weapon the player currently has selected is assigned to the 'player.weapon' object, I believe.

Omini 06-06-2006 05:33 PM

I wasn't sure if it was to go in the GS2 section or not, since it's also sort of in relation to GS1.

So it'll be player.weapon = "WEAPON";? Does it have to be serverside?

ApothiX 06-06-2006 05:34 PM

Uh, I think player.weapon is readonly, not sure though.
Also, I said it's an object, not a string. ie: player.weapon.name, player.weapon.image, etc.

xXziroXx 06-06-2006 05:36 PM

Quote:

Originally Posted by ApothiX
Uh, I think player.weapon is readonly, not sure though.
Also, I said it's an object, not a string. ie: player.weapon.name, player.weapon.image, etc.

Correct.

Omini 06-06-2006 05:37 PM

Then how am I meant to change the players current weapon?

xXziroXx 06-06-2006 05:48 PM

I belive you cant do that with script.

Omini 06-06-2006 05:52 PM

Well you were able to in GS1, so why remove that capability in GS2?

napo_p2p 06-06-2006 07:12 PM

selectedweapon will still work...

xXziroXx 06-06-2006 07:15 PM

Quote:

Originally Posted by Omini
Well you were able to in GS1, so why remove that capability in GS2?

You were? Then I suppose it would work in GS2 aswell..

Omini 06-06-2006 07:38 PM

Quote:

Originally Posted by napo_p2p
selectedweapon will still work...

Alright but I'm unsure how to get it done... it seems a bit different now.

PHP Code:

for (this.i=0;this.i<weaponscount;this.i++) {
      if (
strequals(#w(this.i),#I(clientr.hotkey1,0))) {
        
addstring clientr.hotkey1,#v(this.i);
        
break;
      }
    } 

That's GS1 version, of course. I'm not sure the GS2 version of #w(this.i)

I tried

PHP Code:

for (this.i=0;this.i<weaponscount;this.i++) {
      if (
this.== clientr.hotkey1[0]) {
        
clientr.hotkey1.insert(2,this.i);
        break;
      }
    } 

It doesn't seem to pick up if the this.i is the weapon name (clientr.hotkey1[0] is the name of the weapon)

Any suggestions? Like

PHP Code:

if (this.== clientr.hotkey1[0].id) { 

Or something.

napo_p2p 06-06-2006 07:48 PM

You can do:

PHP Code:

for (temp.wweapons) {
  if (
temp.w.name == "whatever") {

  }


That's a special for loop that will go through each of the weapons, while making temp.w a reference to each weapon object.

Omini 06-06-2006 07:56 PM

PHP Code:

clientr.hotkey1.replace(0,params[1]);
    
clientr.hotkey1.replace(1,params[2]);
    for (
temp.wweapons) {
      if (
temp.w.name == clientr.hotkey1[0]) {
        
clientr.hotkey1.replace(2,temp.w);
      }
    } 

That isn't working. Can you see where it's going wrong?

ApothiX 06-07-2006 01:12 PM

Quote:

Originally Posted by Omini
PHP Code:

clientr.hotkey1.replace(0,params[1]);
    
clientr.hotkey1.replace(1,params[2]);
    for (
temp.wweapons) {
      if (
temp.w.name == clientr.hotkey1[0]) {
        
clientr.hotkey1.replace(2,temp.w);
      }
    } 

That isn't working.

Might help if you gave more information.

Have you tried doing: player.weapon = findWeapon("WeaponName"); ?

Omini 06-07-2006 01:46 PM

I never bothered till now, and it pretty much broke it. Anymore suggestions?

ApothiX 06-07-2006 04:08 PM

Quote:

Originally Posted by Omini
I never bothered till now, and it pretty much broke it. Anymore suggestions?

Did you bother to read the first half of my response?

contiga 06-07-2006 06:27 PM

Lol is this a serverside script or clientside? Because clientside it wouldnt work..

Omini 06-07-2006 06:54 PM

Quote:

Originally Posted by ApothiX
Did you bother to read the first half of my response?

Yes, and I decided to not give you more information.

Quote:

Originally Posted by contiga
Lol is this a serverside script or clientside? Because clientside it wouldnt work..

The finding of weapon ID or setting the players weapon? Finding the ID is serverside, I was trying to set the players weapon clientside.


All times are GMT +2. The time now is 04:34 AM.

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