X-Team Lua Scripts question

Results 1 to 5 of 5
  1. #1
    Hardcore Member marecznyjo is offline
    MemberRank
    May 2005 Join Date
    106Posts

    X-Team Lua Scripts question

    X-Team Lua Scripts question
    Hello Ragezoners

    I'm working with XTeam Lua scripting API and I have few questions because I couldn't figure some things out with official documentation and by experimenting.

    Maybe someone who is more experienced will be able to help me.

    1. EventItemBag Special Value

    There are various options to add or drop an item in the API. One of it allows the usage of EventItemBag. From what I understand, I can use it to define rewards for completing something (as an example - a custom event).

    The documentation states as follow:

    Code:
    ItemDrop(aIndex,aValue,bValue,cValue,dValue)
     
    aIndex = User index.
    aValue = Map number.
    bValue = Map position X.
    cValue = Map position Y.
    dValue = EventItemBag SpecialValue.
     
    Drop at the chosen position an item from an EventItemBag.
    Same for:

    Code:
    ItemGive(aIndex,aValue)
     
    aIndex = User index.
    aValue = EventItemBag SpecialValue.
     
    Insert to the user inventory an item from an EventItemBag.
    I'm unable to understand what is this EventItemBag SpecialValue.

    When I check the server files, I have EventItemBagManager which contains column "SpecialValue" but it doesn't seem to correlate with the special value I provide to the function. No matter what value I enter, I'm receiving various items (exc Hurricane Set equivalents) which I could not identify from which EventItemBag it comes from.

    Using this feature is important to me as EventItemBags allow me to specify the option value to send it to Gremory Case of the player instead of dropping it on the ground or doing a complicated inventory space check.

    2. Timer function

    There is a listed function in the documentation for Timers.

    Code:
    TimerStartSend(aIndex,aValue,bValue,cValue)
     
    aIndex = User index.
    aValue = Timer type.
    bValue = Timer flag.
    cValue = Time in seconds.
     
    Show a timer at selected player screen (Season13+ ONLY).
    I experimented with it a bit but I was unable to understand the parameters and could not make it work.

    No matter what I provide to the cValue (time in seconds), the timer shows up for a second and dissapears.

    I also don't know what is Timer flag param supposed to do.

    So a couple of questions:
    a. What Timer type values are available?
    b. What is the Timer flag and what does it do?
    c. Why the timer dissapears immediately and it doesnt countdown when providing e.g. 10s to Time in seconds param. Does it have to run on some kind of script loop?

    3. User Action Send

    There is a function for user actions:

    Code:
    UserActionSend(aIndex,bIndex,aValue)
    
    aIndex = User index.
    bIndex = Target user index.
    aValue = Action number.
    
    User performs the chosen action.
    Does anyone have a listing of available action in this API call?


  2. #2
    Account Upgraded | Title Enabled! zipper20032 is offline
    True MemberRank
    Oct 2006 Join Date
    0x198837ADLocation
    238Posts

    Re: X-Team Lua Scripts question

    I'm not familiar with the X Team, but what you can do is breakpointing the SpecialValue somewhere and see what's the data inside the EventItemBagManager. Test few event item bags and write down the data you found. This way you can compare the data between items. Check if the SpecialValue is loaded from any files, this way you can check where the calculation for that data is done. If the SpecialValue is calculated inside LUA, you need to find it. And what I remember, is pretty tricky to debug LUA, so.. You can work with what's inside the gameserver source.

    Timers usually are in miliseconds and not seconds by default. If there's any calculation done to transform ms to sec, then you need to find it. 1000ms = 1 sec. If you enter a value of 1, that's 0.001 sec.

    For sending an item to the Gremory Case, I'm pretty sure you can reuse the code from other things to send that item to that inventory. I'm doing this on my zTeam S6E3 with my custom jewel bank. LUA scripting usually just calculates things, and it needs a data packet to be sent to the client so it'll receive the item in his inventory. So, I don't think you need to alter the LUA scripting in order to do that.

    So to give you a hint. Gremory Case is a list, not an inventory. Probably only special conditioned items can be inserted, not sure about armors, weapons.
    Probably you can add a special condition for those too in the GS.
    Even so, to receive the item, a function will still need to calculate the free positions in inventory, but probably that's already taking care of by the Gremory Case functions. Event Item Bags are defined in the files, so just play with the data from the files.

    Also, breakpoint to an item which is in Gremory Case and see what's that special condition which your items need so those can be inserted into the list.

    In DB, surely there's a Gremory Case table which store the Gremory Case list. Add a few items in that list, run a query in the DB and see the values for those stored items. Compare them with your inventory data and see what's the difference between them.

    I gave you some starting points. XD it's a lot to write cause there are many details you need to check and understand.
    Last edited by zipper20032; 22-02-21 at 12:38 PM.

  3. #3
    Hardcore Member marecznyjo is offline
    MemberRank
    May 2005 Join Date
    106Posts

    Re: X-Team Lua Scripts question

    Quote Originally Posted by zipper20032 View Post
    I'm not familiar with the X Team, but what you can do is breakpointing the SpecialValue somewhere and see what's the data inside the EventItemBagManager. Test few event item bags and write down the data you found. This way you can compare the data between items. Check if the SpecialValue is loaded from any files, this way you can check where the calculation for that data is done. If the SpecialValue is calculated inside LUA, you need to find it. And what I remember, is pretty tricky to debug LUA, so.. You can work with what's inside the gameserver source.

    Timers usually are in miliseconds and not seconds by default. If there's any calculation done to transform ms to sec, then you need to find it. 1000ms = 1 sec. If you enter a value of 1, that's 0.001 sec.

    For sending an item to the Gremory Case, I'm pretty sure you can reuse the code from other things to send that item to that inventory. I'm doing this on my zTeam S6E3 with my custom jewel bank. LUA scripting usually just calculates things, and it needs a data packet to be sent to the client so it'll receive the item in his inventory. So, I don't think you need to alter the LUA scripting in order to do that.

    So to give you a hint. Gremory Case is a list, not an inventory. Probably only special conditioned items can be inserted, not sure about armors, weapons.
    Probably you can add a special condition for those too in the GS.
    Even so, to receive the item, a function will still need to calculate the free positions in inventory, but probably that's already taking care of by the Gremory Case functions. Event Item Bags are defined in the files, so just play with the data from the files.

    Also, breakpoint to an item which is in Gremory Case and see what's that special condition which your items need so those can be inserted into the list.

    In DB, surely there's a Gremory Case table which store the Gremory Case list. Add a few items in that list, run a query in the DB and see the values for those stored items. Compare them with your inventory data and see what's the difference between them.

    I gave you some starting points. XD it's a lot to write cause there are many details you need to check and understand.
    I actually figured some stuff out after few hours.

    1. As for the EventItemBag SpecialValue - it is indeed a SpecialValue column available in the EventItemBagManager. We just need to be sure that the provided EventItemBag is the only one with the same SpecialValue and that we have restarted GS after creating a new EventItemBag listed there.

    To send any item to GremoryCase we just need to configure EventItemBag correctly - it needs to have OptionValue set to 16 (account GremoryCase) or 32 (character GremoryCase) and then the MoneyAmount column needs to specify the id of the event type that is granting the reward.

    Code:
    1 = Chaos Castle.
    2 = Blood Castle.
    3 = Illusion Temple.
    4 = Double Goer.
    13 = Devil Square.
    14 = Arca Battle.
    100 = Game Master reward.
    There are more codes for the events but I do not have the complete list.

    I'm describing that for anyone who would try to figure this out in the future.

    2. When it comes to Timer. I'll try providing the time as miliseconds, although the documentations specifically stated that it is "in seconds". But we'll see.

    As you mentioned, there is no easy way to debug Lua so my only option is to print any types that I have to the log or some other sanity checks like that. I'm operating strictly on the API without GS source code so checking the server source is also not an option.

  4. #4
    Account Upgraded | Title Enabled! zipper20032 is offline
    True MemberRank
    Oct 2006 Join Date
    0x198837ADLocation
    238Posts

    Re: X-Team Lua Scripts question

    That's very cool. Good job.
    Yeah, could be in seconds, but it happened to me that they forgot to apply the conversions from miliseconds. But yeah, who knows.
    Yeah, sanity checks, many ifs and elses and logs could help in debugging.

    Oh, that's gonna be tough to use only the API cause you are limited on what that API can do.

    Regarding the EventItemBags, from what I've learned, these are only the boxes like "Box of Luck, Box of Heaven, Heart of Love, Box of Kundun.. etc". The GS is randomizing the list + randomizing each level, if skill or not, additional options, etc. Everything is based on the EventItemBags config files from Data in the server files when it comes to those boxes.

    Ofc, I can be very wrong, as the gameserver would have a different approach when it comes to EventItemBags, even differently managed.
    If the GS is allowing you to select and make the event item drop bag for Gremory Case, then probably could be as simple as adding the item inside any drop bag.

    Tell me this (cause I don't think I've played or I can't remember this): When you finished the Blood Castle event, an item will be delivered in your Gremory Case? Or: When the items would drop inside your Gremory Case? Like when this is used? (Gremory Case is the special "gift box"?)

  5. #5
    Hardcore Member marecznyjo is offline
    MemberRank
    May 2005 Join Date
    106Posts

    Re: X-Team Lua Scripts question

    Quote Originally Posted by zipper20032 View Post
    That's very cool. Good job.
    Yeah, could be in seconds, but it happened to me that they forgot to apply the conversions from miliseconds. But yeah, who knows.
    Yeah, sanity checks, many ifs and elses and logs could help in debugging.

    Oh, that's gonna be tough to use only the API cause you are limited on what that API can do.

    Regarding the EventItemBags, from what I've learned, these are only the boxes like "Box of Luck, Box of Heaven, Heart of Love, Box of Kundun.. etc". The GS is randomizing the list + randomizing each level, if skill or not, additional options, etc. Everything is based on the EventItemBags config files from Data in the server files when it comes to those boxes.

    Ofc, I can be very wrong, as the gameserver would have a different approach when it comes to EventItemBags, even differently managed.
    If the GS is allowing you to select and make the event item drop bag for Gremory Case, then probably could be as simple as adding the item inside any drop bag.

    Tell me this (cause I don't think I've played or I can't remember this): When you finished the Blood Castle event, an item will be delivered in your Gremory Case? Or: When the items would drop inside your Gremory Case? Like when this is used? (Gremory Case is the special "gift box"?)
    Blood Castle has its own EventItemBag defined and the reward is being sent to Gremory Case (in newest Seasons).

    You were right. The timer works now - the documentation was wrong and the param should be provided in miliseconds. It will come in handy when doing custom events :)



Advertisement