• 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

Heres the code for Mages (Feel free to change the formula to change how much it heals and to change it to health if you want it for knights)

Code:
 function onUse(cid, item, fromPosition, itemEx, toPosition)
              local level = getPlayerLevel(cid)
              local mag = getPlayerMagLevel(cid)
          local manamin = (level/2.5)+(mag*2)
          local manamax = (level/2)+(mag*2)
          local mana_add = math.random(manamin, manamax)


                      if (getPlayerVocation(cid) == 1 or 5) then
                              doPlayerAddMana(cid, mana_add)
                              doSendAnimatedText(topos, mana_add, TEXTCOLOR_LIGHTBLUE)
                              doSendMagicEffect(topos, CONST_ME_MAGIC_GREEN)
                      else
                              doPlayerSendCancel(cid, "You cannot use this rune")
                              doSendMagicEffect(topos, CONST_ME_POFF)
      end
              return FALSE
                      end
 
Last edited:
Type of Script: action

Priority: fast/medium

Reason of Request: Last script in my server.. After this is done my server is online

Public/Private: Public

Description: Place 2 items and pull lever and teleport player.
Example:
A player places 1 item on tile XYZ and another item on tile XYZ
The player stands on tile XYZ
The lever is pulled.
The items are removed.
The player is teleported.

screeniewdd.jpg


A picture of how i mean.


+Rep if you can help. I know here are already aciton scripts like this but only for 1 item.. can't get it working for 2.

Thanks
 
Type of Script: action
Priority: normal
Reason of Request: The problem is: I can open the box without killing the monster. The monster is alive and still I can open the box to receive the amulet.
Description: You must kill the monster to open the box.
*Public

"You must kill the monster to open the box."

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
-- Script by BomBa
 if getPlayerGroupId(cid) <= 1 then
  if getPlayerStorageValue(cid, 026610) <= 0 then
   if ((getCreatureName(cid) == "Ghoul") and (isInRange(getCreaturePosition(cid), {x=90, y=149, z=8}, {x=96, y=155, z=8}) == TRUE)) then
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You must kill the monster to open the box.")
     else
      doPlayerAddItem(cid, 2661, 1)
       doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You opened the box and won an amulet.")
        setPlayerStorageValue(cid, 026610, 1)
        end
       else
      doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "This is empty.")
     end
    else
   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are not a common player.")
  end
 return TRUE
-- Script by BomBa
end

The problem is:
I can open the box without killing the monster. The monster is alive and still I can open the box to receive the amulet.

I think I have to replace the 'cid' by another function. But what?
 
Added to first post, will complete soon.



Any error messages? More info please.

Code:
[24/06/2009 02:12:28] Lua Script Error: [Spell Interface] 
[24/06/2009 02:12:28] data/spells/scripts/whirlwind exori.lua:onCastSpell

[24/06/2009 02:12:28] data/spells/scripts/whirlwind exori.lua:10: attempt to call global 'getWeaponType' (a nil value)
[24/06/2009 02:12:28] stack traceback:
[24/06/2009 02:12:28] 	data/spells/scripts/whirlwind exori.lua:10: in function <data/spells/scripts/whirlwind exori.lua:9>
The script is supposed to shoot effects like the exori hur ones and it checks if you use axe, club or sword
 
talkactions/talkactions.xml:
Code:
<talkaction words="power" event="script" value="angelpower.lua"/>

talkactions/scripts/angelpower.lua
Lua:
function onSay(cid, words, param, channel)
	if(getPlayerStorageValue(cid, 63452) == 1) then
		setPlayerStorageValue(cid, 63452, 2) --can't do again--
		doPlayerAddSpentMana(cid, getPlayerRequiredMana(cid, getPlayerMagLevel(cid, ignoreBuffs))) --recieving power-- 
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have recieved my power.") --recieving message
	return true
	else
	return false
	end
end

movements/movements.xml

Code:
	<movevent type="StepIn" itemid="426" event="script" value="angelpower.lua"/>
	<movevent type="StepOut" itemid="426" event="script" value="angelpower.lua"/>
NOTE: there is already an action for 426, please combine both the scripts or choose another tile.

movements/angelpower.lua
Lua:
function onStepIn(cid, item, pos)
	if(item.actionid == 5435) then
		if(isPlayer(cid) and getPlayerStorageValue(cid, 63452) < 1) then
			setPlayerStorageValue(cid, 63452, 1) --tile storage--
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "If you require my power please say \"power\".") --talkaction message--
	end
		if(isPlayer(cid) and getPlayerStorageValue(cid, 63452) == 2) then
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Away with you! You have recieved my power already!") --Already completed message--
		end
	return true
end
end

function onStepOut(cid, item, pos)
		if(isPlayer(cid) and getPlayerStorageValue(cid, 63452) < 2) then
		setPlayerStorageValue(cid, 63452, 0) --left without answering--
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "I see. Come back to harness my power another time!")
	end
	return true
end

Not exactly as requested but its close and I'm tired. Its poorly written but I tested in 3.4pl2 and it works.

Thx! it does work, + rep :).

the only thing is that is about the tile, how could combine them? and what tile should be the best to use? because now im using the 414ID and every time u walk out from start location from temple you get the message, -.-'

how to combine?
 
@up will update script to work with 414

EDIT: check link in second post, the newest movement script should work.
 
Last edited:
Kill Monster Chest

Not Tested:

Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
 if getPlayerGroupId(cid) < 1 then
  if getPlayerStorageValue(cid, 026610, -1) then
   if (getCreatureName(cid) == "Ghoul") and (isInRange(getCreaturePosition(cid), {x = 90, y = 149, z = 8}, {x = 96, y = 155, z = 8}) == TRUE) then
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You must kill the monster to open the box.")
     else
      doPlayerAddItem(cid, 2661, 1)
       doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You opened the box and won an amulet.")
        setPlayerStorageValue(cid, 026610, 1)
        end
       else
      doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "This is empty.")
     end
    else
   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are not a common player.")
  end
 return TRUE
end
 
Last edited:
2 Item Teleporter

Not Tested:
Credits to JBD for base code

Lua:
  function onUse(cid, item, fromPosition, itemEx, toPosition)

firstID = ITEMID          -- id of the first item
secondID = ITEMID         -- id of the second item
newPOS = {xxx,yyy,z}      -- player teleported too...

local piece1pos = {

        x = xxx,
        y = yyy,    -- Poition of the first item
        z = z,

stackpos=1}
local piece2pos = {

        x = xxx,
        y = yyy,    -- Poition of the second item
        z = z,

stackpos=1}
local getpiece1 = getThingfromPos(piece1pos)
local getpiece2 = getThingfromPos(piece2pos)
local playerpos = getPlayerPosition(cid)
        if getpiece1.itemid == firstID and getpiece2.itemid == secondID or getpiece1.itemid == secondID and getpiece2.itemid == firstID then
                if item.itemid == 1945 then
                        doTransformItem(item.uid,item.itemid+1)
                elseif item.itemid == 1946 then
                        doTransformItem(item.uid,item.itemid-1)
                end
                doRemoveItem(getpiece1.uid,1)
                doRemoveItem(getpiece2.uid,1)
                doSendMagicEffect(piece1pos,2)
                doSendMagicEffect(piece2pos,2)
				doTeleportThing(cid, newPOS)
                doSendMagicEffect(playerpos, CONST_ME_TELEPORT)
                end
        else
                doPlayerSendTextMessage(cid, 22, "You need " .. getItemArticleById(firstID) .. " "..getItemNameById(firstID).." and " .. getItemArticleById(secondID) .. " "..getItemNameById(secondID)..".")
        return TRUE
end
 
Type of Script: action
Priority: normal
Reason of Request: The problem is: I can open the box without killing the monster. The monster is alive and still I can open the box to receive the amulet.
Description: You must kill the monster to open the box.
*Public



Well heres the way i did it.

Ghoulkill.lua
Code:
function onKill(cid, target)

local config = { 
monstername = "Custom Ghoul name", -- monster name 
needeedkills = 1, -- kills needed to complete quest 
finalstorage = 10002, -- storage of completed quest 
} 

	if(isMonster(target) == TRUE) then 
            if getCreatureName(target) == config.monstername then 
                if getPlayerStorageValue(cid, config.finalstorage) == 1 then
                   	doSendMagicEffect(toPos, 12) 
                      else
                doCreatureSay(cid, "You killed "..config.monstername..", Your now able to get your award.", TALKTYPE_ORANGE_1) 
                   setPlayerStorageValue(cid,config.finalstorage,1) 
	end
	return TRUE
end
   end
      end

GhoulChest.lua
Code:
function onUse(cid, item, frompos, item2, topos)
				if getPlayerStorageValue(cid, 10002) == -1 then
			doPlayerSendTextMessage(cid,22,"You have found a Scarf.")
   			doPlayerAddItem(cid,2661,1)
			setPlayerStorageValue(cid, 10002,1)
		else
			doPlayerSendTextMessage(cid,22,"It is empty.")
		end   
           end
 
Type of Script: Talkaction

Priority:
Low, no rush.

Reason of Request: Its driving me nuts that I cant make it work propely ^_^ I guess you can :thumbup: It's also a must for my project but also for me, in order to learn/improve my lua scripting.

Description: Everything is in this post: http://otland.net/f132/summon-single-creature-rep-36507/#post369093. The code is "partially" done in that thread, but not completely as I need it (as mentioned in that linked post), so you only need to do half of the coding and not necessarily from scratch :)

Public/Private: Public.

About what you ask in return, no problems with either of those. I always +Rep when Im helped and in my "being worked on" server's website one of the first things I added was a "Credits" sub-page where people can see the proper credits (others's or mines) for everything done in the server. If everyone did that the *OT* world would be a better place IMHO :thumbup:

Anyways, no rush. Ill subscribe this thread to be able to check for responses more efficiently. Great job with this service, just keep it up and dont let it die too soon like others who've tried it in the past ;)

Cheers~
 
Last edited:
@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
 
Edit:
My script starts in the fluid_of_blood.LUA:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
-- Script by BomBa
 local ITEM_ = getThingfromPos({x=102, y=148, z=8, stackpos=STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE})
  local ITEM__ = getThingfromPos({x=105, y=150, z=8, stackpos=STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE})
   local ITEM___ = getThingfromPos({x=102, y=153, z=8, stackpos=STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE})
    if itemEx.uid == 36150 then
     if ((ITEM_.itemid == 2047) and (ITEM__.itemid == 2320) and (ITEM___.itemid == 2041)) then
      doRemoveItem(ITEM__.uid, 1)
       doTransformItem(ITEM_.uid, 2048, 1)
        doTransformItem(ITEM___.uid, 2042, 1)
       doTeleportThing(cid, {x=96, y=152, z=8}, TRUE)
      setPlayerStorageValue(cid, 126610, 1)
     else
    doPlayerSendCancel(cid, "Put the items in the correct places.")
   end
  end
 return TRUE
-- Script by BomBa
end
Code:
<action uniqueid="39410" event="script" value="other/fluid_of_blood.lua"/>

Now the player needs to kill the monster undead_man__box.LUA:
Code:
function onDeath(cid, corpse, lastHitKiller, mostDamageKiller)
 if getCreatureName(cid) == "Undead Man" then
  doCreatureSay(cid, "Ahhh! do not open the boxes!!!", TALKTYPE_ORANGE_1)
   local target = getPlayerByNameWildcard(getCreatureName(mostDamageKiller))
   setPlayerStorageValue(target, 226610, 1)
  end
 return TRUE
end
Code:
registerCreatureEvent(cid, "UndeadManBox")
Code:
<event type="death" name="UndeadManBox" event="script" value="undead_man__box.lua"/>
Code:
<script>
  <event name="UndeadManBox"/>
 </script>

After killing the monster, the player can open the box rookgaard_scarf.LUA:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
 if getPlayerStorageValue(cid, 226610) == 1 then
  if getPlayerStorageValue(cid, 326610) == -1 then
   doPlayerAddItem(cid, 2661, 1)
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a Scarf.")
     setPlayerStorageValue(cid, 326610, 1)
      else
      doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.")
     end
    else
   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You must kill the monster to open the box.")
  end
 return TRUE
end
Code:
<action uniqueid="26610" event="script" value="quests/rookgaard_scarf.lua"/>

but I don't receive the item... shows the msg:
You must kill the monster to open the box.


Where are the error? storages? please re-make the scripts...
 
Last edited:
I'd like a script that does the following:

-If you kill a monster called "Tormented Soul", the global storage value 1000 is set to 0.

I just can't seem to get it to work <.<

Thanks in advance,
//Kokokoko
 
[UP]

Lua:
local config = {
    bossname = "Tormented Soul",
    globalStorage = 1000,
    setTo = 0
}

function onDeath(cid, corpse, killer)
    if config.bossname == getCreatureName(cid) then
        if getGlobalStorageValue(config.globalStorage) >= 1 then 
            setGlobalStorageValue(config.globalStorage, 0)
        end	
    end
    return TRUE
end
 
I tryed to do a script idk what is the script type but i think after u see this post u will know.
A ring that add's mana.
When a player wield/wear the ring his mana will be increased by 25%.
Like if the player mana is 1000 when he wield/wear it his mana is 1250.
 
Back
Top