[System/Function] Town Reputation

Oxxy

New member
Messages
142
Points
0
Location
Estonia, Tallinn
Emulator
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.

Code:
// ==== 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;
}
 
Last edited by a moderator:
@@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.
default_smile.png


 
Back
Top