Jump to content
Oxxy

[System/Function] Town Reputation

Recommended Posts

Script that I made a while ago, was thinking about creating somekind of reputation system. For example, if you complete quests in Prontera town, you add "Prontera reputation" and then you can make interesting scripts. Its up to your imagination.

// ==== Author: Oxxy
// ==== Version: 1.0.1
// ==== Changelog:
// ==== Version 1.0.0: First Release.
// ==== Version 1.0.1: Fixed script little bit.

// ==== Increases Player's <Town> reputation by <value>
// ==== Syntax is: CallFunc("getRep", "<Town>", <value>);
function    script    getRep    {
    .@Town$ = getarg(0);
    .@rep = getarg(1);
    setd(.@Town$+"_rep"), getd(.@Town$+"_rep") + .@rep;
    return;
}

// ==== Check if player meets <value> reputation requirement of <Town> reputation.
// ==== Syntax is: CallFunc("CheckRep", "<Town>", <value>);
// ==== Returns 0 if Town's name reputation lower than required reputation.
// ==== Returns 1 if Town's name reputation greater or equal to required rep.
function    script    checkRep    {
    .@Town$ = getarg(0);
    .@neededRep = getarg(1);
    set @townRep$, getd(.@Town$+"_rep");
    
    if(@townRep$ < .@neededRep)
        return 0;
    
    if(@townRep$ >= .@neededRep)
        return 1;
    
    return;

}

// ==== Decreases Player's <Town> reputation
// ==== First argument is Town's name (i.e Prontera)
// ==== Second argument is the amount of town's reputation you want to decrease by.
// ==== Third argument means if you want to delete all the reputation of the town <Town>, to delete all the reputation set it to 1.
// ==== Syntax is: CallFunc("delRep", "<Town>", <value>, "<1:0>");
function    script    delRep    {
    .@Town$ = getarg(0);
    .@amount = getarg(1);
    .@del_all = getarg(2);
    
    if(.@del_all)
        setd(.@Town$+"_rep"), 0;
    else
        setd(.@Town$+"_rep"), getd(.@Town$+"_rep") - .@amount;
        
    if(getd(.@Town$+"_rep") - .@amount < 0)
        setd(.@Town$+"_rep"), 0;
        
    return;
}

// ==== Shows Player's <Town> reputation
// ==== Syntax is: CallFunc("showRep", "<Town>");
function    script    showRep    {
    .@Town$ = getarg(0);
    .@townRep = getd(.@Town$+"_rep");    
    dispbottom "Your "+.@Town$+" town reputation is "+.@townRep;    
    return;
}
Edited by Oxxy

Share this post


Link to post
Share on other sites

@@Oxxy no script ? 

What kind of script do you want? That's actually basic system that allows you to manage reputation stuff. It's up to you where you want to use it :-) You can create Town-related quests that require specific amount of reputation before you can do them, or you can make shops which won't sell anything you before you reach Town's reputation amount X. :)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

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