Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: ESGmaster on Thu 26/02/2009 18:53:02

Title: How to do I take items and store them for later use?
Post by: ESGmaster on Thu 26/02/2009 18:53:02
As in when a player uses a airplane to move to city to city how do I have the airport customs take the players guns?
Title: Re: How to do I take items and store them for later use?
Post by: Akatosh on Thu 26/02/2009 19:09:01
I recommend the LoseInventory and AddInventory functions.

Also, read the manual.
Title: Re: How to do I take items and store them for later use?
Post by: Khris on Thu 26/02/2009 20:18:08
Does the player carry a variety of different guns throughout the game?
Title: Re: How to do I take items and store them for later use?
Post by: ESGmaster on Fri 27/02/2009 01:19:29
Yes, the player uses many guns through out the game, aleast 4 per city with about 5 cities total.
Title: Re: How to do I take items and store them for later use?
Post by: Joe on Fri 27/02/2009 01:33:38
Quote from: ESGmaster on Thu 26/02/2009 18:53:02
As in when a player uses a airplane to move to city to city how do I have the airport customs take the players guns?

But please explain what you mean, I really don't understand
Title: Re: How to do I take items and store them for later use?
Post by: ESGmaster on Fri 27/02/2009 01:48:42
As in when the player wants to go to another city (or has completed all they can do for right now.) they have their guns taken from them and stored in a chest in the airport for when they come back to that city.
Title: Re: How to do I take items and store them for later use?
Post by: Joe on Fri 27/02/2009 02:08:57
Ok, I think I understood you.

Let's think the roomA ir the city-A airport.


//roomA script

bool got=false;//we havent finished city-A

function room_Load( ){ //player enters room

  if(got==true){//if we have finished city-A another time

    player.AddInventory(iGun1);
    player.AddInventory(iGun2);
    player.AddInventory(iGun3);
    player.AddInventory(iGun4);
    //.....
  }

}

function room_Leave( ){ //player leaves room

  player.LoseInventory(iGun1);//lose all guns you want
  player.LoseInventory(iGun2);
  player.LoseInventory(iGun3);
  player.LoseInventory(iGun4);
  //.....

}

//some where in your code
got=true;//means we have finishe the city



This is not tested and you'll have to implement it in your rooms or make a module.