Jump to content

Necrosx

Members
  • Posts

    3
  • Joined

  • Last visited

Posts posted by Necrosx

  1. 16 hours ago, Racaae said:

    Hello. Using getunitdata inside a if statement is causing the error. Don't know why.
    Try:

    -	script	cashpoints	-1,{
    	OnInit:
    		setarray .champions$,"Elusive","Furious","Ringleader","Solid","Swift";
    		end;
    	OnNPCKillEvent:
    		
    		.@exists = getunitdata(killedgid, .@data);
    		if ( .@exists != -1  ){
    			
    			.@mode = .@data[UMOB_MODE];
                if(.@mode & MD_MVP){
    				if ( getmonsterinfo( killedrid, MOB_LV ) < 71 ) 
    					#CASHPOINTS += rand( 5, 10 );
    				else 
    					#CASHPOINTS += rand( 10, 15 );    //MVP
    			}
    
    			else if(.@mode & MD_STATUSIMMUNE){
    				if ( getmonsterinfo( killedrid, MOB_LV ) < 71 ) 
    					#CASHPOINTS += rand( 3, 8 );
    				else 
    					#CASHPOINTS += rand( 8, 13 );    //miniboss
    				}else {
    					for(.@i = 0; .@i < getarraysize(.champions$); .@i++){
    						if(compare(.@mobname$,.champions$[.@i])){
    							if ( getmonsterinfo( killedrid, MOB_LV ) < 71 ) 
    								#CASHPOINTS += rand( 1, 3 );
    							else 
    								#CASHPOINTS += rand( 3, 6 );    //cashpoints
    							break;
    						}
    					} //Champion tests
    				}
    		}
    		end;
    }

     

    Progress! It works for minibosses and MVP's now, but not for champions, but no errors...

    Edit- Solved. Completed script is in the original post.

  2. Hello, I am trying to make a script that will reward players with cashpoints whenever they kill a boss/miniboss/mvp/champion mob. I have had some success with help from the discord, but Im not quite there yet, and am receiving an error. Been beating my head against the wall trying to fix things, so I figured I would come here and ask if anyone has any idea how to fix this and get it to do what I want it to.

     

    The script in question (Original):

    Spoiler
      -	script	cashpoints	-1,{
    	OnInit:
    		setarray .champions$,"Elusive","Furious","Ringleader","Solid","Swift";
    		end;
    	OnNPCKillEvent:
    		if (  getunitdata(killedgid, .@data) != -1  ){
    			.@mode = .@data[UMOB_MODE];
                if(.@mode & MD_MVP){
    				if ( getmonsterinfo( killedrid, MOB_LV ) < 71 ) 
    					#CASHPOINTS += rand( 5, 10 );
    				else 
    					#CASHPOINTS += rand( 10, 15 );    //MVP
    			}else if(.@mode & MD_STATUSIMMUNE){
    				if ( getmonsterinfo( killedrid, MOB_LV ) < 71 ) 
    					#CASHPOINTS += rand( 3, 8 );
    				else 
    					#CASHPOINTS += rand( 8, 13 );    //miniboss
    				}else {
    					for(.@i = 0; .@i < getarraysize(.champions$); .@i++){
    						if(compare(.@mobname$,.champions$[.@i])){
    							if ( getmonsterinfo( killedrid, MOB_LV ) < 71 ) 
    								#CASHPOINTS += rand( 1, 3 );
    							else 
    								#CASHPOINTS += rand( 3, 6 );    //cashpoints
    							break;
    						}
    					} //Champion tests
    				}
    		}
    		end;
    }

     

    And the error I am receiving whenever I kill any mob at all:

    [Error] : script:op_2: invalid data for operator C_NE
    [Debug] : Data: C_ARG
    [Debug] : Data: number value=-1

     Thanks in advance for any and all help!

     

    Completed and functional script:

    Spoiler
    -	script	cashpoints	-1,{
    	OnInit:
    		setarray .champions$,"Elusive","Furious","Ringleader","Solid","Swift";
    		end;
    	OnNPCKillEvent:
    		.@mobname$ = getmonsterinfo(killedrid,MOB_NAME)
    		.@exists = getunitdata(killedgid, .@data);
    		if ( .@exists != -1  ){
    			
    			.@mode = .@data[UMOB_MODE];
                if(.@mode & MD_MVP){
    				if ( getmonsterinfo( killedrid, MOB_LV ) < 71 ) 
    					#CASHPOINTS += rand( 5, 10 );
    				else 
    					#CASHPOINTS += rand( 10, 15 );    //MVP
    			}
    
    			else if(.@mode & MD_STATUSIMMUNE){
    				if ( getmonsterinfo( killedrid, MOB_LV ) < 71 ) 
    					#CASHPOINTS += rand( 3, 8 );
    				else 
    					#CASHPOINTS += rand( 8, 13 );    //miniboss
    			}else {
    				for(.@i = 0; .@i < getarraysize(.champions$); .@i++){
    					if(compare(.@mobname$,.champions$[.@i])){
    						if ( getmonsterinfo( killedrid, MOB_LV ) < 71 ) 
    							#CASHPOINTS += rand( 1, 3 );
    						else 
    							#CASHPOINTS += rand( 3, 6 );    //cashpoints
    						break;
    					}
    				} //Champion tests
    			}
    		}
    		end;
    }

     

     

×
×
  • Create New...