Jump to content

meko

Core Developers
  • Content Count

    363
  • Joined

  • Days Won

    46

Posts posted by meko


  1. -	script	AutoVIP	FAKE_NPC,{
    
    OnPCLoginEvent:
    	// save the original group
    	@ACTUAL_GROUP = getgroupid();
    
    	// check if the player was never a VIP
    	if (##VIP_UNTIL < 1) {
    		// give the free VIP status
    		##VIP_UNTIL = gettimetick(2) + .free_vip_length;
    	}
    
    	// check if the player is currently a VIP
    	if (##VIP_UNTIL > gettimetick(2)) {
    		// move the player to the VIP group until logout
    		setgroupid(.vip_group);
    
    		// notify the player
    		dispbottom("You are a VIP player.");
    
    		// schedule a timer to revert the group on expiration
    		addtimer((##VIP_UNTIL - gettimetick(2)) * 1000, strnpcinfo(0) + "::OnExpire");
    	}
    
    	// check if the player was a VIP but it expired while away
    	else if (##VIP_UNTIL > 1) {
    		goto OnExpire;
    	}
    end;
    
    OnExpire:
    	if (##VIP_UNTIL <= gettimetick(2)) {
    		// revert to the original group
    		setgroupid(@ACTUAL_GROUP);
    
    		// notify the player
    		dispbottom("Your VIP status expired. You are now a normal player.");
    
    		// update the variable
    		##VIP_UNTIL = 1;
    	}
    end;
    
    
    
    /////////// Configuration below
    OnInit:
    	.vip_group = 1; // the ID of your VIP group
    	.free_vip_length = (((60 * 60) * 24) * 5); // the length of the free VIP period (5 days)
    }

     


  2. Offline as in only available on the computer you are currently using? Hercules, by default, already binds to localhost (127.0.0.1) so there's no extra configuration required: no need to open ports anywhere, no need to register a domain name, no need to get a VPS. Just follow the official instructions: README.md

     

    BTW, since you are on Windows 10, you don't have to install that oh-so-bulky Visual Studio, you can just enable the Windows Subsystem for Linux (WSL) and follow the Linux installation instructions instead of the Windows ones.


  3. The rAthena documentation does NOT apply to Hercules. Please refer to the Hercules documentation when using Hercules. If you seek support for rAthena instead, please use the rAthena forums.

     

    Hercules currently does not support this script command, and there is no Pull Request implementing it.

     

    Also, your syntax in Script<> is wrong


  4. Try this:

    function	script	loot_crate	{
    	.@index = getarrayindex(getarg(0));
    	.@size = getarraysize(getarg(0));
    
    	for (.@i = .@index; .@i < .@size - .@index; .@i += 3) {
    		for (.@e = 0; .@e < getelementofarray(getarg(0), .@i + 2); ++.@e) {
    			.@loot[.@count++] = .@i;
    		}
    	}
    
    	.@rand = .@loot[rand(.@count)];
    	getitem(getelementofarray(getarg(0), .@rand), getelementofarray(getarg(0), .@rand + 1));
    
    	announce(sprintf("Player %s obtained %ix %s from a loot crate!"
    			strcharinfo(PC_NAME),
    			getelementofarray(getarg(0), .@rand + 1),
    			getitemname(getelementofarray(getarg(0), .@rand))),
    		getarg(1, bc_all));
    
    	return true;
    }

     

    And in your NPC do something like this:

    MAP,X,Y,DIR	script	NAME	SPRITE,{
    
    	mes("Hello");
    	next();
    	loot_crate(.rewards, bc_all);
    	mes("Goodbye!");
    	close;
    
    OnInit:
    	setarray(.rewards,
    		// Item,           Amount, Chance
    		Yggdrasilberry,    1,      60,
    		Portable_Furnace,  1,      10,
    		Spectacles,        1,      10,
    		Seed_Of_Yggdrasil, 1,      10,
    		Poison_Bottle,     1,      5,
    		Silver_Coin,       1,      5);
    }

     


  5. the macro I posted WILL remain the same, but I added a ternary operator (if ? then : else) to it so it will check with is_boss() and have different behaviour accordingly, just like what you wanted

    if you want the check outside of macros, then make a 2nd one and when invoked do something like is_boss(src) ? macro1 : macro2


  6. This is unrelated to Hercules, please contact the phpMyAdmin team instead:
    https://www.phpmyadmin.net/support/

     

    BTW, this is just an encoding error: make sure you set the charset in your Content-type HTTP header and use a matching charset client-side in a <meta> tag. If that's too complicated, just use a desktop SQL client:


  7. you have a syntax error in your if statements: the condition(s) must be enclosed within parentheses.

     

    if (gettime(4) == 5) && (gettime(3) >= 1745)

    should be:

    if ((gettime(4) == 5) && (gettime(3) >= 1745))

     

    also, you should use constants instead of passing 3 or 4 to gettime()

×
×
  • Create New...

Important Information

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