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
FAQ Calendar Arcade Today's Posts Search

Reply
 
Thread Tools Search this Thread
Old 07-12-2003, 12:16 PM   #11
Legolas
Jack Burton
 

Join Date: March 31, 2001
Location: The zephyr lands beneath the brine.
Age: 39
Posts: 5,459
Nope, I've no modules running on the 'net. I'm sure it would be fun, but if it's going to be a module it's going to be one of my own...
And at this rate, that's not going to happen. My only project is a single-player module based on the Hazardous Times threads from the RP section, and if you download that one you'll see I still have tons of work to do before that one is completed.

Although I do suppose that in multiplayer modules I could get away with far less detail, fewer scripts and the like, and I could keep parts of it 'under construction' a while too...

But I digress... I seriously doubt that was me. Probably one of those youngsters who decided to grab my name (COC in the making) or similar [img]smile.gif[/img]
I'm usually found going by the name of Golas, or Say NO to the Trouser Tyranny if it's one of the older characters I'm playing.
Legolas is offline   Reply With Quote
Old 07-12-2003, 01:59 PM   #12
Legolas
Jack Burton
 

Join Date: March 31, 2001
Location: The zephyr lands beneath the brine.
Age: 39
Posts: 5,459
Okay then, I think I've got it now. Instead of adding elses in ifs everywhere, I've added a single one right at the very end.

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 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(iRandom2 == 2)
{return iClass1;}
}
else if (iLevel1 'SMALLER THAN' iLevel2)
{return iClass2;}
else if (iLevel1 'GREATER THAN' iLevel2)
{return iClass1;}
}
else if((iClass2 == CLASS_TYPE_INVALID) && (iClass3 == CLASS_TYPE_INVALID)) {return iClass1;}
}
{return CLASS_TYPE_INVALID;}

}
This script does nothing other than adding a new command to the list in the editor. It is the 'GetHighestClassRandom(object)' command, which returns the CLASS_TYPE_* with the most levels in it, or picks randomly between those tied for highest.
It has to be linked to every script you write that uses the GetHighestClassRandom command. You can do so by either repeating the above script in each of those other scripts, above the void main(), or by making this into it's own script (by saving it into an empty new script file, without the void main()) and then linking to it by typing #include "script name" above the void main() of the other scripts.

Then, you can use a script very similar to the one I used first to cover all the options.
Your OnOpen and OnDeath scripts for class related containers will look like one of the below:

Quote:
#include "get-highest-level-random-script's-name"
void main()
{
if(GetHighestClassRandom(GetLastOpenedBy()) == CLASS_TYPE_ARCANE_ARCHER)
{
*Insert items here*
}
else if(GetHighestClassRandom(GetLastOpenedBy()) == CLASS_TYPE_ASSASSIN)
{
*Insert items here*
}
else if(GetHighestClassRandom(GetLastOpenedBy()) == CLASS_TYPE_BARBARIAN)
{
*Insert items here*
}
else if(GetHighestClassRandom(GetLastOpenedBy()) == CLASS_TYPE_BARD)
{
*Insert items here*
}
else if(GetHighestClassRandom(GetLastOpenedBy()) == CLASS_TYPE_BLACKGUARD)
{
*Insert items here*
}
else if(GetHighestClassRandom(GetLastOpenedBy()) == CLASS_TYPE_CLERIC)
{
*Insert items here*
}
else if(GetHighestClassRandom(GetLastOpenedBy()) == CLASS_TYPE_DRUID)
{
*Insert items here*
}
else if(GetHighestClassRandom(GetLastOpenedBy()) == CLASS_TYPE_FIGHTER)
{
*Insert items here*
}
else if(GetHighestClassRandom(GetLastOpenedBy()) == CLASS_TYPE_HARPER)
{
*Insert items here*
}
else if(GetHighestClassRandom(GetLastOpenedBy()) == CLASS_TYPE_INVALID)
{
PrintString("The GetHighestClassRandom thingy isn't working properly. Tell Leggy to test his scripts and do a better job in the future")
}
else if(GetHighestClassRandom(GetLastOpenedBy()) == CLASS_TYPE_MONK)
{
*Insert items here*
}
else if(GetHighestClassRandom(GetLastOpenedBy()) == CLASS_TYPE_PALADIN)
{
*Insert items here*
}
else if(GetHighestClassRandom(GetLastOpenedBy()) == CLASS_TYPE_RANGER)
{
*Insert items here*
}
else if(GetHighestClassRandom(GetLastOpenedBy()) == CLASS_TYPE_ROGUE)
{
*Insert items here*
}
else if(GetHighestClassRandom(GetLastOpenedBy()) == CLASS_TYPE_SHADOWDANCER)
{
*Insert items here*
}
else if(GetHighestClassRandom(GetLastOpenedBy()) == CLASS_TYPE_SORCERER)
{
*Insert items here*
}
else if(GetHighestClassRandom(GetLastOpenedBy()) == CLASS_TYPE_WIZARD)
{
*Insert items here*
}
}
if you've stored the first script of the post in another file, or:

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 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(iRandom2 == 2)
{return iClass1;}
}
else if (iLevel1 'SMALLER THAN' iLevel2)
{return iClass2;}
else if (iLevel1 'GREATER THAN' iLevel2)
{return iClass1;}
}
else if((iClass2 == CLASS_TYPE_INVALID) && (iClass3 == CLASS_TYPE_INVALID)) {return iClass1;}
}
{return CLASS_TYPE_INVALID;}

}
void main()
{
if(GetHighestClassRandom(GetLastOpenedBy()) == CLASS_TYPE_ARCANE_ARCHER)
{
*Insert items here*
}
else if(GetHighestClassRandom(GetLastOpenedBy()) == CLASS_TYPE_ASSASSIN)
{
*Insert items here*
}
else if(GetHighestClassRandom(GetLastOpenedBy()) == CLASS_TYPE_BARBARIAN)
{
*Insert items here*
}
else if(GetHighestClassRandom(GetLastOpenedBy()) == CLASS_TYPE_BARD)
{
*Insert items here*
}
else if(GetHighestClassRandom(GetLastOpenedBy()) == CLASS_TYPE_BLACKGUARD)
{
*Insert items here*
}
else if(GetHighestClassRandom(GetLastOpenedBy()) == CLASS_TYPE_CLERIC)
{
*Insert items here*
}
else if(GetHighestClassRandom(GetLastOpenedBy()) == CLASS_TYPE_DRUID)
{
*Insert items here*
}
else if(GetHighestClassRandom(GetLastOpenedBy()) == CLASS_TYPE_FIGHTER)
{
*Insert items here*
}
else if(GetHighestClassRandom(GetLastOpenedBy()) == CLASS_TYPE_HARPER)
{
*Insert items here*
}
else if(GetHighestClassRandom(GetLastOpenedBy()) == CLASS_TYPE_INVALID)
{
PrintString("The GetHighestClassRandom thingy isn't working properly. Tell Leggy to test his scripts and do a better job in the future")
}
else if(GetHighestClassRandom(GetLastOpenedBy()) == CLASS_TYPE_MONK)
{
*Insert items here*
}
else if(GetHighestClassRandom(GetLastOpenedBy()) == CLASS_TYPE_PALADIN)
{
*Insert items here*
}
else if(GetHighestClassRandom(GetLastOpenedBy()) == CLASS_TYPE_RANGER)
{
*Insert items here*
}
else if(GetHighestClassRandom(GetLastOpenedBy()) == CLASS_TYPE_ROGUE)
{
*Insert items here*
}
else if(GetHighestClassRandom(GetLastOpenedBy()) == CLASS_TYPE_SHADOWDANCER)
{
*Insert items here*
}
else if(GetHighestClassRandom(GetLastOpenedBy()) == CLASS_TYPE_SORCERER)
{
*Insert items here*
}
else if(GetHighestClassRandom(GetLastOpenedBy()) == CLASS_TYPE_WIZARD)
{
*Insert items here*
}
}
if you haven't.

As you can see, using #include is a lot more compact and well worth the effort if you are going to use this function in more than one or two scripts.

Now, if it does not work, just check the nwclient log file for further instructions. Phew [img]smile.gif[/img]

[ 07-12-2003, 02:09 PM: Message edited by: Legolas ]
Legolas is offline   Reply With Quote
Old 07-12-2003, 02:47 PM   #13
robertthebard
Xanathar Thieves Guild
 

Join Date: March 17, 2001
Location: Wichita, KS USA
Age: 60
Posts: 4,537
once again, thanks for all your hard work, hopefully others will also use this to help with their modules. I appreciate the effort it took to work this out, i'll be sure to send you a copy of the mod, when it's done
__________________
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-12-2003, 02:57 PM   #14
Legolas
Jack Burton
 

Join Date: March 31, 2001
Location: The zephyr lands beneath the brine.
Age: 39
Posts: 5,459
You're most welcome, and I'll be looking forward to it [img]smile.gif[/img]
I just hope it works as planned, I haven't tested it yet using the different classes available.
Legolas is offline   Reply With Quote
Reply


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

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 04:21 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