• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

War scripts

Evan

A splendid one to behold
Senator
Premium User
Joined
May 6, 2009
Messages
7,019
Solutions
1
Reaction score
1,029
Location
United States
Long ago, I've been working on a war server that uses no magic system.
Unfortunately, I lost interest in it and do not have a lot of time to continue work on it as I am working on other things.

So, I've decided to release some scripts that would be used in a war server.
I will release more different scripts when I get the time to make them.

TESTED ON 0.4,
TESTED ON 0.3, thanks amiroslo!
If someone can please test it on 0.2, I will put your name here!

Trapping net

WqK0WQ15pP.png


You can use this trap (ID: 13173) to throw it on the ground in front of an enemy,
if he/she walks on it, they will not be allowed to move for X period of time.
You can click it to destroy it.

In data/actions/actions.xml:
Lua:
<action itemid="13173" event="script" value="trappingnet.lua"/>

In data/actions/scripts/trappingnet.lua:
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)	
	if isPlayer(cid) then
		doSendMagicEffect(getThingPosition(item.uid), 2)
		doCreatureSay(cid, "DESTROYED!", TALKTYPE_ORANGE_1)
		doRemoveItem(item.uid)
		end
	return true
end

In data/movements/movements.xml:
Lua:
<movevent type="StepIn" itemid="13173" event="script" value="trappingnet.lua"/>

In data/movements/scripts/trappingnet.lua:
Lua:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	doCreatureSetNoMove(cid, true)
	doSendMagicEffect(getCreaturePosition(cid), 31)
	doCreatureSay(cid, "TRAPPED!", TALKTYPE_ORANGE_1)
	addEvent(doCreatureSetNoMove, 1000*3, cid, false)
	doRemoveItem(item.uid)
return true
end



Land mine

UuDfv6VDgD.png


When you place the land mine (ID: 5888) on the ground and if you use it, it will turn into cracks as if it looked like it was buried,
then when someone steps on it, the bomb will blow up and do damage to the person that steps on it.

In data/actions/actions.xml:
Lua:
<action itemid="5888" event="script" value="landmine.lua"/>

In data/actions/scripts/landmine.lua:
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getTilePzInfo(fromPosition) == FALSE then
		doTransformItem(itemEx.uid, 6299)
		doDecayItem(itemEx.uid)
	else
		doPlayerSendCancel(cid, 'You cannot use this in PZ.') 
	return true
	end
end

In data/movements/movements.xml:
Lua:
<movevent type="StepIn" itemid="6299" event="script" value="landmine.lua"/>

In data/movements/scripts/landmine.lua:
Lua:
function onStepIn(cid, item, pos)
	if(item.itemid == 6299) then
		if(isPlayer(cid)) then
			doTargetCombatHealth(0, cid, COMBAT_PHYSICALDAMAGE, -100, -200, CONST_ME_FIREAREA)
			doRemoveItem(item.uid)
		end
	end
	return true
end



Drunk Dart

q48tRZzWbg.png


While you're attacking someone, use this bamboo stick to shoot a dart that will make the target drunk and difficult to move in a straight path.

In data/actions/actions.xml:
Lua:
<action itemid="12401" event="script" value="drunkdart.lua"/>

In data/actions/scripts/drunkdart.lua:
Lua:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 5000)

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_CRAPS)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_POISON)
 
local condition = createConditionObject(CONDITION_DRUNK)
setConditionParam(condition, CONDITION_PARAM_TICKS, 10000)
setCombatCondition(combat, condition)
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
		if not hasCondition(cid, CONDITION_EXHAUST) then 
			local target = getCreatureTarget(cid)
			if target ~= 0 then
				doAddCondition(cid, exhaust)
				doCombat(cid, combat, numberToVariant(target))
				doRemoveItem(item.uid, 1)
			else
				doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUCANONLYUSEITONCREATURES)
			end
		else
			doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
	end
	return true
end
 
Last edited:
Haha
love those ideas, can be used for non war ots 2
works on tfs 0.3.6pl1??

I haven't tested 0.2 or 0.3, sorry!
If you test it on 0.3, I'll edit the post and put your credits there!
 
Ok sure,
To let u know, 19:09 /i 13173
19:09 Couldn't add item: 13173
so there is no ID for 13173, Use 10570 for it maybe
The trap thing works on 0.3.6pl1
But make it so u use it in pz or so.. and make it, so no one can pick it up and take it...

The Landmine works fine on 0.3.6pl1

About the drunk dart, use the ID 10031, but there is a problem in script, when u use it, it says
You can only use it on creatures.
And Im using it on a player but still same
 
Last edited:
Okay, remember the net was introduced in 8.7, so if you're using an 8.6 server, you will have to use something else.
Anyways, glad it worked on 0.3 :)

And what did you mean by PZ? You mean so you can only use it OUTSIDE PZ?
 
Ye, only outside pz
The trap thing works on 0.3.6pl1
But make it so u use it in pz or so.. and make it, so no one can pick it up and take it...
About the drunk dart, use the ID 10031, but there is a problem in script, when u use it, it says
You can only use it on creatures.
And Im using it on a player but still same
 
Okay, I can probably do the PZ thing using the AddItem function.
Drunk dart, I will check the problem, it was working fine when I had it in my server.
Thanks for testing it, I will look into it and change the main post when I get home later today.
 
Just few advises, don't mind me.

  • * Wrong placed returns.
    * Ugly tabbed code.
    * Unnecessary parenthesis.
    * You once use comparison to false and once 'not' operator. You should decide which one you want to use, it's easier to read scripts if they all are in same style.
    * You should use inline function in addEvent to avoid errors in console in case player logs out. For example:
    Code:
    addEvent(
    	function n(cid)
    		if isPlayer(cid) then
    			doCreatureSetNoMove(cid, false)
    		end
    	end,
    	time,
    	cid
    )
    * You should use Condition SubID for Drunk Dart so exhaust doesn't collide.

Good you contributed though, nice to see something other than just simple action.
 
Oh I know, I made these long ago, just posted them as they are because I no longer need them, I've improved now.
People can just fix them up or do whatever they want with them.

What I need is advises and criticism for my Boss Bailout script that I just recently made.
 
Just few advises, don't mind me.

  • * Wrong placed returns.
    * Ugly tabbed code.
    * Unnecessary parenthesis.
    * You once use comparison to false and once 'not' operator. You should decide which one you want to use, it's easier to read scripts if they all are in same style.
    * You should use inline function in addEvent to avoid errors in console in case player logs out. For example:
    Code:
    addEvent(
    	function n(cid)
    		if isPlayer(cid) then
    			doCreatureSetNoMove(cid, false)
    		end
    	end,
    	time,
    	cid
    )
    * You should use Condition SubID for Drunk Dart so exhaust doesn't collide.

Good you contributed though, nice to see something other than just simple action.

I believe that to avoid disconnection of the character who fell into the trap, we had to add this line on the script.

Code:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	[COLOR="#FF0000"]doAddCondition(cid, CONDITION_INFIGHT)[/COLOR]
	doCreatureSetNoMove(cid, true)
	doSendMagicEffect(getCreaturePosition(cid), 31)
	doCreatureSay(cid, "TRAPPED!", TALKTYPE_ORANGE_1)
	addEvent(doCreatureSetNoMove, 1000*3, cid, false)
	doRemoveItem(item.uid)
return true
end

not tested, tomorrow i will test :)
 
I have a cool grenade script here:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local tempo = 3 -- seconds until bomb exploding
bombal = 4029
p = toPosition
first = 5357

function setFirst()
	if getPlayerStorageValue(cid,first) == -1 then
		setPlayerStorageValue(cid,bombal,0)
		setPlayerStorageValue(cid,first,1)
	end
end

function setTime()
	timing = tempo + 1
	alvo = {x=p.x,y=p.y,z=p.z}
end

function explode()
	if (timing ~= 1 and getPlayerStorageValue(cid,bombal) == 1) then
		setPlayerStorageValue(cid,re,1)
		timing = timing - 1
		doSendAnimatedText(alvo,timing,TEXTCOLOR_WHITE)
		addEvent(explode,1000)
	else
		doRemoveItem(getTileItemById(alvo, 2360).uid, 1)
		doAreaCombatHealth(cid, COMBAT_FIREDAMAGE, alvo, 1, -getPlayerLevel(cid) * 3, -getPlayerLevel(cid) * 8, 6)

		setPlayerStorageValue(cid,bombal,0)
		setPlayerStorageValue(cid,re,0)
	end
end

	setFirst()	
	if getTilePzInfo(getPlayerPosition(cid)) == TRUE and getPlayerAccess(cid) < 5 then
		doPlayerSendCancel(cid,"You cannot use this item on a protected zone!")

	elseif getPlayerStorageValue(cid,bombal) == 0 then
		setPlayerStorageValue(cid,bombal,1)
		doSendDistanceShoot(fromPosition, toPosition, 30)
		doSendMagicEffect(toPosition,5)
		doCreateItem(2360,toPosition)
		setTime()
		explode()

	elseif getPlayerStorageValue(cid,bombal) > 0 then
		doPlayerSendCancel(cid,"You can use only 1 bomb at once!")
	end
	return TRUE
end

Feel free to add it to your topic... ;D
BTW, don't /reload actions as a counter is going, or storage will be stucked.
 
K, thanks. <short>

[EDIT]: Tried it out on monsters, but it didn't work :S
works on players though.
 
Last edited:
Back
Top