Jump to content
Sign in to follow this  
Sultan

[Guide] How to make Buff Ticket or NPC

Recommended Posts

[Guide] How to make Buff Ticket or NPC

  • Simple Function (Example):

Go to functions.lua and put this function inside there:

function AddBuffs(role)
AddState (role, role, STATE_XLZH, 10, 180)
AddState (role, role, STATE_SHPF, 10, 180)
AddState (role, role, STATE_MLCH, 10, 180)
AddState (role, role, STATE_FZLZ, 10, 180)
AddState (role, role, STATE_JSFB, 10, 180)
AddState (role, role, STATE_TSHD, 10, 180)

BickerNotice(role,'You are buffed for 3 min(s)!')
RefreshCha(role)
end

 

  • Using it as an item:

Go to ItemEffect.lua and put this function inside there:

function ItemUse_BuffTicket(role, Item)
	local Cha_Boat = 0
    Cha_Boat = GetCtrlBoat ( role )
    if Cha_Boat ~=  nil then
        SystemNotice( role , "Can not be used at sea" )
        UseItemFailed ( role )
        return
    end

	-- use function:
	AddBuffs(role)
end

 

Do ItemInfo line inside ItemInfo.txt and compile (Replace '####' with Item ID number):

####    Buff Potion    n1480    10130001    0    0    0    0    0    0    31    0    0    0    0    0    1    1    1    1    99    1    4000    -1,-2,-2,-2    0    -1,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2    0    0    -1,-2,-2,-2,-2,-2,-2,-2,-2,-2    -1,-2,-2,-2,-2,-2,-2,-2,-2,-2    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0,0    0,0    0,0    0,0    0,0    0,0    0,0    0,0    0,0    0,0    0,0    0,0    0,0    0,0    0,0    0,0    0,0    0,0    0,0    0,0    0,0    0,0    0    0,0    0,0    0    0    0    0    0    0    0    0    0    ItemUse_BuffTicket    0    0    0    0,0    0    0    Double click on it to get full buffs for 3 minutes.    0

 

  • Using it as an NPC:

Go to MissionSdk.lua (Resource/script/) and search for:

elseif actions[i].func == ReAll then

 

You will find:

elseif actions[i].func == ReAll then

	PRINT( "ActionProc:ReAll" )

	ReAll( character )


Under it, add this:
elseif actions[i].func == AddBuffs then

	PRINT( "ActionProc:AddBuffs" )

	AddBuffs( character )


Finally, Go to NPCScript01~ and place this NPC function:
function Buff_NPC()
InitTrigger()
TriggerCondition( 1, KitbagLock, 0 )
TriggerCondition( 1, HasMoney, 10000 ) -- Has 10k gold
TriggerAction( 1, TakeMoney, 10000 ) -- Take 10k gold
TriggerAction( 1, AddBuffs ) -- Add buffs
TriggerFailure( 1, JumpPage, 2 )

Talk( 1, 'Buffer: Hello! I am Buffer. I can grant you full buffs for just 10,000G!' )
Text( 1, 'Full Buffs!', MultiTrigger,GetMultiTrigger(),1)

Talk( 2, 'Buffer: You do not have enough Fairy Coins or inventory is locked!' )
end

 

Edited by Sultan

Share this post


Link to post
Share on other sites

I know OP already has something like this, but just for other people who wants
to remove the hardcoded 3 minutes.

function AddBuffs(role, min)
AddState (role, role, STATE_XLZH, 10, min*60)
AddState (role, role, STATE_SHPF, 10, min*60)
AddState (role, role, STATE_MLCH, 10, min*60)
AddState (role, role, STATE_FZLZ, 10, min*60)
AddState (role, role, STATE_JSFB, 10, min*60)
AddState (role, role, STATE_TSHD, 10, min*60)

BickerNotice(role,'You are buffed for '..min..' min(s)!')
RefreshCha(role)
end

So ideally, you can invoke

AddBuff(role, 10) // for 10 minutes
//or
AddBuff(role, 3) // for 3 minutes

 

  • Like 2

kong.png

a2.png

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.

Sign in to follow this  

×
×
  • Create New...