Jump to content

Capuche

Developer
  • Posts

    2407
  • Joined

  • Last visited

  • Days Won

    51

Posts posted by Capuche

  1. Your character is warped on the 'main' map 1@spa, not in the instance map.

    1@spa,54,28,0	script	#gp3warp	WARPNPC,1,1,{
    	if ( instance_id() < 0 ) end;
    	if( !'gp5 && instance_mapname("1@spa") != "" )
    		warp instance_mapname("1@spa"),218,186;
    	else {
    		if (checkquest(40024) == -1)
    			setquest 40024;
    		warp "dali",49,127;
    	}
    	end;
    }
    
    • Upvote 1
  2. It could be optimized but the query seems correct. However the correct value of the variable for players online may differ from the sql variable value. You need to check the variable value for players offline differently from players online.

  3. prontera,160,160,4	script	mob	857,{
    	
    	mes .@nameNpc$;// unset (see oninit)
    	mes "Hello "+ strcharinfo(0)+".";
    	mes "I can give Poring Coin";
    	mes "in return you have to kill all the monsters that tell you";
    	next;
    	.@sql = query_sql( "SELECT `ID`,`iName` FROM `mob_db` ORDER BY RAND(ID) LIMIT 500",.@id,.@name$ );// it should be rand()
    	
    	for( .@i = 0; .@i < .@sql; .@i++ ){// unused the loop stop after the close
    		
    		copyarray .@mobID[0],.@id[.@i],500;// you can take 1 random monster with sql (rand() limit 1)
    		copyarray .@mobName$[0],.@name$,500;
    		setarray .@mobKill[0],100,200,300;
    		set .@ranmob,rand(0,500);
    		set .@rankill,rand(0,2);
    		
    		mes .@nameNpc$;
    		mes "Today you need kill :"+.@mobName$[.@ranmob]+" x "+.@mobkill[.@rankill];
    		close;
    	}
    	
    	
    //-----------------------------------------------------------------------//
    //OnNPCKIllEvent Label
    //-----------------------------------------------------------------------//		
    	OnNPCKillEvent:
    		if(killedrid == .@mobID[.@ranmob]){
    			mes "You have kill "+.@mobName$[.@ranmob];
    			close;
    		}
    		end;	
    		
    //-----------------------------------------------------------------------//
    //OnInit Label
    //-----------------------------------------------------------------------//
    		OnInit:
    		waitingroom "Kill Mob for Coin",0;
    		set .@nameNpc$,"[Mob Kills]";// everytime the script end the .@variables are cleared
    		
    			
    }
    	
    

    I didn't test :

    prontera,160,160,4	script	mob	857,{
    	.@nameNpc$ = "[Mob Kills]";
    
    	mes .@nameNpc$;
    	mes "Hello "+ strcharinfo(0) +".";
    	mes "I can give Poring Coin";
    	mes "in return you have to kill all the monsters that tell you.";
    	next;
    	if (date_event != gettime(8)) {
    		mob_count_event = 0;			// clear the previous count kill
    		date_event = gettime(8);		// save the date
    		rankill_event = rand(1,3) *100;	// save the number to kill
    		query_sql( "select `ID` from mob_db where `EXP` > 0 and (`Drop1id` > 0 or `Drop2id` > 0 or `Drop3id` > 0 or `Drop4id` > 0 or `Drop5id` > 0 or `Drop6id` > 0 or `Drop7id` > 0 or `Drop8id` > 0 or "+
    			"`Drop9id` > 0 or DropCardid > 0 ) ORDER BY RAND() LIMIT 1", mob_id_event );// not an event mob
    
    		mes .@nameNpc$;
    		mes "Today you need kill: "+ getmonsterinfo( mob_id_event,MOB_NAME ) +" x"+ rankill_event;
    	}
    	else if (mob_count_event < rankill_event)
    		mes "You have killed "+ mob_count_event +"/"+ rankill_event +" "+ getmonsterinfo( mob_id_event,MOB_NAME );
    	else {
    		mes "Congrat you killed all the monsters.";
    		getitem 501,1;
    	}
    	close;
    	
    OnNPCKillEvent:
    	if (killedrid == mob_id_event && mob_count_event < rankill_event) {
    		mob_count_event++;
    		message strcharinfo(0), "You have killed "+ mob_count_event +"/"+ rankill_event +" "+ getmonsterinfo( mob_id_event,MOB_NAME );
    	}
    	end;
    
    OnInit:
    	waitingroom "Kill Mob for Coin",0;
    	end;
    }
    	
    
  4. 
    

    pvp_n_1-3,83,116,5 script PoringSpawner1 139,{

    end;

    OnNPCKillEvent:

    if (killedrid == 1296) {

    /*

    - if player kill several monsters in few seconds, spam of enable/disable

    Set a variable when timer start then clear when end

    */

    getmapxy(.@mapa$,.@x,.@y,0);

    if (.@mapa$ == "pvp_n_1-3") {

    enablenpc "PoringWarp1";

    sleep 120000;

    disablenpc "PoringWarp1";

    end;

    }

    }

    // <- add end to stop the script here otherwise if players kill another monster than 1296 or 1296 on another map than pvp_n_1-3, the warp is disabled

    //Disable the warp when the server starts.

    OnInit:

    disablenpc "PoringWarp1";

    end;

    }

    //My Example

    //Warp NPC

    pvp_n_1-3,100,140,0 warp PoringWarp1 1,1,aldebaran,143,57

  5. Ha ok btw you did the same event under the others label, what about group them ?

    -	script	TreasureBoxSummonerCoin		-1,{
    
    OnClock1500:
    OnClock1600:
    OnClock2400:
    	set $@ran, rand(1,9);// use .@ran (temporary variable only attached to this npc) instead of $@ran
    	/*
    	- what about an array ?
    	setarray .@jmpmap$[1],
    		"hugel",
    		"yuno",
    		"comodo",
    		"aldebaran",
    		"izlude",
    		"payon",
    		"geffen",
    		"morocc",
    		"prontera";
    	- Then save you map name into a .variable$ (npc variable)
    	.map_name$ = .@jmpmap$[.@ran];
    	*/
    	if ($@ran == 9) set $@jmpmap$,"hugel";
    	if ($@ran == 8) set $@jmpmap$,"yuno";
    	if ($@ran == 7) set $@jmpmap$,"comodo";
    	if ($@ran == 6) set $@jmpmap$,"aldebaran";
    	if ($@ran == 5) set $@jmpmap$,"izlude";
    	if ($@ran == 4) set $@jmpmap$,"payon";
    	if ($@ran == 3) set $@jmpmap$,"geffen";
    	if ($@ran == 2) set $@jmpmap$,"morocc";
    	if ($@ran == 1) set $@jmpmap$,"prontera";
    
    	announce "A rare Treasure Box will be spawned in "+ $@jmpmap$ +".",bc_all|bc_npc;
    	monster $@jmpmap$,0,0,"Treasure Box Coin",1845,5,"TreasureBoxSummonerCoin::OnCoinBoxKilled";
    	initnpctimer;
    	end;
    	
    OnTimer1800000: //30min
    	announce "All treasure in "+ $@jmpmap$ +" are destroyed",bc_all|bc_npc;
    	killmonster $@jmpmap$,"TreasureBoxSummonerCoin::OnCoinBoxKilled";// TreasureBoxSummonerCoin unknown NPC
    	stopnpctimer;
    	end;
    
    OnCoinBoxKilled:
    	announce "The rare Treasure Box has been found and destroyed by "+strcharinfo(0)+"!", bc_all;
    	getitem 7539,1; // Change your prize here 7539 Poring Coin
    	end;
    }
    

    and yes moik is right (I got screwed by the "A rare"), there is 5 box. You should stop the timer if someone kill all the box to avoid to display the message after 30mins (just make a count like moik suggested but with npc var)

  6. You have an error when you load this NPC ?

    dup label means you used a same label name in the npc (like OnTimer1000: twice or OnCoinBoxKilled: twice). Please post a ss of the error displayed by mapserv

     

    And :

    OnCoinBoxKilled:
    	announce "The rare Treasure Box has been found and destroyed by "+strcharinfo(0)+"!", bc_all;
    	getitem 7539,1; // Change your prize here 7539 Poring Coin
    	stopnpctimer;// <-- add this
    	end;
    
  7. 
    

    - script Trasure Coin -1,{

    OnClock0300:

    OnClock1600:

    OnClock2400:

    announce "A rare Treasure Box will be spawned in Prontera",0;

    /*

    - you miss a comma after ,0,0

    - TreasureBoxSummonerCoin unknown NPC

    */

    monster "prontera",0,0"Treasure Box Coin",1845,5,"TreasureBoxSummonerCoin::OnCoinBoxKilled";

    startnpctimer;// better to use initnpctimer;

    end;

    OnTimer1000:

    announce "All treasure in Prontera are destroyed",0;

    killmonster "prontera","TreasureBoxSummonerCoin::OnCoinBoxKilled";// TreasureBoxSummonerCoin unknown NPC

    setnpctimer,0;// Typo error ; It's better to use stopnpctimer;

    end;

    OnCoinBoxKilled:

    announce "The rare Treasure Box has been found and destroyed by "+strcharinfo(0)+"!", bc_all;

    getitem 7539,1; // Change your prize here 7539 Poring Coin

    end;

    }

  8. Is 6295c77 is the version of rathena folder? 

    Check if your emu is younger than 31 Aug 2015 (so you got this update).

     

    and 127 means?

    Before the commit 6295c77 the maximum array size for npc script was 128 that's why Euphy used the condition to check if you can add more session.

    if (.Size > 127) {
    

    (.Size is the size of $WOE_CONTROL used to store the session data)

     

     whats the connection between 32 and 127?

    For one session he saved 4 values within the same array.

    setarray $WOE_CONTROL[.@i], .@Day, .@Start, .@End, .@Castle;
    

    So for 32 sessions -> 128 values in the array (maximum size).

     

    After the commit 6295c77 the max array size become 2147483647 ; you can now save ( 2,147,483,647 / 4 ) = 536,870,911 sessions.

  9. You got this warning because addrid and the dialog box. Not sure what you want to do, this ?

    izlude,0,0,0	script	NPC	-1,{
    
    // OnClock1645:
    OnInit:
    	for ( .@i = 5; .@i > 0; .@i-- ) {
    		mapannounce "izlude", .@i +"!.",0;
    		sleep 1000;
    	}
        donpcevent strnpcinfo(0) +"::OnEvent";
    
    	for ( .@i = 5; .@i > 0; .@i-- ) {
    		mapannounce "izlude", "Message 2: "+ .@i +"!.",0;
    		sleep 1000;
    	}
        end;
    
    OnEvent:
    	addrid(1);
    	mes " FIRST RESULT ";
    	sleep2 5000;// wait until the end of message 2
    	mes " SECOND RESULT ";
    	close;
    }
    
  10. I don't understand what you want to do, but note addrid will attach the script to all players in the NPC map. That means it will display n times your 'second part' (n the number of player in the map).

    You may call the addrid part with a donpcevent to avoid this

×
×
  • Create New...