Jump to content

meko

Core Developers
  • Content Count

    363
  • Joined

  • Days Won

    46

Posts posted by meko


  1. You could spawn your monster with the monster() command to get its GID, and then periodically (like every 100ms) check for nearby units using the getunits() command. If a unit is found that matches your criteria (ie type being MOB or PC) you kill it using unitkill() and you can make it spawn a new one after a timeout to begin the cycle again.

    If you want something simpler look for NPC_SELFDESTRUCTION in the mob skill db


  2. -	script	@request	32767,{
    OnCall:
    	if (gettimetick(2) <= @COMMAND_LOCK[getnpcid(0)] && !has_permission(PERM_RECEIVE_REQUESTS)) {
    		dispbottom(sprintf("You must wait at least %i seconds to call this command again.", .delay));
    	} else {
    		@COMMAND_LOCK[getnpcid(0)] = gettimetick(2) + .delay; // update the lock
    		atcommand("@request " + implode(.@atcmd_parameters$[0], " ")); // call the true command
    	}
    	end;
    
    OnInit:
    	.delay = 10; // number of seconds to wait in between calls
    	bindatcmd("request", strnpcinfo(NPC_NAME) + "::OnCall", 99, 99, 0); // bind the custom atcommand
    	add_group_command("request", 0, true, false); // allow group 0 to use the custom atcommand
    	add_group_command("request", 1, true, false); // allow group 1 to use the custom atcommand
    	add_group_command("request", 2, true, false); // allow group 2 to use the custom atcommand
    	add_group_command("request", 3, true, false); // allow group 3 to use the custom atcommand
    	add_group_command("request", 4, true, false); // allow group 4 to use the custom atcommand
    	add_group_command("request", 10, true, false); // allow group 10 to use the custom atcommand
    	// ^ add or remove groups to match your groups.conf
    }


    In the OnInit section change .delay to the amount of seconds to wait and add your groups to the add_group_command() lines if any is missing.
    Any group that has the "receive_requests" permission will bypass the delay entirely.

     

    Relevant documentation:


  3. Instead of adding dynamic mob modes I would suggest a more flexible approach: a new script command that allows to change mob data at any given time so you could do

    -	script	DayNight	FAKE_NPC,{
    OnClock0600:
    	day();
    
    	// make Poring passive at daytime
    	setmonsterinfo(PORING, MOB_MODE, 
    		getmonsterinfo(PORING, MOB_MODE) &~ 0x4);
    	end;
    
    OnInit:
    	// setting correct mode upon server start-up
    	if (gettime(GETTIME_HOUR) >= 6 && gettime(GETTIME_HOUR) < 18) {
    		end;
    	}
    
    OnClock1800:
    	night();
    
    	// make Poring aggressive at night
    	setmonsterinfo(PORING, MOB_MODE, 
    		getmonsterinfo(PORING, MOB_MODE) | 0x4);
    	end;
    }

     

    If this is desirable please fill an issue here and I will add it when I get some time: https://github.com/HerculesWS/Hercules/issues/new


  4. Hercules does support packet shuffling and you can use pretty much any client with it; Hercules will automatically rearrange the packets based on the client version.

     

    About Hercules vs. rAthena, see the already existing topics:

    (there's many, many more but I won't list them all)

     

    Hercules is focused on performance and stability while rAthena is mostly focused on features and content.
    The two scripting engines and database formats are similar but incompatible, this means you will need to do some conversion.


  5. right before using unitskill() you could call getmapxy() with GID of the mob. If the GID is not found the command will return -1 (while it returns 0 on success). If it returns -1 you would then call deletearray() to remove it from the array while shifting; You can also use the array manipulation function, namely array_shift()

     


  6. It really depends on what you wish to accomplish. Do you want to do it from a plugin or from scripts? Do you want the effect to be centered on the player or on another unit (mob,npc, ...)? Do you want all players in the area to see it or only one player?

     

    From a plugin you would simply push to the event queue, while from script you would use addtimer() or npc timers in combination with specialeffect().
     

    	@timed_effect = EF_HITDARK; // set a PC variable with the effect to use
    	addtimer(500, strnpcinfo(NPC_NAME) + "::OnTimedEffect"); // set the trigger to 500ms in the future
    	end; // terminate execution
    
    OnTimedEffect:
    	specialeffect(@timed_effect, AREA, playerattached()); // show the effect to everyone in the area, centered on the attached player
    	end;

     


  7. I guess you meant (x,y) of a cell but if you really want an ID (of map->cell[]) you would do (x + y * map->list[m].xs).

    If you just want x,y then you don't need to do anything fancy since skill_castend_pos2 already has access to x,y


  8. @greenieken It seems you didn't read my post at all...

     

    specialeffect2 is the easiest to convert because its behaviour is predicable, unlike misceffect, which depends on attached oid/rid.

     

    In your case, specialeffect2(EF_BEGINSPELL6) could be converted to specialeffect(EF_BEGINSPELL6, AREA, playerattached()). However, I see you call it from the OnAgitStart event, which does not have an attached rid so even your specialeffect2() shouldn't have worked before... And the vanilla script did not use specialeffect2 either. The correct command to use here is simply specialeffect(EF_BEGINSPELL6);

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.