Jump to content
  • 0

Specific Npc Script [HELP :D]


Question

Posted

Dear community,

I want a Npc on which the castle owner (guild leader) of prtg_cas01 can click on an Npc on which he can obtain specific item with a random chance :)

 

Can anyone help me? :D

7 answers to this question

Recommended Posts

Posted

Try this one player can only talk to npc if WOE is not activated : 

prontera,150,150,0    script    Sample    100,{
    query_sql "SELECT `guild_id` FROM `guild_castle` WHERE `castle_id` = 15",@gid;
    set .@chance, 30; // 30% chance
    setarray .@items[0],4001,4002,4003; // <item id>
    set .@size, getarraysize(.@items);
    set .@random, rand(.@size);
    
    if ( !getcharid(2) || !@gid || agitcheck() || agitcheck2() ) end;
    if ( (@gid == getcharid(2)) && (getguildmaster(getcharid(2)) == strcharinfo(0)) ) {
        if ( rand(100) < .@chance ) 
            getitem .@items[.@random], 1;
    }
    end;
}
Posted

the script doesn´t work :/

Maybe you can show error if any? 

 

1. 

prontera,150,150,0<TAB>script<TAB>Sample<TAB>100,{

2. The guild master can get the item in a chance of 30%

 

Anyway this works fine on my test server.

Posted

Either no guild or no castle owner of prtg_cas01 or woe is starting. When this is true then the script will end.

if ( !getcharid(2) || !@gid || agitcheck() || agitcheck2() ) end;
 
Posted
if( getcharid(0) == getguildmasterid( getcastledata( "prtg_cas01",1 ) ) ){
	// get item ....
}
end;

you dont have to run sql command to retrieve the guild id ...

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...