Jump to content

Z3R0

Members
  • Posts

    618
  • Joined

  • Last visited

  • Days Won

    11

Posts posted by Z3R0

  1. Trying again...

    // Trades tokens
    // getarg(0) - number of tokens to be traded
    function	script	thqs_trade_token	{
    
    	// getarg(0) == Token Option
    	.@index = getarg(0);
    
    	// Number of Tokens
    	.@token_count[0], 1, 10, 100;
    	.@zeny_amt[0],5000000,50000000,500000000;
    
    	// If Nevermind was selected
    	if (.@index == 3) { close; }
    
    	if (#Treasure_Token < .@token_count[.@index]) {
    		mes "You don't have enough tokens!";
    		close;
    	}
    
    	if ( ( Zeny == MAX_ZENY ) || ( ( Zeny + .@zeny_amt[.@index] ) > MAX_ZENY) {
    		mes "You are already at max Zeny or this trade will go over max zeny";
    		close;
    	}
    
    	Zeny += .@zeny_amt[.@index];
    	#Treasure_Token -= .@token_amount[.@index];
    	close;
    }
    
    // Main script
    prt_in,164,174,1	script	Treasure Hunter's Shop	1_M_YOUNGKNIGHT,{
    	mes "[Ash]";
    	mes "Ahh, "+strcharinfo(PC_NAME)+"! Welcome to the Offical Treasure Hunter's Guild Shop.";
    	mes "You currently have ^FF0000"+#Treasure_Token+"^000000 treasure tokens!!!";
    	next;
    	switch( select("How does this place work?","What do you have in stock?","Nevermind") ) {
    		case 1:
    			mes "[Ash]";
    			mes "Well you see here you can exchange your treasure hunter tokens for zeny or rare weapons forged by our blacksmiths.";
    			mes " ";
    			mes "Everything has its own price value and the only way you can get the tokens is by completing quests assigned to you,the system normally works like this.";
    			mes " ";
    			mes "The harder the mission the more Tokens you will earn. All red quests are worth 4-8 Tokens, and the rest are worth 1-5.";
    			mes " ";
    			mes "Hope that solves your problem and questions.";
    			close;
    		case 2:
    			break;
    		case 3:
    			close;
    	}
    
    	mes "[Ash]";
    	mes "Ok here is our Big list of goods.";
    	mes " ";
    	mes "(Note T stands for a Treasure Token.)";
    	next;
    	mes "[Ash]";
    	mes "This is what we have to offer.";
    	next;
    	switch( select("Trade for zeny", "Trade for Weapons", "Trade for Cards", "Nevermind") ) {
    		case 1:
    			// Subtract 1 from the choice (Select Options are 1 to X) but arrays are 0 - X so we subtract 1... start at 0... and send to function
    			.@choice = select("5,000,000z - 1T","50,000,000z - 10T","500,00,000z - 100T","Nevermind") - 1;
    			thqs_trade_token(.@choice);
    		case 2:
    			mes "[Ash]";
    			mes "This is what we have to offer.";
    			next;
    			.@choice = select("Axe's","1 Handed Swords","2 Handed Swords","Book's","Bow's","Katar's","Knuckle's","Mace's","Whips","Wands","Nevermind");
    			ths_menu_weapons(.@choice);
    		case 3:
    			mes "[Ash]";
    			mes "This is what we have to offer.";
    			next;
    			thqs_menu_buy("$THQS_menu_cards","$THQS_menu_price");
    		case 4:
    			close;
    	}
    	end;
    }
     
    

     

  2. Here you go

     

    // Trades tokens
    // getarg(0) - number of tokens to be traded
    function	script	thqs_trade_token	{
    
    	// getarg(0) == Token Option
    	.@index = getarg(0);
    
    	// Number of Tokens
    	.@token_count[0], 1, 10, 100;
    	.@zeny_amt[0],5000000,50000000,500000000;
    
    	// If Nevermind was selected
    	if (.@index == 3) { close; }
    
    	if (#Treasure_Token < .@token_count[.@index]) {
    		mes "You don't have enough tokens!";
    		close;
    	}
    
    	if ( ( Zeny == MAX_ZENY ) || ( ( Zeny + .@zeny_amt[.@index] ) > MAX_ZENY) {
    		mes "You are already at max Zeny or this trade will go over max zeny";
    		close;
    	}
    
    	Zeny += .@zeny_amt[.@index];
    	#Treasure_Token -= .@token_amount[.@index];
    	close;
    }
    
    // Main script
    prt_in,164,174,1	script	Treasure Hunter's Shop	1_M_YOUNGKNIGHT,{
    	mes "[Ash]";
    	mes "Ahh, "+strcharinfo(PC_NAME)+"! Welcome to the Offical Treasure Hunter's Guild Shop.";
    	mes "You currently have ^FF0000"+#Treasure_Token+"^000000 treasure tokens!!!";
    	next;
    	switch( select("How does this place work?","What do you have in stock?","Nevermind") ) {
    		case 1:
    			mes "[Ash]";
    			mes "Well you see here you can exchange your treasure hunter tokens for zeny or rare weapons forged by our blacksmiths.";
    			mes " ";
    			mes "Everything has its own price value and the only way you can get the tokens is by completing quests assigned to you,the system normally works like this.";
    			mes " ";
    			mes "The harder the mission the more Tokens you will earn. All red quests are worth 4-8 Tokens, and the rest are worth 1-5.";
    			mes " ";
    			mes "Hope that solves your problem and questions.";
    			close;
    		case 2:
    			break;
    		case 3:
    			close;
    	}
    
    	mes "[Ash]";
    	mes "Ok here is our Big list of goods.";
    	mes " ";
    	mes "(Note T stands for a Treasure Token.)";
    	next;
    	mes "[Ash]";
    	mes "This is what we have to offer.";
    	next;
    	switch( select("Trade for zeny", "Trade for Weapons", "Trade for Cards", "Nevermind") ) {
    		case 1:
    			// Subtract 1 from the choice (Select Options are 1 to X) but arrays are 0 - X so we subtract 1... start at 0... and send to function
    			.@choice = select("5,000,000z - 1T","50,000,000z - 10T","500,00,000z - 100T","Nevermind") - 1;
    			thqs_trade_token(.@choice);
    		case 2:
    			mes "[Ash]";
    			mes "This is what we have to offer.";
    			next;
    			.@choice = select("Axe's","1 Handed Swords","2 Handed Swords","Book's","Bow's","Katar's","Knuckle's","Mace's","Whips","Wands","Nevermind");
    			ths_menu_weapons(.@choice);
    		case 3:
    			mes "[Ash]";
    			mes "This is what we have to offer.";
    			next;
    			thqs_menu_buy("$THQS_menu_cards","$THQS_menu_price");
    		case 4:
    			close;
    	}
    	end;
    }
     
    

     

  3. I don't have my scripting command reference on me via mobile... But... OnPCLogoutEvent:

    Get value of timer... And play it in a perm char var... Then OnPCLoginEvent: first check for the existence of the perm char var... And if it exists... Addtimer... For .s_time - permcl char var... Else not exist... .s_time

     

    Also you will need to make sure to clear that perm char var on hourly pickup, or whenever else in the script the timer is reset or added... But it should work just fine

    • Upvote 1
  4. 8 hours ago, Quesooo said:

    when the correct answer hit by the players the announcement should be

     

    - Unknown is correct ! i was disguise a Plasma ( guess time 15sec )

    image.png.d9f225d1dd6cc977616a1f0625d61d3c.png

    i want to change this announcement with time interval how long does players guess the correct answer ^_^

    You will need to setup an OnTimer15000:

    with that, check if the Event is active, if it hasn't already been guessed, end the event and restart it later OnClock####:

    etc

    • Upvote 1
    • Love 1
  5. 7 hours ago, salmanshaikh14 said:

    if player have this >item id  2933 or if player have this >item id  29434 it will give heal..

    script below please help me

     

    specialeffect(EF_HEAL2, AREA, playerattached()); percentheal 100,100;
       if ( countitem( 29333 ) )
       if ( countitem( 29334 ) ) {

        specialeffect2 (EF_INCAGILITY, AREA, playerattached()); sc_start SC_INCREASEAGI,240000,10;
        specialeffect2 (EF_BLESSING, AREA, playerattached()); sc_start SC_BLESSING,240000,10; 
        specialeffect2 EF_INCAGILITY;
        specialeffect2 EF_BLESSING; }
        set TimeHealed, gettimetick(2);
     

    healer.txt

     

    if ( countitem(#) || countitem(#) ) {
      // DO STUFF
    }

     

  6. absolutely!

    If using an SQL Server which I think is common now-a-days you can do a simple query for the character login information for last_ip (don't know exactly what the column is...)

    From that extraction you should be able to do whatever you want to do from there...

  7. You would simply have 1 npc with multiple functions...

     

    -	script	StatTracker	-1,{
    
    	OnPCLoginEvent: 
    		// Gather Information from SQL, store in @vars
    
    	OnPCLogoutEvent:
    		// Push @vars back to SQL
    
    	OnPCKillEvent:
    		// Increase @pvp vars + 1
    
    	OnNPCKillEvent:
    		// Increase @mobs killed + 1
    
    	OnPCDieEvent:
    		// Decrease Death Vars + 1
    
    }

    Something similar to that :D

  8. On 9/14/2017 at 12:58 PM, Alayne said:

    Hello peoples,

    I'm stucked on this case for 3h in a row now...I've ran out of ideas, so if anyone got one...I took it!

    I'm currently working on a script that pops a monster, and I want this monster to pop a skill. But no matter what, it doesn't work...

    Here's the case I've tried:

    
    monster .wbMap$[.@spawnRand],123,150,.wBossName$[.lastRandId],.wBossIds[.lastRandId],1,strnpcinfo(3) + "::OnWorldBossDied",2; 
    set .wBossId, $@mobId[0];
    debugmes "pop skill " + .wBossId + " " + unitexists(.wBossId);
    
    unitskilluseid .wBossId, WZ_STORMGUST, 5; //or with skill id
    
    getunitdata(.wBossId, .@worldBossData);
    areamobuseskill $lastPopMap$, .@worldBossData[UMOB_X], .@worldBossData[UMOB_Y], 50, .wBossIds[.lastRandId], 653, 10, 3000,1,e_gg,3; //or with NPC_EARTHQUAKE

    It's a bit modified to make it easiest to post (the global script is 250 lines long), but globaly, that's the try I maked.

    According to the debugmes, the maps good, the ids too, the unit exists...But nothing poped out...

    Any idea why? Am I missing something?

    According to 

    https://github.com/rathena/rathena/blob/master/doc/script_commands.txt *unitskilluseid

    I think you need to either set a target or coordinates for that particular skill, because that skill is a clickable targetable skill on the ground? ...

     

    I could be wrong, but worth a shot? maybe just for testing purposes try to target 

    ```unitskilluseid .wBossId, WZ_STORMGUST, 5, 125, 155;```

    can't hurt?

  9. 1 hour ago, Skorm said:

    If the users can instantiate SQL queries on a whim they could flood your SQL server with many requests. If controlled SQL makes it very easy todo things that would normally be time consuming in scripts with variables.
     

    For example:

    
    SELECT * FROM item_db_re ORDER BY price_buy DESC LIMIT 5;

    With one line I can easily find what are the most expensive items to purchase in the game. You could easily apply something like this to a pvp ranker.

    If you plan on keeping all your data for the players in variables they get hard to manage and remove, and the sql table for perm variables gets pinged by the server quite often so it's best to keep that as small as you can. This is where I would recommend using an SQL database.

     

    Without getting into it any further what I'm trying to say is. If used correctly SQL can be a powerful tool that should be taken advantage of, and for bigger scripts with lots of numbers and information there's no reason not to use SQL.

     

    Just have to say, full agree. 

    Most NPC's can easily call an OnInit: function, that serves as the "basis" to pull information from SQL... This is a on time call, but grants you the ability to manipulate the server on the "fly" without having to deal with remembering what variables are what... You can make a change to the DB, call a refresh method and BAM, settings updated... (almost too magical...)

    Any time you are going to be doing cross game-browser, chances are you are going to need a SQL Table to handle the data... but like Skorm said, making sure it's not hammering it is definitely something to note...

     

    For instance, you don't want a click handler calling the DB every time someone clicks the NPC... (ew, no)... 

    Now, say for instance it runs after a PVP Event... ok, well that's 1 time per event... not horrible... 

    So yes, while you may need local and npc and temporary variables to manage the workings of the script, by all means, push them to sql when complete so you can query that data from your web browser or retrieve it later with a refresh function :D

  10. Anything is possible.

    On quest acceptance instead of getitem... store a variable array on the char...

    Starry qShopStuff[0], .@iemid, 20170901,daytimetick;

    This integer is the following format...

    Year month day hour minute

    You specify it backwards that way you can compare it...

    If getarraysize(qShopStuff) then they have an open quest... claim it...

    Once claim attempt compare to current year month day ... if > 0 then it's been a day or more ok to claim, if 0 then compare time tick to 120000... if >= then it's ok to claim, else wait...

    Getitem qShopStuff[0]

    Deletearray qShopStuff[0], getarraysize(qShopStuff);

     

    Goodluck and happy hunting!

    • Upvote 1
  11. Yes, the array is registered with the following information

     

    char_id | name of variable | index of array | value

     

    so for instance, if you create array on character: 

    setarray charArray[0], 1, 2, 3;

    you will have 3 values for 1 character...

    150001 | charArray | 0 | 1

    150001 | charArray | 1 | 2

    150001 | charArray | 2 | 3

  12. 4 hours ago, Mikki said:

    no they do their own events, and they give rewards via pm npc:reward2

    Would it be possible to get GMpoints everytime they give reward to someone?

    Also, how can I put a limit to their rewards? like  it will only be 15 rewards per gm per day (to avoid abuse)..
    This is the script I use for the rewards..

    
    -	script	reward2	-1,{
     
    	OnInit:
    		// Configuration
    		.reward_id = 671;
    		.amount = 1;
    		.min_gm = 40;
    		end;
     
     
    	OnWhisperGlobal:
    		// Check GM level
    		if (getgmlevel() < .min_gm) {
    			message strcharinfo(0), "You are not authorised to access this feature.";
    			end;
    		}
     
    		// Check if reward session ended
    		if (select("Reward a player:End session") == 2) {
    			close;
    		}
     
    		do {
    			// Input target player's name
    			message strcharinfo(0), "Enter the name of the character to be rewarded.";
    			input .@player_name$;
     
    			// Check if specified player is logged in
    			if (!isloggedin(getcharid(3, .@player_name$), getcharid(0, .@player_name$))) {
    				message strcharinfo(0), "'"+ .@player_name$ +"' is either not logged in or does not exist.";
    			}
    		} while (!isloggedin(getcharid(3, .@player_name$), getcharid(0, .@player_name$)));
     
    		// Reward specified player
    		getitem .reward_id, .amount, getcharid(3, .@player_name$);
     
    		// Announce reward
    		announce "'"+ strcharinfo(0) +"' has rewarded '"+ .@player_name$ +"' with "+ .amount +" "+ getitemname(.reward_id) +".", bc_all;
    		close;
     
    }

     

    Well..

    1. I personally wouldn't give players the power to host events anymore... too much favortism...

    2.  Abusing it is probably going to happen.. unless your gm's are really awesome... but even then...

    3. They are GM's, what items could they possibly want that they couldn't make? (Unless they are strictly Event GM's) ...

    4. I personally instead of granting points per event, I would record in a SQL Log when they gave out rewards and to who, and monitor it :D and then you can just give them whatever item... or what not...

    - Not something I think should really exist anymore... 

  13. Stolao, after looking the code in that function there are missing brackets...

    in F_ApplyOption.txt

    Line 56:

    setrandomoption(getarg(0,9),0,rand(RDMOPT_BODY_ATTR_NOTHING,RDMOPT_BODY_ATTR_UNDEAD),1,1;

    Missing an ending )

    Same with the setrandomoption() below it

     

    haven't really looked deeper

×
×
  • Create New...