char_has_item?

Error message

Deprecated function: implode(): Passing glue string after array is deprecated. Swap the parameters in drupal_get_feeds() (line 394 of /var/www/pied-piper.ermarian.net/includes/common.inc).
AuthorTopic: char_has_item?
Master
Member # 5977
Profile Homepage #0
I want to take all energy, healing and all other potions from the player at a certain moment in game. Also taking wands may be a good idea, but i was wondering if there is a quick and efficient way of doing this, instead of using char_has_item about 23586012,56 times.

--------------------
Play and rate my scenarios:

Where the rivers meet
View my upcoming scenario: The Nephil Search: Escape.

Give us your drek!
Posts: 3029 | Registered: Saturday, June 18 2005 07:00
The Establishment
Member # 6
Profile #1
It is not difficult with a loop:

i = 0;
j = 1;
while (i < 499) {
if (j==1)
i = 17;
if (j==2)
i = 32;
if (j==3)
i = 74;
if (j==4)
i = 500;
take_num_of_item(i,200);
j = j + 1;
}
This will pretty much take all of (or at least 200 of) items 17, 32, and 74. Just add more conditionals for items you want to take.

[ Tuesday, December 27, 2005 07:15: Message edited by: *i ]

--------------------
Your flower power is no match for my glower power!
Posts: 3726 | Registered: Tuesday, September 18 2001 07:00
Master
Member # 5977
Profile Homepage #2
Sounds good to me. thanks. I take it that i is the itm number, but what exactly is j?

EDIT: never mind. I already understand it. j is how many times the loop has been run, every time the loop has finished it adds 1 up to j, therey making it possible... Okay. I understand it. thanks!

[ Tuesday, December 27, 2005 07:59: Message edited by: Thralni, chicken god prophet ]

--------------------
Play and rate my scenarios:

Where the rivers meet
View my upcoming scenario: The Nephil Search: Escape.

Give us your drek!
Posts: 3029 | Registered: Saturday, June 18 2005 07:00
The Establishment
Member # 6
Profile #3
Thought about it a little bit more and this method would be better for grouped items. That's what I get for being so hasty:

i = 220;
while (i <= 238) {
take_num_of_item(i,200);
i = i + 1;
}
This takes all items between 220 and 238, i.e. all the potions. If you want to take items individually, it is best just to use the take_num_of_item() with the number you want directly.

--------------------
Your flower power is no match for my glower power!
Posts: 3726 | Registered: Tuesday, September 18 2001 07:00
Master
Member # 5977
Profile Homepage #4
I want the party to keep potions that will only harm them (like searing balm). thanks anyway. God, these loops, I never used them, but they are so handy! Thanks for showing me them!

Another question: I made a custom special ability, but I don't know what th game will do with it. The ability shouldn't be there immeditaly when the scenario starts, they should get it at some point, but I don't know if the gmae automatically ives it or not. then something else, how do i give it? for now i just did set_char_trait(0,0,1), but i don't know if that's correct. i looked in the docs and other scenario's, but didn't find what i needed.

--------------------
Play and rate my scenarios:

Where the rivers meet
View my upcoming scenario: The Nephil Search: Escape.

Give us your drek!
Posts: 3029 | Registered: Saturday, June 18 2005 07:00
The Establishment
Member # 6
Profile #5
If you want to take away most of the helpful potions, set the top limit to 241 on the while loop.

I never personally mucked with special abilities, I intend to, just never got around with it. Most of TMs scenarios and Bahssikava have them I know. Take a look at their main scenario script file.

--------------------
Your flower power is no match for my glower power!
Posts: 3726 | Registered: Tuesday, September 18 2001 07:00
Off With Their Heads
Member # 4045
Profile Homepage #6
Bahs gives special abilities in the START_SCEN_STATE in slithhome.txt, near the end of the state.

The call you want is change_custom_abil_uses. You also have to make sure to init the special ability in the LOAD_SCEN_STATE.

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
Apprentice
Member # 4786
Profile #7
is there a reason to use take_num_of_item instead of take_all_of_item?
Posts: 3 | Registered: Tuesday, July 27 2004 07:00
Master
Member # 5977
Profile Homepage #8
Yes, i was thinking about that too. Isn't it better to use take_all_item?

I already looked in bahs's scenario script, but couldn't find it. Anyway, now kelandon told me where to look, I'll figure it out soon enough. I looked at change_custom_abil_uses, but i thought it was only for changing how many times the party can still use the thing. i suppose it will work lime this (tell me if I'm wrong): In the beginning, you set it to 0, so the party can't use it. later, you set it to a large number, say 200, so the party cn use it all the time. Am i right?

--------------------
Play and rate my scenarios:

Where the rivers meet
View my upcoming scenario: The Nephil Search: Escape.

Give us your drek!
Posts: 3029 | Registered: Saturday, June 18 2005 07:00
The Establishment
Member # 6
Profile #9
Yes, take_all_of_item will work fine as well. I believe that's how custom abilities work. Test it to find out.

[ Wednesday, December 28, 2005 08:34: Message edited by: *i ]

--------------------
Your flower power is no match for my glower power!
Posts: 3726 | Registered: Tuesday, September 18 2001 07:00
Off With Their Heads
Member # 4045
Profile Homepage #10
It defaults to 0. You don't have to set it to 0.

When they're supposed to get the ability, set their uses to, say, 1.

Then, in the state that gets called when they use the ability, set the uses of the character who used the ability back to 1. (That is, if the ability is ability number 1, for example, the first line of the ability state should be
change_custom_abil_uses(who_used_custom_abil(),1,1); All of Bahs's abilities work like this.

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
Master
Member # 5977
Profile Homepage #11
Thanks kelandon.

i got an email back from jeff about the graphics, saying to download the most recent version, and see what happens next. i did that, thereby deleting all my save files. that's not so bad, actually, thanks to kelandon's high party maker. otherwise I would have been mad, yes. Anyway, i installed it, but the game was immediatly registered. is this normal?

EDIT: oh yes, when i tried to install the update to version 1.1.2, the updater said it couldn't install, because the graphics and some other files were corrupt. Could this have been the reason for my graphics not to work?

[ Thursday, December 29, 2005 02:02: Message edited by: Thralni, chicken god prophet ]

--------------------
Play and rate my scenarios:

Where the rivers meet
View my upcoming scenario: The Nephil Search: Escape.

Give us your drek!
Posts: 3029 | Registered: Saturday, June 18 2005 07:00
The Establishment
Member # 6
Profile #12
Possibly. What platform are you on? Did you uninstall all of the files for Blades of Avernum and the editor before reinstalling a new version? Try that if you have not. If not, try to figure out what is corrupted.

--------------------
Your flower power is no match for my glower power!
Posts: 3726 | Registered: Tuesday, September 18 2001 07:00
Master
Member # 5977
Profile Homepage #13
*look dissapointed* Nothing has changed with the graphics. they still don't work. And no, i didn't uninstall the editor before installing the new version. And how can i discover what was corrupt?

--------------------
Play and rate my scenarios:

Where the rivers meet
View my upcoming scenario: The Nephil Search: Escape.

Give us your drek!
Posts: 3029 | Registered: Saturday, June 18 2005 07:00
The Establishment
Member # 6
Profile #14
Apparently you did not understand, you SHOULD uninstall ALL Blades of Avernum files and reinstall them with the new version.

--------------------
Your flower power is no match for my glower power!
Posts: 3726 | Registered: Tuesday, September 18 2001 07:00
Master
Member # 5977
Profile Homepage #15
aha, okay. I'll try it again. this will probably mean I also have to get a new registration code.

--------------------
Play and rate my scenarios:

Where the rivers meet
View my upcoming scenario: The Nephil Search: Escape.

Give us your drek!
Posts: 3029 | Registered: Saturday, June 18 2005 07:00
The Establishment
Member # 6
Profile #16
Possibly, but Jeff is pretty good about getting new registration codes out.

--------------------
Your flower power is no match for my glower power!
Posts: 3726 | Registered: Tuesday, September 18 2001 07:00
Master
Member # 5977
Profile Homepage #17
Yes, he is. I just sent him an email (yesterday, actually), and I already got an email back. That's the part I DO like about Jeff, he does give new registration codes when really needed. What I don't like however, is that he isn't really keen on helping people with their problems.

--------------------
Play and rate my scenarios:

Where the rivers meet
View my upcoming scenario: The Nephil Search: Escape.

Give us your drek!
Posts: 3029 | Registered: Saturday, June 18 2005 07:00