Jump to content

Z3R0

Members
  • Posts

    615
  • Joined

  • Last visited

  • Days Won

    11

Posts posted by Z3R0

  1. Crude and Highly Untested

    prontera,158,173,4	script	CoinExchanger	88,{
    
    	mes("Welcome");
    	mes("Please give me your coins...");
    	
    	// Check Inventory for Coins
    	getinventorylist;
    
    	freeloop(true);
    	for(.@coin_index = 0; .@coin_index < getarraysize(.exchange_ids); .@coin_index++) {
    		for(.@i = 0; .@i < @inventorylist_count, .@i++) {
    			if (@inventorylist_id[.@i] == .exchange_ids[.@coin_index]) {
    				if (@inventorylist_amount[.@i] >= .exchange_amount[.@coin_index]) {
    					set(.@menu_coin_index[getarraysize(.@menu_coin_index)], .@coin_index);
    					set(.@menu$, ( .@menu$ = "" ? "" : ":" ) + getitemname(.exchange_ids[.@coin_index]) + "(" + @inventorylist_amount[.@i] + ")");
    				}
    			}
    		}
    	}
    	freeloop(false);
    
    	// Display Option to Show them choices and how many coins they have...
    	set .@choice, select(.@menu$) - 1; // Subtract 1 to get Array Index
    	set .@index, .@menu_coin_index[.@choice];
    
    	dispbottom("You have chosen to use " + getitemname(.exchange_ids[.@index]) );
    
    	progressbar("00FF00", .exchange_duration[.@index]); // Start the Progressbar 
    
    	// On Progress Bar Completion... let's see what we do here...
    	delitem(.exchange_ids[.@index], .exchange_amount[.@index];
    	freeloop(true);
    	for(.@i = 0; .@i < getarraysize(.available_items); .@i++) {
    		.@random = rand(1, 100); 
    		if (.@random <= .available_chance[.@i]) { // GET THE ITEM
    			mes "Here you go";
    			getitem(.available_items[.@i], .available_amount[.@i]);
    			if (.available_chance[.@i] <= .announce_level_chance) {
    				announce(strcharinfo(0) + " just scored " + getitemname(.exchange_ids[.@index]), bc_all, C_YELLOW);
    			}
    			close;
    		} 
    	}
    	freeloop(false);
    
    	mes("You got the default prize...");
    	getitem(.default_item, .default_amount);
    	close;	
     
    	OnInit:
    		setarray(.exchange_ids, 673, 675, 671, 677);
    		setarray(.exchange_amount, 1, 1, 1, 1);
    		setarray(.exchange_duration, 10, 8, 5, 2); // # of seconds to progressbar...
    
    		setarray(.available_items, 501, 502, 503, 504);
    		setarray(.available_amount, 1, 1, 1, 1);
    		setarray(.available_chance, 50, 40, 30, 10); // % of 100 
    
    		set(.announce_level_chance, 10); // Will only display announce if they get item 504... since it's the only one with 10 chance or lower
    		
    		set(.default_item, 501);
    		set(.default_amount, 1);
    		end;
    
    }

     

    • Upvote 1
  2. Crude and Untested (just figured i would whip something to get you started...)

     

    -	script	TestEvent	-1,{
    
      OnInit:
        initnpctimer;
        .event_started = 0;
        end;
    
      OnTimer300000: // 5 Minutes Check (When Event is on)
        if (.event_started == 1) {
          doevent("TestEvent::OnStopEvent");
        }
        end;
    
      OnTimer1080000: // 18 Minutes
        .r = rand(5);
        if (.r == 0) { doevent("TestEvent::OnRunEvent"); }
        end;
    
      OnTimer1140000: // 19 Minutes
        if (.r == 1) { doevent("TestEvent::OnRunEvent"); }
        end;
    
      OnTimer1200000: // 20 Minutes
        if (.r == 2) { doevent("TestEvent::OnRunEvent"); }
        end;
    
      OnTimer1260000: // 21 Minutes
        if (.r == 3) { doevent("TestEvent::OnRunEvent"); }
        end;
    
      OnTimer1320000: // 22 Minutes
        if (.r == 4) { doevent("TestEvent::OnRunEvent"); }  
        end; 
    
      OnRunEvent:  
        .event_started = 1;
        setnpctimer(0);
        announce("Event Running...", bc_all, C_YELLOW);
        // Do Other Event Things
        end;
    
      OnStopEvent:
        .event_started = 0;
        setnpctimer(0);
        announce("Event Stopped", bc_all, C_YELLOW);
        end;
    
    }

     

  3. .@generatedMenu$ = "";
    
    setarray(.@pvp_maps$, "a", "b", "c", "d"); // Corresponds to the Menu Options
    
    // Generate the Menu from the Array
    for (.@i = 0; .@i < getarraysize(.@pvp_maps$); .@i++) {
      .@generatedMenu$ += ( .@i = 0 ? "" : ":" ) + "Enter PVP Room #" + (.@i + 1) + "[" + getmapusers(.@pvp_maps$[.@i]) + "]";
    }
                                                  
    // Append the last option
    .@generatedMenu$ += ":I'm out of potions for today";
    
    .@selection = select(.@generatedMenu$) - 1; // Substract 1 because select gives 1-N and array starts 0-N
                                              
    if (.@selection = getarraysize(.@menu$) ) { // This is the actual array size because we added +1 due to last option
     // Chose Last Option
      mes "Sorry to see you go";
      close;
    }
                                              
    // Else they chose to warp to a pvp place...
    warp .@pvp_maps$[.@selection], 0, 0;
    end;

     

  4. Sorry I botched the code a bit... this is what happens when I can't test haha...

     

    Getmapxy you need to include the charname... I think u can use charid... don't know..m to access char id... it will be...

     

    getelementofarray ( getvariableofnpc (".mine_players", npc name), .@i) within the for loop...

     

    When u initnpctimer you need to include char id... to replace getcharid (0) with the above code as well... or you can simply male that it's own var...

     

    .@charid = getelementofarray ( getvariableofnpc (".mine_players", npc name), .@i); from within the for loop

  5. Oh sorry one small glitch you have to specify the npc name to retrieve the variable from in getvariableofnpc... not something I have used in a while... look up the syntax in rathena script commands.. and put the npc name that has that variable of the players... so that you retrieve that variable from that npc

  6. -	script	MVPSummoner	-1,{
    
    // There is no reason to kill them if you summon them... so I didn't add that command...
    // This will simply spawn the mob id's you list, on the maps you choose at random coordinates on the maps..
    // and display them with the name you chose...
    
    // I would have gone through the DB, but they don't list the maps that the MVP's spawn on... 
    
    OnSpawnMVP:
    	setarray(.@mvp_ids, 1086, 1087); // Continue to list MVP ID's here...
    	setarray(.@maps$, "prt_fild08", "prontera"); // List the correct map that corresponds with the MVP ID
    	serarray(.@mvp_names$, "Golden Thief Bug", "Other"); // MVP Names to Display can customize
    
    	// Summon the MVPs
    	for(.@i = 0; .@i < getarraysize(.@mvp_ids); .@i++) {
          monster .@maps$[.@i], 0, 0, .@mvp_names$[.@i], .@mvp_ids[.@i], 1;
        }
        end;
    
    OnInit: // Load the script commands
    	bindatcmd("spawnmvp", strnpcinfo(0) + "::OnSpawnMVP");
    	end;
    }

     

  7. Well the only time the players interact with those NPC's are 2 instances...

    A ) When they warp to the map

    B ) When they kill something...

    What I would suggest doing is storing the players that are warped to the map into an array

    right before the warp...

    set(.mine_players[getarraysize(.@mine_players)], getcharid(0));

    This will give you a useable array of character id's that have joined the event...

     

    On your crystaltimer npc... where you start the timer... instead of starting it with initnpctimer()... loop through each character that should still be in the mine map...

    for(.@i = 0; .@i < getarraysize(getvariableofnpc(".mine_players")); .@i++) {
    
      // Make sure the users are still on the map...
      getmapxy(.@map$, .@x, .@y, UNITTYPE_PC);
      if (.@map$ == "mine_evt") {
       	// Still on the map...
        initnpctimer(getcharid(0)); // This will attach the NPC Timer to the character so you can run multiple rather than 1...
      }
                                                     
    }

    I haven't tested this so I can't be 100% sure, but that's something for what you are looking for...

     

  8. It should pull the mvp I'd list from query_sql if you want to add custom ones not in that table... after the query_sql... add:

    set(.@idList [getarraysize [.@idList], 1234);

    Where 1234 is a new id not listed in the db... you can add multiples of those if you want...

  9. The set .@menu $, .@menu $ + ":";

    Are irrelevant... remove those else's... that would just create empty spacers in the menu and there is no reason for that... although I am assuming you have that because the menu is not setup to be dynamic...

    Wish people would take more approaches with dynamics than just making "extra" room hehe...

    I can help look when I get to my pc on Monday if it is not resolved by then.

  10. The solution would require a bit of work considering its only using an account variable to determine if the user has reached the limit. You would probably have to change this to an sql table and instead of increasing an account variable it should read an entry and determine if it exists and is ready. I can look into it at a later time. However it would require a bit for work.

    • Love 1
×
×
  • Create New...