Jump to content

Euphy

Members
  • Posts

    2997
  • Joined

  • Last visited

  • Days Won

    73

Posts posted by Euphy

  1. From what I remember, something gets buggy when you move NPCs onto different maps in runtime. It's already possible with 'unitwarp':

    unitwarp getnpcid(0),"<map name>",<x>,<y>;
    A core dev could probably explain this better, though.
    • Upvote 1
  2. Is it possible to make players join to the #main channel by default when they log in?

    -	script	#channel_autojoin	-1,{
    OnPCLoginEvent:
    	atcommand "@join #main";
    	end;
    }

    It would be also nice if the status of #<channels> would be stored for every player (joined / not joined), but this is only a nice-to-have :)

    I don't know what you mean by this.
  3. I don't understand this part.

    Every variable in `mapreg` is directly available, as you've noticed. They server gets them from the database when it boots, stores them in RAM, and periodically queries them all back into the database (or else you'd lose all your data on a reboot). Having a large number of variables (e.g. thousands) may cause your server to lag. You can read more here: http://www.eathena.ws/board/index.php?s=9d7dbd4ba43d6eed7e2903043c4a97b7&showtopic=181741&view=findpost&p=1478950

    What's wrong if I store it as a string? it a big deal? The reason I'm doing that is because I'm also going to add the option to buy the map... Making it permanent...

    It's fine to store strings as strings, but you were storing integers as strings. That'll either give you errors or be a waste of processing (as the server will try to convert it to an integer anyway).

    Also, another thing... I cant figure out how to use OnPCLoadMapEvent

    Read about it in trunk/doc/script_commands.txt. You need to set the mapflag "mf_loadevent" on the map in order for the label to trigger.
  4. Oh, if you're only using a single map then mapreg will suffice.  (We like to avoid mapreg when using lots of variables because all permanent global variables auto-save in regular intervals.)

     

    You're using the variable correctly - just note that gettimetick(2) is in seconds, not days, and that you shouldn't be storing it as a string.

    A sample:

    	if (gettimetick(2) < $rentexpire) {
    		mes (($renter_guild)?getguildname($renter_guild):"No guild")+" currently owns the map.";
    		if ($renter_guild && getcharid(2) == $renter_guild) {
    			mes "Would you like to warp there?";
    			next;
    			if(select("Yes!:No.") == 1)
    				warp "map",x,y;
    			close;
    		}
    		close;
    	} else {
    		mes "Ownership by the "+getguildname($renter_guild)+" has expired.";
    		if (!getcharid(2)) {
    			mes "You must be part of a guild to rent this map.";
    			close;
    		}
    		mes "Do you want to rent this map?";
    		next;
    		if(select("Yes!:No") == 2) {
    			mes "See you later.";
    			close;
    		}
    		//your requirements
    		if (gettimetick(2) < $rentexpire) {
    			mes "Sorry, but another guild has rented this map.";
    			close;
    		}
    		set $renter_guild, getcharid(2);
    		set $rentexpire, gettimetick(2) + 2678400;
    		mes "Map rented successfully to the "+getguildname($renter_guild)+" guild for 31 days.";
    		mes "Enjoy!";
    		close;
    	}
    • Upvote 1
  5. I would suggest using a separate database; they're not that difficult to create, consume less resources, and are guaranteed to be persistent to server shutdowns.

    Concept:

    • Create a database with columns for guild, time, and (if applicable) map name.
    • Have an NPC (or function) query the database to check if the user's guild is the owner prior to warping.  I'd include code to delete expired entries here, as well.
    • If there is no owner, ask if the player wants to rent; if yes, and all conditions are met (cost, re-check ownership, etc.), insert an entry into the database (guild, current time + 1 month, map).
    • (optional) Use an OnPCLoadMapEvent trigger to remove unwanted players from the map.

    'gettimetick(2)' retrieves the system time in UNIX epoch time (in seconds).  Not really applicable for this unless you want to use UNIX time instead of a DATETIME data type.

  6. We're in the final stages of testing right now -- the mechanics are nearly finished, but we still have to make sure that our changes don't affect Pre-Renewal servers.

    • Upvote 1
  7. Only 'npcskill', which you could create an OnTouch label for:

    *npcskill <skill id>,<skill lvl>,<stat point>,<NPC level>;

    *npcskill "<skill name>",<skill lvl>,<stat point>,<NPC level>;

    This command causes the attached NPC object to cast a skill on the attached

    player. The skill will have no cast time or cooldown. The player must be

    within the default skill range or the command will fail silently.

    The "stat point" parameter temporarily sets all NPC stats to the given value,

    and "NPC level" is the temporary level of the NPC (used in some skills).

    Neither value can be greater than the max level defined in config, and will

    not work properly if the NPC has a mob sprite.

    // Casts Level 10 Heal on the attached player, calculated with

    // all stats 99 and base level 60.

    npcskill "AL_HEAL",10,99,60;

×
×
  • Create New...