SphereCommunity
Can_u issue - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: Can_u issue (/Thread-Can-u-issue)



Can_u issue - kn4tseb - 06-03-2014 04:15 AM

Hi everyone, i'am trying to make an item be equipable by all races but im having problem with this:

this is the original script from sphere_item_typedef_equipitem.scp

the problem is when you are playing as a gargoyle...

can_u_none works fine, can_u_all doesnt work, when it's set, for some reason it has conflits with the second gargish check "ELSEIF !(<CanUse>&can_u_gargoyle)" so i get the ""Gargoyles can't wear this." message...

and if i set CanUse=can_u_human|can_u_gargoyle, it has conflits with <canuse>&can_u_human" condition check so i get the "You cannot equip that." message.

is it an script issue? or can_u_all is not working property at all??

PHP Code:
ON=@EquipTest
IF (<CanUse>&can_u_none)
    RETURN 
1
ELSEIF (<CanUse>&can_u_all)
    RETURN 
0
ENDIF
IF (<
SRC.IsPlayer>)
    
//Checking if the item can be equiped by gargoyles, don't uncomment the following 2 checks.
    
IF (<CanUse>&can_u_gargoyle)
        IF !(<
SRC.f_isgarg>)
            
SRC.SYSMESSAGELOC color_text,1111707//"Only gargoyles can wear this."
            
RETURN 1
        
ENDIF
    ELSEIF !(<
CanUse>&can_u_gargoyle)
        IF (<
SRC.f_isgarg>)
            
SRC.SYSMESSAGELOC color_text,1111708//"Gargoyles can't wear this."
            
RETURN 1
        
ENDIF
    ENDIF
    
//If you want every item equipable for every character without checking for race/sex uncomment the next line (return 0).
    //return 0
    
IF ( (<CanUse>&can_u_female) && !(<CanUse>&can_u_male) )     //Female item
        
IF !(<SRC.f_isfemale>)    //must be used by females.
            
SRC.SYSMESSAGELOC color_text,1010388//"Only females can wear this."
            
RETURN 1
        
ENDIF
    ELSEIF ( (<
CanUse>&can_u_male) && !(<CanUse>&can_u_female) )    //male item
        
IF (<SRC.f_isfemale>)    //must be used by males.
            
SRC.SYSMESSAGELOC color_text,1063343//"Only males can wear this."
            
RETURN 1
        
ENDIF
    ENDIF
    IF ( ( (<
CanUse>&can_u_human) && !(<src.f_IsHuman>) ) && !( (<CanUse>&can_u_elf) && (<src.f_IsElf>) ) )
        
SRC.SYSMESSAGELOC color_text,1071936//"You cannot equip that."
        
RETURN 1
    
ELSEIF ( ( (<CanUse>&can_u_elf) && !(<SRC.f_iself>) ) && !( (<CanUse>&can_u_human) && (<src.f_IsHuman>) ) )        //can't be used by elves
            
SRC.SYSMESSAGELOC color_text,1072203//"Only elves may use this."
            
RETURN 1
        
ENDIF
    ENDIF
ENDIF 


Thank you so much ^^


RE: Can_u issue - XuN - 06-03-2014 04:33 AM

My bad, ELSEIF !(<CanUse>&can_u_gargoyle) should be ELSEIF !(<CanUse>&can_u_all), i'll commit it soon.


RE: Can_u issue - kn4tseb - 06-03-2014 05:26 AM

ok ^^, for Nth time, thanks XuN xDDD... btw

ELSEIF ( !(<CanUse>&can_u_gargoyle) && (<CanUse>&can_u_all) )

seems to fix this problem.