• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Chris77's Scripting Services

-- Hello friend can you help me to fix this script??? i made this script to change max health player gain after EQUIP a armor, but this send this message when i put on armor slot, and dont add this to armor slot:

-- Message error on GAME after equip item:
Code:
you cannot dress this objecte there

-- See the MOVEMENTS:
Lua:
<movevent type="Equip" itemid="2508" slot="armor" event="script" value="kina_arm.lua" />
<movevent type="DeEquip" itemid="2508" slot="armor" event="script" value="kina_arm.lua" />

-- This my script:
Lua:
local config = {
        item1 = 2508 -- ID of armor
}

function onEquip(cid, item, slot)
        if getPlayerSlotItem(cid, CONST_SLOT_ARMOR).itemid == config.item then
                doPlayerSendTextMessage(cid, 25, "Health changed...")
                setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + 500)
                setCreatureMaxMana(cid, getCreatureMaxMana(cid) + 300)
        end
end

function onDeEquip(cid, item, slot)
        if getPlayerSlotItem(cid, CONST_SLOT_ARMOR).itemid == config.item then
                doPlayerSendTextMessage(cid, 25, "Health changed...")
                setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) - 500)
                setCreatureMaxMana(cid, getCreatureMaxMana(cid) - 300)
        end
end

-- This my item.xml
Lua:
<item id="2508" article="a" name="native armor">
		<attribute key="weight" value="5000"/>
		<attribute key="armor" value="1"/>
		<attribute key="slotType" value="body"/>
</item>

-- Can you solve this for me??? I need this for urgence... many thx for you, i'm will greatfull...

In order to fix your Script, you need to add
Code:
Return TRUE
otherwise it will cancel the script when you try and equip it.
 
<movevent event="Equip" itemid="2123" slot="ring" level="8" function="onEquipItem" script="cidade/mana ring.lua" />
<movevent event="DeEquip" itemid="2123" slot="ring" function="onDeEquipItem" script="cidade/mana ring.lua" />
_____________________________________________________________
local addmana = getCreatureMaxMana(cid)*2.5
local submana = getCreatureMaxMana(cid)/2.5

function onEquip(cid, item, slot)
setCreatureMaxMana(cid, addmana)
return TRUE
end
function onDeEquip(cid, item, slot)
setCreatureMaxMana(cid, submana)
return TRUE
end
_______________________________________________________________
</item>
<item id="2123" article="a" name="Mana Ring">
<attribute key="weight" value="100"/>
<attribute key="decayTo" value="0"/>
<attribute key="transformDeEquipTo" value="2123"/>
<attribute key="slotType" value="ring"/>
 
In order to fix your Script, you need to add
Code:
Return TRUE
otherwise it will cancel the script when you try and equip it.


--->>>>> If me add
Lua:
 return TRUE

--->>>>> Don't send ERROR on GAME, BUT the changes me want don't work...

--- Have someone to help me to fix????
 
Reward System : When we kill someone, we gain a BANANA.
Type Of Script : Action?
Priority : HIGH|
Reason: Because I cannot open my server without this script ;P
Public

Script from Jose Didn't work. Go see page 2-3 for his script
 
-- Hello friend can you help me to fix this script??? i made this script to change max health player gain after EQUIP a armor, but this send this message when i put on armor slot, and dont add this to armor slot:

-- Message error on GAME after equip item:
Code:
you cannot dress this objecte there

-- See the MOVEMENTS:
Lua:
<movevent type="Equip" itemid="2508" slot="armor" event="script" value="kina_arm.lua" />
<movevent type="DeEquip" itemid="2508" slot="armor" event="script" value="kina_arm.lua" />

-- This my script:
Lua:
local config = {
        item1 = 2508 -- ID of armor
}

function onEquip(cid, item, slot)
        if getPlayerSlotItem(cid, CONST_SLOT_ARMOR).itemid == config.item then
                doPlayerSendTextMessage(cid, 25, "Health changed...")
                setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + 500)
                setCreatureMaxMana(cid, getCreatureMaxMana(cid) + 300)
        end
end

function onDeEquip(cid, item, slot)
        if getPlayerSlotItem(cid, CONST_SLOT_ARMOR).itemid == config.item then
                doPlayerSendTextMessage(cid, 25, "Health changed...")
                setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) - 500)
                setCreatureMaxMana(cid, getCreatureMaxMana(cid) - 300)
        end
end

-- This my item.xml
Lua:
<item id="2508" article="a" name="native armor">
		<attribute key="weight" value="5000"/>
		<attribute key="armor" value="1"/>
		<attribute key="slotType" value="body"/>
</item>

-- Can you solve this for me??? I need this for urgence... many thx for you, i'm will greatfull...
 
Reward System : When we kill someone, we gain a BANANA.
Type Of Script : Action?
Priority : HIGH|
Reason: Because I cannot open my server without this script ;P
Public

Script from Jose Didn't work. Go see page 2-3 for his script

Code:
function onDeath(cid, corpse, killer)
	if isPlayer(killer) == TRUE then
	local item = doPlayerAddItem(killer, 2676, 1)
	end
	return TRUE
end
 
-- Hello friend can you help me to fix this script??? i made this script to change max health player gain after EQUIP a armor, but this send this message when i put on armor slot, and dont add this to armor slot:

-- Message error on GAME after equip item:
Code:
you cannot dress this objecte there

-- See the MOVEMENTS:
Lua:
<movevent type="Equip" itemid="2508" slot="armor" event="script" value="kina_arm.lua" />
<movevent type="DeEquip" itemid="2508" slot="armor" event="script" value="kina_arm.lua" />

-- This my script:
Lua:
local config = {
        item1 = 2508 -- ID of armor
}

function onEquip(cid, item, slot)
        if getPlayerSlotItem(cid, CONST_SLOT_ARMOR).itemid == config.item then
                doPlayerSendTextMessage(cid, 25, "Health changed...")
                setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + 500)
                setCreatureMaxMana(cid, getCreatureMaxMana(cid) + 300)
        end
end

function onDeEquip(cid, item, slot)
        if getPlayerSlotItem(cid, CONST_SLOT_ARMOR).itemid == config.item then
                doPlayerSendTextMessage(cid, 25, "Health changed...")
                setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) - 500)
                setCreatureMaxMana(cid, getCreatureMaxMana(cid) - 300)
        end
end

-- This my item.xml
Lua:
<item id="2508" article="a" name="native armor">
		<attribute key="weight" value="5000"/>
		<attribute key="armor" value="1"/>
		<attribute key="slotType" value="body"/>
</item>

-- Can you solve this for me??? I need this for urgence... many thx for you, i'm will greatfull...

loool why this *if getPlayerSlotItem(cid, CONST_SLOT_ARMOR).itemid == config.item then*
you already do that with *slot="armor"*


Lua:
function onEquip(cid, item, slot)
        doPlayerSendTextMessage(cid, 25, "Health changed...")
        setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + 500)
        setCreatureMaxMana(cid, getCreatureMaxMana(cid) + 300)
return TRUE
end

function onDeEquip(cid, item, slot)
        doPlayerSendTextMessage(cid, 25, "Health changed...")
        setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) - 500)
        setCreatureMaxMana(cid, getCreatureMaxMana(cid) - 300)
return TRUE
end
 
@up i notice you had difficulty so ill explain how to do it.

Heres all you were really missing.
Code:
function doPlayerAddSummon(cid, name, pos)  
    local MyCreature = doSummonCreature(name, pos)  
    doConvinceCreature(cid, MyCreature)
end

And

Code:
doPlayerAddSummon(cid, param, getCreaturePosition(cid))

Heres the full script:

Code:
function doPlayerAddSummon(cid, name, pos)  
    local MyCreature = doSummonCreature(name, pos)  
    doConvinceCreature(cid, MyCreature)
end

function onSay(cid, words, param, channel)

local level = 30
local mana = 200
local vocsCanUse = {1, 2, 3, 4, 5, 6, 7,8}
local condition = CONDITION_DRUNK
local canBeSummoned = {"Dog", "Troll", "Bug", "Fire Devil", "Fire Elemental"}

        if getPlayerLevel(cid) < level then
                doPlayerSendCancel(cid, "Your level is too low.")
                return TRUE
        end

        if getCreatureMana(cid) < mana then
                doPlayerSendCancel(cid, "You do not have enough mana.")
                return TRUE
        end

        if(not isInArray(vocsCanUse, getPlayerVocation(cid))) then
                doPlayerSendCancel(cid, "Your vocation cannot use this spell.")
                return TRUE
        end

        if getCreatureCondition(cid, condition) == FALSE then
                doPlayerSendCancel(cid, "You need to be drunked to use this spell.")
                return TRUE
        end

        if(not isInArray(canBeSummoned, param)) then
                doPlayerSendCancel(cid, "You cannot summon this creature.")
                return TRUE
        end
 
    doPlayerAddSummon(cid, param, getCreaturePosition(cid))
          doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_RED)
        return TRUE
end

Yep I could actually achieve the convince part (as stated in the post of the other thread), but the problem comes when I try to add a "max amount" of summons, it just doesnt work regardless what I do. Ive played around as much as possible with the function "getCreatureSummons(cid)" but I just cant get it to work properly with the script.

The closer it was to work was when the talkaction summoned 2 convinced creatures and if you tried to make a 3rd one it would, instead of just not summoning it like it should be, it would summon it like a monster (like doing /m with a God), which is a problem ;)

So again, the real problem is on the "max summons" part when mixed with the convince part, not only the convince one.

If you can manage to make a working script that mixes those that way, Id be grateful, but still already +Repped for the effort.

Cheers.
 
Last edited:
<movevent event="Equip" itemid="2123" slot="ring" level="8" function="onEquipItem" script="cidade/mana ring.lua" />
<movevent event="DeEquip" itemid="2123" slot="ring" function="onDeEquipItem" script="cidade/mana ring.lua" />

local addmana = getCreatureMaxMana(cid)*2.5
local submana = getCreatureMaxMana(cid)/2.5

function onEquip(cid, item, slot)
setCreatureMaxMana(cid, addmana)
end
function onDeEquip(cid, item, slot)
setCreatureMaxMana(cid, submana)
end

When i try to put the ring on ring slot it says:

You cannot dress this object here.

This script can be done by just using item attributes, you dont really require lua scripting.

Here are the steps (Im using ID 2179 which is Gold Ring in this example):

  1. Find in items.xml your desired item ID, in this case 2179 which looks like this:

    PHP:
    	<item id="2179" article="a" name="gold ring">
    		<attribute key="weight" value="100"/>
    		<attribute key="slotType" value="ring"/>
    	</item>

  2. Now we add a line with the respective attribute, in this case it is "maxmanapercent", so it would look like this:

    PHP:
    	<item id="2179" article="a" name="gold ring">
    		<attribute key="weight" value="100"/>
    		<attribute key="slotType" value="ring"/>
    		
    		<attribute key="maxmanapercent" value="125"/>
    	</item>

    (Notice it is 125 because 100 as value equals 100%, so if you wrote 25% it would cut it DOWN to 25% of the mana (1/4), but if you put it 125% it will raise the mana 25% more. This works for most "percent" based attributes, if not all)

  3. Now you only need to "register" the attribute by adding the item to movements.xml, adding these lines to that file:

    PHP:
    	<movevent type="Equip" itemid="2179" slot="ring" event="function" value="onEquipItem"/>
    	<movevent type="DeEquip" itemid="2179" slot="ring" event="function" value="onDeEquipItem"/>

  4. Now just save both files (items.xml and movements.xml) and restart the server. This is tested and works fine since it is just like any other item attribute.

Also notice that Im using TFS 0.3.2, which means the attribute I used is the one for my distro, it might work for yours but, in case it doesnt, you need to find the respective one (you can tell me the version you're using and Ill tell you the attribute you need, or you can use the tutorial in my signature to know how to do it yourself).

Cheers.
 
just add a storage value, if the storage value is maxed over 2 or so..then script returns false?

I tried it but I dont think Im doing it correctly, it always throws me something like "Unable to compare a number with a table" as an error in console. Im still pretty basic in lua knowledge :rolleyes:

As a side-note, wow 80 replies in 2 days, saw something like that coming thats why I said the last part of my first post ;) Its hard to keep up when making this type of threads. Good luck :thumbup:
 
Back
Top