New gathering item

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • New gathering item


      i'm tweaking around GuildResource.dbt trying to understand how everythings works, i want to do something :
      -When you gather something in a field (wheat or barley), you also get insects, which are worth nothing and just take place in your worker's inventory
      -Later i want to add an upgrade that will remove the insects
      (i've managed to create the insect item thanks to Fajeth so i just need to make it gatherable)
      its just an idea to practice i know its not really useful x)

      Anyway, here's what i've understood of the file :

      Source Code

      1. "id" INT -1 |"name" STRING 0 |"default_proto" INT 0 |"can_change" INT 0 |"entries" LIST 0 |"hidden" INT 0 |"resetonwinter" INT 0 |"needownership" INT 0 |
      id = id of the resource
      name = the name of the resource
      default_proto = the id of the building that will produce the good
      can_change = id of the measure associated to change the gathered resource, like a field can be used to gather wheat or barley
      entries(list) = (id of the gathered item, don't know, don't know, don't know, don't know, don't know, id of the building once "sowed" (635 will turn into 614 if wheat for exemple), name of the action category ?, i don't know(separator maybe?), [...we just repeat this pattern if we want the building to produce more than one resource])
      hidden = no idea
      resetonwinter = i suppose the building turn back into the default proto on winter
      needowneship = i suppose its if the building need to be owned to be gathered

      but what i want to do is that a field gives you two different resource (wheat and insect or barley and insect).

      Any idea how i should proceed ? I didnt found anything related to this so sorry if i'm the wrong section or if there's already a tutorial on that, didn't see any (in english at least)

      thank you :)
    • well, I guess you don't want insects as an actual ressource, do you? Then you don't need a guildresource in the world, you can simply add the item at random. Open Scripts/library/gather.lua and look for "AddItems" - this is the code that gives you wheat/ barley.

      Now, you could do something like this:

      Lua Source Code

      1. if ItemID == 2 or ItemID == 3 then -- 2 = wheat, 3 = barley
      2. if Rand(10) == 0 then
      3. AddItems(WorkerAlias, 999, 1) -- 999 - insects
      4. else
      5. AddItems(WorkerAlias, ItemID, Count)
      6. end
      7. else
      8. AddItems(WorkerAlias, ItemID, Count)
      9. end
    • You might wanna add a Message for the player so he knows he got some insects in his inventory. To avoid spam you could also make a new impact "InsectMsg". If GetImpactValue(WorkerAlias, "InsectMsg") < 1 then ... AddImpact(WorkerAlias, "InsectMsg", 1, 4)

      Of course I don't know how serious this mod is, but still, it can be good for learning ^^
    • impacts save a integer for a specific time (ingame hours). So after x hours they automaticly vanish. This is very useful for temporary buffs or debuffs or to suppress messages for a few hours.

      You need to make a new entry to impacts.dbt though.

      The upgrade appears to the upgrade tree if you have done everything right ... depending on the building id and if you set something to the "room" entry. For testing better leave that at 0 first. You might have to scroll sideways to find it