Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Small NPC Help please (https://forums.graalonline.com/forums/showthread.php?t=48039)

wildwog2001 09-17-2003 10:08 AM

Small NPC Help please
 
I made a small npc so as long as the player had this npc in his/her inventory they could say like /add 10 gralet etc..... yet i dont know how to do it so that its if the player has the weapon, i knowh owt o do it if its weaponfired but not by chat if they are holding the weapon yet i can do it while it is on the ground somewhere in the level. can anyone please explain to me the certain commands I can use to get it to work for when the player is holding the weapon.

:)

CheeToS2 09-17-2003 01:21 PM

playerchats, same as if it were on the ground.

Python523 09-17-2003 02:26 PM

hasweapon(name) perhaps?

SaijinGohan 09-17-2003 03:44 PM

I'm a little confused on what you mean. You want a weapon that drops things only when its a weapon and you have it?

NPC Code:

if (playerchats && isweapon) {
if (strequals(#c,/add 10 gralet)) {
dostuffhere;
}
}



Is that around what you need?

wildwog2001 09-17-2003 05:09 PM

Im not sure if what you said was what i needed but

hasweapon

ended up working and this was my final script

if (playertouchsme){
toweapons Stuff Adder!;
}
if (hasweapon(Stuff Adder!)) if (playerchats&&
strequals(#c,Add 1000)){
players[index].rupees+=1000;
}

but for some reason it adds 2000?

GoZelda 09-17-2003 05:38 PM

Because you say it several times. Try using "setplayerprop #c,;" after players[index].rupees+=1000. Maybe it also could be useful using tokenize to define how much the player wants.

CheeToS2 09-17-2003 09:39 PM

Quote:

Originally posted by wildwog2001
Im not sure if what you said was what i needed but

hasweapon

ended up working and this was my final script

if (playertouchsme){
toweapons Stuff Adder!;
}
if (hasweapon(Stuff Adder!)) if (playerchats&&
strequals(#c,Add 1000)){
players[index].rupees+=1000;
}

but for some reason it adds 2000?

don't put events (aka playerchats) within other code blocks.

Ningnong 09-17-2003 10:52 PM

You also need to use if (playerchats) before if (hasweapon()).

osrs 09-18-2003 12:51 AM

Quote:

Originally posted by wildwog2001
Im not sure if what you said was what i needed but

hasweapon

ended up working and this was my final script

if (playertouchsme){
toweapons Stuff Adder!;
}
if (hasweapon(Stuff Adder!)) if (playerchats&&
strequals(#c,Add 1000)){
players[index].rupees+=1000;
}

but for some reason it adds 2000?

Wouldn't be better change players[index].rupees+=1000 by playerrupees+=1000?


All times are GMT +2. The time now is 05:25 AM.

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