What's new

Exp Ring by me

Status
Not open for further replies.

Dragonas

Advanced User
Joined
Jul 11, 2009
Messages
321
Reaction score
18
Age
31
Oto co stworzy?em:
Code:
-- Dragonas --
local lvlmin = 70 --lvl minimum by uzyc
local lvlmax = 400 --lvl max by uzyc
local procent = 20 -- ile % wiecej ma byc expa
local exprate = 1 + (procent/100)
local effect = math.random(27, 32)
function onEquip(cid, item, slot) 
playerlvl = getPlayerLevel(cid)
playerpos = getPlayerPosition(cid)
if playerlvl >= lvlmin then
		if playerlvl <= lvlmax then
			doPlayerSetExperienceRate(cid, exprate)
			doPlayerSendTextMessage(cid,22,"Your Exp rate + "..procent.."%.")
			doSendMagicEffect(playerpos, effect)
		else
			doPlayerSendTextMessage(cid,22,"Your lvl is too big!")
		end
else
	doPlayerSendTextMessage(cid,22,"Your lvl is too low!")
	end
return true
end
function onDeEquip(cid, item, slot)
playerlvl = getPlayerLevel(cid)
playerpos = getPlayerPosition(cid)
if playerlvl >= lvlmin then
	doPlayerSetExperienceRate(cid, 1)
	doPlayerSendTextMessage(cid,22,"Extra exp ended.")
	doSendMagicEffect(playerpos, effect)
end
return true
end
Po jakim? czasie stwierdzi?em, ?e mnie chuj strzela i zapytam si? was tutaj co doda? do items.xml i movements.xml
Po ci??kiej prazy (rysunek ni?ej) wysz?o mi co? co nie dzia?a
nowyobrazmapabitowah.png

Code:
<!-- Exp Ring-->
<!-- ON -->
   <item id="7708" article="a" name="Experience ring">
        <attribute key="weight" value="80"/>
        <attribute key="slotType" value="ring"/>
        <attribute key="decayTo" value="0"/>
        <attribute key="duration" value="480"/>
        <attribute key="showduration" value="1"/>
	</item>
    <!-- OFF -->
    <item id="7697" article="an" name="experience ring">
        <attribute key="weight" value="80"/>
        <attribute key="slotType" value="ring"/>
		<attribute key="transformEquipTo" value="7708"/>
        <attribute key="stopduration" value="1"/>
        <attribute key="showduration" value="1"/>
    </item>
To doda?em do items.xml
Code:
	<movevent type="Equip" itemid="7697" slot="ring" event="function" value="onEquipItem"/>
	<movevent type="Equip" itemid="7708" slot="ring" event="script" value="exp_ring.lua"/><!-- EXPERIENCE RING IN USE-->
    	<movevent type="DeEquip" itemid="7708" slot="ring" event="script" value="exp_ring.lua"/> <!--  EXPERIENCE RING IN USE-->
I nie dzia?a ...
Opisz? co si? dzieje.
Jest sobie na pod?odze item o id 7697
Zak?adam go i dostaje exp o x % wi?kszy (item zamienia si? w id: 7708)
Potem go zdejmuje i k?ad? na pod?og?, a item nadal ma id 7708.... a powinien mie? 7697
ju? mnie to wkurza..
Wie kto? jak to naprawi??
 

Maniucza

Advanced User
Joined
Jan 18, 2009
Messages
374
Reaction score
57
Odp: Exp Ring by me

Witam, Do :
movevent.xml
PHP:
<movevent type="Equip" itemid="7697" slot="ring" event="function" value="onEquipItem"/>
<movevent type="Equip" itemid="7708" slot="ring" event="script" value="script.lua"/>
<movevent type="DeEquip" itemid="7708" slot="ring" event="script" value="script.lua"/>

Do items.xml
PHP:
   <item id="7708" article="a" name="Experience ring">
        <attribute key="weight" value="80"/>
        <attribute key="slotType" value="ring"/>
        <attribute key="decayTo" value="0"/>
        <attribute key="duration" value="480"/>
        <attribute key="showduration" value="1"/>
	</item>
    <item id="7697" article="an" name="experience ring">
        <attribute key="weight" value="80"/>
        <attribute key="slotType" value="ring"/>
		<attribute key="transformEquipTo" value="7708"/>
        <attribute key="stopduration" value="1"/>
        <attribute key="showduration" value="1"/>
    </item>

Pozdrawiam.
 
Last edited:

Dragonas

Advanced User
Joined
Jul 11, 2009
Messages
321
Reaction score
18
Age
31
Odp: Exp Ring by me

No w?a?nie nie...
Wiem, jest to tajemniczo dziwne, ale nie. Bo kiedy zdejm? ring, on nadal ma id 7708. Czyli id dzia?aj?cego ringa. I wtedy nawet gdy posiadam go w plecaku to on si? ko?czy. ;/

Prosz?, pom?? xD
 

Maniucza

Advanced User
Joined
Jan 18, 2009
Messages
374
Reaction score
57
Odp: Exp Ring by me

To spr?buj tak :
Items.XML
PHP:
	<item id="7708" article="a" name="Experience ring">
        <attribute key="weight" value="80"/>
        <attribute key="slotType" value="ring"/>
        <attribute key="decayTo" value="0"/>
        <attribute key="duration" value="480"/>
        <attribute key="showduration" value="1"/>
        <attribute key="transformEquipTo" value="7697"/>
    </item>
    <item id="7697" article="an" name="experience ring">
        <attribute key="weight" value="80"/>
        <attribute key="slotType" value="ring"/>
        <attribute key="transformEquipTo" value="7708"/>
        <attribute key="stopduration" value="1"/>
        <attribute key="showduration" value="1"/>
    </item>

A w Movevent.xml
PHP:
	<movevent type="Equip" itemid="7697" slot="ring" event="function" value="onEquipItem"/>
	<movevent type="DeEquip" itemid="7697" slot="ring" event="script" value="script.lua"/> 
	<movevent type="Equip" itemid="7708" slot="ring" event="script" value="script.lua"/>
	<movevent type="DeEquip" itemid="7708" slot="ring" event="script" value="script.lua"/>
 
Last edited:

Dragonas

Advanced User
Joined
Jul 11, 2009
Messages
321
Reaction score
18
Age
31
Odp: Exp Ring by me

Kurde znowu nic.

Mo?e ?atwiej zrobi? w skrypcie, ?e po zdj?ciu si? zmienia id z 7708 na 7697?

Edit:
Dla wyja?nienia:
Maniucza pom?g? mi na pw, wi?c ostatecznie u?y?em tego:
Code:
local rate = 1.2
function onEquip(cid, item, slot) 
    if(item.itemid ~= 7697) then     
    	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your exp rate + "..((rate - 1)*100).."%.") 
    	doPlayerSetExperienceRate(cid, rate) 
    	doTransformItem(item.uid, 7708 ) 
    	return true
    end  
    return true
end  
function onDeEquip(cid, item, slot) 
    if(item.itemid ~= 7708 ) then 
        return true
    end   
    doPlayerSetExperienceRate(cid, 1.0) 
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your extra experience rate has ended.") 
    doTransformItem(item.uid, 7697) 
    return true
end
movements.xml:
Code:
	<movevent type="Equip" itemid="7697" slot="ring" event="function" value="onEquipItem"/>
	<movevent type="Equip" itemid="7708" slot="ring" event="script" value="exp_ring.lua"/>
    	<movevent type="DeEquip" itemid="7708" slot="ring" event="script" value="exp_ring.lua"/>
items.xml:
Code:
<!-- Exp Ring-->
<!-- ON -->
   <item id="7708" article="a" name="Experience ring">
        <attribute key="weight" value="80"/>
        <attribute key="slotType" value="ring"/>
        <attribute key="decayTo" value="0"/>
        <attribute key="duration" value="480"/>
        <attribute key="showduration" value="1"/>
	</item>
    <!-- OFF -->
    <item id="7697" article="an" name="experience ring">
        <attribute key="weight" value="80"/>
        <attribute key="slotType" value="ring"/>
		<attribute key="transformEquipTo" value="7708"/>
        <attribute key="stopduration" value="1"/>
        <attribute key="showduration" value="1"/>
    </item>

Pozdrawiam, Dragonas
 
Last edited:
Status
Not open for further replies.
Top