Module Question

Started by joelphilippage, Wed 05/09/2007 00:16:02

Previous topic - Next topic

joelphilippage

Hey. Ive got a question. Ive been trying to make my own module and I have a question. If I put a function like this
Code: ags
function PickupInv(int ObjectNumber, int InvItem){
  character[ObjectNumber].ChangeRoom(-1);
  cInv.AddInventory(inventory[InvItem]);
  invMain.CharacterToUse = player;
  cInv.SetAsPlayer();
  cInv.ActiveInventory = inventory[InvItem];
  ObjectNumber = obj;
  InvItem = inv;
}

I then use this function and use the character 2 as the object number.
Why, when I use this in mouse click, does it use to the first character.
Code: ags
character[obj].ChangeRoom(1, mouse.x, mouse.y);
character[obj].PlaceOnWalkableArea();



Ashen

Those two bits of code don't seem to have anything to do with each other - where are you using PickupInv in relation to the on_mouse_click lines? Where have you declared obj (the variable you're using in the on_mouse_click code), and where do you set/change it?

Oh, wait, should:
Code: ags

  ObjectNumber = obj;

Be:
Code: ags

  obj = ObjectNumber;


That would make the mouse click lines affect whatever character as was last used in PickupInv, if that's what you're after. (And if it's not, can you explain the problem again...)
I know what you're thinking ... Don't think that.

joelphilippage

Thanks. yeah that was my problem.



SMF spam blocked by CleanTalk