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

[request] special war script

Yony

New Member
Joined
Sep 7, 2007
Messages
318
Reaction score
0
Location
Israel
Well I need script that will go like this:
If you are 1-4 vocation ID and you kill 5-8 vocation ID you get experience
and the same as for the other.

(This is only example)
 
Last edited:
I don't tested the script, but I think it works.
LUA:
function onKill(cid, target)

local multiplier = 1     -- multiplier (exp that you get * "number") higher number here = more exp

	-- Don't touch --------------------------------------
	local exp = (lv_t * 100 - lv * 100) * multiplier
	local lv = getPlayerLevel(cid)
	local lv_t = getPlayerLevel(target)
	local voc = getPlayerVocation(cid)
	local voc_t = getPlayerVocation(target)
	------------------------------------------------------

	if voc == 1 or voc == 2 or voc == 3 or voc == 4 then
		if voc_t == 5 or voc_t == 6 or voc_t == 7 or voc_t == 8 then
                        doPlayerAddExp(cid, exp)
                end
	elseif voc == 5 or voc == 6 or voc == 7 or voc == 8 then
		if voc_t == 1 or voc_t == 2 or voc_t == 3 or voc_t == 4 then
                        doPlayerAddExp(cid, exp)
                end
	end
        return TRUE                            
end

Regards,
Shawak
 
Last edited:
Thanke you bro!! I'll test that out!
BTW there is a way to random the exp you get (the higher level you kill the higher exp you get)
 
Bro, I think the error is in this line
isInArray(first_IDs,voc) == FALSE or isInArray(second_IDs,voc) == FALSE
but I tried to change some things here but still it doesnt working
 
You add in,
data/creaturescripts/creaturescripts.xml
LUA:
	<event type="kill" name="warScript" event="script" value="war_script.lua"/>
Or you forgot it?

Regards,
Shawak
 
I did, but still not working.. im almost sure it have to do with this line:
isInArray(first_IDs,voc) == FALSE or isInArray(second_IDs,voc) == FALSE
 
login.lua

LUA:
	registerCreatureEvent(cid, "warScript")

Do not forget, in you creaturescript.xml..

to have warScript as name="warScript"

If using anything else, then change the name of the registerCreatureEvent(cid, "to your name="" ")
 
i did everything u said and it is now totally bugged :p
you cant die.. u get into 0 hp and still stay at same place and when u relog u get full hp/mana in same place
 
I've shortened it down a bit, enjoy.

LUA:
function onKill(cid, target)

local multiplier = 1     -- multiplier (exp that you get * "number") higher number here = more exp

        -- Don't touch --------------------------------------
        local exp = (getPlayerLevel(target) * 100 - getPlayerLevel(cid) * 100) * multiplier
        ------------------------------------------------------
		
	if (isInArray({1,2,3,4}, getPlayerVocation(cid)) == TRUE) and (isInArray({5,6,7,8}, getPlayerVocation(target)) == TRUE) then
		doPlayerAddExp(cid, exp)
	elseif (isInArray({5,6,7,8}, getPlayerVocation(cid)) == TRUE) and (isInArray({1,2,3,4}, getPlayerVocation(target)) == TRUE) then
		doPlayerAddExp(cid, exp)
	end
	return TRUE                            
end


kind regards, Evil Hero
 
My first script was like
LUA:
  function onKill(cid, target)

local multiplier = 1     -- multiplier (exp that you get * "number") higher number here = more exp

        -- Don't touch --------------------------------------
        local exp = (getPlayerLevel(target) * 100 - getPlayerLevel(cid) * 100) * multiplier
        ------------------------------------------------------
               
        if (isInArray({1,2,3,4}, getPlayerVocation(cid)) == TRUE) and (isInArray({5,6,7,8}, getPlayerVocation(target)) == TRUE) then
                doPlayerAddExp(cid, exp)
        elseif (isInArray({5,6,7,8}, getPlayerVocation(cid)) == TRUE) and (isInArray({1,2,3,4}, getPlayerVocation(target)) == TRUE) then
                doPlayerAddExp(cid, exp)
        end
        return TRUE                            
end

But because it don't work, I made it longer to see the errors ^_^.

Regards,
Shawak
 
The script plaides told me to put in login.lua is bugging the server.. You cant die... maybe i need to put that in other place?
and still the script isnt working!! please help xd
 

Similar threads

  • Question Question
Replies
5
Views
304
Back
Top