• 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!

CreatureEvent War Scripts

Sync

Ø,ø
Joined
May 26, 2009
Messages
1,901
Reaction score
26
Location
Canada
Im posting some War Scripts i made for my server. I know some of the coding may be "messy" or "bad" but bear with me and just try and make the code better instead of making fun of it.

First off this code Will set a storage value for Current Frags (untill u die), for a Total Storage for frags and a Storage for Total Deaths. It also broadcasts on certian storage value (Certian Frag ammount). And i also made it remove a Frag after you get a Frag So i can have the server Normal pvp.

Lua:
function onKill(cid, target)

local config = {
item = 6500, -- Demonic Essence
store = getPlayerStorageValue(cid, 6000),  -- storrage for Current frags
tstore = getPlayerStorageValue(cid, 7000), -- Total Storage value for kills
dstore = getPlayerStorageValue(cid, 8000),  -- Total Storage value for deaths 
rand = math.random(1,4),
pos = getPlayerPosition(cid)
}
	local table = {
	{"Smashed!", 189, 1},
	{"Dead!", 190, 2},
	{"Owned!", 18, 3},
	{"Pwnt!", 215, 4}
}

	if isPlayer(target) == true then
	setPlayerStorageValue(cid, 6000, (config.store+1))  
		setPlayerStorageValue(cid, 7000, (config.tstore+1))
            setPlayerStorageValue(target, 8000, (config.dstore+1))
              doPlayerSetRedSkullTicks(cid, 0)

local rand = math.random(1, #table)
doSendAnimatedText(config.pos, table[rand][1], tablica[rand][2])
doPlayerAddItem(cid, config.item, table[rand][3])
     
 
        if(getPlayerStorageValue(cid, 6000) == 5) then
				broadcastMessage(getCreatureName(cid) .. " is on killing spree! He killed 5 players!")
			elseif(getPlayerStorageValue(cid, 6000) == 10) then
                broadcastMessage(getCreatureName(cid) .. " is dominating! He killed 10 players!")
			elseif(getPlayerStorageValue(cid, 6000) == 25) then
			broadcastMessage(getCreatureName(cid) .. " is CRAZY! He killed 25 players!")
			elseif(getPlayerStorageValue(cid, 6000) == 50) then
				broadcastMessage(getCreatureName(cid) .. " is UNSTOPPABLE!! He killed 50 players! DO SOMETHING!")
			elseif(getPlayerStorageValue(cid, 6000) == 100) then
            	broadcastMessage("Bow down to your new god " ..getCreatureName(cid).. " has 100 frags!")
            end
            	return TRUE
               end	
                   end

This code just does a simple check and adds an Aol if you dont have one onLogin.

Lua:
function onLogin(cid)
          if getPlayerItemCount(cid, 2173) == FALSE then
		 doPlayerAddItem(cid, 2173, 1)
                            return TRUE
		                      end

This is a code to make you go to Level 1 after death.

Lua:
function onDeath(cid, corpse, killer)
	local downgradeToLevel = 1
	doPlayerAddExperience(cid, (getExperienceForLevel(downgradeToLevel) - getPlayerExperience(cid)))
end

And this is the script to set you to level 100 when you log back in.

Lua:
function onLogin(cid)
	if(getPlayerLevel(cid) < 100) then
		local setPlayerLevelOnLogin = 100
		doPlayerAddExperience(cid, (getExperienceForLevel(setPlayerLevelOnLogin) - getPlayerExperience(cid)))
	else
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Go kill someone!")
	end
	return TRUE
end

If you want to make it so people can donate so they start at a different level isntead of 100 you could use this script.

Lua:
function onLogin(cid)
local config = {
setPlayerLevelOnLogin = 130,
storage = 9000
}

if getPlayerStorageValue(cid, config.storage) and (getPlayerLevel(cid) < 130) then
	  doPlayerAddExperience(cid, (getExperienceForLevel(setPlayerLevelOnLogin) - getPlayerExperience(cid)))
   end
   return TRUE
end

And heres a little Action script to set the donor storage value.

Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
        doCreatureSay(cid, "You will now login at level 130 for ever. Thx for buying!", TALKTYPE_ORANGE_1)
            doSendMagicEffect(fromPosition, 37)
              doRemoveItem(item.uid)
                setPlayerStorageValue(cid,9000,1)
            return TRUE
end

Heres another Action script you could use so if you only have a certian Frag count (storage Value) you can go to the certian Place

Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local depo = {x = 529, y = 207, z = 7}

if item.actionid == 1596 and (getPlayerStorageValue(cid, 7000) > 100) then
		doTeleportThing(cid, depo)
	doSendMagicEffect(depo, CONST_ME_GROUNDSHAKER)
                            else		                
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need to have a total of 100 or more frags to go into the Depo.") 
	end
	   end

And heres a Talk Action that allows you to check a players Total Frags and Total Deaths, there ML and some other things.

Lua:
function onSay(cid, words, param)
	if(param == "") then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
		return TRUE
	end
local player = getPlayerByNameWildcard(param)
if getPlayerStorageValue(player, 7000) == -1 or getPlayerStorageValue(player, 8000) == -1 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Information about: " .. getCreatureName(player) .. ". \nHe has a total of 0 frags.\nHe has a total of 0 deaths.")
else 
doPlayerPopupFYI(cid, "               " .. getCreatureName(player) .. " \n\nTotal frags:  " .. getPlayerStorageValue(player, 7000).. "\nTotal deaths: " .. getPlayerStorageValue(player, 8000).. "\nMagic Level: " .. getPlayerMagLevel(player) .. "\nCurrent Level: " .. getPlayerLevel(player) .. "\nMelee Skill: " .. getPlayerSkillLevel(player,2) .. "\nDistance Skill: " .. getPlayerSkillLevel(player,4) .. "")
    end
end

Well theres all my newbie war scripts i hope itleast some people benefited from them =p
 
Last edited:
Code:
if rand == 1 then
		doSendAnimatedText(config.pos, "Smashed!" ,180)
		doPlayerAddItem(cid, 6500, 1)   
		elseif rand == 2 then
        doSendAnimatedText(config.pos, "Dead!" ,190)
		doPlayerAddItem(cid, 6500, 2)  
		elseif rand == 3 then
        doSendAnimatedText(config.pos, "Owned!" ,18)
		doPlayerAddItem(cid, 6500, 3)
		elseif rand == 4 then
        doSendAnimatedText(config.pos, "Pwnt!" ,215)
		doPlayerAddItem(cid, 6500, 4)  
			return TRUE
end

Code:
local tablica = {
	{"Smashed!", 189, 1},
	{"Dead!", 190, 2},
	{"Owned!", 18, 3},
	{"Pwnt!", 215, 4}
}

local rand = math.random(1, #tablica)
doSendAnimatedText(config.pos, tablica[rand][1], tablica[rand][2])
doPlayerAddItem(cid, 6500, tablica[rand][3])

^_^


Same with broadcast but:
[5] = {"blah blah"},
[10] = {"blah blah 2}
 
Last edited:
Script that should remove levels (configurable added, and now should be more precise :thumbup:)
Code:
function onDeath(cid, corpse, killer)
	local downgradeToLevel = 1
	doPlayerAddExperience(cid, (getExperienceForLevel(downgradeToLevel) - getPlayerExperience(cid)))
end

Script that should set player level onLogin (configurable added, and same, more precise).
Code:
function onLogin(cid)
	if(getPlayerLevel(cid) < 100) then
		local setPlayerLevelOnLogin = 100
		doPlayerAddExperience(cid, (getExperienceForLevel(setPlayerLevelOnLogin) - getPlayerExperience(cid)))
	else
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Go kill someone!")
	end
	return TRUE
end

Yeah, all of them are made in lame way, but still thanks for sharing ;)

Regards,
Hermes
 
I made this mod,
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="War Level Donator" version="1.0" author="Husam" contact="[email protected]" enabled="yes">
        <description>
        If player loggs in and is below set level then he is reset to that level.only if hes donator
    </description>
        <config name="warlv_config"><![CDATA[
                config = {
                        level = 150
                }
        ]]></config>
        <event type="login" name="War Level Donator" event="script"><![CDATA[
        function onLogin(cid)
        domodlib("warlv_config")
        if getPlayerStorageValue(cid, 9000) and getPlayerLevel(cid) <= config.level then
                local exp2nl = getExperienceForLevel(config.level) - getPlayerExperience(cid)
                        doPlayerAddExperience(cid,exp2nl)
                end
        return true
        end
]]></event>
</mod>
 
Script that should remove levels (configurable added, and now should be more precise :thumbup:)
Code:
function onDeath(cid, corpse, killer)
	local downgradeToLevel = 1
	doPlayerAddExperience(cid, (getExperienceForLevel(downgradeToLevel) - getPlayerExperience(cid)))
end

Script that should set player level onLogin (configurable added, and same, more precise).
Code:
function onLogin(cid)
	if(getPlayerLevel(cid) < 100) then
		local setPlayerLevelOnLogin = 100
		doPlayerAddExperience(cid, (getExperienceForLevel(setPlayerLevelOnLogin) - getPlayerExperience(cid)))
	else
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Go kill someone!")
	end
	return TRUE
end

Yeah, all of them are made in lame way, but still thanks for sharing ;)

Regards,
Hermes


Ah, i made most of em really quick so there a bit sloppy and thanks for rewritin em.
 
Back
Top