• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Releasing some of my fun War System. Ranks, Kill Streaks, Bonus Additions.

Blood BlvD Ot

Member
Joined
Jun 12, 2010
Messages
243
Reaction score
7
Ok so I was gonna start a fun War Server with some neattoo additions to it.. But ofcourse I'm not going to go on with it cuz I got bored with it lol.
So I thought that some people may be able to take some of the ideas n what not so here we go with some scripts :)
creaturescripts:
add @ creaturescripts.xml..
Code:
	<event type="kill" name="FragReward" event="script" value="fragreward.lua"/>

add @ scripts : fragreward.lua
This adds the RankPoint and KillStreakPoint to the player.
Code:
function onKill(cid, target, lastHit)
------------------------------------------------------------
local rankStorage = 10000
local getFrags = getPlayerStorageValue(cid,rankStorage)
local addFrag = ((getPlayerStorageValue(cid,10000))+1)
------------------------------------------------------------
local killStreaks = 10010
local getKSP = getPlayerStorageValue(cid,killStreaks)
local addKSP = ((getPlayerStorageValue(cid,10010))+1)
------------------------------------------------------------
local reward = 2152


		if(isPlayer(cid) and isPlayer(target)) then
			if getPlayerIp(cid) == getPlayerIp(target) then
				doPlayerAddExperience(cid,-100000)
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"You have been punished for killing a player of the same IP.")
			elseif getFrags <= 1000 then
				doPlayerAddItem(cid,reward,getKSP)
				setPlayerStorageValue(cid,rankStorage,addFrag)
				setPlayerStorageValue(cid,killStreaks,addKSP)
			else
			end
		end
	return TRUE
end


add @ creaturescripts.xml..

Code:
	<event type="kill" name="RankUpDown" event="script" value="rankUpDown.lua"/>

add @ scripts: rankUpDown.lua
This auto teleports the player to the next rank filtered area.

Code:
function onKill(cid, target, lastHit)
---Config---
local pos = getPlayerPosition(cid)
local fragStorage = 10000
local getFrags = getPlayerStorageValue(cid, fragStorage)
--/Config---

---Dungeon Teleport---
local noobCamp1  = {x=949, y=1106, z=7}
local noobCamp2  = {x=1010, y=1106, z=7}
local noobCamp3  = {x=1071, y=1106, z=7}
local lavaWar1  = {x=1022, y=1163, z=7}
local lavaWar2  = {x=1083, y=1163, z=7}
local desertWar1  = {x=1084, y=1229, z=7}

local animationID = 10
--/Dungeon Teleport---

---Rank Stages--
local rankOne = 10
local rankTwo = 40
local rankThree = 90
local rankFour = 150
local rankFive = 250
local rankSix = 400
local rankOneII = 11
local rankTwoII = 41
local rankThreeII = 91
local rankFourII = 151
local rankFiveII = 251
local rankSixII = 401
--/Rank Stages--
	   
-------Command Area---------

        if(isPlayer(cid) and isPlayer(target)) then
				if getFrags == rankOne or getFrags == rankOneII then 
					doTeleportThing(cid, lavaWar1, FALSE)
					doSendMagicEffect(newPosition1, animationID)
				elseif getFrags == rankTwo or getFrags == rankTwoII then 
					doTeleportThing(cid, desertWar1, FALSE)
					doSendMagicEffect(newPosition2, animationID)
				else
			end 
		end
	return true
end
------/Command Area---------

add @ creaturescripts.xml

Code:
	<event type="kill" name="KillStreakBonus" event="script" value="killStreakBonus.lua"/>

add @ scripts: killStreakBonus.lua

This is just a fun Bonus thingy for when players get so many KillStreakPoints.

Code:
-------- ADD BONUS -----------
------- FIRST BONUS ----------
local firstBonus = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(firstBonus, CONDITION_PARAM_TICKS, 500000)
setConditionParam(firstBonus, CONDITION_PARAM_LIGHT_COLOR, 25)
setConditionParam(firstBonus, CONDITION_PARAM_LIGHT_LEVEL, 125)
setConditionParam(firstBonus, CONDITION_PARAM_STAT_MAXMANAPERCENT, 115)
setConditionParam(firstBonus, CONDITION_PARAM_STAT_MAXHEALTHPERCENT, 115)

----- /FIRST BONUS -----------
------ /ADD BONUS ------------
--- CARE PACKAGE FUNCTION  ---
 function setItemName(uid,name)
		return doItemSetAttribute(uid,'name',name)
    end	
--- /CARE PACKAGE FUNCTION ---
	
-- KILLSTREAK BONUS SYSTEM ---
function onKill(cid, target, lastHit)


-----Config-----
local killStreaks = 10010
local getKSP = getPlayerStorageValue(cid,killStreaks)
local addKSP = ((getPlayerStorageValue(cid,10000))+1)
local pos = getPlayerPosition(cid)
local dropZone = {x = pos.x+(math.random(-1,1)) , y = pos.y+(math.random(-1,1)), z = pos.z, stackpos=1}
local playerName = getPlayerName(cid)
local carePackage = " " .. getPlayerName(cid) .. "'s Care Package"
local dogsName = "Attack Dogs"
local nukeName = Nuke
local nukeWords = NUKEM
----/Config-----

       if isPlayer(target) == TRUE then
			if getKSP == 5 then
				doAddCondition(cid,firstBonus)
				doSendMagicEffect(pos,7)
				doPlayerAddItem(cid,2160,1)
			elseif getKSP == 10 then
				setItemName(doCreateItem(5675,1,dropZone),carePackage)
				doSendMagicEffect(pos,7)
				doPlayerAddItem(cid,2160,2)
			elseif getKSP == 15 then 
				doConvinceCreature(cid, doCreateMonster("".. dogsName .."", pos))
				doConvinceCreature(cid, doCreateMonster("".. dogsName .."", pos))
			else
				doPlayerSendCancel(cid,"You have a " .. getKSP .. " killstreak")
			end
		end
	return TRUE
end

-- /KILLSTREAK BONUS SYSTEM --

replace @ scripts: login.lua

Code:
local config = {
	loginMessage = getConfigValue('loginMessage'),
	useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}

function onLogin(cid)
	local loss = getConfigValue('deathLostPercent')
	if(loss ~= nil) then
		doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
		doPlayerAddBlessing(cid, 1)
		doPlayerAddBlessing(cid, 2)
		doPlayerAddBlessing(cid, 3)
		doPlayerAddBlessing(cid, 4)
		doPlayerAddBlessing(cid, 5)
		doPlayerAddPremiumDays(cid, 2)
	end

	local accountManager = getPlayerAccountManager(cid)
	if(accountManager == MANAGER_NONE) then
		local mapMark = {x=1010, y=1015, z=6}
		local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
		if(lastLogin > 0) then
			setPlayerStorageValue(cid,10010,0)
			doPlayerSendCancel(cid,"Your Killstreaks Have Been Reset")
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
			str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
			if getPlayerLevel(cid) < 80 then
				doPlayerAddExp(cid,4000000)
			end
		else
			doPlayerPopupFYI(cid,"Welcome to Dungeon Wars Ot")
			doPlayerPopupFYI(cid,"After you choose your outfit and set your hotkeys..")
			doPlayerPopupFYI(cid,"Walk north into the teleport to begin fighting :D")
			doPlayerAddMapMark(cid,mapMark,2,"TELEPORTER")
			str = str .. " Please choose your outfit."
			doPlayerSendOutfitWindow(cid)
			if getPlayerLevel(cid) < 80 then
				doPlayerAddExp(cid,4000000)
			end
		end

		doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
	elseif(accountManager == MANAGER_NAMELOCK) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
	elseif(accountManager == MANAGER_ACCOUNT) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
	end

	if(not isPlayerGhost(cid)) then
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
	end

	registerCreatureEvent(cid, "Mail")
	registerCreatureEvent(cid, "GuildMotd")
	registerCreatureEvent(cid, "RankUpDown")
	registerCreatureEvent(cid, "FragReward")
	registerCreatureEvent(cid, "KillStreakBonus")

	registerCreatureEvent(cid, "Idle")
	if(config.useFragHandler) then
		registerCreatureEvent(cid, "SkullCheck")
	end

	registerCreatureEvent(cid, "ReportBug")
	registerCreatureEvent(cid, "AdvanceSave")
	return true
end

MOVEMENTS

add in @ movements.xml

Code:
    <movevent type="StepIn" actionid="65001" event="script" value="dungeonTeleport.lua"/>

add @ scripts: dungeonTeleport.lua
This filters the players by Rank and then sends them to a random mapped war area.

The server works with multiple copys of the same waring area, the more u rank up the more areas you unlock =]
Code:
function onStepIn(cid, item, frompos, item2, topos)
---Config---
local fragStorage = 10000
local getFrags = getPlayerStorageValue(cid, fragStorage)
--/Config---

---Dungeon Teleport---
local noobCamp1  = {x=949, y=1106, z=7}
local noobCamp2  = {x=1010, y=1106, z=7}
local noobCamp3  = {x=1071, y=1106, z=7}
local lavaWar1  = {x=1022, y=1163, z=7}
local lavaWar2  = {x=1083, y=1163, z=7}
local desertWar1  = {x=1084, y=1229, z=7}
local animationID = 10
--/Dungeon Teleport---

---Rank Stages--
local rankOne = 10
local rankTwo = 40
local rankThree = 90
local rankFour = 150
local rankFive = 250
local rankSix = 400
local randOne = math.random(1,2)
local randTwo = math.random(1,3)
--/Rank Stages--
	   
    if isPlayer(cid) then
		if item.actionid == 65001 then 
				if getFrags >= -1 and getFrags <= rankOne then 
						doTeleportThing(cid, noobCamp1, FALSE)
						doSendMagicEffect(noobCamp1, animationID)
						
				elseif getFrags >= rankOne and getFrags <= rankTwo then
					if randOne == 1 then 
						doTeleportThing(cid, noobCamp2, FALSE)
						doSendMagicEffect(noobCamp2, animationID)
					elseif randOne == 2 then
						doTeleportThing(cid, lavaWar1, FALSE)
						doSendMagicEffect(lavaWar1, animationID)
					end
						
				elseif getFrags >= rankTwo then 
					if randTwo == 1 then 
						doTeleportThing(cid, noobCamp3, FALSE)
						doSendMagicEffect(noobCamp3, animationID)
					elseif randTwo == 2 then
						doTeleportThing(cid, lavaWar2, FALSE)
						doSendMagicEffect(lavaWar2, animationID)
					elseif randTwo == 3 then
						doTeleportThing(cid, desertWar1, FALSE)
						doSendMagicEffect(deserWar1, animationID)
					end
						
				else 
					doPlayerSendCance(cid,"It Don't Work")
			end
		end
	end
return true
end

SOME FUN NPCS

addonExchanger.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Addon Exchanger" script="data/npc/scripts/addonExchanger.lua" walkinterval="5000" floorchange="0">
    <health now="100" max="100"/>
    <look type="289" head="0" body="0" legs="114" feet="114" addons="3"/>
    <parameters>
		<parameter key="message_greet" value="Hey |PLAYERNAME|, You can {Exchange} your Rank Points. {Points Left}" />
        <parameter key="module_keywords" value="1" />
        <parameter key="keywords" value="hi;exchange" />
        <parameter key="keyword_reply1" value="Hey |PLAYERNAME|, You can {Exchange} your Rank Points. {Points Left}" />
        <parameter key="keyword_reply2" value="The {First Addon} Costs 50RP, and the {Second Addon} costs 250!" />

    </parameters>
</npc>

addonExchanger.lua

Code:
-----------NPC SYSTEMS----------
  local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid)                          npcHandler:onCreatureAppear(cid)                        end
function onCreatureDisappear(cid)                       npcHandler:onCreatureDisappear(cid)                     end
function onCreatureSay(cid, type, msg)                  npcHandler:onCreatureSay(cid, type, msg)                end
function onThink()                                      npcHandler:onThink()                                    end
function creatureSayCallback(cid, type, msg)
        if(not npcHandler:isFocused(cid)) then
                return false
        end
---------/NPC SYSTEMS-------------

------------CONFIGS---------------

local fragStorage = 10000
local getFrags = getPlayerStorageValue(cid, fragStorage)
local fragsSpentStorage = 12000
local fragsSpent = getPlayerStorageValue(cid, fragsSpentStorage)
local fragsLeft = ((getFrags) - (fragsSpent))
local addSpent = ((getPlayerStorageValue(cid,fragsSpentStorage))+25)
local addSpentAddonOne = ((getPlayerStorageValue(cid,fragsSpentStorage))+50)
local addSpentAddonTwo = ((getPlayerStorageValue(cid,fragsSpentStorage))+250)
local pos = getPlayerPosition(cid)
local magicEffect = 6

--------RP Costs------------
local firstAddonCost = 50
local secondAddonCost = 250
local swordCost = 25
local maxSword = 150
local distanceCost = 25
local maxDistance = 150
local magicCost = 25
local maxMagic = 150
-----------/CONFIGS---------------

		
		if msgcontains(msg,"first addon") then
				if fragsLeft >= firstAddonCost then
					if getPlayerStorageValue(cid,10101) == -1 then
						setPlayerStorageValue(cid,fragsSpentStorage,addSpentAddonOne)
						doPlayerAddAddons(cid, 1)
						doSendMagicEffect(pos,magicEffect)
						setPlayerStorageValue(cid,10101,1)
					else
						doCreatureSay(cid, "You've already bought the First Addons!", TALKTYPE_ORANGE_1)
					end
				else 
					doCreatureSay(cid, "You need ".. firstAddonCost .." RP to Buy the First Addons!", TALKTYPE_ORANGE_1)
				end
		elseif msgcontains(msg,"second addon") then
				if fragsLeft >= secondAddonCost then
					if getPlayerStorageValue(cid,10102) == -1 then
						setPlayerStorageValue(cid,fragsSpentStorage,addSpentAddonTwo)
						doPlayerAddAddons(cid, 2)
						doSendMagicEffect(pos,magicEffect)
						setPlayerStorageValue(cid,10102,1)
					else
						doCreatureSay(cid, "You've already bought the Second Addons!", TALKTYPE_ORANGE_1)
					end
				else 
					doCreatureSay(cid, "You need ".. secondAddonCost .." RP to Buy the First Addons!", TALKTYPE_ORANGE_1)
				end
		elseif msgcontains(msg,"points left") then 
				doCreatureSay(cid, "You have ".. fragsLeft .." Points Left To Spend", TALKTYPE_ORANGE_1)
		end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Rank Point Exchanger.xml

Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Rank Point Exchanger" script="data/npc/scripts/rankPointExchanger.lua" walkinterval="5000" floorchange="0">
    <health now="100" max="100"/>
    <look type="289" head="114" body="114" legs="0" feet="0" addons="3"/>
    <parameters>
		<parameter key="message_greet" value="Hey |PLAYERNAME|, You can {Exchange} your Power Orbs here. {Points Left}" />
        <parameter key="module_keywords" value="1" />
        <parameter key="keywords" value="hi;exchange" />
        <parameter key="keyword_reply1" value="Hey |PLAYERNAME|, You can {Exchange} your Power Orbs here. {Points Left}" />
        <parameter key="keyword_reply2" value="I can {add sword} , {add distance} , and {add magic} skills." />

    </parameters>
</npc>

rankPointExchanger.lua

Code:
-----------NPC SYSTEMS----------
  local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid)                          npcHandler:onCreatureAppear(cid)                        end
function onCreatureDisappear(cid)                       npcHandler:onCreatureDisappear(cid)                     end
function onCreatureSay(cid, type, msg)                  npcHandler:onCreatureSay(cid, type, msg)                end
function onThink()                                      npcHandler:onThink()                                    end
function creatureSayCallback(cid, type, msg)
        if(not npcHandler:isFocused(cid)) then
                return false
        end
---------/NPC SYSTEMS-------------

------------CONFIGS---------------

local fragStorage = 10000
local getFrags = getPlayerStorageValue(cid, fragStorage)
local fragsSpentStorage = 12000
local fragsSpent = getPlayerStorageValue(cid, fragsSpentStorage)
local fragsLeft = ((getFrags) - (fragsSpent))
local addSpent = ((getPlayerStorageValue(cid,fragsSpentStorage))+25)
local addSpentAddonOne = ((getPlayerStorageValue(cid,fragsSpentStorage))+50)
local addSpentAddonTwo = ((getPlayerStorageValue(cid,fragsSpentStorage))+250)
local pos = getPlayerPosition(cid)
local magicEffect = 6

--------RP Costs------------
local firstAddonCost = 50
local secondAddonCost = 250
local swordCost = 25
local maxSword = 150
local distanceCost = 25
local maxDistance = 150
local magicCost = 25
local maxMagic = 150
-----------/CONFIGS---------------

		
        if msgcontains(msg,"add sword") then
                if fragsLeft >= swordCost then
					if(isInArray({4,8}, getPlayerVocation(cid)) == TRUE) then
						if getPlayerSkill(cid,SKILL_SWORD) < maxSword then
							setPlayerStorageValue(cid,fragsSpentStorage,addSpent)
							doPlayerAddSkill(cid,SKILL_SWORD,1)
							doCreatureSay(cid, "You have exchanged ".. swordCost .." Rank Points for +1 Sword Skill", TALKTYPE_ORANGE_1)
							doSendMagicEffect(pos,magicEffect)
						else
							doCreatureSay(cid, "".. maxSword .." is the max sword level", TALKTYPE_ORANGE_1)
						end
					else
						doCreatureSay(cid, "You must be a Knight to learn Sword Skills.", TALKTYPE_ORANGE_1)
					end
				else
					doCreatureSay(cid, "You need ".. swordCost .." Rank Points in order exchange for +1 Sword Skill!", TALKTYPE_ORANGE_1)
				end
		elseif msgcontains(msg,"add magic") then
                if fragsLeft >= magicCost then
					if(isInArray({1,5,2,6}, getPlayerVocation(cid)) == TRUE) then
						if getPlayerSkill(cid,SKILL__MAGLEVEL) < maxMagic then
							setPlayerStorageValue(cid,fragsSpentStorage,addSpent)
							doPlayerAddSkill(cid,SKILL__MAGLEVEL,1)
							doCreatureSay(cid, "You have exchanged ".. magicCost .." Rank Points for +1 Sword Skill", TALKTYPE_ORANGE_1)
							doSendMagicEffect(pos,magicEffect)
						else 
							doCreatureSay(cid, "".. maxMagic .." is the max magic level", TALKTYPE_ORANGE_1)
						end
					else 
						doCreatureSay(cid, "You must be a Sorcerer or Druid to learn Magic Skills.", TALKTYPE_ORANGE_1)
					end
				else
					doCreatureSay(cid, "You need ".. magicCost .." Rank Points in order exchange for +1 Magic Skill!", TALKTYPE_ORANGE_1)
				end
		elseif msgcontains(msg,"add distance") then
                if fragsLeft >= distanceCost then
					if(isInArray({3,7}, getPlayerVocation(cid)) == TRUE) then
						if getPlayerSkill(cid,SKILL_DISTANCE) < maxMagic then
							setPlayerStorageValue(cid,fragsSpentStorage,addSpent)
							doPlayerAddSkill(cid,SKILL_DISTANCE,1)
							doCreatureSay(cid, "You have exchanged ".. distanceCost .." Rank Points for +1 Sword Skill", TALKTYPE_ORANGE_1)
							doSendMagicEffect(pos,magicEffect)
						else 
							doCreatureSay(cid, "".. maxDistance .." is the max magic level", TALKTYPE_ORANGE_1)
						end
					else 
						doCreatureSay(cid, "You must be a Sorcerer or Druid to learn Magic Skills.", TALKTYPE_ORANGE_1)
					end
				else
					doCreatureSay(cid, "You need ".. distanceCost .." Rank Points in order exchange for +1 Magic Skill!", TALKTYPE_ORANGE_1)
				end
		elseif msgcontains(msg,"points left") then 
				doCreatureSay(cid, "You have ".. fragsLeft .." Points Left To Spend", TALKTYPE_ORANGE_1)
		else 
			doCreatureSay(cid, "Something went wrong, Please report to administrator", TALKTYPE_ORANGE_1)
		end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Rare Orb Npc.xml

Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Power Orb Exchanger" script="data/npc/scripts/PowerItemSeller.lua" walkinterval="5000" floorchange="0">
    <health now="100" max="100"/>
    <look type="289" head="114" body="114" legs="91" feet="91" addons="3"/>
    <parameters>
		<parameter key="message_greet" value="Hey |PLAYERNAME|, You can {Exchange} your Power Orbs here." />
        <parameter key="module_keywords" value="1" />
        <parameter key="keywords" value="hi;exchange;power weapons;power armors;more armors" />
        <parameter key="keyword_reply1" value="Hey |PLAYERNAME|, You can {Exchange} your Power Orbs here." />
        <parameter key="keyword_reply2" value="Exhange Power Orbs for {Power Weapons}, {Power Armors} , and a {Power Ring}" />
        <parameter key="keyword_reply3" value="For weapons we have the {Power Wand} , the {Power Sword} , and the {Power Star}." />
        <parameter key="keyword_reply4" value="For armors we have the {Power Helmet} , {Power Armor} , {Power Legs} , .. {more armors}" />
        <parameter key="keyword_reply5" value="{Power Boots} , and {Power Shield}." />

    </parameters>
</npc>

PowerItemSeller.xml

Code:
-----------NPC SYSTEMS----------
  local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid)                          npcHandler:onCreatureAppear(cid)                        end
function onCreatureDisappear(cid)                       npcHandler:onCreatureDisappear(cid)                     end
function onCreatureSay(cid, type, msg)                  npcHandler:onCreatureSay(cid, type, msg)                end
function onThink()                                      npcHandler:onThink()                                    end
function creatureSayCallback(cid, type, msg)
        if(not npcHandler:isFocused(cid)) then
                return false
        end
---------/NPC SYSTEMS-------------

------------CONFIGS---------------
local orbId = 5944
local magicEffect = 10
local pos = getPlayerPosition(cid)
-------POWER SET ITEM NAMES-------
local powerHelmetName = "Power Helmet"
local powerArmorName = "Power Armor"
local powerLegsName = "Power Legs"
local powerBootsName = "Power Boots"
local powerShieldName = "Power Shield"
local powerWandName = "Power Wand"
local powerSwordName = "Power Sword"
local powerStarName = "Power Star"
local powerRingName = "Power Ring"
------/POWER SET ITEM NAMES-------
-------POWER SET ITEM IDS---------
local powerHelmetId = 7901
local powerArmorId = 8879
local powerLegsId = 7895
local powerBootsId = 11113
local powerShieldId = 2515
local powerWandId = 7735
local powerSwordId = 11301
local powerStarId = 7366
local powerRingId = 2357
------/POWER SET ITEM IDS---------
-------POWER SET ITEM COSTS-------
local powerHelmetCost = 100
local powerArmorCost = 100
local powerLegsCost = 100
local powerBootsCost = 100
local powerShieldCost = 100
local powerWandCost = 100
local powerSwordCost = 100
local powerStarCost = 100
local powerRingCost = 100
------/POWER SET ITEM COSTS-------



-----------/CONFIGS---------------

		
        if msgcontains(msg,powerHelmetName) then
                if doPlayerRemoveItem(cid,orbId,5) == TRUE then
					doPlayerAddItem(cid,powerHelmetId,powerHelmetCost)
					doCreatureSay(cid, "You have created a " .. powerHelmetName .. "!", TALKTYPE_ORANGE_1)
					doSendMagicEffect(pos,magicEffect)
				else
					doCreatureSay(cid, "You need " .. powerHelmetCost .. " Orbs to Buy the " .. powerHelmetName .. "!", TALKTYPE_ORANGE_1)
				end
        elseif msgcontains(msg,powerArmorName) then
                if doPlayerRemoveItem(cid,orbId,powerArmorCost) == TRUE then
					doPlayerAddItem(cid,powerArmorId,1)
					doCreatureSay(cid, "You have created a " .. powerArmorName .. "!", TALKTYPE_ORANGE_1)
					doSendMagicEffect(pos,magicEffect)
				else
					doCreatureSay(cid, "You need " .. powerHelmetCost .. " Orbs to Buy the " .. powerHelmetName .. "!", TALKTYPE_ORANGE_1)
				end
        elseif msgcontains(msg,powerLegsName) then
                if doPlayerRemoveItem(cid,orbId,powerLegsCost) == TRUE then
					doPlayerAddItem(cid,powerLegsId,1)
					doCreatureSay(cid, "You have created a " .. powerLegsName .. "!", TALKTYPE_ORANGE_1)
					doSendMagicEffect(pos,magicEffect)
				else
					doCreatureSay(cid, "You need " .. powerLegsCost .. " Orbs to Buy the " .. powerLegsName .. "!", TALKTYPE_ORANGE_1)
				end
        elseif msgcontains(msg,powerBootsName) then
                if doPlayerRemoveItem(cid,orbId,powerBootsCost) == TRUE then
					doPlayerAddItem(cid,powerBootsId,1)
					doCreatureSay(cid, "You have created a " .. powerBootsName .. "!", TALKTYPE_ORANGE_1)
					doSendMagicEffect(pos,magicEffect)
				else
					doCreatureSay(cid, "You need " .. powerBootsCost .. " Orbs to Buy the " .. powerBootsName .. "!", TALKTYPE_ORANGE_1)
				end
        elseif msgcontains(msg,powerShieldName) then
                if doPlayerRemoveItem(cid,orbId,powerShieldCost) == TRUE then
					doPlayerAddItem(cid,powerShieldId,1)
					doCreatureSay(cid, "You have created a " .. powerShieldName .. "!", TALKTYPE_ORANGE_1)
					doSendMagicEffect(pos,magicEffect)
				else
					doCreatureSay(cid, "You need " .. powerShieldCost .. " Orbs to Buy the " .. powerShieldName .. "!", TALKTYPE_ORANGE_1)
				end
        elseif msgcontains(msg,powerWandName) then
                if doPlayerRemoveItem(cid,orbId,powerWandCost) == TRUE then
					doPlayerAddItem(cid,powerWandId,1)
					doCreatureSay(cid, "You have created a " .. powerWandName .. "!", TALKTYPE_ORANGE_1)
					doSendMagicEffect(pos,magicEffect)
				else
					doCreatureSay(cid, "You need " .. powerWandCost .. " Orbs to Buy the " .. powerWandName .. "!", TALKTYPE_ORANGE_1)
				end
        elseif msgcontains(msg,powerSwordName) then
                if doPlayerRemoveItem(cid,orbId,powerSwordCost) == TRUE then
					doPlayerAddItem(cid,powerSwordId,1)
					doCreatureSay(cid, "You have created a " .. powerSwordName .. "!", TALKTYPE_ORANGE_1)
					doSendMagicEffect(pos,magicEffect)
				else
					doCreatureSay(cid, "You need " .. powerSwordCost .. " Orbs to Buy the " .. powerSwordName .. "!", TALKTYPE_ORANGE_1)
				end
        elseif msgcontains(msg,powerStarName) then
                if doPlayerRemoveItem(cid,orbId,powerStarCost) == TRUE then
					doPlayerAddItem(cid,powerStarId,1)
					doCreatureSay(cid, "You have created a " .. powerStarName .. "!", TALKTYPE_ORANGE_1)
					doSendMagicEffect(pos,magicEffect)
				else
					doCreatureSay(cid, "You need " .. powerStarCost .. " Orbs to Buy the " .. powerStarName .. "!", TALKTYPE_ORANGE_1)
				end
        elseif msgcontains(msg,powerRingName) then
                if doPlayerRemoveItem(cid,orbId,powerRingCost) == TRUE then
					doPlayerAddItem(cid,powerRingId,1)
					doCreatureSay(cid, "You have created a " .. powerRingName .. "!", TALKTYPE_ORANGE_1)
					doSendMagicEffect(pos,magicEffect)
				else
					doCreatureSay(cid, "You need " .. powerRingCost .. " Orbs to Buy the " .. powerRingName .. "!", TALKTYPE_ORANGE_1)
				end
		end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

ACTIONS

add in @ actions.xml

Code:
	<action itemid="5675" event="script" value="codModScripts/carePackage.lua"/>

add @ scripts: carePackage.lua

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
----- CONFIG ------
local crateName = " " .. getPlayerName(cid) .. "'s Carepackage"
local rand = math.random(1,16)
local pos = getPlayerPosition(cid)
---- RANDOM ITEMS "IDS" ----
local packageOne = 2160
local packageTwo = 2157
local packageThree = 2152
local packageFour = 8473
local packageFive = 7590
local packageSix = 5944
--- /RANDOM ITEMS "IDS" ----

---- /CONFIG ------
		if string.find(getItemAttribute(item.uid, "name"):lower(), getCreatureName(cid):lower()) ~= nil then
			if rand == 1 then
				doPlayerAddItem(cid,packageOne,(math.random(25,50)))
			elseif rand == 2 then
				doPlayerAddItem(cid,packageTwo,(math.random(1,2)))
			elseif rand == 3 then
				doPlayerAddItem(cid,packageThree,(math.random(50,100)))
			elseif rand == 4 then
				doPlayerAddItem(cid,packageFour,1)
			elseif rand == 5 then
				doPlayerAddItem(cid,packageFive,1)
			elseif rand == 6 then
				doPlayerAddItem(cid,packageOne,(math.random(25,50)))
			elseif rand == 7 then
				doPlayerAddItem(cid,packageTwo,(math.random(1,2)))
			elseif rand == 8 then
				doPlayerAddItem(cid,packageThree,(math.random(50,100)))
			elseif rand == 9 then
				doPlayerAddItem(cid,packageFour,1)
			elseif rand == 10 then
				doPlayerAddItem(cid,packageFive,1)
			elseif rand == 11 then
				doPlayerAddItem(cid,packageOne,(math.random(25,50)))
			elseif rand == 12 then
				doPlayerAddItem(cid,packageTwo,(math.random(1,2)))
			elseif rand == 13 then
				doPlayerAddItem(cid,packageThree,(math.random(50,100)))
			elseif rand == 14 then
				doPlayerAddItem(cid,packageFour,1)
			elseif rand == 15 then
				doPlayerAddItem(cid,packageFive,1)
			elseif rand == 16 then
				doPlayerAddItem(cid,packageSix,(math.random(1,25)))
				doCreatureSay(cid, "OBTAINED POWER ORB!", TALKTYPE_ORANGE_1)
			end
				doRemoveItem(item.uid)
				
		elseif string.find(getItemAttribute(item.uid, "name"):lower(), getItemNameById(5676):lower()) ~= nil then
            doCreatureSay(cid, "Script Worked!", TALKTYPE_ORANGE_1)
			if rand == 1 then
				doPlayerAddItem(cid,packageOne,(math.random(25,50)))
			elseif rand == 2 then
				doPlayerAddItem(cid,packageTwo,(math.random(1,5)))
			elseif rand == 3 then
				doPlayerAddItem(cid,packageThree,(math.random(50,100)))
			elseif rand == 4 then
				doPlayerAddItem(cid,packageFour,1)
			elseif rand == 5 then
				doPlayerAddItem(cid,packageFive,1)
			elseif rand == 6 then
				doPlayerAddItem(cid,packageOne,(math.random(25,50)))
			elseif rand == 7 then
				doPlayerAddItem(cid,packageTwo,(math.random(1,5)))
			elseif rand == 8 then
				doPlayerAddItem(cid,packageThree,(math.random(50,100)))
			elseif rand == 9 then
				doPlayerAddItem(cid,packageFour,1)
			elseif rand == 10 then
				doPlayerAddItem(cid,packageFive,1)
			elseif rand == 11 then
				doPlayerAddItem(cid,packageOne,(math.random(25,50)))
			elseif rand == 12 then
				doPlayerAddItem(cid,packageTwo,(math.random(1,5)))
			elseif rand == 13 then
				doPlayerAddItem(cid,packageThree,(math.random(50,100)))
			elseif rand == 14 then
				doPlayerAddItem(cid,packageFour,1)
			elseif rand == 15 then
				doPlayerAddItem(cid,packageFive,1)
			elseif rand == 16 then
				doPlayerAddItem(cid,packageSix,(math.random(1,5)))
				doCreatureSay(cid, "OBTAINED POWER ORB!", TALKTYPE_ORANGE_1)
			end
				doRemoveItem(item.uid)
		else  
			doCreatureSay(cid, "You are not the Owner of this Care Package!", TALKTYPE_ORANGE_1)
		end
	return true
end

so yah, test it all out n lemme know your ideas n opinions...
Please mind I'm a massive local / if+elseif user its my only knowledge of LUA scripting..
 
Last edited:
Cool, it will hopefully help lots of people who are planning to make a warOT, well done dude :D
 
Back
Top