Jump to content

Raikumi

Members
  • Posts

    49
  • Joined

  • Last visited

Posts posted by Raikumi

  1. I made significant progress for a noobie like myself! This code is now working. One NPC block with buffs and timers that get set up once, then you can duplicate the npc's logic across the map or many maps.

     

    prt_fild08,70,167,3	script	-1,000 Zeny#1	1907,1,1,{
    	if (Zeny >= 999) {
    		Zeny -= 1000;
    
    		set .foundBuff, 0;
    		hideonnpc strnpcinfo(0);
    		set .start, rand(1,6); // Random start point for buff selection
    
    		for( set .i, 0; .i < 6; set .i, .i + 1 ) {
    			set .buff, (.start + .i) % 6 + 1; // Cycles through 1 to 6
    
    			switch( .buff ) {
    				case 1: // 2x ATK / MATK
    					if( getstatus( SC_ATKPOTION ) ) continue;
    					specialeffect2 EF_MAXPOWER;
    					sc_start SC_ATKPOTION,( .duration * 1000 ),100;
    					sc_start SC_MATKPOTION,( .duration * 1000 ),100;
    					sc_start SC_INCATKRATE,( .duration * 1000 ),100;
    					sc_start SC_INCMATKRATE,( .duration * 1000 ),100;
    					set .foundBuff, 1;
    					break;
    				case 2: // Enchant Deadly Poison
    					if( getstatus( SC_EDP ) ) continue;
    					sc_start SC_EDP,( .duration * 1000 ),100;
    					specialeffect2 EF_EDP;
    					specialeffect2 EF_GREENBODY;
    					set .foundBuff, 1;
    					break;
    				case 3: // Two Hand Quicken
    					if( getstatus( SC_TWOHANDQUICKEN ) ) continue;
    					sc_start4 SC_TWOHANDQUICKEN,( .duration * 1000 ),-10,1,0,0;
    					specialeffect2 EF_TWOHANDQUICKEN;
    					set .foundBuff, 1;
    					break;
    				case 4: // Clone
    					// replace with actual status check for clone if available
    					if( getstatus( SC_SOMETHING_FOR_CLONE ) ) continue;
    					getmapxy( .@map$, .@x, .@y, BL_PC, strcharinfo(0) );
    					clone .@map$, .@x, .@y, "", getcharid(0), getcharid(0), "", 1, .duration;
    					clone .@map$,.@x,.@y,"",getcharid(0),getcharid(0),"",1,.duration;
    					set .foundBuff, 1;
    					break;
    				case 5: // Haste
    					if( getstatus( SC_SpeedUp1 ) ) continue;
    					specialeffect2 EF_INCAGILITY;
    					sc_start SC_SpeedUp1,( .duration * 1000 ),200;
    					set .foundBuff, 1;
    					break;
    				case 6: // Blessing
    					if( getstatus( SC_AUTOGUARD ) ) continue;
    					sc_start SC_AUTOGUARD,( .duration * 1000 ),100;
    					specialeffect2 EF_GUARD3;
    					set .foundBuff, 1;
    					break;
    			}
    			if( .foundBuff ) break; // If a buff is applied, break the loop
    		}
    		if( !.foundBuff ) {
    			dispbottom "You already have all buffs.";
    		}
    		end;
    	} else {
    		dispbottom "Not enough Zeny!";
    		close;
    	}
    
    OnTimer4000:
    	movenpc  strnpcinfo(0),rand(0,400), rand(0,400);
    	end;
    
    OnTimer10000:
    	hideoffnpc strnpcinfo(0);
    	setnpctimer 0;
    
    OnInit:
    	initnpctimer;
    
    	set .duration,60;
    
    	setarray .name$[0],
    		"Double Damage",	//	2 x ATK Rate
    		"Enchant Deadly Poison",	//	EDP
    		"Two Hand Quicken",	//	Two Hand Quicken
    		"Self Clone",		//	Clone
    		"Unlimit Haste",	//	Haste
    		"Blessing";		//	Blessing
    	
    	end;
    }
    
    prt_fild08,81,168,5	duplicate(-1,000 Zeny#1)	-1,000 Zeny#2	1907,1,1
    prt_fild08,81,168,5	duplicate(-1,000 Zeny#1)	-1,000 Zeny#3	1907,1,1
    prt_fild08,81,168,5	duplicate(-1,000 Zeny#1)	-1,000 Zeny#4	1907,1,1
    prt_fild08,81,168,5	duplicate(-1,000 Zeny#1)	-1,000 Zeny#5	1907,1,1
    prt_fild08,81,168,5	duplicate(-1,000 Zeny#1)	-1,000 Zeny#6	1907,1,1
    prt_fild08,81,168,5	duplicate(-1,000 Zeny#1)	-1,000 Zeny#7	1907,1,1
    prt_fild08,81,168,5	duplicate(-1,000 Zeny#1)	-1,000 Zeny#8	1907,1,1
    prt_fild08,81,168,5	duplicate(-1,000 Zeny#1)	-1,000 Zeny#9	1907,1,1
    prt_fild08,81,168,5	duplicate(-1,000 Zeny#1)	-1,000 Zeny#10	1907,1,1
    prt_fild08,81,168,5	duplicate(-1,000 Zeny#1)	-1,000 Zeny#11	1907,1,1
    prt_fild08,81,168,5	duplicate(-1,000 Zeny#1)	-1,000 Zeny#12	1907,1,1
    prt_fild08,81,168,5	duplicate(-1,000 Zeny#1)	-1,000 Zeny#13	1907,1,1
    prt_fild08,81,168,5	duplicate(-1,000 Zeny#1)	-1,000 Zeny#14	1907,1,1
    prt_fild08,81,168,5	duplicate(-1,000 Zeny#1)	-1,000 Zeny#15	1907,1,1
    prt_fild08,81,168,5	duplicate(-1,000 Zeny#1)	-1,000 Zeny#16	1907,1,1
    prt_fild08,81,168,5	duplicate(-1,000 Zeny#1)	-1,000 Zeny#17	1907,1,1
    prt_fild08,81,168,5	duplicate(-1,000 Zeny#1)	-1,000 Zeny#18	1907,1,1
    prt_fild08,81,168,5	duplicate(-1,000 Zeny#1)	-1,000 Zeny#19	1907,1,1
    prt_fild08,81,168,5	duplicate(-1,000 Zeny#1)	-1,000 Zeny#20	1907,1,1

     

     

  2. Happy 2024 @Emistry,

     

    Im trying to get your script to work across two maps. Any ideas on how it can be modified to work across many? Im trying to add this to all of the fields.

    When I duplicate onto the second map, functionality is lost on the first. The buff appears in one cell instead of jumping around the entire map like it does when I comment out the duplicate.

    Here is what Ive got so far:
     

    prt_fild08,1,1,5	script	Runes#1	757,1,1,{
    //dispbottom "Walkthrough to get Runes.";
    end;
    
    OnTouch:
    
    	switch( .runes ){
    		case 0: // 2x ATK / MATK
    			if( getstatus( SC_INCATKRATE ) ){dispbottom "You already have the buff: "+.name$[.runes]+".";
    			end;}{if( Zeny >= 1000 ){ Zeny -= 1000;
    			dispbottom "You spent 1,000 Zeny on a buff: "+.name$[.runes]+".";
    			specialeffect2 EF_PROVIDENCE; // This can be custom per case later
    			sc_start SC_INCATKRATE,( .duration * 1000 ),100;
    			sc_start SC_INCMATKRATE,( .duration * 1000 ),100;
    			}else{dispbottom "You do not have enough Zeny for the buff: "+.name$[.runes]+".";
    			end;}}
    			break;
    		case 1: // Invisible
    			if( getstatus( SC_INCATKRATE ) ){dispbottom "You already have the buff: "+.name$[.runes]+".";
    			end;}{if( Zeny >= 1000 ){ Zeny -= 1000;
    			dispbottom "You spent 1,000 Zeny on a buff: "+.name$[.runes]+".";
    			specialeffect2 EF_PROVIDENCE; // This can be custom per case later
    			skill "AS_CLOAKING",10,1;
    			}else{dispbottom "You do not have enough Zeny for the buff: "+.name$[.runes]+".";
    			end;}}
    			break;
    		case 2:
    			// Restore
    			if( getstatus( SC_INCATKRATE ) ){dispbottom "You already have the buff: "+.name$[.runes]+".";
    			end;}{if( Zeny >= 1000 ){ Zeny -= 1000;
    			dispbottom "You spent 1,000 Zeny on a buff: "+.name$[.runes]+".";
    			specialeffect2 EF_PROVIDENCE; // This can be custom per case later
    			sc_start4 SC_REGENERATION,( .duration * 1000 ),-10,1,0,0;
    			}else{dispbottom "You do not have enough Zeny for the buff: "+.name$[.runes]+".";
    			end;}}
    			break;
    		case 3:
    			// Clone
    			if( getstatus( SC_INCATKRATE ) ){dispbottom "You already have the buff: "+.name$[.runes]+".";
    			end;}{if( Zeny >= 1000 ){ Zeny -= 1000;
    			dispbottom "You spent 1,000 Zeny on a buff: "+.name$[.runes]+".";
    			specialeffect2 EF_PROVIDENCE; // This can be custom per case later
    			getmapxy( .@map$, .@x, .@y, BL_PC, strcharinfo(0) );
    			clone .@map$, .@x, .@y, "", getcharid(0), getcharid(0), "", 1, .duration;
    			clone .@map$,.@x,.@y,"",getcharid(0),getcharid(0),"",1,.duration;
    			}else{dispbottom "You do not have enough Zeny for the buff: "+.name$[.runes]+".";
    			end;}}
    			break;
    		case 4:
    			// Haste
    			if( getstatus( SC_INCATKRATE ) ){dispbottom "You already have the buff: "+.name$[.runes]+".";
    			end;}{if( Zeny >= 1000 ){ Zeny -= 1000;
    			specialeffect2 EF_PROVIDENCE; // This can be custom per case later
    			dispbottom "You spent 1,000 Zeny on a buff: "+.name$[.runes]+".";
    			sc_start SC_SpeedUp1,( .duration * 1000 ),0;
    			}else{dispbottom "You do not have enough Zeny for the buff: "+.name$[.runes]+".";
    			end;}}
    			break;
    		default: end;
    	}
    	
    //	
    	end;
    
    OnInit:
    	// Runes Duration in Seconds
    	set .duration,60;
    
    	// Name of Each Runes.
    	setarray .name$[0],
    		"Double Damage",	//	2 x ATK Rate
    		"Invisibility",		//	Cloaking
    		"Regeneration",		//	HP / SP Regeneration
    		"Shadow Clone",		//	Create 2 Clones
    		"Crazy Legs";	//	Improve Movement Speed
    
    	// npc sprite switching if any.
    	setarray .npc_sprite,
    		10428,
    		10429,
    		10430,
    		10431,
    		10432;
    		
    	.rune_size = getarraysize( .name$ );
    	.npc_name$ = strnpcinfo(0);
    	callsub( OnAssign );
    	
    	// Auto movement and spawning get onTimer10 for debugging
    	initnpctimer;
    	end;
        OnTimer10:
    	.runes = rand( .rune_size );
    	delwaitingroom;
        callsub( OnAssign );
    
    	setnpctimer(0);
    	end;
    	
    	OnAssign:
    			.@rand_x = rand( 0, 400);
    			.@rand_y = rand( 0, 400);
    		movenpc .npc_name$, .@rand_x, .@rand_y;
    		hideoffnpc .npc_name$;
    		if ( .npc_sprite[.runes] )
    			setnpcdisplay( .npc_name$, "Buff Cost: -1,000 Zeny", .npc_sprite[.runes] );
    		delwaitingroom;
    		waitingroom "   " + .name$[.runes], 0;
    		return;
    	
    	
    }
    
    moc_fild07,1,1,5	duplicate(Runes#1)	Runes#2	811

     

  3. @Zell Any idea how to fix the bug above? I pasted in the the src scripting each time for each mob behavior to mask, but I do not want to have to paste the src scripting in for each different sprite appearance. 

    Everytime the fakeplayer command runs, it replaced the look of the previously spawned ones to the most recent. 

  4. Will do .

    Btw this came up for the original script.

    m[status]
    m: Loading NPC file: npc/custom/events/disguise.txtK
    m[Error]
    m: 
    script error on npc/custom/events/disguise.txt line 162
       parse_line: expect command, missing function name or calling undeclared function
      157 :  while (.@guessrepeat);
      158 :  setnpctimer 0;
      159 :  initnpctimer;
      160 :  setnpcdisplay "Disguise NPC",$monster;
      161 :  set $MonsterName$, strmobinfo(1,$monster);
    *  162 :  'a'ctivatepset 1;
      163 :  npctalk "What's my name?";
      164 :  sleep 3000;
      165 :  npcwalkto 102,103;
      166 :  sleep 2000;
      167 :  npcwalkto 102,99;
    m[Error]
    m: npc_parsesrcfile: Unable to parse, probably a missing or extra TAB in file 'npc/custom/events/disguise.txt', line '387'. Skipping line...
    * w1=ama_test
    * w2=pvp
    * w3=off
    * w4=
    

    I would still like a solution.

    =========

    For the script Eroces gave me I get this error:

    m[Error]
    m: 
    script error on npc/custom/events/disguise.txt line 40
       parse_line: expect command, missing function name or calling undeclared function
       35 :	 if(select("Yes:No")==2) close;
       36 :	 if ($@EventON) {
       37 :	  set $@EventON,0; set $@Timer,0;
       38 :	  setnpctimer 0; stopnpctimer;
       39 :	  announce "A GM has decided to turn the Disguise Event off. As a result no further prizes will be given.",bc_map | bc_blue;
    *   40 :	  'd'eletepset 1;
       41 :	  setnpcdisplay "Disguise Event",795;
       42 :	  close; }
       43 :	 set $@EventON,1; set $@Timer,1; setnpctimer 0; initnpctimer;
       44 :	 set $@ResetCounter,$@ResetCounter+1;
       45 :	 announce "The Disguise Event will begin in 3 minutes.",bc_all | bc_blue;
    

×
×
  • Create New...