Frictional Games Forum (read-only)
How to empty inventory. - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: How to empty inventory. (/thread-20700.html)

Pages: 1 2


How to empty inventory. - W4rpCore - 03-10-2013

I have been searching for a command that can empty your inventory.

My custom story starts with the main character being in a dream, and i want to empty the inventory of the player after he leaves the dream.

I havent found this anywhere on the forums and google is useless too.

How?


RE: How to empty inventory. - stonecutter - 03-10-2013

you have to call this method for every item you have in the inventory:

void RemoveItem(string& asName);


RE: How to empty inventory. - NaxEla - 03-10-2013

Don't forget to look on the wiki. This page has all the engine scripts for Amnesia: http://wiki.frictionalgames.com/hpl2/amnesia/script_functions


RE: How to empty inventory. - W4rpCore - 03-10-2013

(03-10-2013, 07:03 PM)stonecutter Wrote: you have to call this method for every item you have in the inventory:

void RemoveItem(string& asName);

Isn't there a way to reset everything?

also if I try to remove a lantern, but the player doesnt have one, does it give an error or something? or should i check if the player has one first?


RE: How to empty inventory. - ExpectedIdentifier - 03-10-2013

(03-10-2013, 07:09 PM)W4rpCore Wrote:
(03-10-2013, 07:03 PM)stonecutter Wrote: you have to call this method for every item you have in the inventory:

void RemoveItem(string& asName);

Isn't there a way to reset everything?

also if I try to remove a lantern, but the player doesnt have one, does it give an error or something? or should i check if the player has one first?

You won't get an error I don't think. Also for things such as tinderboxes/laudanum, just count up how many you have on the entire map and remove that many, that way the inventory will be empty no matter how many the player picks up.


RE: How to empty inventory. - The chaser - 03-10-2013

(03-10-2013, 07:09 PM)W4rpCore Wrote:
(03-10-2013, 07:03 PM)stonecutter Wrote: you have to call this method for every item you have in the inventory:

void RemoveItem(string& asName);

Isn't there a way to reset everything?

also if I try to remove a lantern, but the player doesnt have one, does it give an error or something? or should i check if the player has one first?


It doesn't give any error. No, there isn't a way to reset everything.


RE: How to empty inventory. - stonecutter - 03-10-2013

there is a way to check it :

try something like that :
String[] itemList = ("itemName1", "itemName2", "itemName3");

Code:
String[] itemList = ("itemName1", "itemName2", "itemName3");

for(int i = 0; i<= itemList.length; i++){
    if(hasItem(itemList[i]) == true){
               removeItem(itemList[i];
    }
}

please consider this is java code, sooo you have to find out how you have to write it in the script file ...


RE: How to empty inventory. - PutraenusAlivius - 03-11-2013

Use an if statement.
Like this.
PHP Code:
if(condition)
{
    
// things to do if condition is TRUE
}
else
{
    
// things to do if condition is FALSE

EDIT: For the lantern thing.
For everything, use
PHP Code:
void RemoveItem(stringasName); 
On every item.

@No Author
Get the script?
PHP Code:
void StartEffectFlash(float afFadeInfloat afWhitefloat afFadeOut);
 
Fades the screen to white.

afFadeIn time in seconds until screen is white
afWhite 
determines to which percentage the screen fades to white (1.0 completely white)
afFadeOut time in seconds until screen is back to normal again 



RE: How to empty inventory. - No Author - 03-11-2013

(03-11-2013, 03:42 PM)JustAnotherPlayer Wrote: Use an if statement.
Like this.
PHP Code:
if(condition)
{
    
// things to do if condition is TRUE
}
else
{
    
// things to do if condition is FALSE

EDIT: For the lantern thing.
For everything, use
PHP Code:
void RemoveItem(stringasName); 
On every item.

@No Author
Get the script?
PHP Code:
void StartEffectFlash(float afFadeInfloat afWhitefloat afFadeOut);
 
Fades the screen to white.

afFadeIn time in seconds until screen is white
afWhite 
determines to which percentage the screen fades to white (1.0 completely white)
afFadeOut time in seconds until screen is back to normal again 

Dude, I haven't replied to this thread yet.


RE: How to empty inventory. - W4rpCore - 03-11-2013

Thanks.

also is there a way to start the game with a black screen and then fade to normal.
do i just use a very quick FadeOut in the beginning?

I am trying to make it so that when the game starts, its all black, says some dialog and then it shows the room the player is in.