useinv problem

Started by guv, Fri 17/10/2008 10:19:41

Previous topic - Next topic

guv

what is the scripting to use an object on a char and then after that use another

how can i fit two functions into the "use inventory on" space


Khris

Code: ags
bool done;

function cChar_UseInv() {
  InventoryItem*ai = player.ActiveInventory;
  if (ai == iItem1) {
    ...
    done = true;
  }
  else if (ai == iItem2) {
    if (done) {
      ...
    }
    else player.Say("I can't do that yet.");
  }
  else player.Say("I don't want to give that to him.");
}

guv

ok...so i did it...but now when i use the gold it doesn't dissappear from the inv and she repeats what she said for the suitcase...
heres my script...
function csarah_useinv(){{
  if (player.ActiveInventory == isuitcase)
  cFreddy.Walk(190, 161, eBlock, eWalkableAreas);
  csarah.Say("thanks i guess...heres your money...");
  cFreddy.LoseInventory(isuitcase);
  cFreddy.AddInventory(igold);
}
if (player.ActiveInventory == igold){
csarah.Say("great...we'll eventually change the sign...in the meantime why dont you check out the park...try to find something to sell...");
cFreddy.LoseInventory(igold);
cFreddy.AddInventory(iparkkey);
}}
any idea??

Khris

You have misplaced a few brackets:
Code: ags
function csarah_useinv() {
  if (player.ActiveInventory == isuitcase) {
    cFreddy.Walk(190, 161, eBlock, eWalkableAreas);
    csarah.Say("thanks i guess...heres your money...");
    cFreddy.LoseInventory(isuitcase);
    cFreddy.AddInventory(igold);
  }
  if (player.ActiveInventory == igold) {
    csarah.Say("great...we'll eventually change the sign...in the meantime why dont you check out the park...try to find something to sell...");
    cFreddy.LoseInventory(igold);
    cFreddy.AddInventory(iparkkey);
  }
}

guv


SMF spam blocked by CleanTalk