Restricting item usage by class/race/alignment

A place for players to discuss building content (toolset Q&A etc.)
Post Reply
BeyondRedemption
Dasarian Scout
Posts: 409
Joined: Tue Oct 17, 2006 10:47 am
Location: Santa Cruz, CA

Restricting item usage by class/race/alignment

Post by BeyondRedemption »

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.
Wyvern
Forum Troll
Posts: 2349
Joined: Fri Sep 22, 2006 3:16 am
Contact:

Post by Wyvern »

If someone figures out a way to restrict or allow subraces (not just the base race (Moon Elf only instead of Elf, which allow Drow for example) it would be appreciated.
It's just a game...
Ludovic
Dasarian Scout
Posts: 301
Joined: Mon Nov 06, 2006 11:08 am

Post by Ludovic »

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.
Wyvern
Forum Troll
Posts: 2349
Joined: Fri Sep 22, 2006 3:16 am
Contact:

Post by Wyvern »

Pretty much what I figured. Thanks.
It's just a game...
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

Post by Rob »

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

Post by Rob »

Optional code...

Code: Select all

		if (GetIsDay())
		{
			ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectBlindness(), oPC);
			SendMessageToPC(oPC, "ZOMG IT'S BRIGHT!  LOLZORZ!");
		}
Wyvern
Forum Troll
Posts: 2349
Joined: Fri Sep 22, 2006 3:16 am
Contact:

Post by Wyvern »

I will have to use that, Rob. :wink:
It's just a game...
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

Post by Rob »

For BR...

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.");
	}
}
Wyv, if you become over stressed, I'll join the team - DM_ILLGIVEYOUSOMETHINGTOCRYABOUT.
BeyondRedemption
Dasarian Scout
Posts: 409
Joined: Tue Oct 17, 2006 10:47 am
Location: Santa Cruz, CA

Post by BeyondRedemption »

String Rob = "The Man";
BeyondRedemption
Dasarian Scout
Posts: 409
Joined: Tue Oct 17, 2006 10:47 am
Location: Santa Cruz, CA

Post by BeyondRedemption »

Is there some special way to attach the script to the weapon? Just having the script saved in the module didn't work for me.
Wyvern
Forum Troll
Posts: 2349
Joined: Fri Sep 22, 2006 3:16 am
Contact:

Post by Wyvern »

Attach it to the script hook onEquip?

It is in the item properties.
It's just a game...
Wyvern
Forum Troll
Posts: 2349
Joined: Fri Sep 22, 2006 3:16 am
Contact:

Post by Wyvern »

In fact, don't worry about it. In all likelihood, we will have a generic, configurable script to assign these sorts of restrictions. Just make a note of what restriction you are proposing and we will take it from there.
It's just a game...
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

Post by Rob »

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...

Code: Select all

void main() 
{ 
   object oItem; 
   object oPC; 
    
   oPC = GetPCItemLastEquippedBy(); 
   oItem = GetPCItemLastEquipped(); 
    
   SendMessageToPC(oPC, "You equipped a longsword.");
}
...The user should get a message saying "You equipped a longsword" when they equip a longsword.
Post Reply

Return to “The Carpenter's Hall”