Restricting item usage by class/race/alignment
-
BeyondRedemption
- Dasarian Scout
- Posts: 409
- Joined: Tue Oct 17, 2006 10:47 am
- Location: Santa Cruz, CA
Restricting item usage by class/race/alignment
It's pretty easy to add an item property that makes an item only usable by certain classes, races, and alignments. However, I can't for the life of me figure out how to specifically prohibit a class, race, or alignment.
For instance, I'm trying to create shuriken only usable by pure monks. I can add the item property for allowing monks but I can't figure out how to deny the rest of the classes so the multiclass monks can't use them.
For instance, I'm trying to create shuriken only usable by pure monks. I can add the item property for allowing monks but I can't figure out how to deny the rest of the classes so the multiclass monks can't use them.
You can't restrict something based on the level of a class as such. It restricts it based on the overall level, or class (indeed, both) depending how you set the abilities.
There may be a way to restrict the item via scripting; having a script on the OnEquip (or similar) hook. But this requires -obviously- scripting and you cannot do it by clicking a button or two as with adding item properties.
This would apply to both what Wyvern said as well as Beyond Redemption.
There may be a way to restrict the item via scripting; having a script on the OnEquip (or similar) hook. But this requires -obviously- scripting and you cannot do it by clicking a button or two as with adding item properties.
This would apply to both what Wyvern said as well as Beyond Redemption.
-
Rob
- Forum Troll
- Posts: 3146
- Joined: Fri Sep 22, 2006 9:39 pm
- Other PCs: Amir Ma'fir, Darius Aylomen, Dewey Scoville, Jack Red-Eyes, Jørann, Kale, Leopold von Bruhl, Modelo Del Mar & Quintus d'Cerevallia
- Bioware Username: robertharris
- Location: Dallas, TX
i_<item tag>_eq
Code: Select all
void main()
{
object oItem;
object oPC;
oPC = GetPCItemLastEquippedBy();
oItem = GetPCItemLastEquipped();
if (GetSubRace(oPC) == RACIAL_SUBTYPE_DROW)
{
AssignCommand(oPC, ActionUnequipItem(oItem));
SendMessageToPC(oPC, "Crawl back into the crack that crapped you out, you filthy Drow!");
}
}-
Rob
- Forum Troll
- Posts: 3146
- Joined: Fri Sep 22, 2006 9:39 pm
- Other PCs: Amir Ma'fir, Darius Aylomen, Dewey Scoville, Jack Red-Eyes, Jørann, Kale, Leopold von Bruhl, Modelo Del Mar & Quintus d'Cerevallia
- Bioware Username: robertharris
- Location: Dallas, TX
Optional code...
Code: Select all
if (GetIsDay())
{
ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectBlindness(), oPC);
SendMessageToPC(oPC, "ZOMG IT'S BRIGHT! LOLZORZ!");
}-
Rob
- Forum Troll
- Posts: 3146
- Joined: Fri Sep 22, 2006 9:39 pm
- Other PCs: Amir Ma'fir, Darius Aylomen, Dewey Scoville, Jack Red-Eyes, Jørann, Kale, Leopold von Bruhl, Modelo Del Mar & Quintus d'Cerevallia
- Bioware Username: robertharris
- Location: Dallas, TX
For BR...
Wyv, if you become over stressed, I'll join the team - DM_ILLGIVEYOUSOMETHINGTOCRYABOUT.
Code: Select all
void main()
{
object oItem;
object oPC;
oPC = GetPCItemLastEquippedBy();
oItem = GetPCItemLastEquipped();
if (GetClassByPosition(1, oPC) == CLASS_TYPE_MONK)
{
if (GetClassByPosition(2, oPC) != CLASS_TYPE_INVALID)
{
AssignCommand(oPC, ActionUnequipItem(oItem));
SendMessageToPC(oPC, "I DON'T LIKE YOUR BUILD. TRY AGAIN.");
SetXP(oPC, 0);
}
}
else
{
AssignCommand(oPC, ActionUnequipItem(oItem));
SendMessageToPC(oPC, "Your chi is too feeble to equip this item.");
}
}-
BeyondRedemption
- Dasarian Scout
- Posts: 409
- Joined: Tue Oct 17, 2006 10:47 am
- Location: Santa Cruz, CA
-
BeyondRedemption
- Dasarian Scout
- Posts: 409
- Joined: Tue Oct 17, 2006 10:47 am
- Location: Santa Cruz, CA
-
Rob
- Forum Troll
- Posts: 3146
- Joined: Fri Sep 22, 2006 9:39 pm
- Other PCs: Amir Ma'fir, Darius Aylomen, Dewey Scoville, Jack Red-Eyes, Jørann, Kale, Leopold von Bruhl, Modelo Del Mar & Quintus d'Cerevallia
- Bioware Username: robertharris
- Location: Dallas, TX
Well, if you're using the default on module load script, x2_mod_def_load, tag based scripting is enabled by default. If you create a script called i_<item tag>_eq, it will execute when an item of <item tag> is equipped.
So if I make a script called i_NW_WSWLS001_eq which looks like this...
...The user should get a message saying "You equipped a longsword" when they equip a longsword.
So if I make a script called i_NW_WSWLS001_eq which looks like this...
Code: Select all
void main()
{
object oItem;
object oPC;
oPC = GetPCItemLastEquippedBy();
oItem = GetPCItemLastEquipped();
SendMessageToPC(oPC, "You equipped a longsword.");
}