Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   changing variables of class scripts (https://forums.graalonline.com/forums/showthread.php?t=43428)

alarid0 03-13-2003 06:36 AM

changing variables of class scripts
 
I made a NPC that drops tickets. You can drop multiple amounts into the ticket, that works fine. Where I'm having trouble is, if i drop another ticket ontop of a ticket, how would i merge the two together as well as the count?

Falados 03-13-2003 06:47 AM

Well, I can think of one way, would be to, upon creation of an item, have it search around itself for items of the exact same type, and if it finds some, then make it increase its own count and delete the item it found.

Knuckles 03-14-2003 01:53 AM

Yea... Get the X and Y infront of player, whichever way hes facing; then check for a npc infront of it using:

NPC Code:

npcs[index].x
npcs[index].y



... If found, then do what he says ^_^.

alarid0 03-14-2003 04:57 AM

Yeah, but how would i check if that NPC is a ticket NPC, and how would i get the variables held within it?

Soul-Blade 03-14-2003 05:08 AM

One way would be to use a NPCs save variable, maybe assign a number to ID the type of item. When a item is placed, if checks all NPCs and if a NPC has a x/y within the radius of the potential x/y of the new item, then it checks the save, if the save is the same type as the save the current item has, then it destroys itself. Of course, another save could be used to store the data for quantity of a item, but there are a variety of ways to store that.

alarid0 03-14-2003 05:19 AM

Yeah, I've thought about using save variables, but for the quantity, that would help since i think save varaibles have a limit of 200++ something.

Python523 03-14-2003 03:05 PM

run a for loop and maybe check via with(npcs[index]) if it matches the current item, it doesnt sound too difficult


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

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