Multiple inventories for more characters

Started by Liliana, Sat 14/10/2006 14:53:40

Previous topic - Next topic

Liliana

Hello,
I've got a little problem: I want to have more characters, between which is possible to switch(3), each having 2 separate inventories, and almost all inventory GUIs would be different, could you please help me with it?

I would also like to ask how to let the player choose at the begining between 12 possible characters, each of which would have different dialogues, abilities, inventory GUIs and so on. Is there any easier way to do it, which wouldn't make the game too large?

Thank you

Khris

script header:
struct data {
  GUI*g;
  InvWindow*inv;
  Character*c1;
  Character*c2;
}

import inv[13];
global script:
data inv[13];

// call this in game_start()
// replace p1, iw1, cPerson1, cPerson1a aso. with the script names
// of the GUIs, their InvWindows and the two characters, the first being
// the actual character, the second being a blank one holding the 2nd inv.
function init() {
  data i=inv[cPerson1.ID];
  i.g=p1;   // set inventory GUI of first character
  i.inv=iw1;  // set inventory window of GUI
  i.c1=cPerson1;
  i.c2=cPerson1a;  // additional char that'll hold second inventory

  i=inv[cPerson2.ID];
  i.g=p2;
  i.inv=iw2;
  i.c1=cPerson2;
  i.c2=cPerson2a;

  ...
}

// call this to change which inventory the character's inv-GUI displays
// if you created inv-GUIs with two InvWindows, you won't need this
function switch_inventory(Character*c) {
  data i=inv[c.ID];
  if (i.inv.CharacterToUse==i.c1) i.inv.CharacterToUse=i.c2;
  else i.inv.CharacterToUse=i.c1;
}

// call this to show the inv-GUI of the current player
function show_inventory_window() {
  data i=inv[player.ID];
  i.g.Visible=true;
}
This should get you started. Untested, but should work.

SMF spam blocked by CleanTalk