W4rpCore
Junior Member
Posts: 6
Threads: 2
Joined: Mar 2013
Reputation:
0
|
How to empty inventory.
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?
|
|
03-10-2013, 06:52 PM |
|
stonecutter
Member
Posts: 140
Threads: 17
Joined: Feb 2011
Reputation:
4
|
RE: How to empty inventory.
you have to call this method for every item you have in the inventory:
void RemoveItem(string& asName);
|
|
03-10-2013, 07:03 PM |
|
NaxEla
Senior Member
Posts: 415
Threads: 5
Joined: Dec 2012
Reputation:
28
|
|
03-10-2013, 07:09 PM |
|
W4rpCore
Junior Member
Posts: 6
Threads: 2
Joined: Mar 2013
Reputation:
0
|
RE: How to empty inventory.
(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?
(This post was last modified: 03-10-2013, 07:09 PM by W4rpCore.)
|
|
03-10-2013, 07:09 PM |
|
ExpectedIdentifier
Member
Posts: 234
Threads: 10
Joined: Sep 2012
Reputation:
11
|
RE: How to empty inventory.
(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.
|
|
03-10-2013, 07:20 PM |
|
The chaser
Posting Freak
Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation:
113
|
RE: How to empty inventory.
(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.
THE OTHERWORLD (WIP)
Aculy iz dolan.
|
|
03-10-2013, 07:20 PM |
|
stonecutter
Member
Posts: 140
Threads: 17
Joined: Feb 2011
Reputation:
4
|
RE: How to empty inventory.
there is a way to check it :
try something like that :
String[] itemList = ("itemName1", "itemName2", "itemName3");
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 ...
|
|
03-10-2013, 07:26 PM |
|
PutraenusAlivius
Posting Freak
Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation:
119
|
RE: How to empty inventory.
Use an if statement.
Like this.
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
void RemoveItem(string& asName);
On every item.
@No Author
Get the script?
void StartEffectFlash(float afFadeIn, float afWhite, float 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
"Veni, vidi, vici."
"I came, I saw, I conquered."
|
|
03-11-2013, 03:42 PM |
|
No Author
Posting Freak
Posts: 962
Threads: 10
Joined: Jun 2012
Reputation:
13
|
RE: How to empty inventory.
(03-11-2013, 03:42 PM)JustAnotherPlayer Wrote: Use an if statement.
Like this.
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
void RemoveItem(string& asName);
On every item.
@No Author
Get the script?
void StartEffectFlash(float afFadeIn, float afWhite, float 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.
|
|
03-11-2013, 03:53 PM |
|
W4rpCore
Junior Member
Posts: 6
Threads: 2
Joined: Mar 2013
Reputation:
0
|
RE: How to empty inventory.
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.
|
|
03-11-2013, 03:58 PM |
|
|