![]() |
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?
|
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.
|
Yea... Get the X and Y infront of player, whichever way hes facing; then check for a npc infront of it using:
NPC Code: ... If found, then do what he says ^_^. |
Yeah, but how would i check if that NPC is a ticket NPC, and how would i get the variables held within it?
|
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.
|
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.
|
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.