Jump to content

Question

Posted

i requests for guild npc.

 

this npc working like this,

 

guild leader buy a npc guild then only guildmate can use that npc.

if guild leader sell that npc, another guild can buy that npc.

I want this npc can duplicate.

12 answers to this question

Recommended Posts

Posted

Try this one, bear with my laziness xD i didn't include many dialogues. 

-    script    Sample::test    -1,{
    if ( !getcharid(2) ) end;
    if ( !$@guild_owner && getcharid(2) ) {
        if ( getguildmaster( getcharid(2) ) != strcharinfo(0) ) end;
        mes .npc$;
        mes "Buy me for " +.prize_of_npc+ " zeny.";
        next;
        mes .npc$;
        if ( Zeny < .prize_of_npc )
            mes "You don't have enough zeny";
        else 
            Zeny -= .prize_of_npc;
        $@guild_owner = getcharid(2);
        announce "[" +getguildname($@guild_owner)+ "] guild bought me for " +.prize_of_npc+ " zeny!",0;
        close;
    }
    
    if ( getcharid(2) != $@guild_owner ) {
        mes .npc$;
        mes "This npc is not dedicated on your guild";
        close;
    }
    
    mes .npc$;
    mes "What you want me to do master?";
    next;
    switch(select("Heal Me:No thanks:" +(getguildmaster($@guild_owner)==strcharinfo(0)?"Sell me":""))) {
        case 1: percentheal 100,100; break;
        case 2:    break;
        case 3: mes .npc$;
                mes "Done!";
                Zeny += .prize_of_npc;
                announce getguildmaster($@guild_owner)+ " sell me. Someone buy me!",0;
                $@guild_owner = 0;
                break;
        default: debugmes "Error on NPC " +.npc$; break;
    }
    
    OnInit:
        .prize_of_npc = 20;
        .npc$ = strnpcinfo(1);
        end;
}
prontera,150,150,0    duplicate(test)    Sample    100
prontera,153,153,0    duplicate(test)    Sample    100

Configuration :

.prize_of_npc = 20; // price of npc
.npc$ = strnpcinfo(1); // npc name

When guild bought the npc, You can add more benefit here. On my example i only have heal benefit, i add also the "sell me" choice when talking to the npc :

switch(select("Heal Me:No thanks:" +(getguildmaster($@guild_owner)==strcharinfo(0)?"Sell me":"")))
  • Upvote 1
Posted

sorry patskie , it about duplicate.

i donno how to explain so i give 

 

 

i want to function the same npc, but who differ duplicate,
 
have two guild npc
 
Prontera and payon
 
Guild X buy guild npc at Prontera
Guild Y can not buy it but Guild Y can buy guild npc at payon because no one is buying it.



btw your script is working  /kis2
Posted

My npc uses a global temporary variable ( $@guild_owner ). If you plan to make multiple npc's with same function but you want it in a way that other guild can buy the other npc's. Just change the guild_owner to anything ( $@guild_owner1 , $@guild_owner2 ) and so on

Posted

so you mean like this ?

 

-    script    Sample::test    -1,{
    if ( !getcharid(2) ) end;
    if ( !$@guild_owner1 && getcharid(2) ) {
        if ( getguildmaster( getcharid(2) ) != strcharinfo(0) ) end;
        mes .npc$;
        mes "Buy me for " +.prize_of_npc+ " zeny.";
        next;
        mes .npc$;
        if ( Zeny < .prize_of_npc )
            mes "You don't have enough zeny";
        else 
            Zeny -= .prize_of_npc;
        $@guild_owner = getcharid(2);
        announce "[" +getguildname($@guild_owner1)+ "] guild bought me for " +.prize_of_npc+ " zeny!",0;
        close;
    }
    
    if ( getcharid(2) != $@guild_owner1 ) {
        mes .npc$;
        mes "This npc is not dedicated on your guild";
        close;
    }
    
    mes .npc$;
    mes "What you want me to do master?";
    next;
    switch(select("Heal Me:No thanks:" +(getguildmaster($@guild_owner1)==strcharinfo(0)?"Sell me":""))) {
        case 1: percentheal 100,100; break;
        case 2:    break;
        case 3: mes .npc$;
                mes "Done!";
                Zeny += .prize_of_npc;
                announce getguildmaster($@guild_owner1)+ " sell me. Someone buy me!",0;
                $@guild_owner = 0;
                break;
        default: debugmes "Error on NPC " +.npc$; break;
    }
    
    OnInit:
        .prize_of_npc = 20;
        .npc$ = strnpcinfo(1);
        end;
}
prontera,150,150,0    duplicate(test)    Sample    100
prontera,153,153,0    duplicate(test)    Sample    100

 

 

 

 
or just change at 

prontera,150,150,0    duplicate(test)    Sample    100,{ getguildname("$@guild_owner",1) }
prontera,153,153,0    duplicate(test)    Sample    100,{ getguildname("$@guild_owner",2) }

 

Posted

What i mean is that stick with my script with post#2. What i want you to do is to create another text file on npc folder and change $@guild_owner to $@guild_owner1 since the first script is already using it. You can't stick to $@guild_owner because it is a global variable

Posted (edited)

@Paktskie

Suggestion : HMm , can u make the npc timed/rented??

I mean if GUILD X buy it for like maybe 8 CastleDrop the npc would be thier npc as long as they can pay it.. Maybe for 5 days.
That way the guild will do their best to win woe..
Failure to Pay the rent will make them lose the npc :) , and maybe a delay like 1day before they can buy another..

Hope this isn't that much trouble.

Edited by NexusXVI
Posted

Try this one, bear with my laziness xD i didn't include many dialogues. 

-    script    Sample::test    -1,{
    if ( !getcharid(2) ) end;
    if ( !$@guild_owner && getcharid(2) ) {
        if ( getguildmaster( getcharid(2) ) != strcharinfo(0) ) end;
        mes .npc$;
        mes "Buy me for " +.prize_of_npc+ " zeny.";
        next;
        mes .npc$;
        if ( Zeny < .prize_of_npc )
            mes "You don't have enough zeny";
        else 
            Zeny -= .prize_of_npc;
        $@guild_owner = getcharid(2);
        announce "[" +getguildname($@guild_owner)+ "] guild bought me for " +.prize_of_npc+ " zeny!",0;
        close;
    }
    
    if ( getcharid(2) != $@guild_owner ) {
        mes .npc$;
        mes "This npc is not dedicated on your guild";
        close;
    }
    
    mes .npc$;
    mes "What you want me to do master?";
    next;
    switch(select("Heal Me:No thanks:" +(getguildmaster($@guild_owner)==strcharinfo(0)?"Sell me":""))) {
        case 1: percentheal 100,100; break;
        case 2:    break;
        case 3: mes .npc$;
                mes "Done!";
                Zeny += .prize_of_npc;
                announce getguildmaster($@guild_owner)+ " sell me. Someone buy me!",0;
                $@guild_owner = 0;
                break;
        default: debugmes "Error on NPC " +.npc$; break;
    }
    
    OnInit:
        .prize_of_npc = 20;
        .npc$ = strnpcinfo(1);
        end;
}
prontera,150,150,0    duplicate(test)    Sample    100
prontera,153,153,0    duplicate(test)    Sample    100

Configuration :

.prize_of_npc = 20; // price of npc
.npc$ = strnpcinfo(1); // npc name

When guild bought the npc, You can add more benefit here. On my example i only have heal benefit, i add also the "sell me" choice when talking to the npc :

switch(select("Heal Me:No thanks:" +(getguildmaster($@guild_owner)==strcharinfo(0)?"Sell me":"")))

sir im getting error on this part >> Zeny -= .prize_of_npc;

Join the conversation

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

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...