Jump to content

jaBote

Members
  • Posts

    182
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by jaBote

  1. You can add it to an already existing NPC (any NPC script) or if you want you can make a new one with this code and then load it:

     

    -	script	GMdontwarptoGvG	-1,{
    
    OnPCLoadMapEvent:
    	getmapxy (.@map$,.@x,.@y,0);
    	if( getgmlevel() && (gemapflag(.@map$,"mf_gvg")) || (gemapflag(.@map$,"mf_gvg_noparty")) || (gemapflag(.@map$,"mf_gvg_castle")) || (gemapflag(.@map$,"mf_gvg_dungeon")) ) 
    		warp "SavePoint";
    	end;
    }
    
    mapname	mapflag	loadevent // Add this mapflag to every map that also has mapflag gvg of any kind AND you want this script to be run
    mapname2	mapflag	loadevent
    mapname3	mapflag	loadevent
    mapname4	mapflag	loadevent
    mapname5	mapflag	loadevent
    mapname6	mapflag	loadevent
    mapname7	mapflag	loadevent
    

    I personally would use a separate NPC.

     

    P.S.: Careful, the script I made on the other post has unbalanced brackets and that's an error, that piece of code won't run.

  2. Nope, I'll take the lead of Emistry and fix the little problem it had. This should work: instead of a map name check I've used a mapflag check:

     

    OnPCLoadMapEvent:
    getmapxy (.@map$,.@x,.@y,0);
    if( getgmlevel() && (gemapflag(.@map$,"mf_gvg") || (gemapflag(.@map$,"mf_gvg_noparty") || (gemapflag(.@map$,"mf_gvg_castle") || (gemapflag(.@map$,"mf_gvg_dungeon")) ) warp "SavePoint";
    end;
    
    
    mapname    mapflag   loadevent // Add this mapflag to every map that also has mapflag gvg of any kind AND you want this script to be run
    

     

    Try this one.

  3. In code boxes colors are not shown, but you have to change the 0x91 value on that line.

     

    Let's analyse it: 0x91 is the sum of 0x80 + 0x10 + 0x01 which means that mob can move (0x01), cast sensor (0x10) and that it can attack (0x80).

     

    So you'll have to sum the values of what you want the mob to do. If you want to make the mob to change target when it's in chase mode you'll have to sum that to the existing mode the mob has so you'll have to sum 0x91 + 0x400 which is 0x491 and place it on the mode column of the monster.

     

    Then save the file, @reloadmobdb (or restart the server if it doesn't work) and chew the new behavior of Mi Gao. Then see if it fits your needs or else experiment with the rest of the modes a mob can have.

     

    Hope it helped.

    • Upvote 1
  4. Well, for disabling renewal you can go to /src/config/renewal.h in your rAthena folder and comment out the definitions there. You just need to put a double slash (//) at the start of the definitions.

     

    You'll have the new maps once you compile your server (it doesn't matter if you put renewal or not). Unfortunately, for using the new monster and items you'll have to edit them yourself. As long as I know, any customization regarding that hasn't ever been made (please correct me Support Leaders if I'm wrong).

  5. Lo importante es que funciona. Y el problema con eso es que estás consumiendo una variable permanente de personaje, y tienes solo 256 a menos que lo edites en mmo.h. Además esa consulta SQL te puede servir para reproducir tu ranking en la web con PHP por ejemplo.

     

    Creo que voy a adoptar otra solución cuando haga otro servidor, porque voy a tener rankings incluso para morir xD

  6. No sé si he dado con lo que tenía que dar, parece que sí. Prueba a usar esto en tu casero desde PhpMyAdmin (o en tu servidor después de hacer un backup), que no puedo testearlo ahora mismo en un casero porque no dispongo de nadie con quien usarlo. Aun así un SELECT no debería nunca fastidiarte la base de datos:

    SELECT `char`.`name` AS `nombre`, `global_reg_value`.`value` AS `puntos`
    FROM `global_reg_value`
    LEFT JOIN `char` ON `global_reg_value`.`char_id` = `char`.`char_id`
    WHERE `global_reg_value`.`type` =3
    AND `global_reg_value`.`str` = 'punto'
    ORDER BY `puntos` DESC, `nombre` ASC
    LIMIT 10

    Una vez compruebes que funciona (¡Importante!) inserta dicha consulta en un NPC, la cual en una sentencia de scripting sería:

    query_sql "SELECT `char`.`name` AS `nombre`, `global_reg_value`.`value` AS `puntos` FROM `global_reg_value` LEFT JOIN `char` ON `global_reg_value`.`char_id` = `char`.`char_id` WHERE `global_reg_value`.`type` = 3 AND `global_reg_value`.`str` = 'punto' ORDER BY `puntos` DESC, `nombre` ASC LIMIT 10", .@nombre$, .@puntos;
    

     
    Y creo que ya sabrías qué hacer con los arrays .@nombre$ y .@puntos.

    Ahora cuando pruebes me cuentas. Malditos JOINs y su enrevesada sintaxis...

  7. Hay una consulta SQL que pueda hacerse desde la tabla `char` ampliada que pueda recoger los valores de los puntos otorgados, pero ahora mismo no doy con la tecla. Hay que pelearse con consultas SQL anidadas que sepan hacerlo o bien genera un web script que te las inserte.

     

    Voy a intentar buscar cómo se hacía para obtener esas 10 posiciones sin "trampa". Mientras tanto mantén activa la petición en scripting Support a ver si alguien logra encontrar la solución antes que yo. Simplemente para responder diciendo que no sirve di que no valía o algo.

  8. I've just replied you in the Spanish section of this forum. Didn't know you posted this when I already replied there, sorry. Check if that works and if not I'll improvise another solution.

  9. ¡Buenas! Siento tardar en la respuesta, pero ayer la tenía redactada al completo y se me borró justo cuando la iba a enviar, me enfadé porque la hice bastante completita. Soy consciente de que es una respuesta larga, pero además pretendo ser didáctico.

     

    (Antes de que lo que redacté durante alrededor de una hora se desvaneciera) Te propuse una segunda solución, mucho más sencilla y rápida de hacer pero menos elegante, la cual usé en mi último servidor sin ningún problema y me simplificaba muchísimo la creación de rankings. Además facilitaba también el visionado de los mismos rankings desde la propia web del servidor.

     

    Esta segunda solución pasa por crear un nuevo campo en la tabla `char`, de valor entero, el cual para este ejemplo llamaré `puntosranking`. Esto deberías hacerlo desde PhpMyAdmin con un usuario que tenga privilegios para alterar tablas de la base de datos que uses en el emulador (supongo que ya sabes que es la que por defecto se llama `ragnarok`). Entonces, deberías ejecutar esto en la base de datos `ragnarok`:

    ALTER TABLE `char` ADD `puntosranking` INT NOT NULL DEFAULT '0';
    

    Tranquilo, a menos que actualicen las bases de datos no tendrás nunca ningún problema con esto. Este es el primer motivo por el que no se trata de una solución elegante.

     

    Entonces ya con esto tienes las dos variables que necesitas (nombre y puntos) en la misma tabla, de tal manera que ya puedes olvidarte por completo de usar JOINs (que no es tan complicado pero a veces se las trae). Ahora necesitamos una consulta SQL que recoja la información que buscamos de la forma que queremos. Entonces podemos usar un SELECT básico para recoger los datos que queremos. En este caso la consulta sería:

    SELECT `name`, `puntosranking`
    FROM `char`
    ORDER BY `puntosranking` DESC, `name` ASC
    LIMIT 10
    

    La cual devuelve el nombre y los puntos del ranking almacenados en nuestra tabla, ordenada primero por puntos del ranking y en caso de empate se ordena alfabéticamente (podrías ordenarlo por account_id ascendente si quieres dar esa ventaja a los usuarios más viejos o incluso pasar de esta segunda ordenación, pero siempre conviene mantener un orden estricto en los resultados de las consultas). Ahora necesitamos implementarlo en una consulta SQL que pueda usar un NPC y recoger sus resultados. ¿Como? Suponiendo que sabes usar la estructura del script command query_sql, la cual es:

    query_sql "your MySQL query", <array variable> {,<array variable>, ...};
    

    Y teniendo cuidado de que la consulta se mantenga en una sola línea, nos queda:

    query_sql "SELECT `name`, `puntosranking` FROM `char` ORDER BY `puntosranking` DESC, `name` ASC LIMIT 10", .@nombres$, .@puntos;
    

    Donde .@nombres$ es un array que contiene los nombres de los 10 usuarios con más puntos y .@puntos es otro array que contiene sus respectivos puntos. Ya puedes usar esos arrays para lo que necesites a través de scripting.

     

    Pero... ¿cómo añades o restas puntos a un jugador si las variables permanentes de PJ normales no funcionan así? Pues estamos ante el otro motivo por el que tampoco esta solución es elegante. Hay que usar otra consulta SQL para esto (a menos que sepas modificar el source y usarlo directamente como variable de PJ, en cuyo caso te pediría que compartieras el resultado si puedes porque también lo necesitaría). Afortunadamente, las consultas SQL para añadir o restar puntos son sencillas y directas, aunque estas pueden ejecutarse solo a través de scripting desde el juego, si quieres hacerla directamente en la base de datos es más rápido hacerlas a través de PhpMyAdmin.

    query_sql "UPDATE `char` SET `puntosranking` = `puntosranking` + 1 WHERE `char_id` = " + getcharid(0) + " LIMIT 1";
    

    Esta consulta SQL añade un punto para el ranking al PJ desde el que se ejecute el script. Para variar la cantidad de puntos o añadir puntos a otros jugadores que no sea el que ejecuta el script el procedimiento es análogo.

     

    Supongo que sabiendo esto ya podrás integrarlo sin problemas en tus scripts.

     

    Si aún así prefieres la solución elegante, intentaré echarle un vistazo. ¡Un saludo!

    • Upvote 1
  10. Well, it should be possible. First you save all item attributes on temporary variables some way (I'm right now thinking of using getrefine and getequipcardid function, and if you wanna save the element too you'll need to search for a coincidence by using getinventorylist) and on fail you just do the failedrefitem then a getitem2 with the same item but with the same refine -1.

     

    I don't know if I have explained myself, or if you need the script done, but that's what I thought you need to do on the refiner script. Then you'll obviously have to modify the dialogue or the refiner would surely say they destroyed the item.

  11. Capuche said that if you change that in the first line of the announcer script and add the loadevent mapflag to the pvp_arena2 map you can solve your error. The announcer is indeed a script of a NPC. An invisible one, though.

  12. Por defecto se guarda siempre la última posición del PJ, a menos que el mapa tenga activado el mapflag nosave. En tal caso al reloguear el servidor te envía de vuelta a tu savepoint.

     

    Por favor, observa que en ninguno de los scripts que tengas con efecto en tu nuevo mapa haya presencia del mapflag nosave, o que no hayas hecho modificación al source para que todos los mapas sean nosave excepto los que tú marques personalmente.

     

    Podías eliminar el mapflag nosave del mapa (en caso de que estuviera activo) sin necesidad de reiniciar el servidor ni crear un script que lo instale yendo como GM al mapa en cuestión y ejecutando "@mapflag nosave 0", (sin comillas), que elimina el mapflag nosave del mapa.

  13. It's quite difficult to explain these here. Just look up the item ID or name and you can help yourself on editing them by seeing the item bonuses you can grant by seeing /trunk/doc/item_bonus.txt You can also use some script commands, but it's more advanced.

     

    No client hexing required. At most you should alter the description of the item in your client side to make it reflect what you have made, but it's optional.

     

    You can refer to the custom item addition on the Wiki (you can read between lines there and know how to edit item bonuses), the item_bonus.txt and the script_commands.txt (it's for more advanced items as I said) to get more information, which is all the information you need.

  14. If only Skoegul is active and you want to warp to prt_guild 122, 240 then you should:

    //Changing only the Prontera location
    setarray .region_x[0],122, 0, 0, 0, 0, 0, 148;
    setarray .region_y[0],240, 0, 0, 0, 0, 0, 163;
    

    and then reload the script.

     

    You can easily change the x and y coordinates each day (for sending people near the active castle of the day), but the problem is when you want to provide an option to warp to 2 different castles in the same region on the same day.

     

    If I were you and you want to code yourself a warper, I'd code a separate NPC because of not having to cope with a system NOT thought for warping to 2 places the same day (you'd need to do a fairly heavy modification of the script) and for making your code. It's quite simple and fast to code that NPC in that way providing you know (or want to know, it's a quite simple one!) some basic scripting.
     

×
×
  • Create New...