Visit the Ironworks Gaming Website Email the Webmaster Graphics Library Rules and Regulations Help Support Ironworks Forum with a Donation to Keep us Online - We rely totally on Donations from members Donation goal Meter

Ironworks Gaming Radio

Ironworks Gaming Forum

Go Back   Ironworks Gaming Forum > Ironworks Gaming Forums > Neverwinter Nights 1 & 2 Also SoU & HotU Forum

Reply
 
Thread Tools Search this Thread
Old 07-10-2003, 09:13 AM   #1
robertthebard
Xanathar Thieves Guild
 

Join Date: March 17, 2001
Location: Wichita, KS USA
Age: 60
Posts: 4,537
I'm toolset stupid, how do i make a container get a char's class for treasure type to drop. I've seen it done, but can't figure out how, is there a script on the onopen, or ondeath that will give it, or do i need to write one? If so, can someone tell me how?
__________________
To those we have lost; May your spirits fly free.
Good Music: Here.
Interesting read, one of my blogs.
robertthebard is offline   Reply With Quote
Old 07-10-2003, 10:28 AM   #2
Legolas
Jack Burton
 

Join Date: March 31, 2001
Location: The zephyr lands beneath the brine.
Age: 39
Posts: 5,459
It's a bit of a long script, but I wanted to include all the options and have you be able to give each and every one of them a different item. Just insert it somewhere in both the OnOpen script and the OnDeath scrip where it deals with handing out items.

Quote:
{
if(GetLevelByClass(CLASS_TYPE_ABERRATION, GetLastOpenedBy()) > 0)
{
}
else if(GetLevelByClass(CLASS_TYPE_ANIMAL, GetLastOpenedBy()) > 0)
{
}
else if(GetLevelByClass(CLASS_TYPE_ARCANE_ARCHER, GetLastOpenedBy()) > 0)
{
}
else if(GetLevelByClass(CLASS_TYPE_ASSASSIN, GetLastOpenedBy()) > 0)
{
}
else if(GetLevelByClass(CLASS_TYPE_BARBARIAN, GetLastOpenedBy()) > 0)
{
}
else if(GetLevelByClass(CLASS_TYPE_BARD, GetLastOpenedBy()) > 0)
{
}
else if(GetLevelByClass(CLASS_TYPE_BEAST, GetLastOpenedBy()) > 0)
{
}
else if(GetLevelByClass(CLASS_TYPE_BLACKGUARD, GetLastOpenedBy()) > 0)
{
}
else if(GetLevelByClass(CLASS_TYPE_CLERIC, GetLastOpenedBy()) > 0)
{
}
else if(GetLevelByClass(CLASS_TYPE_COMMONER, GetLastOpenedBy()) > 0)
{
}
else if(GetLevelByClass(CLASS_TYPE_CONSTRUCT, GetLastOpenedBy()) > 0)
{
}
else if(GetLevelByClass(CLASS_TYPE_DRAGON, GetLastOpenedBy()) > 0)
{
}
else if(GetLevelByClass(CLASS_TYPE_DRUID, GetLastOpenedBy()) > 0)
{
}
else if(GetLevelByClass(CLASS_TYPE_ELEMENTAL, GetLastOpenedBy()) > 0)
{
}
else if(GetLevelByClass(CLASS_TYPE_FEY, GetLastOpenedBy()) > 0)
{
}
else if(GetLevelByClass(CLASS_TYPE_FIGHTER, GetLastOpenedBy()) > 0)
{
}
else if(GetLevelByClass(CLASS_TYPE_GIANT, GetLastOpenedBy()) > 0)
{
}
else if(GetLevelByClass(CLASS_TYPE_HARPER, GetLastOpenedBy()) > 0)
{
}
else if(GetLevelByClass(CLASS_TYPE_HUMANOID, GetLastOpenedBy()) > 0)
{
}
else if(GetLevelByClass(CLASS_TYPE_INVALID, GetLastOpenedBy()) > 0)
{
}
else if(GetLevelByClass(CLASS_TYPE_MAGICAL_BEAST, GetLastOpenedBy()) > 0)
{
}
else if(GetLevelByClass(CLASS_TYPE_MONK, GetLastOpenedBy()) > 0)
{
}
else if(GetLevelByClass(CLASS_TYPE_MONSTROUS, GetLastOpenedBy()) > 0)
{
}
else if(GetLevelByClass(CLASS_TYPE_OUTSIDER, GetLastOpenedBy()) > 0)
{
}
else if(GetLevelByClass(CLASS_TYPE_PALADIN, GetLastOpenedBy()) > 0)
{
}
else if(GetLevelByClass(CLASS_TYPE_RANGER, GetLastOpenedBy()) > 0)
{
}
else if(GetLevelByClass(CLASS_TYPE_ROGUE, GetLastOpenedBy()) > 0)
{
}
else if(GetLevelByClass(CLASS_TYPE_SHADOWDANCER, GetLastOpenedBy()) > 0)
{
}
else if(GetLevelByClass(CLASS_TYPE_SHAPECHANGER, GetLastOpenedBy()) > 0)
{
}
else if(GetLevelByClass(CLASS_TYPE_SORCERER, GetLastOpenedBy()) > 0)
{
}
else if(GetLevelByClass(CLASS_TYPE_UNDEAD, GetLastOpenedBy()) > 0)
{
}
else if(GetLevelByClass(CLASS_TYPE_VERMIN, GetLastOpenedBy()) > 0)
{
}
else if(GetLevelByClass(CLASS_TYPE_WIZARD, GetLastOpenedBy()) > 0)
{
}
}
You can cut some classes from this (I doubt you'll need the invalid class or the vermin class) by deleting the line dealing with the class and the two brackets that go with it.
You can add classes together by using the || or 'or' symbol, or create multiclass combinations using && or 'and'. For example, for a fighter/wizard and fighter/rogue only item you'd say

Quote:
else if(((GetLevelByClass(CLASS_TYPE_WIZARD, GetLastOpenedBy()) > 0) && (GetLevelByClass(CLASS_TYPE_FIGHTER, GetLastOpenedBy()) > 0)) || ((GetLevelByClass(CLASS_TYPE_ROGUE, GetLastOpenedBy()) > 0) && (GetLevelByClass(CLASS_TYPE_FIGHTER, GetLastOpenedBy()) > 0)))
{
}
The commands for the actual items etc. need to be added between the brackets { }, as I'm sure you'll know [img]smile.gif[/img]

What the "(GetLevelByClass(CLASS_TYPE_WIZARD, GetLastOpenedBy()) > 0)" line actually says is "does the character who last opened whatever calls this script have more than 0 levels in the wizard class?".
Legolas is offline   Reply With Quote
Old 07-10-2003, 02:01 PM   #3
robertthebard
Xanathar Thieves Guild
 

Join Date: March 17, 2001
Location: Wichita, KS USA
Age: 60
Posts: 4,537
Thanks Legolas, that is a long script, and no, I didn't know. I'm finally getting around to trying to make a serious mod, instead of just an item stocker mod. Hence the toolset stupid thing. I feel good about myself if the doors and transitions work! Thanks again.
__________________
To those we have lost; May your spirits fly free.
Good Music: Here.
Interesting read, one of my blogs.
robertthebard is offline   Reply With Quote
Old 07-10-2003, 02:10 PM   #4
Legolas
Jack Burton
 

Join Date: March 31, 2001
Location: The zephyr lands beneath the brine.
Age: 39
Posts: 5,459
Area transitions can be difficult to understand, you've every right to feel good if you figured that out by yourself [img]graemlins/thumbsup.gif[/img]
And you're welcome. If you need more help just post so [img]smile.gif[/img]
Legolas is offline   Reply With Quote
Old 07-11-2003, 08:40 AM   #5
robertthebard
Xanathar Thieves Guild
 

Join Date: March 17, 2001
Location: Wichita, KS USA
Age: 60
Posts: 4,537
Ok, so will it award according to highest class, if a char is multi-class?
__________________
To those we have lost; May your spirits fly free.
Good Music: Here.
Interesting read, one of my blogs.
robertthebard is offline   Reply With Quote
Old 07-11-2003, 10:09 AM   #6
Legolas
Jack Burton
 

Join Date: March 31, 2001
Location: The zephyr lands beneath the brine.
Age: 39
Posts: 5,459
This script won't, it only checks for at least a single level. Looking at it again, I think it also stops as soon as it has found a matching class. For example, a 19/1 fighter/aberration would only get the abberation items.
It shouldn't be much trouble to rewrite the script to go with the highest class, but if there are two tied for highest a choice still has to be made; do you give the items of one class, the other class, one of the classes at random, both the classes, nothing or a standard classless item?

I'm going to rewrite it to get the highest class level from the standard PC classes, and for now I'll make the item handed out in case of a tie one picked at random from between the two or three tied classes.
Legolas is offline   Reply With Quote
Old 07-11-2003, 03:06 PM   #7
robertthebard
Xanathar Thieves Guild
 

Join Date: March 17, 2001
Location: Wichita, KS USA
Age: 60
Posts: 4,537
that would be a good idea, even if it just picked randomly between the two, so long as a monk's not getting druid items, etc. I've played a lot of cool stuff, and want to translate that over into this mod. Self closing doors, for example, and the reason behind this post. Just haven't gotten that good at it, yet...I've got a few areas drawn up, and a running story line, just got to work out the details.
__________________
To those we have lost; May your spirits fly free.
Good Music: Here.
Interesting read, one of my blogs.
robertthebard is offline   Reply With Quote
Old 07-11-2003, 03:36 PM   #8
Legolas
Jack Burton
 

Join Date: March 31, 2001
Location: The zephyr lands beneath the brine.
Age: 39
Posts: 5,459
Okay, it's not working yet because not not all control paths seem to return a value (in other words, the editor can think of values to enter which the script does not cover when it should) but I'm posting it anyway [img]smile.gif[/img]
This bit goes before the void main() section of a script and basically adds a new command to the set in the editor. It's a bit cluttered up by " else {return CLASS_TYPE_INVALID;}" lines because that was my first attempt at covering all the bases. They are not needed for the script itself to work, and the editor won't consider them to be covering everything.

Quote:
int GetHighestClassRandom(object oCreature);
int GetHighestClassRandom(object oCreature)
{
int iClass1 = GetClassByPosition(1, oCreature);
int iClass2 = GetClassByPosition(2, oCreature);
int iClass3 = GetClassByPosition(3, oCreature);
int iLevel1 = GetLevelByClass(iClass1, oCreature);
int iLevel2 = GetLevelByClass(iClass2, oCreature);
int iLevel3 = GetLevelByClass(iClass3, oCreature);
int iRandom2 = Random(2);
int iRandom3 = Random(3);
{
if((iClass2 != CLASS_TYPE_INVALID) && (iClass3 != CLASS_TYPE_INVALID))
{
if((iLevel1 == iLevel2) && (iLevel1 == iLevel3))
{
if(iRandom3 == 0)
{return iClass1;}
else if(iRandom3 == 1)
{return iClass2;}
else if(iRandom3 == 2)
{return iClass3;}
}
else if((iLevel1 == iLevel2) && (iLevel1 'smaller than' iLevel3))
{return iClass3;}
else if((iLevel1 == iLevel2) && (iLevel1 'greater than' iLevel3))
{
if(iRandom2 == 0)
{return iClass1;}
else if(iRandom2 == 1)
{return iClass2;}
}
else if((iLevel1 == iLevel3) && (iLevel1 'smaller than' iLevel2))
{return iClass2;}
else if((iLevel1 == iLevel3) && (iLevel1 'greater than' iLevel2))
{
if(iRandom2 == 0)
{return iClass1;}
else if(iRandom2 == 1)
{return iClass3;}
}
else if((iLevel2 == iLevel3) && (iLevel1 'smaller than' iLevel3))
{
if(iRandom2 == 0)
{return iClass2;}
else if(iRandom2 == 1)
{return iClass3;}
}
else if((iLevel2 == iLevel3) && (iLevel1 'greater than' iLevel3))
{return iClass1;}
else if((iLevel1 'greater than' iLevel2) && (iLevel1 'greater than' iLevel3))
{return iClass1;}
else if((iLevel2 'greater than' iLevel1) && (iLevel2 'greater than' iLevel3))
{return iClass2;}
else if((iLevel3 'greater than' iLevel2) && (iLevel3 'greater than' iLevel1))
{return iClass3;}
else {return CLASS_TYPE_INVALID;}

}
else if((iClass2 != CLASS_TYPE_INVALID) && (iClass3 == CLASS_TYPE_INVALID))
{
if(iLevel1 == iLevel2)
{
if(iRandom2 == 0)
{return iClass1;}
else if(iRandom2 == 1)
{return iClass2;}
}
else if (iLevel1 'smaller than' iLevel2)
{return iClass2;}
else if (iLevel1 'greater than' iLevel2)
{return iClass1;}
else {return CLASS_TYPE_INVALID;}
}

else if((iClass2 == CLASS_TYPE_INVALID) && (iClass3 == CLASS_TYPE_INVALID))
{return iClass1;}
else if((iClass2 == CLASS_TYPE_INVALID) && (iClass3 != CLASS_TYPE_INVALID))
{return CLASS_TYPE_INVALID;}
else {return CLASS_TYPE_INVALID;}
}
}
What it does (should do) is to return the highest class in the form of a CLASS_TYPE_*. You could use it later on in the container's script (after the void main()) for lines such as

Quote:
if(GetHighestClassRandom(OBJECT_SELF) == CLASS_TYPE_ARCANE_ARCHER)
{
CreateItemOnObject("archer item", OBJECT_SELF, 1);
}
Oh, right. The forum doesn't allow the 'greater than' and 'smaller than' symbols in the text.

[ 07-11-2003, 03:39 PM: Message edited by: Legolas ]
Legolas is offline   Reply With Quote
Old 07-12-2003, 11:37 AM   #9
Legolas
Jack Burton
 

Join Date: March 31, 2001
Location: The zephyr lands beneath the brine.
Age: 39
Posts: 5,459
Meh, okay. I know the problem lies either in comparing the levels (might be), or in resolving the random outcomes (quite likely), or both (probably). It works for single class characters, when I remove the random bit it also works for characters with two classes, but for a character with three classes that doesn't seem to be enough.
I'm sure the fix is as easy as it is logical, I just have to spot it first [img]tongue.gif[/img]
Legolas is offline   Reply With Quote
Old 07-12-2003, 11:43 AM   #10
robertthebard
Xanathar Thieves Guild
 

Join Date: March 17, 2001
Location: Wichita, KS USA
Age: 60
Posts: 4,537
thanks for all the hard work, really appreciate it, in the long run, it will be worth it. on the side, don't you have a module running, infinite realms, or something similar, if so, i've been a frequent visitor of late
__________________
To those we have lost; May your spirits fly free.
Good Music: Here.
Interesting read, one of my blogs.
robertthebard is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Scripting Son of Osiris Neverwinter Nights 1 & 2 Also SoU & HotU Forum 1 04-05-2003 08:34 AM
Q: there's a container outside the asylum... PeeWee Baldurs Gate II: Shadows of Amn & Throne of Bhaal 10 02-28-2002 02:32 AM
container for potions? (pos. spoiler - maybe?) cheesus Baldurs Gate II Archives 3 11-21-2001 01:49 PM
When I open a container... Barloc Baldurs Gate II Archives 5 11-04-2001 08:03 PM
Newbie container question Hallas Baldurs Gate II Archives 4 02-25-2001 11:02 AM


All times are GMT -4. The time now is 12:50 PM.


Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
©2024 Ironworks Gaming & ©2024 The Great Escape Studios TM - All Rights Reserved