Legend 0 Report post Posted August 1, 2022 Hello, Recently I'm working on changing Poss Color to what ever color you want by using commands ( /peff0-8 ) as shown in picture below. https://ibb.co/w7dt77v Everything works fine and I tested to teleport or enter a maze to see if there is something wrong will happen everything is just smooth and it gives stats also. BUT the issue I found is that when I restart/close gameserver.exe the poss color returns to its original form it doesn't save the last color I chose. Ex. If I Possed with fairy of luck the original poss is red colour after I use the command lets say /peff5 it turns to green when I restart the gameserver.exe it goes back to red and doesnt stay green I have to enter the command again. the script shows the original color is random - everytime you poss gives random colour - I made that but my point is I want poss color that I chose stays even after restarting the gameserver without typing the command again. anyone can help me in that. Thanks in advance. Here is the script: Resource -> Script -> Calculate -> skilleffect.lua --------- CUSTOM PET GLOW COLOUR --------- --------- POSS GLOW ------------ function Skill_JLFTGlow_End ( ATKER , DEFER , sklv ) local statelv = sklv local statetime = 190 - sklv * 10 local item_elf = GetChaItem(ATKER , 2, 1) -- Pet Handle local item_elf_type = GetItemType ( item_elf ) -- Pet Type local Item_ID = GetItemID ( item_elf ) -- Pet ID local STATE_PCOLOR = math.random ( STATE_JLFT1 , STATE_JLFT8 ) if Item_ID==231 or Item_ID==232 or Item_ID==233 or Item_ID==234 or Item_ID==235 or Item_ID==236 or Item_ID==237 or Item_ID==500 or Item_ID==681 or Item_ID==422 or Item_ID==423 or Item_ID==424 or Item_ID==425 or Item_ID==426 or Item_ID==427 or Item_ID==428 or Item_ID==429 or Item_ID==430 or Item_ID==431 or Item_ID==432 or Item_ID==433 or Item_ID==434 or Item_ID==457 or Item_ID==458 or Item_ID==143 or Item_ID==144 or Item_ID==145 or Item_ID==146 or Item_ID==147 then AddState( ATKER , ATKER , STATE_PCOLOR, statelv , statetime ) end end cmd.list['peff0'] = function(role, param) BickerNotice (role, "Switched Poss Glow to Original Poss (Random Colour).") function Skill_JLFTGlow_End ( ATKER , DEFER , sklv ) local statelv = sklv local statetime = 190 - sklv * 10 local item_elf = GetChaItem(ATKER , 2, 1) -- Pet Handle local item_elf_type = GetItemType ( item_elf ) -- Pet Type local Item_ID = GetItemID ( item_elf ) -- Pet ID local STATE_PCOLOR = math.random ( STATE_JLFT1 , STATE_JLFT8 ) if Item_ID==231 or Item_ID==232 or Item_ID==233 or Item_ID==234 or Item_ID==235 or Item_ID==236 or Item_ID==237 or Item_ID==500 or Item_ID==681 or Item_ID==422 or Item_ID==423 or Item_ID==424 or Item_ID==425 or Item_ID==426 or Item_ID==427 or Item_ID==428 or Item_ID==429 or Item_ID==430 or Item_ID==431 or Item_ID==432 or Item_ID==433 or Item_ID==434 or Item_ID==457 or Item_ID==458 or Item_ID==143 or Item_ID==144 or Item_ID==145 or Item_ID==146 or Item_ID==147 then AddState( ATKER , ATKER , STATE_PCOLOR, statelv , statetime ) end end end cmd.list['peff1'] = function(role, param) BickerNotice (role, "Switched Poss Glow to Red Colour.") function Skill_JLFTGlow_End ( ATKER , DEFER , sklv ) local statelv = sklv local statetime = 190 - sklv * 10 local item_elf = GetChaItem(ATKER , 2, 1) -- Pet Handle local item_elf_type = GetItemType ( item_elf ) -- Pet Type local Item_ID = GetItemID ( item_elf ) -- Pet ID if Item_ID==231 or Item_ID==232 or Item_ID==233 or Item_ID==234 or Item_ID==235 or Item_ID==236 or Item_ID==237 or Item_ID==500 or Item_ID==681 or Item_ID==422 or Item_ID==423 or Item_ID==424 or Item_ID==425 or Item_ID==426 or Item_ID==427 or Item_ID==428 or Item_ID==429 or Item_ID==430 or Item_ID==431 or Item_ID==432 or Item_ID==433 or Item_ID==434 or Item_ID==457 or Item_ID==458 or Item_ID==143 or Item_ID==144 or Item_ID==145 or Item_ID==146 or Item_ID==147 then AddState( ATKER , ATKER , STATE_JLFT1, statelv , statetime ) end end end cmd.list['peff2'] = function(role, param) BickerNotice (role, "Switched Poss Glow to Orange Colour.") function Skill_JLFTGlow_End ( ATKER , DEFER , sklv ) local statelv = sklv local statetime = 190 - sklv * 10 local item_elf = GetChaItem(ATKER , 2, 1) -- Pet Handle local item_elf_type = GetItemType ( item_elf ) -- Pet Type local Item_ID = GetItemID ( item_elf ) -- Pet ID if Item_ID==231 or Item_ID==232 or Item_ID==233 or Item_ID==234 or Item_ID==235 or Item_ID==236 or Item_ID==237 or Item_ID==500 or Item_ID==681 or Item_ID==422 or Item_ID==423 or Item_ID==424 or Item_ID==425 or Item_ID==426 or Item_ID==427 or Item_ID==428 or Item_ID==429 or Item_ID==430 or Item_ID==431 or Item_ID==432 or Item_ID==433 or Item_ID==434 or Item_ID==457 or Item_ID==458 or Item_ID==143 or Item_ID==144 or Item_ID==145 or Item_ID==146 or Item_ID==147 then AddState( ATKER , ATKER , STATE_JLFT2, statelv , statetime ) end end end cmd.list['peff3'] = function(role, param) BickerNotice (role, "Switched Poss Glow to Yellow Colour.") function Skill_JLFTGlow_End ( ATKER , DEFER , sklv ) local statelv = sklv local statetime = 190 - sklv * 10 local item_elf = GetChaItem(ATKER , 2, 1) -- Pet Handle local item_elf_type = GetItemType ( item_elf ) -- Pet Type local Item_ID = GetItemID ( item_elf ) -- Pet ID if Item_ID==231 or Item_ID==232 or Item_ID==233 or Item_ID==234 or Item_ID==235 or Item_ID==236 or Item_ID==237 or Item_ID==500 or Item_ID==681 or Item_ID==422 or Item_ID==423 or Item_ID==424 or Item_ID==425 or Item_ID==426 or Item_ID==427 or Item_ID==428 or Item_ID==429 or Item_ID==430 or Item_ID==431 or Item_ID==432 or Item_ID==433 or Item_ID==434 or Item_ID==457 or Item_ID==458 or Item_ID==143 or Item_ID==144 or Item_ID==145 or Item_ID==146 or Item_ID==147 then AddState( ATKER , ATKER , STATE_JLFT3, statelv , statetime ) end end end cmd.list['peff4'] = function(role, param) BickerNotice (role, "Switched Poss Glow to Green Colour.") function Skill_JLFTGlow_End ( ATKER , DEFER , sklv ) local statelv = sklv local statetime = 190 - sklv * 10 local item_elf = GetChaItem(ATKER , 2, 1) -- Pet Handle local item_elf_type = GetItemType ( item_elf ) -- Pet Type local Item_ID = GetItemID ( item_elf ) -- Pet ID if Item_ID==231 or Item_ID==232 or Item_ID==233 or Item_ID==234 or Item_ID==235 or Item_ID==236 or Item_ID==237 or Item_ID==500 or Item_ID==681 or Item_ID==422 or Item_ID==423 or Item_ID==424 or Item_ID==425 or Item_ID==426 or Item_ID==427 or Item_ID==428 or Item_ID==429 or Item_ID==430 or Item_ID==431 or Item_ID==432 or Item_ID==433 or Item_ID==434 or Item_ID==457 or Item_ID==458 or Item_ID==143 or Item_ID==144 or Item_ID==145 or Item_ID==146 or Item_ID==147 then AddState( ATKER , ATKER , STATE_JLFT4, statelv , statetime ) end end end cmd.list['peff5'] = function(role, param) BickerNotice (role, "Switched Poss Glow to Light Green Colour.") function Skill_JLFTGlow_End ( ATKER , DEFER , sklv ) local statelv = sklv local statetime = 190 - sklv * 10 local item_elf = GetChaItem(ATKER , 2, 1) -- Pet Handle local item_elf_type = GetItemType ( item_elf ) -- Pet Type local Item_ID = GetItemID ( item_elf ) -- Pet ID if Item_ID==231 or Item_ID==232 or Item_ID==233 or Item_ID==234 or Item_ID==235 or Item_ID==236 or Item_ID==237 or Item_ID==500 or Item_ID==681 or Item_ID==422 or Item_ID==423 or Item_ID==424 or Item_ID==425 or Item_ID==426 or Item_ID==427 or Item_ID==428 or Item_ID==429 or Item_ID==430 or Item_ID==431 or Item_ID==432 or Item_ID==433 or Item_ID==434 or Item_ID==457 or Item_ID==458 or Item_ID==143 or Item_ID==144 or Item_ID==145 or Item_ID==146 or Item_ID==147 then AddState( ATKER , ATKER , STATE_JLFT5, statelv , statetime ) end end end cmd.list['peff6'] = function(role, param) BickerNotice (role, "Switched Poss Glow to Cyan Colour.") function Skill_JLFTGlow_End ( ATKER , DEFER , sklv ) local statelv = sklv local statetime = 190 - sklv * 10 local item_elf = GetChaItem(ATKER , 2, 1) -- Pet Handle local item_elf_type = GetItemType ( item_elf ) -- Pet Type local Item_ID = GetItemID ( item_elf ) -- Pet ID if Item_ID==231 or Item_ID==232 or Item_ID==233 or Item_ID==234 or Item_ID==235 or Item_ID==236 or Item_ID==237 or Item_ID==500 or Item_ID==681 or Item_ID==422 or Item_ID==423 or Item_ID==424 or Item_ID==425 or Item_ID==426 or Item_ID==427 or Item_ID==428 or Item_ID==429 or Item_ID==430 or Item_ID==431 or Item_ID==432 or Item_ID==433 or Item_ID==434 or Item_ID==457 or Item_ID==458 or Item_ID==143 or Item_ID==144 or Item_ID==145 or Item_ID==146 or Item_ID==147 then AddState( ATKER , ATKER , STATE_JLFT6, statelv , statetime ) end end end cmd.list['peff7'] = function(role, param) BickerNotice (role, "Switched Poss Glow to Light Purple Colour.") function Skill_JLFTGlow_End ( ATKER , DEFER , sklv ) local statelv = sklv local statetime = 190 - sklv * 10 local item_elf = GetChaItem(ATKER , 2, 1) -- Pet Handle local item_elf_type = GetItemType ( item_elf ) -- Pet Type local Item_ID = GetItemID ( item_elf ) -- Pet ID if Item_ID==231 or Item_ID==232 or Item_ID==233 or Item_ID==234 or Item_ID==235 or Item_ID==236 or Item_ID==237 or Item_ID==500 or Item_ID==681 or Item_ID==422 or Item_ID==423 or Item_ID==424 or Item_ID==425 or Item_ID==426 or Item_ID==427 or Item_ID==428 or Item_ID==429 or Item_ID==430 or Item_ID==431 or Item_ID==432 or Item_ID==433 or Item_ID==434 or Item_ID==457 or Item_ID==458 or Item_ID==143 or Item_ID==144 or Item_ID==145 or Item_ID==146 or Item_ID==147 then AddState( ATKER , ATKER , STATE_JLFT7, statelv , statetime ) end end end cmd.list['peff8'] = function(role, param) BickerNotice (role, "Switched Poss Glow to Purple Colour.") function Skill_JLFTGlow_End ( ATKER , DEFER , sklv ) local statelv = sklv local statetime = 190 - sklv * 10 local item_elf = GetChaItem(ATKER , 2, 1) -- Pet Handle local item_elf_type = GetItemType ( item_elf ) -- Pet Type local Item_ID = GetItemID ( item_elf ) -- Pet ID if Item_ID==231 or Item_ID==232 or Item_ID==233 or Item_ID==234 or Item_ID==235 or Item_ID==236 or Item_ID==237 or Item_ID==500 or Item_ID==681 or Item_ID==422 or Item_ID==423 or Item_ID==424 or Item_ID==425 or Item_ID==426 or Item_ID==427 or Item_ID==428 or Item_ID==429 or Item_ID==430 or Item_ID==431 or Item_ID==432 or Item_ID==433 or Item_ID==434 or Item_ID==457 or Item_ID==458 or Item_ID==143 or Item_ID==144 or Item_ID==145 or Item_ID==146 or Item_ID==147 then AddState( ATKER , ATKER , STATE_JLFT8, statelv , statetime ) end end end Quote Share this post Link to post Share on other sites
Dan 184 Report post Posted August 1, 2022 I think if you are doing this method, it may require you to store it in the database, otherwise the only thing I can think of is making an item such as ItemID = XXXX, if player has ItemID then poss glow X, and when using cmd /peff# to change glow, it will GiveItem XXXX, and maybe store it in tempBag. Quote Share this post Link to post Share on other sites
Legend 0 Report post Posted August 2, 2022 On 8/1/2022 at 8:48 PM, Dan said: I think if you are doing this method, it may require you to store it in the database, otherwise the only thing I can think of is making an item such as ItemID = XXXX, if player has ItemID then poss glow X, and when using cmd /peff# to change glow, it will GiveItem XXXX, and maybe store it in tempBag. Thank You @Dan I followed the second method and its working fine there is just a small problem that now I should have both the pet and the Item in inventory for poss to work if pet or item alone in inventory poss isn't working but I just added the Item for free in NPC. Quote Share this post Link to post Share on other sites
Dan 184 Report post Posted August 2, 2022 43 minutes ago, Legend said: Thank You @Dan I followed the second method and its working fine there is just a small problem that now I should have both the pet and the Item in inventory for poss to work if pet or item alone in inventory poss isn't working but I just added the Item for free in NPC. You can use the /temp to put the item in tempbag and make a function to check if the item is in tempbag if its true then give X poss eff, I've done this similar to "Titles" in the past, also like bracelet/handguards etc. You might just need to remove poss effect glow if they're using the skill. 1 Quote Share this post Link to post Share on other sites
Legend 0 Report post Posted August 3, 2022 11 hours ago, Dan said: You can use the /temp to put the item in tempbag and make a function to check if the item is in tempbag if its true then give X poss eff, I've done this similar to "Titles" in the past, also like bracelet/handguards etc. You might just need to remove poss effect glow if they're using the skill. I meant that when player uses poss skill the poss color depend on the Item he has for Ex. if the player used poss skill instead of the purple colour for MJR, if player has Cyan Aura then the poss glow is cyan if he has Red Aura then poss glow is red so on. but from what you are saying you mean that players walks 24/7 with poss glow right? Quote Share this post Link to post Share on other sites
BXlevovich 22 Report post Posted August 3, 2022 @Legend better work on optimizing the code. No need to duplicate the same code, you can also improve my version, it also makes no sense to declare variables that are used only 1 time or not used at all. function Skill_JLFTGlow_End ( ATKER , DEFER , sklv) local item_elf = GetChaItem(ATKER , 2, 1) if (item_elf ~= nil) then local Item_ID = GetItemID ( item_elf ) if (Item_ID >= 231 and Item_ID <= 237) or Item_ID==500 or Item_ID==681 or (Item_ID >= 422 and Item_ID <=434) or Item_ID==457 or Item_ID==458 or (Item_ID >= 143 and Item_ID <= 147) then AddState( ATKER , ATKER , math.random ( STATE_JLFT1 , STATE_JLFT8 ), sklv , 190 - sklv * 10 ) end end end function ChangePoss(role, message, state, statelv) BickerNotice (role, message) local item_elf = GetChaItem(ATKER , 2, 1) if (item_elf ~= nil) then local Item_ID = GetItemID ( item_elf ) if (Item_ID >= 231 and Item_ID <= 237) or Item_ID==500 or Item_ID==681 or (Item_ID >= 422 and Item_ID <=434) or Item_ID==457 or Item_ID==458 or (Item_ID >= 143 and Item_ID <= 147) then AddState( role , role , state, statelv , 190 - statelv * 10 ) end end end cmd.list['peff0'] = function(role, param) ChangePoss(role, "Switched Poss Glow to Original Poss (Random Colour).", math.random ( STATE_JLFT1 , STATE_JLFT8 ), 10) end cmd.list['peff1'] = function(role, param) ChangePoss(role, "Switched Poss Glow to Red Colour.", STATE_JLFT1, 10) end cmd.list['peff2'] = function(role, param) ChangePoss(role, "Switched Poss Glow to Orange Colour.", STATE_JLFT2, 10) end cmd.list['peff3'] = function(role, param) ChangePoss(role, "Switched Poss Glow to Yellow Colour.", STATE_JLFT3, 10) end cmd.list['peff4'] = function(role, param) ChangePoss(role, "Switched Poss Glow to Green Colour.", STATE_JLFT4, 10) end cmd.list['peff5'] = function(role, param) ChangePoss(role, "Switched Poss Glow to Light Green Colour.", STATE_JLFT5, 10) end cmd.list['peff6'] = function(role, param) ChangePoss(role, "Switched Poss Glow to Cyan Colour.", STATE_JLFT6, 10) end cmd.list['peff7'] = function(role, param) ChangePoss(role, "Switched Poss Glow to Light Purple Colour.", STATE_JLFT7, 10) end cmd.list['peff8'] = function(role, param) ChangePoss(role, "Switched Poss Glow to Purple Colour.", STATE_JLFT8, 10) end 1 Quote Share this post Link to post Share on other sites
Legend 0 Report post Posted August 3, 2022 5 hours ago, BXlevovich said: @Legend better work on optimizing the code. No need to duplicate the same code, you can also improve my version, it also makes no sense to declare variables that are used only 1 time or not used at all. function Skill_JLFTGlow_End ( ATKER , DEFER , sklv) local item_elf = GetChaItem(ATKER , 2, 1) if (item_elf ~= nil) then local Item_ID = GetItemID ( item_elf ) if (Item_ID >= 231 and Item_ID <= 237) or Item_ID==500 or Item_ID==681 or (Item_ID >= 422 and Item_ID <=434) or Item_ID==457 or Item_ID==458 or (Item_ID >= 143 and Item_ID <= 147) then AddState( ATKER , ATKER , math.random ( STATE_JLFT1 , STATE_JLFT8 ), sklv , 190 - sklv * 10 ) end end end function ChangePoss(role, message, state, statelv) BickerNotice (role, message) local item_elf = GetChaItem(ATKER , 2, 1) if (item_elf ~= nil) then local Item_ID = GetItemID ( item_elf ) if (Item_ID >= 231 and Item_ID <= 237) or Item_ID==500 or Item_ID==681 or (Item_ID >= 422 and Item_ID <=434) or Item_ID==457 or Item_ID==458 or (Item_ID >= 143 and Item_ID <= 147) then AddState( role , role , state, statelv , 190 - statelv * 10 ) end end end cmd.list['peff0'] = function(role, param) ChangePoss(role, "Switched Poss Glow to Original Poss (Random Colour).", math.random ( STATE_JLFT1 , STATE_JLFT8 ), 10) end cmd.list['peff1'] = function(role, param) ChangePoss(role, "Switched Poss Glow to Red Colour.", STATE_JLFT1, 10) end cmd.list['peff2'] = function(role, param) ChangePoss(role, "Switched Poss Glow to Orange Colour.", STATE_JLFT2, 10) end cmd.list['peff3'] = function(role, param) ChangePoss(role, "Switched Poss Glow to Yellow Colour.", STATE_JLFT3, 10) end cmd.list['peff4'] = function(role, param) ChangePoss(role, "Switched Poss Glow to Green Colour.", STATE_JLFT4, 10) end cmd.list['peff5'] = function(role, param) ChangePoss(role, "Switched Poss Glow to Light Green Colour.", STATE_JLFT5, 10) end cmd.list['peff6'] = function(role, param) ChangePoss(role, "Switched Poss Glow to Cyan Colour.", STATE_JLFT6, 10) end cmd.list['peff7'] = function(role, param) ChangePoss(role, "Switched Poss Glow to Light Purple Colour.", STATE_JLFT7, 10) end cmd.list['peff8'] = function(role, param) ChangePoss(role, "Switched Poss Glow to Purple Colour.", STATE_JLFT8, 10) end Thanks for Reply @BXlevovich im actually still new to coding and im learning one by one, and about this script im not using it anymore as you said there are many duplicated codes I made new script and everything is working perfect now thanks to Dan for guiding me. Quote Share this post Link to post Share on other sites
Legend 0 Report post Posted August 3, 2022 I will also take look at your script Thanks for Share. Quote Share this post Link to post Share on other sites
MrWick 0 Report post Posted August 2, 2023 On 8/1/2022 at 3:48 PM, Dan said: I think if you are doing this method, it may require you to store it in the database, otherwise the only thing I can think of is making an item such as ItemID = XXXX, if player has ItemID then poss glow X, and when using cmd /peff# to change glow, it will GiveItem XXXX, and maybe store it in tempBag. Dan Hello, would you help me with the tempbag issue? Discord: mrwick7028 Quote Share this post Link to post Share on other sites