Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   setting player weapon (https://forums.graalonline.com/forums/showthread.php?t=51279)

Blue_Dragn 02-23-2004 05:21 AM

setting player weapon
 
Is there anyway to do this? Say i want to have a certain weapon called to be the players active weapon (Thats activated when weaponfired)?

I tried a few things but have failed miserabally

Edit:

ive tried so far

selectedweapon =

but i think npcid changes, so that dosent work?
and i know you cant write #w like setplayerprop #w

-Ramirez- 02-23-2004 06:04 AM

NPC Code:

for (a = 0;a < weaponscount;a++) {
if (strequals(#w(a),WeaponName)) selectedweapon = a;
}


?

(No, I don't like i.)

Kristi 02-23-2004 07:36 AM

Well if youre doing it from serverside access, you could remove it from their inventory then readd it. The newest weapon added always gets focus.

WanDaMan 02-23-2004 09:40 AM

****y:
if(hasweapon(weaponname)){
}
Sorry double posted, here

if(!hasweapon(weaponname)){
addweapon namehere; //serverside
}

If they don't have the weapon it will add it.

Loriel 02-23-2004 11:31 AM

What Kat said is clearly the preferred way ;)
Please think of the background work that has to happen when deleting and readding a weapon.

Blue_Dragn 02-23-2004 06:07 PM

Quote:

Originally posted by -Ramirez-
NPC Code:

for (a = 0;a < weaponscount;a++) {
if (strequals(#w(a),WeaponName)) selectedweapon = a;
}


?

(No, I don't like i.)

I hadnt thought of running it in a loop like that, thanks.

Kristi 02-23-2004 11:11 PM

Quote:

Originally posted by Loriel
What Kat said is clearly the preferred way ;)
Please think of the background work that has to happen when deleting and readding a weapon.

Its a quick and dirty solution =p And Kat had already given a good one... and i like hearing myself speak...


All times are GMT +2. The time now is 08:50 AM.

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