Jump to content

GmOcean

Members
  • Posts

    666
  • Joined

  • Last visited

  • Days Won

    4

Posts posted by GmOcean

  1. You need to limit your arrays to 128. Right now your telling sql to fetch ALL your account IDs at 1 time, but rAthena only supports a max of 128 per array.

    query_sql("SELECT account_id FROM `char` LIMIT 128;",.@account_ids);
    

    But, this is only HOW you limit it, what you need to do is loop this query until it's completely retrieved all the information, so we'll change it to this:

    do {
       set .@results, query_sql("SELECT account_id FROM `char` LIMIT 128,"+ .@page +"",.@account_ids);
       for (set .@x,0; .@x < .@results; set .@x, .@x + 1) {
                        blah;
                        blah;
                        blah;
                        blah;
                        blah;
       }
        set .@page,.@page + 128;
    } while (.@results);
    

    Replace blah blah blah blah, with the update query's, and this SHOULD effectively continuously loop through all account_ids and then do what you want with them until they are all done.

  2. The problem is, your making the script call:  getcharid(3) automatically, but the issue with that is there isn't a player attached.

    If your going to use it in this method, you need to apply the optional parameter of specifying what player to get the id from.

     

    ex:

    query_sql "SELECT `this_week` FROM `char` WHERE `account_id` = " + getcharid(3, "player_name") + "", .@this_week;
    
  3. @Skorm - Duplicates only share same NPC variables when they were set by the main npc right? Or did that change in a previous update, because eA didn't work like that and I haven't experimented with rA in that way yet D:

     

    Edit: It seems they do indeed share the same values when using a duplicate NPC D: Changed my frist post, to direct to Skorm's for #3 =P

    • Upvote 2
  4. 
    

    *getitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};

    *getitem2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};

    This command will give an amount of specified items to the invoking character.

    If an optional account ID is specified, and the target character is currently

    online, items will be created in their inventory instead. If they are not

    online, nothing will happen. It works essentially the same as 'getitem' but is

    a lot more flexible.

    Those parameters that are different from 'getitem' are:

    identify - Whether you want the item to be identified (1) or not (0).

    refine - For how many pluses will it be refined.

    It will not let you refine an item higher than the max refine.

    attribute - Whether the item is broken (1) or not (0).

    card1,2,3,4 - If you want a card compound to it, place the card ID number into

    the specific card slot.

    Card1-card4 values are also used to store name information for named items, as

    well as the elemental property of weapons and armor. You can create a named item

    in this manner, however, if you just need a named piece of standard equipment,

    it is much easier to the 'getnameditem' function instead.

    You will need to keep these values if you want to destroy and then perfectly

    recreate a named item, for this see 'getinventorylist'.

    If you still want to try creating a named item with this command because

    'getnameditem' won't do it for you cause it's too limited, you can do it like

    this. Careful, minor magic ahead.

    // First, let's get an ID of a character who's name will be on the item.

    // Only an existing character's name may be there.

    // Let's assume our character is 'Adam' and find his ID.

    @charid = getcharid(0,"Adam");

    // Now we split the character ID number into two portions with a binary

    // shift operation. If you don't understand what this does, just copy it.

    @card3 = @charid & 65535;

    @card4 = @charid >> 16;

    // If you're inscribing non-equipment, @card1 must be 254.

    // Arrows are also not equipment. :)

    @card1 = 254;

    // For named equipment, card2 means the Star Crumbs and elemental

    // crystals used to make this equipment. For everything else, it's 0.

    @card2 = 0;

    // Now, let's give the character who invoked the script some

    // Adam's Apples:

    getitem2 512,1,1,0,0,@card1,@card2,@card3,@card4;

    This wasn't tested with all possible items, so I can't give any promises,

    experiment first before relying on it.

    To create equipment, continue this example it like this:

    // We've already have card3 and card4 loaded with correct

    // values so we'll just set up card1 and card2 with data

    // for an Ice Stiletto.

    // If you're inscribing equipment, @card1 must be 255.

    @card1 = 255;

    // That's the number of star crumbs in a weapon.

    @sc = 2;

    // That's the number of elemental property of the weapon.

    @ele = 1;

    // And that's the wacky formula that makes them into

    // a single number.

    @card2 = @ele+((@sc*5)<<8);

    // That will make us an Adam's +2 VVS Ice Stiletto:

    getitem2 1216,1,1,2,0,@card1,@card2,@card3,@card4;

    Experiment with the number of star crumbs - I'm not certain just how much will

    work most and what it depends on. The valid element numbers are:

    1 - Ice, 2 - Earth 3 - Fire 4 - Wind.

    You can, apparently, even create duplicates of the same pet egg with this

    command, creating a pet which is the same, but simultaneously exists in two

    eggs, and may hatch from either, although, I'm not sure what kind of a mess will

    this really cause.

    
    

    prontera,150,180,4 script npc_name 123,{ getitem2 2137,1,1,0,0,0,0,0,4800; end; }

  5. "." - A NPC variable.
    They exist in the NPC and disappear when the server restarts or the
    NPC is reloaded. Can be accessed from inside the NPC or by calling
    'getvariableofnpc'. Function objects can also have .variables which
    are accessible from inside the function, however 'getvariableofnpc'
    does NOT work on function objects.
    
    
    *getvariableofnpc(<variable>,"<npc name>")
    Returns a reference to a NPC variable (. prefix) from the target NPC.
    This can only be used to get . variables.
    Examples:
    //This will return the value of .var, note that this can't be used, since the value isn't caught.
    getvariableofnpc(.var,"TargetNPC");
    //This will set the .v variable to the value of the TargetNPC's .var variable.
    set .v, getvariableofnpc(.var,"TargetNPC");
    //This will set the .var variable of TargetNPC to 1.
    set getvariableofnpc(.var,"TargetNPC"), 1;
    Note: even though function objects can have .variables,
    getvariableofnpc will not work on them.
    

    @1: Yes, it should be possible using this method.

    @2: You need to use getvariableofnpc for each instance of needing to use the variable from another NPC.

    @3: As Skorm mentions, as long as the NPC is a duplicate of another NPC, the scope variables will be the same as another.

    @4: When using deletearray command, the documentation is right, but also wrong. It should read:

    *deletearray <array name>{[<first value>],<how much to delete>};
    

    This is because, when a start & end value is omitted, it defaults to:   deletearray <arrayname>[0],<script_max_array_size>;

    So it should be completely erasing your array from existence.

     

     

    Hope that helps D: and anyone else who feels I am wrong on a certain matter, please don't hesitate to correct me !!

    • Upvote 1
  6. Okay, so I was wondering if some one would be able to make a command that does the following:

    1. Changes a player & his guild into a certain PK type state.

    2. This PK type state will have a value of X (Which is change able).

    3. A Player/Guild of PK State X  will not be able to attack anyone in the open world unless the person they are attacking is also in PK State X.

    (ex1. Player A is in PKstateX. Player B is in PKstateY. = Can not attack.)

    (ex2. Player A is in PKstateX. Player B is in PKstateX. = Can Attack.)

    (ex3. Player A is in PKstateX. Player B is in PKstateY. Both players are in a PvP/GvG map. = Can Attack).

    (ex4. Player A is in PKstateX. Player B is in PKstateX. Player C is in PKstateZ. = Player A can attack Player B.  Player C can not attack either of them.).

    4. Follows the same rules as GvG/PvP.

     

    Hope to see if this is possible. I would assume so, since factions are possible, and this is a "form" of that.

  7. File Name: Utility: Effect List

    File Submitter: GmOcean

    File Submitted: 31 Aug 2014

    File Category: Utilities

    Content Author: GmOcean

     

    A simple script that will allow users to cycle through the effects listed in 'effect_list.txt'. These effects were tested using client version: 2013-08-07a.
    Older clients (such as Pre-Renewal Clients) may result in errors due to not having those effects inside them.

     

    Click here to download this file

  8. -	script	bounty_script	-1,{
    	OnInit:
    	set .bounty,10000; //Sets Earned Bounty in zeny.
            setarray .woe_reward[0],501,1; //[0] = Item given. |  [1] = Amount given.
    	set .wanted_increments,100000; //Sets how large a wanted level is in comparison to bountys.
    	set .ip_ban,0; //Whether or not IP farming results in a ban. (Time in days).
    	set .ip_jail,0; //Whether or not IP farming results in jail time. (Time in hours).
    	set .mapname$,""; //Mapname script works on. Leave blank for all maps.
    	set .resu_kill,0; //Whether or not to warp players to savepoint upon death.
    	set .zeny_warp,0; //Whether or not to warp players to savepoint upon having less than 10k zeny.
    	set .zeny_loss,0; //Whether or not players lose zeny upon dying.
    	
    	
    	
    	OnPCLoginEvent:
    	if( !.ip_ban && !.ip_jail ){end;} //Prevents useless sql_query if ip farming punishments are disabled.
    	query_sql("select last_ip from `login` WHERE account_id = "+ getcharid(3) +""),.@ip$;
    	setd ".ip"+getcharid(0)+"$",.@ip$;
    	end;
    	OnPCLogoutEvent:
    	if( !.ip_ban && !.ip_jail ){end;} //Prevents useless commands, if ip farming punishments are disabled.
    	setd ".ip"+getcharid(0)+"$","";
    	end;
    	OnPCKillEvent:
    	if( strcharinfo(3) != .mapname$ && .mapname$ != "" ){end;}
    	set .ip1$, getd(".ip"+getcharid(0)+"$");
    	if(killedrid == getcharid(3)){end;} //Prevent Suicide.
    	attachrid(killedrid);
    	if( .ip_ban || .ip_jail ){ //Checks to see if IP farming punishment is enabled.
    		if( .ip1$ == getd(".ip"+getcharid(0)+"$") )
    			{dispbottom "Cheating will not be tolerated. Repeated offenses will result in a public denounciation, and a 5day ban."; 
    			 set @repeatcheat,@repeatcheat +1; 
    			 if(@repeatcheat >=3)
    				{announce ""+strcharinfo(0)+" has been caught cheating and has been banned for 5days.",bc_blue|bc_all; 
    				 if( .ip_ban ){ atcommand "@ban +5d "+strcharinfo(0)+""; } else if( .ip_jail ){ atcommand "@jail "+strcharinfo(0)+""; } }
    			 end;} //Prevents same IP Address Farming
    	}
    	if( .zeny_loss ){ if( zeny >= .bounty ){set zeny,zeny-.bounty;} }
    	set .zeny, getd(".bounty"+ getcharid(0) +"");
    	setd ".bounty"+ getcharid(0) +"",0; //Sets Bounty to 0 if they die.
    	if( .zeny_warp ){ if(zeny < .bounty){warp "SavePoint",0,0;} } //Warps them out of map if they no longer have zeny.
    	if( .resu_kill ){ warp "SavePoint",0,0; } //Warps them out of map to prevent resu kill spam
    	attachrid(killerrid);
    	set zeny,zeny + .zeny;
    	setd ".bounty"+ getcharid(0) +"", getd(".bounty"+ getcharid(0) +"") + .bounty; //Sets Bounty to +.bounty per kill.
    	set .@a$, ""+ getd(".bounty"+ getcharid(0) +"") +"";
            if(agitcheck() || agitcheck2()){if( .woe_reward[0] ){getitem .woe_reward[0],.woe_reward[1];}end;}
    	set .@b, getstrlen(.@a$);
    	while(.@c < .@
    		{set .@a$,insertchar(.@a$,",",(.@b - 3));set .@b,.@b-3; set .@c,.@c+3;}
    	if( (getd(".bounty"+ getcharid(0) +"") / .wanted_increments) >= 10 ){announce "["+ strcharinfo(0) +"] has killed ["+ rid2name(killedrid) +"]. "+ (Sex?"He":"She") +" has a bounty of: "+ .@a$ +" zeny! [ WANTED LEVEL ***** ]",bc_blue|bc_all;}
    	if( (getd(".bounty"+ getcharid(0) +"") / .wanted_increments) == 9 ){announce "["+ strcharinfo(0) +"] has killed ["+ rid2name(killedrid) +"]. "+ (Sex?"He":"She") +" has a bounty of: "+ .@a$ +" zeny! [ WANTED LEVEL **** ]",bc_blue|bc_all;}
    	if( (getd(".bounty"+ getcharid(0) +"") / .wanted_increments) == 8 ){announce "["+ strcharinfo(0) +"] has killed ["+ rid2name(killedrid) +"]. "+ (Sex?"He":"She") +" has a bounty of: "+ .@a$ +" zeny! [ WANTED LEVEL *** ]",bc_blue|bc_all;}
    	if( (getd(".bounty"+ getcharid(0) +"") / .wanted_increments) == 7 ){announce "["+ strcharinfo(0) +"] has killed ["+ rid2name(killedrid) +"]. "+ (Sex?"He":"She") +" has a bounty of: "+ .@a$ +" zeny! [ WANTED LEVEL ** ]",bc_blue|bc_all;}
    	if( (getd(".bounty"+ getcharid(0) +"") / .wanted_increments) == 6 ){announce "["+ strcharinfo(0) +"] has killed ["+ rid2name(killedrid) +"]. "+ (Sex?"He":"She") +" has a bounty of: "+ .@a$ +" zeny! [ WANTED LEVEL * ]",bc_blue|bc_all;}
    	if( (getd(".bounty"+ getcharid(0) +"") / .wanted_increments) >= 1 && (getd(".bounty"+ getcharid(0) +"") / .wanted_increments) < 6 ){announce "["+ strcharinfo(0) +"] has killed ["+ rid2name(killedrid) +"]. "+ (Sex?"He":"She") +" has a bounty of: "+ .@a$ +" zeny! [ WANTED LEVEL "+ (getd(".bounty"+ getcharid(0) +"") / .wanted_increments) +" ]",bc_blue|bc_all;}
    	if( (getd(".bounty"+ getcharid(0) +"") / .wanted_increments) == 0 ){announce "["+ strcharinfo(0) +"] has killed ["+ rid2name(killedrid) +"]. "+ (Sex?"He":"She") +" has a bounty of: "+ .@a$ +" zeny!",bc_blue|bc_all;}
    	end;
    }
    

    This version has options to enable and disable certain things. This is the last version, i'm releasing.

  9. setarray .map$[0],"Guild Map 1","Guild Map 2","Guild Map 3"; //Replace with the name of the maps each guild owns
    setarray .guild[0],1,2,3; //Replace with the guild ids that belong to the corresponding guild maps.
    

    You should know all of this information already if your requesting this script.

  10. Okay so let me try to get this straight.

    1. This script works just fine.

    2. You want to know if it'll work when a player uses @warp to one of the guild maps?

     

    If this is so, then the answer to #2 is Yes. When a player uses @warp to the map, it should trigger the OnPCLoadMapEvent: which will make the script run.

     

    If what you're trying to do is remove the ability to use @warp to the map, then a mapflag needs to be added.

  11. Yea, I don't like the global vars either, but seeing as how most already used them, I figured might as well stick with the pattern.

    But thanks, I'll try this out later when I get home. And of course I'll post back with my success chance lol.

     

    Edit: This works perfectly. I believe with this, I can finally complete my script with a minimal annoyance of having to create duplicate NPCs, now just to figure out a decent algorithm to cycle through them all without getting lost on which one i'm on D:

  12. Basically I need a command, that acts like the command, *getareausers("<map name>",<x1>,<y1>,<x2>,<y2>);

    But instead of returning just the AMOUNT of players in the area, I need it to create an array, of those player's account ID's.

    *getareauserid("<map name>",<x1>,<y1>,<x2>,<y2>)
    Upon executing this command,
    
    $@areauseraid[0] is a global temporary number array which contains the account id of all users found in the specified area.
    $@areausercount is the number of users found in the specified area.
    

    This is basically how it would turn out. (Yes I borrowed the layout used for getpartymember and getguildmember commands).

  13. 
    

    - script On1956Dead -1,{

    OnNPCKillEvent:

    if( killedrid == 1956 ) && rand(100) < 10 )

    { getmapxy(.@m$,.@x,.@y,0); makeitem( .item[ rand( .item_size ) ],1,.@m$,.@x,.@y; }

    end;

    OnInit:

    setarray .item[0],18113,2016,1586,1395,1832,21001;

    .item_size = getarraysize( .item );

    end;

    }

    • Upvote 1
  14. Haha. I see. I figured as much. In the past with eA I had a command that would allow me to make npc duplicates via a script command. But sadly that code is lost. It allowed me to specify the w4, npc name and sprite I'd, while just duplicating an existing npc. So essentially it let me make a new one on the fly without the need to reloadscript, and the best part is they were temporary, so they vanished after a restart.

  15. 
    

    *makeitem <item id>,<amount>,"<map name>",<X>,<Y>;

    *makeitem "<item name>",<amount>,"<map name>",<X>,<Y>;

    This command will create an item on the specified cell of a map.

    As with any dropped items, the items created with this command will disappear after

    a period of time. Using an amount greater than 1 will create a single stack of the

    given amount, not multiple stacks of 1.

    Like 'getitem', it also accepts an 'english name' field from the database and creates

    Apples if the name isn't found.

    If the map name is given as "this", the map the invoking character is on will be used.

  16. I want to re-suggest this command. Mainly because, unitwarp + getnpcid is still very buggy.

     

    Some of things i've discovered is:

    1. If the NPC has an OnTouch label, it will not activate at the new location (provided that location is outside of it's original cells).

    2. The NPC doesn't recogize the new location as it's NEW location. It still holds all data to the original location marked in the script structure.

    3. If a player walks over the cells where an NPC used to be, that has an OnTouch label, it will try to activate that label and fail, by sending errors to the map server, stating that the corresponding NPC is no longer there.

     

    I'm sure there are a few more problems out there, but these are the ones i've found in the past couple days.

    So again, I would like to re-suggest an updated command to move an npc across maps without these bugs.

     

    This should be 100% possible, as I've had a src mod for eA a few years back that allowed me to create NPC duplicates on the fly as well as move the NPC across maps if I so choose to.

    • Upvote 1
×
×
  • Create New...