[Release] How To Create Temporary ITems in NPC with timer Easy Way
Discussion on [Release] How To Create Temporary ITems in NPC with timer Easy Way within the SRO PServer Guides & Releases forum part of the SRO Private Server category.
[Release] How To Create Temporary ITems in NPC with timer Easy Way
First Its Little System I Think Some People Like IT
Gallery 1
You Can Use IT with Deffrent Way As You Like But you MakeSure Its Working Fine
How It Work
Its Working with Sell/Buy Item From Shop The Operation System Execute It
So You Need First To Collect The items you Want to put it inside this Timer on
Npc Just Use This Table To Put Items ID/CodeName So When the player Buy Any item from you inserted his ID in the Table The System Start To Save This item inside our Sec Table With Datetime So After The Limited Time Finished Te System check if DateTime < -5 Day Will Remove it
table insert all of info about item and buyer too Notice
You Should Edit The Notice Exec To Work on Your filter Table How To get it
PHP Code:
SELECT ID,CodeName128 FROM SRO_VT_SHARD.._RefObjCommon WHERE CodeName128 LIKE '%YOURiTEMS CODE%'
After This Step You Should Create This Table To put Result Inside IT
Code:
USE YourDatabaseName
GO
/****** Object: Table [dbo].[Temp_itemID] #Mohamed_Montaser Script Date: 10/14/2023 11:32:34 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Temp_itemID](
[ID] [int] IDENTITY(1,1) NOT NULL,
[ItemID] [int] NOT NULL,
[CodeName] [varchar](max) NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
Sec Table To Record Items When player buy it From NPC
Code:
USE YourDatabaseName
GO
/****** Object: Table [dbo].[_Temporary_items] #Mohamed_Montaser Script Date: 10/14/2023 11:31:18 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[_Temporary_items](
[ID] [int] IDENTITY(1,1) NOT NULL,
[CharName] [varchar](30) NOT NULL,
[CharID] [int] NOT NULL,
[UserJid] [int] NOT NULL,
[ID64] [int] NOT NULL,
[ItemID] [int] NOT NULL,
[ItemSerial] [bigint] NOT NULL,
[ItemCodeName] [varchar](max) NOT NULL,
[ShopCodeName] [varchar](max) NULL,
[Timer] [datetime] NOT NULL,
[Stats] [varchar](50) NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
Then Now Our Things Are Ready To put Our Little System inside Game... So You Should Open SRO_VT_SHARDLOG / _AddLogItem and put this System at the End
Code:
---- RECORD TEMPORARY ITEMS #mohamed_montaser
IF (@Operation in (32,35))
DECLARE @TimerWeapon INT = -5 -- Time Down to remove items per days
BEGIN
IF (@ItemRefID IN (SELECT ItemID from TOOL_SYSTEM..Temp_itemID))
BEGIN
---//////
DECLARE @CharNameTemp varchar (35), @ID64Temp INT , @itemCodeNameTemp varchar (Max) ,@NPCTEMP VARCHAR (MAX), @UserTemp INT,@CharNameTempMsg Varchar (35)
SET @CharNameTemp = (SELECT CharName16 FROM SRO_VT_SHARD.._Char WHERE CharID = @CharID )
SET @ID64Temp = (SELECT ID64 FROM SRO_VT_SHARD.._Items WHERE Serial64 = @ItemSerial )
SET @itemCodeNameTemp = ( SELECT CodeName128 From SRO_VT_SHARD.._RefObjCommon where ID = @ItemRefID)
SET @NPCTEMP = (SELECT RefTabCodeName FROM SRO_VT_SHARD.._RefShopGoods WHERE RefPackageItemCodeName = 'PACKAGE_' +@itemCodeNameTemp)
SET @UserTemp = ( SELECT UserJID FROM SRO_VT_SHARD.._User WHERE CharID = @CharID )
SET @CharNameTempMsg = (SELECT CharName16 FROM SRO_VT_SHARD.._Char WHERE CharID = @CharID )
--DECLARE @MgsDetalis VARCHAR (MAX) = 'Hello Dear ['+@CharNameTemp+'] YOUR CharID Is ['+CONVERT (VARCHAR,@CharID)+'] ITEM ID64 IS ['+CONVERT (VARCHAR,@ID64Temp)+'] And Item Serial is ['+CONVERT (VARCHAR,@ItemSerial)+'] AND ItemID is ['+CONVERT (VARCHAR,@ItemRefID)+'] And Item CodeName Is ['+@itemCodeNameTemp+'] The Time is '+ CONVERT(VARCHAR, GETDATE(), 120)
--INSERT INTO ZOLA_VT_FILTER.._AutoNotice VALUES (@MgsDetalis,@CharNameTemp,0,GETDATE())
INSERT INTO TOOL_SYSTEM.._Temporary_items VALUES (@CharNameTemp,@CharID,@UserTemp,@ID64Temp,@ItemRefID,@ItemSerial,@itemCodeNameTemp,@NPCTEMP,GETDATE(),'ADDED')
END
-- Check if items need to be removed based on the timer
IF (SELECT COUNT(*) FROM TOOL_SYSTEM.._Temporary_items WHERE Timer < DATEADD(DAY, @TimerWeapon, GETDATE())) > 0
BEGIN
UPDATE inv -- remove from inventory
SET inv.ItemID = 0
FROM SRO_VT_SHARD.._Inventory AS inv
INNER JOIN SRO_VT_SHARD.._Items AS itm ON inv.ItemID = itm.ID64
INNER JOIN TOOL_SYSTEM.._Temporary_items AS temp ON itm.Serial64 = temp.ItemSerial
WHERE temp.Timer < DATEADD(DAY, @TimerWeapon, GETDATE());
UPDATE Chest ---- remove from Storage
SET Chest.ItemID = 0
FROM SRO_VT_SHARD.._Chest AS Chest
INNER JOIN SRO_VT_SHARD.._Items AS I ON Chest.ItemID = I.ID64
INNER JOIN TOOL_SYSTEM.._Temporary_items AS temp ON i.Serial64 = temp.ItemSerial
WHERE temp.Timer < DATEADD(DAY, @TimerWeapon, GETDATE());
UPDATE PET -- remove from pet
SET PET.ItemID = 0
FROM SRO_VT_SHARD.._InvCOS AS PET
INNER JOIN SRO_VT_SHARD.._Items AS I ON PET.ItemID = I.ID64
INNER JOIN TOOL_SYSTEM.._Temporary_items AS temp ON i.Serial64 = temp.ItemSerial
WHERE temp.Timer < DATEADD(DAY, @TimerWeapon, GETDATE());
UPDATE G
SET G.ItemID = 0 -- remove from storage guild
FROM SRO_VT_SHARD.._GuildChest AS G
INNER JOIN SRO_VT_SHARD.._Items AS I ON G.ItemID = I.ID64
INNER JOIN TOOL_SYSTEM.._Temporary_items AS temp ON i.Serial64 = temp.ItemSerial
WHERE temp.Timer < DATEADD(DAY, @TimerWeapon, GETDATE());
UPDATE temp
SET temp.Stats = 'DELETED'
FROM TOOL_SYSTEM.._Temporary_items AS temp
INNER JOIN SRO_VT_SHARD.._Items AS itm ON temp.ItemSerial = itm.Serial64
WHERE temp.Timer < DATEADD(DAY, @TimerWeapon, GETDATE());
END
END
Then Done! Enjoy# Notice
1- its Simple Code You Can Handle it as You Want Like you can use Filter to handle it if had Trigger on_buy_sell
to let Player Buy from this shop one time only with HWID
2- You Can Use It As Gift Item like you Can Get Copy Of ur real items With little Damge And stats inside this shop for new player with 1 day only with table register Buyer player Then if they try to buy Again Item Will Add With date - 10 Day then it will disappear automatically this can let player buy item one time only
3- You Can use It Too in Pvp Servers with items FB Max Plus in game
4- You can Adjust it with alot of many ways then just enjoy and put Thanks
And if instead of removing it, you want it returned to you, and return it to the chest automatically ?
well in my comment we would already be talking about a loan system
This is going to be intressting for Event themed items, nice release.
Thanks
Yes You Can use it as u want too
Quote:
Originally Posted by XxGhostSpiriTxX
Good job,thanks for sharing with the community
And if instead of removing it, you want it returned to you, and return it to the chest automatically ?
urw Example With Explain
So if u want to returned it to ur Chest You Souldn't Delete it From inventory
but for example If u removed it this itmes still inside table _Temporary_items
with Stats = 'DELETED' You Can add Query To get Last itemID From Table And insert it inside Chest
Example With Code
Code:
DECLARE @DeletedItem INT , @CharIDTemp INT
SELECT TOP 1 @DeletedItem = ItemID , @CharIDTemp = CharID FROM TOOL_SYSTEM.._Temporary_items ORDER BY Timer DESC
INSERT INTO ZOLA_VT_FILTER.._CharChest VALUES (@CharIDTemp,@DeletedItem,1,@Optlevel,1,'Returned temp Item',getdate())
Notice
You Can Edit this Code Too
But Make Sure To Edit The Table To get Optlevel Too before Delete Items
urw Example With Explain
So if u want to returned it to ur Chest You Souldn't Delete it From inventory
but for example If u removed it this itmes still inside table _Temporary_items
with Stats = 'DELETED' You Can add Query To get Last itemID From Table And insert it inside Chest
Example With Code
Code:
DECLARE @DeletedItem INT , @CharIDTemp INT
SELECT TOP 1 @DeletedItem = ItemID , @CharIDTemp = CharID FROM TOOL_SYSTEM.._Temporary_items ORDER BY Timer DESC
INSERT INTO ZOLA_VT_FILTER.._CharChest VALUES (@CharIDTemp,@DeletedItem,1,@Optlevel,1,'Returned temp Item',getdate())
Notice
You Can Edit this Code Too
But Make Sure To Edit The Table To get Optlevel Too before Delete Items
#Enjoy
#Mohamed_Montaser
Suppose the item have bluee and % , it would be the same procedure with the _Item table with all its values, example:
ID64
RefItemID
OptLevel
Variance
Data
CreaterName
MagParamNum
MagParam1
MagParam2
MagParam3
MagParam4
MagParam5
MagParam6
MagParam7
MagParam8
MagParam9
MagParam10
MagParam11
MagParam12
Serial64
but I wouldn't return it to the Chest. If not to the Storage or inventory, that's also possible, right?
urw Example With Explain
So if u want to returned it to ur Chest You Souldn't Delete it From inventory
but for example If u removed it this itmes still inside table _Temporary_items
with Stats = 'DELETED' You Can add Query To get Last itemID From Table And insert it inside Chest
Example With Code
Code:
DECLARE @DeletedItem INT , @CharIDTemp INT
SELECT TOP 1 @DeletedItem = ItemID , @CharIDTemp = CharID FROM TOOL_SYSTEM.._Temporary_items ORDER BY Timer DESC
INSERT INTO ZOLA_VT_FILTER.._CharChest VALUES (@CharIDTemp,@DeletedItem,1,@Optlevel,1,'Returned temp Item',getdate())
Notice
You Can Edit this Code Too
But Make Sure To Edit The Table To get Optlevel Too before Delete Items
#Enjoy
#Mohamed_Montaser
Suppose the item have bluee and % , it would be the same procedure with the _Item table with all its values, example:
ID64
RefItemID
OptLevel
Variance
Data
CreaterName
MagParamNum
MagParam1
MagParam2
MagParam3
MagParam4
MagParam5
MagParam6
MagParam7
MagParam8
MagParam9
MagParam10
MagParam11
MagParam12
Serial64
but I wouldn't return it to the Chest. If not to the Storage or inventory, that's also possible, right?
EvryThing in Sro in possible But need More Work With Brain And Idea
1 - But if u want to return The item Again Then Where is Idea In This System Don't Remove it at first ?
2 - U need To Create Another Table To Get Copy Of Param in item Before Delete it
3- U need To Insert Item Inside chest To At First Then Update _Items With This Last Insterd ise serial To Update params to old items (it's need some owrk)
4- u Can remove the system and create another One IF Day > time update Inventory Not Update Itemid = 0 but update CharID Set CharID = NewCharID Who want to add this item inside his inventory But How U Can Select Slot U can Use @Slot_to then the item will not deleted But will Change To Another Char or Same Char inside Storage or Any if this what u mean
In order to achieve this, you must first grasp how gameserver operates. under some circumstances it doesn't update the database directly, It's crucial to avoid making the assumption that all user data is instantly synchronized with the database while gameserver might have scheduled some operations to be done at the item at the next teleportation
In order to achieve this, you must first grasp how gameserver operates. under some circumstances it doesn't update the database directly, It's crucial to avoid making the assumption that all user data is instantly synchronized with the database while gameserver might have scheduled some operations to be done at the item at the next teleportation
Sure i agreed with you
i Mean What if we have InstantRemove item live ? it will be good idea to remove this item without need to teleport too or scheduled operations
its got with many idea to do it
Job Timer (Taxi Timer, etc) 09/01/2011 - SRO Hacks, Bots, Cheats & Exploits - 2 Replies A small utility to keep track of jobs that need timing.
http://img834.imageshack.us/img834/6076/jt01.png
Always read the changelog!
To get access to Job Timer, register at "www.error- soft.net" ( without the spaces between the - )
Press thanks if this helps at all.