Jump to content
Sign in to follow this  
Tassadar

Fairy exp, and mob drop question

Recommended Posts

Hello, I was wondering what I need to add / change to have the players fairy receive a % of experience from each npc the player kills?

How do I add a chance of more than 1x of a specific item to drop from a mob/chest? For instance, say I wanted to add kals to DW chest, and instead of just having them drop 1 kal, they would drop anywhere from 1 to 10 kals, and have them placed in temp bag? 

I see where its handled in  exp_and_level.lua 


local dead_id = GetChaID(dead)
            local mob = {}
        mob[715] = {ItemDrop = 3457, Quantity = 1, Quality = 4,  Rate = .5}    --50% drop
        mob[716] = {ItemDrop = 3457, Quantity = 1, Quality = 4,  Rate = .5}    --50% drop
        mob[717] = {ItemDrop = 3457, Quantity = 1, Quality = 4,  Rate = .5}    --50% drop
            if mob[dead_id] ~= nil then
                if Percentage_Random(mob[dead_id].Rate) == 1 then
                GiveItemX ( atk, 0, mob[dead_id].ItemDrop, mob[dead_id].Quantity , mob[dead_id].Quality)
                BickerNotice ( atk, "Received a Kal Runestone! Check your Temp Bag.")
            end
        end    

Share this post


Link to post
Share on other sites

not sure what do you want but you can try like this
 

local dead_id = GetChaID(dead)
            local mob = {}
        mob[715] = {ItemDrop = 3457, Quantity = 1, Quality = 4,  Rate = .5}    --50% drop
        mob[716] = {ItemDrop = 3457, Quantity = 1, Quality = 4,  Rate = .5}    --50% drop
        mob[717] = {ItemDrop = 3457, Quantity = 1, Quality = 4,  Rate = .5}    --50% drop
            if mob[dead_id] ~= nil then
                if Percentage_Random(mob[dead_id].Rate) == 1 then
				mob[dead_id].Quantity = math.random(1,10) -- 1 to 10
                GiveItemX ( atk, 0, mob[dead_id].ItemDrop, mob[dead_id].Quantity , mob[dead_id].Quality)
                BickerNotice ( atk, "Received a Kal Runestone! Check your Temp Bag.")
            end
        end    

or you can use like this
   mob[715] = {ItemDrop = 3457, Quantity = 10, Quality = 4,  Rate = .5}   
mob[dead_id].Quantity = math.random(1,Quantity) -- 

Edited by mkhzaleh

Share this post


Link to post
Share on other sites

you can't killl npc but if you mean kill a monster 
use this small lua function
 

function fairyexp(Player, Fairy)
	local FairyEXP = GetItemAttr(Fairy, ITEMATTR_ENERGY)
	local FairyMaxEXP = GetItemAttr(Fairy, ITEMATTR_MAXENERGY)
	FairyEXP = FairyEXP + 1
	if GetItemAttr(Fairy, ITEMATTR_URE) > 49 then
		if FairyEXP >= FairyMaxEXP then
			FairyEXP = FairyMaxEXP
		end
		
		SetItemAttr(Fairy, ITEMATTR_ENERGY, FairyEXP)
	end
end

function GetExp_New(dead , atk  )
	local DeadMonster = GetChaID(dead)
	if DeadMonster == 66 then 
		local Fairy = GetChaItem(atk, 2, 1)
		if Fairy == nil then
			return 
		end
		local FairyType = GetItemType(Fairy)
		local chance = math.random(1, 100)
		if FairyType == 59 then
			if chance >= 50 then
				fairyexp(atk, Fairy)
				BickerNotice(atk, "Fairy EXP: Fairy Received x [1] EXP ")
			end
			

		end
	end
end

 

  • Thanks 1

Share this post


Link to post
Share on other sites

where does the server usually handle fairies gaining exp over time/ how would I disable it, so that fairies will only get exp if the player kills monsters?

 

Share this post


Link to post
Share on other sites

sorry, where in all of this does it handle getting exp over time?   what would I need to comment out, to disable it? 

function cha_timer(role, freq, time) 
tempEffect(role, 7531)
tempEffect(role, 7532)
tempEffect(role, 7533)
tempEffect(role, 7537)
tempEffect(role, 7538)
tempEffect(role, 7539)
tempEffect(role, 7540)
tempEffect(role, 7541)
tempEffect(role, 7542)
tempEffect(role, 7543)
	local resume_freq = 5 
	local now_tick = GetChaParam(role, 1) 
	local is_role_living = -1

	SetChaParam(role, 1, now_tick + freq * time) 
	--hp回复
	if math.mod(now_tick, resume_freq) == 0 and now_tick > 0 then 
		if is_role_living == -1 then
			is_role_living = IsChaLiving(role)
		end
		if is_role_living == 1 then 
			Resume(role)
		end 
	end		
				
		local Saiyan = GetEquipItemP( role, 7 ) -- Hat 0
		local Saiyan_ID = GetItemID ( Saiyan )
		if(Saiyan_ID == 5879) 
		then
			local statelv = 1
			local statetime = 3600
			AddState ( role , role , SAIYAN , statelv , statetime ) 
		--	SystemNotice( role , "SAIYAN Activated")
		else
			local state_SAIYAN = GetChaStateLv ( role , SAIYAN )
			if state_SAIYAN ~= 0 then
	--		SystemNotice( role , "Saiyan Title Removed.")
				RemoveState ( role , SAIYAN )
			end			
				end				
		local SaiyanNeck = GetEquipItemP( role, 7 )
		local SaiyanNeck_ID = GetItemID ( SaiyanNeck )
		if(SaiyanNeck_ID == 5878)then
			local statelv = 1
			local statetime = 3600
			AddState ( role , role , Dbz , statelv , statetime ) 
	--		SystemNotice( role , "Saiyan Effect Activated")
		else
			local state_Dbz = GetChaStateLv ( role , Dbz )
			if state_Dbz ~= 0 then
		--		SystemNotice( role , "Saiyan Effect removed.")
				RemoveState ( role , Dbz )
			end			
				end	

				
		local target = GetChaFirstTarget(role)
		local pet_bg = GetChaItem ( role , 2 , 3 )
		local pet_id = GetItemID ( pet_bg )
		if pet_id == 7024 then
	AddState ( role , role , STATE_TELF , 1 , 3600 )
	RefreshCha(role)
	else
		local statelv_STATE_TELF = GetChaStateLv ( role , STATE_TELF )
		if statelv_STATE_TELF ~=0 then
		RemoveState ( role , STATE_TELF )
	end
end
			if pet_id == 7022 then
		AddState ( role , role , STATE_LELF , 1 , 3600 )
	RefreshCha(role)
	else
		local statelv_STATE_LELF = GetChaStateLv ( role , STATE_LELF )
		if statelv_STATE_LELF ~=0 then
		RemoveState ( role , STATE_LELF )
	end
end
		if pet_id == 7023 then

		AddState ( role , role , STATE_DELF , 1 , 3600 )
		RefreshCha(role)
		else
			local statelv_STATE_DELF = GetChaStateLv ( role , STATE_DELF )
	if statelv_STATE_DELF ~=0 then
		RemoveState ( role , STATE_DELF )
	end
	
	local Level = GetChaAttr( role , ATTR_LV )	
 if math.mod(now_tick, 3600) == 0 and now_tick > 0 and Level > 109 then	
    local cha = TurnToCha ( role )
    local rad = math.random ( 1, 1 )
    if rad == 1 then
    SystemNotice ( cha , "Obtained Online Chest for being online for 1 hour.")
    GiveItem ( cha , 0 , 7828 , 1 , 4 )
 
         end
			end
end


	local pet_freq = 60 
	--宠物消耗
	local Item_Elf = GetChaItem ( role , 2 , 1  )
	local Get_Elf_Type = GetItemType ( Item_Elf )

	if Get_Elf_Type == 59 then
		local ure_type = GetItemAttr( Item_Elf ,ITEMATTR_URE )       --体力
		if ure_type<=49 then
			SetChaKbItemValid2(role , Item_Elf , 0 , 1)			
		else
			SetChaKbItemValid2(role , Item_Elf , 1 , 1)			
		end
		local str = GetItemAttr( Item_Elf ,ITEMATTR_VAL_STR )       --力量
        	local con = GetItemAttr( Item_Elf ,ITEMATTR_VAL_CON )       --体质
        	local agi = GetItemAttr( Item_Elf ,ITEMATTR_VAL_AGI )       --专注
        	local dex = GetItemAttr( Item_Elf ,ITEMATTR_VAL_DEX )       --敏捷
        	local sta = GetItemAttr( Item_Elf ,ITEMATTR_VAL_STA )       --精神
		local Lv = str + agi + dex + con + sta
		if Lv > 27 then
			pet_freq = pet_freq + ( Lv - 27 ) * 5
		end
	end
	local sklv = GetChaStateLv ( role , STATE_JLJSGZ ) -----------------精灵加速果子双倍成长双倍消耗
	if  sklv~=0 then
		pet_freq =math.floor( pet_freq*0.5 )
	end	
	if math.mod(now_tick, pet_freq) == 0 and now_tick > 0 then 
		if is_role_living == -1 then
			is_role_living = IsChaLiving(role)
		end
		if is_role_living == 1 then   
			local Item_bg = GetChaItem ( role , 2 , 1  ) --取角色背包第二栏的指针
			--local Item = Item_bg      --取道具ID
			local Get_Item_Type = GetItemType ( Item_bg ) --调用程序接口获得Item道具类型
			local Item_siliao = GetChaItem ( role , 2 , 2  ) --取角色背包第三栏的指针
			local Item_siliao_ID = GetItemID ( Item_siliao ) --调用程序接口获得Item道具类型
			--SystemNotice ( role , "5 secs" )
			if Get_Item_Type == 59 then
				local Elf_URE = GetItemAttr( Item_bg ,ITEMATTR_URE )       --体力
				local Num_JLone = GetItemForgeParam ( Item_bg , 1 )
				local Part1_JLone = GetNum_Part1 ( Num_JLone )	--Get Num Part 1 到 Part 7
				if Elf_URE<=2550 and Item_siliao_ID==2312 then 
					local j = TakeItem(  role,0,2312,1)
					if j==0 then
						SystemNotice ( role , "Deleting of fairy ration failed!" )
					else
						Elf_URE = Elf_URE + 2500
						SystemNotice ( role , "Automatic feeding successful." )
						SetItemAttr ( Item_bg , ITEMATTR_URE , Elf_URE )
					end
				end
				local star_num = GetItemAttr( Item_bg ,ITEMATTR_VAL_FUSIONID )       --道具精炼信息有以记录精灵一笔的数量
				star_num=star_num+1
				if math.mod( star_num , 1) == 0 and Elf_URE>=50 and Part1_JLone==1 then
					GiveItemX ( role , 0 , 855 , 1 , 4 )										-------成长1点给一精灵硬币
				end
				if math.mod( star_num , 2) == 0 and Elf_URE>=50 and Part1_JLone~=1 then
					GiveItemX ( role , 0 , 855 , 1 , 4 )										-------成长2点给一精灵硬币
				end
				if math.mod( star_num , 30) == 0  and Elf_URE>=50 and Part1_JLone==1 then			-------成长30点给一精灵辉印一个
					GiveItemX ( role , 0 , 2588 , 1 , 4 )						
				end
				if math.mod( star_num , 60) == 0  and Elf_URE>=50 and Part1_JLone~=1 then			-------成长60点给一精灵辉印一个
					GiveItemX ( role , 0 , 2588 , 1 , 4 )						
				end
				if math.mod( star_num , 120) == 0  and Elf_URE>=50  then						-------成长120点给一精灵辉印一个
					GiveItemX ( role , 0 , 2588 , 1 , 4 )						
				end
				if math.mod( star_num , 1200) == 0  and Elf_URE>=50 then						-------成长1200点给精灵王辉印一个
					GiveItemX ( role , 0 , 2589 , 1 , 4 )						
				end
				if star_num==1200 then
					star_num=0
				end
				SetItemAttr ( Item_bg , ITEMATTR_VAL_FUSIONID , star_num )
				--SystemNotice ( role , " starts to deduct fairy stamina" )
				Take_ElfURE ( role , Item_bg , 1 , 0 )
				--SystemNotice ( role , "starts to calculate fairy growth" )
				Give_ElfEXP ( role , Item_bg , 1 , 0 )  --这里有问题
			end 
		end 
	end
end

 

Share this post


Link to post
Share on other sites

added the script.    and it didn't work.   tried
-- Give_ElfEXP ( role , Item_bg , 1 , 0 ) --这里有问题
and edmonscript error.

Share this post


Link to post
Share on other sites

you can't just copy past without read the code lol
image.png.8e9a965452451003894cdad455a84962.png
its random chance  and the example i gave above work for monster id " 66 "
you can edit it to what is fine for your files/server etc

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×