Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/31/16 in all areas

  1. There are multiple ways to approach this. I personally find it easier to make a global variable containing all your values, and then having the NPCs access the array. For example: prontera,151,183,0 script NPC1 77,{ dispbottom "Variable 1: " + $npc_values[0]; end; } prontera,153,183,0 script NPC2 77,{ dispbottom "Variable 2: " + $npc_values[1]; end; } prontera,155,183,0 script NPC3 77,{ dispbottom "Variable 3: " + $npc_values[2]; end; } prontera,157,183,0 script NPC4 77,{ dispbottom "Variable 4: " + $npc_values[3]; end; } - script yourscript_main -1,{ end; OnInit: cleararray $npc_values, 0, 50; setarray $npc_values, 1, 2, 3, 4; // Shuffle the array for (.@i = getarraysize($npc_values) - 1; .@i > 0; .@i--) { .@j = rand(.@i + 1); .@temp = $npc_values[.@i]; $npc_values[.@i] = $npc_values[.@j]; $npc_values[.@j] = .@temp; } end; } This is handy if you plan on duplicating your NPCs, such as: prontera,151,183,0 script NPC#0 77,{ .@id = atoi(strnpcinfo(2)); dispbottom "Variable " + (.@id + 1) + ": " + $npc_values[.@id]; end; } prontera,153,183,0 duplicate(NPC#0) NPC#1 77 prontera,155,183,0 duplicate(NPC#0) NPC#2 77 prontera,157,183,0 duplicate(NPC#0) NPC#3 77 - script yourscript_main -1,{ end; OnInit: cleararray $npc_values, 0, 50; setarray $npc_values, 1, 2, 3, 4; // Shuffle the array for (.@i = getarraysize($npc_values) - 1; .@i > 0; .@i--) { .@j = rand(.@i + 1); .@temp = $npc_values[.@i]; $npc_values[.@i] = $npc_values[.@j]; $npc_values[.@j] = .@temp; } end; } If you plan on shuffling the arrays often, you can use the following custom script command: // script.c BUILDIN_FUNC(shufflearray) { struct script_data* data; const char* name; struct map_session_data* sd = NULL; int array_size, i, j; int32 id; void * temp_val; // Copy-paste from getarraysize data = script_getdata(st, 2); if (!data_isreference(data)) { ShowError("buildin_shufflearray: not a variable\n"); script_reportdata(data); script_pushnil(st); st->state = END; return SCRIPT_CMD_FAILURE;// not a variable } name = reference_getname(data); id = reference_getid(data); if (not_server_variable(*name)) { sd = script_rid2sd(st); if (sd == NULL) return SCRIPT_CMD_SUCCESS;// no player attached } array_size = script_array_highest_key(st, sd, reference_getname(data), reference_getref(data)); // Start shuffling the array for (i = array_size - 1; i > 0; i--) { j = rand() % (i + 1); temp_val = get_val2(st, reference_uid(id, i), reference_getref(data)); script_removetop(st, -1, 0); set_reg(st, sd, reference_uid(id, i), name, get_val2(st, reference_uid(id, j), reference_getref(data)), reference_getref(data)); script_removetop(st, -1, 0); set_reg(st, sd, reference_uid(id, j), name, temp_val, reference_getref(data)); } return SCRIPT_CMD_SUCCESS; } // def BUILDIN_DEF(shufflearray,"r"), and use it as follow: - script yourscript_main -1,{ end; OnInit: cleararray $npc_values, 0, 50; setarray $npc_values, 1, 2, 3, 4; shufflearray $npc_values; end; } If you need something more specific, you'll have to give us more details xD
    2 points
  2. Lmaoo yehhh they used to be such a nuisance. They've killed me soo many times Aa LMAO Thank you! And, Last update of the year~ Being mobbed is dangerous, but at least Darius has a knife... right...? See what happens in the new strip of PP&P! https://tapastic.com/episode/550943 **Also, a quick notice: the comic will be taking a short break and will return with regular updates on Jan 20th 2017. See ya then! **
    1 point
  3. Probably need to port forward the ports to the server host.
    1 point
  4. nevermind i found it already =,=...(i just search stuff on github) here is the answer: under: rathena/src/map/clif.h change this line: MAX_PACKET_VER = 55, to MAX_PACKET_VER = 56,// or what version you like
    1 point
  5. Implemented in Git Hash: 7a011ec.
    1 point
  6. I am not speak Spanish, but in my opinion Hercules is better than rAthena only in your stable and src configs, u can use de plugins if you choose hercules! And system protection is the same as rAthena. However rAthena has more customizations, if you like more themes for fluxcp, or a lot of options for scripts, rAthena is better! It's just my opinion, I use Hercules and rAthena ^^ Depends what do you want, but if you know use commands, u can choose any See you
    1 point
×
×
  • Create New...