DE EN FR ES IT CZ

Add item 'envelope' to Character 'Timmy'

This thread is a few years old. Some details may refer to an earlier version of Visionaire Studio. Current tutorials

  1. · 14 years ago
    Hi,

    How can headline action be done with LUA? I mean, giving an item (i.e. envelope) to a Character (i.e. Timmy).
    I've looked for the action in Data Structure documentation, but the only similar thing I see there is the CharacterItems field in Character table. I have tried adding an object there, but I can't.

    Thanks!
  2. New to Visionaire Studio?

    Create point and click adventures without coding. The free version covers up to 25 scenes per project. For more scenes or to earn money with your game, you need a license.

    See the Indie Bundle Try it for free
  3. · 14 years ago
    hmm ...
    only thing I see in the data structure are the commands for listing game items & character items.

    I'm not sure based on this if you can give the characters items using lua (Alex would know- I think)
    you could try reading the lua files insie of the visionaire3 folder found in program files or maybe inside of the projects.ve file itself by reading it with a text editor like notepad++ or sublime.

    I know you can write commands like game:getLink etc.
  4. · 14 years ago
    Just use a function like this. i.g. addItemToChar( "Timmy", "evenlope" )

    function addItemToChar (iChar, iItem)
      local char = getObject("Characters[" .. iChar .. "]")
      local items = char:getLinks(VCharacterItems)
      local gameItem = getObject("Game.GameItems[" .. iItem.. "]")
    
      table.insert(items, gameItem)
    
      -- debugging
      for i = 1, table.maxn(items) do
        print('item ' .. i .. ': ')
        print(items[i])
      end
    
      char:setValue(VCharacterItems, items)
    end
  5. · 14 years ago
    Yeah, it works!

    Thanks a lot. So, this is the way to add data to a table... Good to know. Thanks!

This thread is closed because nobody has replied for more than a year. Feel free to ask your question in a new thread.

New thread

Really delete this post?