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

I fail at this

Evan

A splendid one to behold
Senator
Premium User
Joined
May 6, 2009
Messages
7,018
Solutions
1
Reaction score
1,040
Location
United States
As you can see my other thread, I'm still having problems putting spells stuff in action scripts.
I VERY rarely use it, so I need some help here!

Unlike the other script I posted, this one seems very critical, it seems so critical that it won't even let me copy the error.
So, I made a picture of it:

2cf6st1.png


Here is molotov.lua:
LUA:
local exhaust = createConditionObject(CONDITION_EXHAUST) 
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 2000) 

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)
setCombatParam(combat, COMBAT_PARAM_CREATEITEM, 1492)

local area = createCombatArea(AREA_SQUARE1X1)
setCombatArea(combat, area)

function onUse(cid, item, fromPosition, itemEx, toPosition)
	doCombat(cid, combat, var)
end

I literally pretty much copy and pasted this from spells/scripts/firebomb.lua.



I have a green flask and if I right-click->use with-> click anywhere, it would make a 3x3 field of fire.
Also, I am hoping if it's possible, can you have a shoottype of an itemID (if I use the flask from a distance, the shot type would be green flask.
Pretty much like a molotov cocktail.

Thanks!
ofcourse REP++

e.mC
 
use example:

Code:
local area_name = createCombatArea{
{0, 0, 0}, 
{0, 2, 0}, 
{0, 0, 1}, 
}

doAreaCombatHealth(cid,element_type,getCreaturePosition(cid), area_name, min, max, effect)
 
hm where is the var ??
LUA:
local exhaust = createConditionObject(CONDITION_EXHAUST) 
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 2000) 
 
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)
setCombatParam(combat, COMBAT_PARAM_CREATEITEM, 1492)
 
local area = createCombatArea(AREA_SQUARE1X1)
setCombatArea(combat, area)
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
    doCombat(cid, combat, numberToVariant(cid))
    return true
end
 
Is there any way that I can make this a far-use script?
Like, if I use it right now and click anywhere on the map, it walks to it and makes the firebomb.
I'm hoping if it was possible to make it so it doesn't walk you to the target spot.
 
Last edited:
allowfaruse="1" in actions.xml
LUA:
local exhaust = createConditionObject(CONDITION_EXHAUST) 
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 2000) 
 
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)
setCombatParam(combat, COMBAT_PARAM_CREATEITEM, 1492)
 
local area = createCombatArea(AREA_SQUARE1X1)
setCombatArea(combat, area)
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if toPosition.x == 0 or toPosition.x == 65535 then
		return false
	elseif hasCondition(cid, CONDITION_EXHAUST) then
		return doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
	end

	return doCombat(cid, combat, positionToVariant(toPosition)) and doAddCondition(cid, exhaust)
end
 
Last edited:
Dammit! I didn't know you can do that! WOW

EDIT:
Now what the hell, far-use works fine, but the area thingy isn't.
Like if I use the cocktail anywhere on the screen (of course my guy doesn't move to the spot), it would throw the bomb right under me.

Here's what I have now:
LUA:
local exhaust = createConditionObject(CONDITION_EXHAUST) 
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 5000) 
 
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, 2009)
setCombatParam(combat, COMBAT_PARAM_CREATEITEM, 1500)
 
local area_name = createCombatArea{
	{1, 1, 1},
	{1, 3, 1},
	{1, 1, 1}
}
setCombatArea(combat, area_name)
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	doRemoveItem(item.uid)
	doCombat(cid, combat, numberToVariant(cid))
    return true
end




EDIT2:

Working now, thanks Cyko!
 
Last edited:
Back
Top