Hello to everybody.
I'm dealing with the CanUse problem. I'm trying to extend this definition to other career options - That means for a warrior, ranger, sorcerer, alchemist, and thief. The question is, can it be done? I could use a selection based on typedef (t_armor, t_weapon, etc.), but that is not enough. I need a separate feature for each item. And the definition of CanUse seemed to me to be appropriate for this. I have some script that works well for basic subjects. But once I add, for example, can_u_warrior to an object that only Elf can wear, the entire CanUse stops working. It does not write any system message and does not assign the subject to anyone. Here is a sample of the script I've compiled. It is built into [TYPEDEF t_equipitem] in sphere_item_typedef_equipitem.scp. The ToolTip also does not work even though I edited the cliloc.enu file and assembled the upper script sample for the ON = @ ClientToolTip.
Code:
[TYPEDEF t_equipitem]
ON=@ClientToolTip
//IF ((<DISPID>!=<BASEID>) || (<DISPIDDEC>>16381))
// ADDCLILOC 1042971,<NAME>
//ELSE
// ADDCLILOC <EVAL 1020000+<DISPIDDEC>>
//ENDIF
SRC.ADDCLILOC 1042971,<NAME>
IF !(<ATTR> & attr_identified)
SRC.ADDCLILOC 1041522,<def.BFONT_RED>,#1038000,<def.BFONT_WHITE>
ENDIF
IF (<TYPE>==t_wand)
IF (<MOREX> > 0) && (<MOREX> <= 64)
LOCAL.SpellCliloc=<EVAL 3002010+<MOREX>>
SRC.ADDCLILOC <dLOCAL.SpellCliloc>,<dMORE2>
ENDIF
SRC.ADDCLILOC 1060741,<dMORE2>
ENDIF
IF (<Rarity>)
SRC.ADDCLILOC 1061078,<INSTANCES>//"Artifact rarity: ~"
ENDIF
IF (<canuse>&can_u_gargoyle) && !((<canuse>&can_u_human) || (<canuse>&can_u_elf))
SRC.ADDCLILOC 1111709//"Gargoyles Only"
ENDIF
IF (<canuse> &can_u_elf) && !((<canuse>&can_u_human) || (<canuse>&can_u_gargoyle))
SRC.ADDCLILOC 1075086
ENDIF
//////////////Start editing
IF (<canuse> &can_u_warrior) && !((<canuse>&can_u_ranger) || (<canuse>&can_u_sorcerer) || (<canuse>&can_u_alchemyst) || (<canuse>&can_u_thiev))
SRC.ADDCLILOC 1030829
ENDIF
IF (<canuse> &can_u_ranger) && !((<canuse>&can_u_warrior) || (<canuse>&can_u_sorcerer) || (<canuse>&can_u_alchemyst) || (<canuse>&can_u_thiev))
SRC.ADDCLILOC 1030830
ENDIF
IF (<canuse> &can_u_sorcerer) && !((<canuse>&can_u_ranger) || (<canuse>&can_u_warrior) || (<canuse>&can_u_alchemyst) || (<canuse>&can_u_thiev))
SRC.ADDCLILOC 1030831
ENDIF
IF (<canuse> &can_u_alchemyst) && !((<canuse>&can_u_ranger) || (<canuse>&can_u_sorcerer) || (<canuse>&can_u_warrior) || (<canuse>&can_u_thiev))
SRC.ADDCLILOC 1030832
ENDIF
IF (<canuse> &can_u_thiev) && !((<canuse>&can_u_ranger) || (<canuse>&can_u_sorcerer) || (<canuse>&can_u_alchemyst) || (<canuse>&can_u_warrior))
SRC.ADDCLILOC 1030833
ENDIF
//////////////End editing
Code:
ON=@EquipTest
IF (<CanUse>&can_u_none)
RETURN 1
ELSEIF (<CanUse>&can_u_all)
return 0
ENDIF
IF (<SRC.IsPlayer>)
IF (<CanUse>&can_u_gargoyle)
IF !(<SRC.f_isgarg>)
SRC.SYSMESSAGELOC color_text,1111707
RETURN 1
ENDIF
ELSEIF !(<CanUse>&can_u_all)
IF (<SRC.f_isgarg>)
SRC.SYSMESSAGELOC color_text,1111708
RETURN 1
ENDIF
ENDIF
//return 0
IF ( (<CanUse>&can_u_female) && !(<CanUse>&can_u_male) )
IF !(<SRC.f_isfemale>)
SRC.SYSMESSAGELOC color_text,1010388
RETURN 1
ENDIF
ELSEIF ( (<CanUse>&can_u_male) && !(<CanUse>&can_u_female) )
IF (<SRC.f_isfemale>)
SRC.SYSMESSAGELOC color_text,1063343
RETURN 1
ENDIF
ENDIF
//////////////Start editing
IF ( ( (<CanUse>&can_u_human) && !(<src.f_IsHuman>) ) && !( (<CanUse>&can_u_elf) && (<src.f_IsElf>) ) && !( (<CanUse>&can_u_warrior) && (<src.IsWarior>) ) && !( (<CanUse>&can_u_ranger) && (<src.IsRanger>) ) && !( (<CanUse>&can_u_sorcerer) && (<src.IsSorcerer>) ) && !( (<CanUse>&can_u_alchemyst) && (<src.IsAlchemyst>) ) && !( (<CanUse>&can_u_thiev) && (<src.IsThiev>) ) )
SRC.SYSMESSAGELOC color_text,1071936
RETURN 1
ELSEIF ( ( (<CanUse>&can_u_elf) && !(<SRC.f_iself>) ) && !( (<CanUse>&can_u_human) && (<src.f_IsHuman>) ) && !( (<CanUse>&can_u_warrior) && (<src.IsWarior>) ) && !( (<CanUse>&can_u_ranger) && (<src.IsRanger>) ) && !( (<CanUse>&can_u_sorcerer) && (<src.IsSorcerer>) ) && !( (<CanUse>&can_u_alchemyst) && (<src.IsAlchemyst>) ) && !( (<CanUse>&can_u_thiev) && (<src.IsThiev>) ) )
SRC.SYSMESSAGELOC color_text,1072203
RETURN 1
ELSEIF ( ( (<CanUse>&can_u_warrior) && (<src.IsWarior>) ) && !( (<CanUse>&can_u_human) && (<src.f_IsHuman>) ) && !( (<CanUse>&can_u_elf) && !(<SRC.f_iself>) ) && !( (<CanUse>&can_u_ranger) && (<src.IsRanger>) ) && !( (<CanUse>&can_u_sorcerer) && (<src.IsSorcerer>) ) && !( (<CanUse>&can_u_alchemyst) && (<src.IsAlchemyst>) ) && !( (<CanUse>&can_u_thiev) && (<src.IsThiev>) ) )
SRC.SYSMESSAGELOC color_text,1072203
RETURN 1
ELSEIF ( ( (<CanUse>&can_u_ranger) && (<src.IsRanger>) ) && !( (<CanUse>&can_u_human) && (<src.f_IsHuman>) ) && !( (<CanUse>&can_u_elf) && !(<SRC.f_iself>) ) && !( (<CanUse>&can_u_warrior) && (<src.IsWarior>) ) && !( (<CanUse>&can_u_sorcerer) && (<src.IsSorcerer>) ) && !( (<CanUse>&can_u_alchemyst) && (<src.IsAlchemyst>) ) && !( (<CanUse>&can_u_thiev) && (<src.IsThiev>) ) )
SRC.SYSMESSAGELOC color_text,1072203
RETURN 1
ELSEIF ( ( (<CanUse>&can_u_sorcerer) && (<src.IsSorcerer>) ) && !( (<CanUse>&can_u_human) && (<src.f_IsHuman>) ) && !( (<CanUse>&can_u_elf) && !(<SRC.f_iself>) ) && !( (<CanUse>&can_u_warrior) && (<src.IsWarior>) ) && !( (<CanUse>&can_u_ranger) && (<src.IsRanger>) ) && !( (<CanUse>&can_u_alchemyst) && (<src.IsAlchemyst>) ) && !( (<CanUse>&can_u_thiev) && (<src.IsThiev>) ) )
SRC.SYSMESSAGELOC color_text,1072203
RETURN 1
ELSEIF ( ( (<CanUse>&can_u_alchemyst) && (<src.IsAlchemyst>) ) && !( (<CanUse>&can_u_human) && (<src.f_IsHuman>) ) && !( (<CanUse>&can_u_elf) && !(<SRC.f_iself>) ) && !( (<CanUse>&can_u_warrior) && (<src.IsWarior>) ) && !( (<CanUse>&can_u_ranger) && (<src.IsRanger>) ) && !( (<CanUse>&can_u_sorcerer) && (<src.IsSorcerer>) ) && !( (<CanUse>&can_u_thiev) && (<src.IsThiev>) ) )
SRC.SYSMESSAGELOC color_text,1072203
RETURN 1
ELSEIF ( ( (<CanUse>&can_u_thiev) && (<src.IsThiev>) ) && !( (<CanUse>&can_u_human) && (<src.f_IsHuman>) ) && !( (<CanUse>&can_u_elf) && !(<SRC.f_iself>) ) && !( (<CanUse>&can_u_warrior) && (<src.IsWarior>) ) && !( (<CanUse>&can_u_ranger) && (<src.IsRanger>) ) && !( (<CanUse>&can_u_sorcerer) && (<src.IsSorcerer>) ) && !( (<CanUse>&can_u_alchemyst) && (<src.IsAlchemyst>) ) )
SRC.SYSMESSAGELOC color_text,1072203
RETURN 1
ENDIF
ENDIF
ENDIF
//////////////End editing
Why am I doing this? I want an elf warrior, for example, to wear all the armor, but Ranger no longer. The Ranger could not wear platemail. And, for example, Dwarf alchemyst to wear only leather armor. I need the objects to be adjusted according to race, by profession, and then to make an exception to an object - For a sorcerer, a magical platemail to wear it. This is just an example.