Jump to content

Z3R0

Members
  • Posts

    615
  • Joined

  • Last visited

  • Days Won

    11

Posts posted by Z3R0

  1. 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
  2. 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
  3. 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
    }

     

  4. 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...

  5. 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

  6. 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?

  7. 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

  8. 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
  9. 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

  10. 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... 

  11. 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

  12. 7 hours ago, luan122 said:

    Hi!

    Can i use strings in array and switch case keys? Like this:

    Array:
     

    
    setarray @array["string"],0,1,2,3,4

     

    Switch:
     

    
    switch(@string$){
      case "string":
        break;
      case "string2":
        break;
    }

     

    1st one can be "simulated"

    setarray( getd( "@array_" + "string"), 0, 1, 2, 3, 4; ); // this will give you @array_string[#]

    2nd, I found this out earlier, no, switch does not work with strings..., however what I found is that if you are setting strings for a switch, something is wrong...

    You can usually use a lookup array for the string and determine which index value it is in order to "case" it properly

    • MVP 1
  13. Right but I am assuming viper players use either a warp or npc to get to that map... meaning u could record all the charid... that go there into an array... using a check say every OnMinute15: loop through array and delete any chars from the array that are no longer logged in or on that map... and check their expire times... if their time is expired then boot em... if they onpcloadmapevent ... meaning they logged out on that map and warped back in check their viper and either kick em if expired or add their code back into the array

×
×
  • Create New...