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

OpenTibia SpellCreator: A graphical spell creation enviroment

ontargetcreature and ontargettile, a sort of template that you write in lua, then have certain parameters that you can set in a properties window.
Sort of making it able to for example, trigger another combat if you hit a target, or send random effects on tile.

Kind of like:
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, 34)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)

local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_EFFECT, 36)

local condition = createConditionObject(CONDITION_FIRE)
setConditionParam(condition, CONDITION_PARAM_DELAYED, 1)
addDamageCondition(condition, 5, 2000, -35)

function onGetFormulaValues(cid, level, maglevel)
	local min = level / 5 + maglevel * 3.9 + 7
	local max = level / 5 + maglevel * 4.2 + 8
	return -min, -max
end

setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

local arr = {
	{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
	{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
	{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
	{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
	{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
	{0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0},
	{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
	{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
	{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
	{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
	{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
}

local arr2 = {
	{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
	{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
	{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
	{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
	{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
	{0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0},
	{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
	{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
	{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
	{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
	{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
}

local area = createCombatArea(arr2, AREADIAGONAL_WAVE4)
local area2 = createCombatArea(arr, AREADIAGONAL_WAVE4)
setCombatArea(combat, area)
setCombatArea(combat2, area2)

function onTargetCreature(cid, target)
	local pos = getCreaturePosition(target)
	doSendMagicEffect(pos, 38)
	if math.random(1,100) <= 10 then
		doTargetCombatCondition(cid, target, condition, 15)
	end
end

setCombatCallback(combat2, CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")

function onCastSpell(cid, var)
	doCombat(cid, combat2, var)
	return doCombat(cid, combat, var)
end

and

Lua:
local combat = createPhase({
	Timer = 200,
	Agressive = true,
	DamageType = COMBAT_ICEDAMAGE,
	Formula = COMBAT_FORMULA_LEVELMAGIC,
	Damage = function(cid, level, maglevel)
	local min = level / 5 + maglevel * 1.2 + 7
	local max = level / 5 + maglevel * 2.85 + 16
	return -min, -max
	end,
	MagicEffect = 255, DistanceEffect = CONST_ANI_ICE,
	OnTargetTile = function(cid, pos)
		delay = math.random(50,200)
		if math.random(1,5) < 3 then addEvent(doSendDistanceShoot, delay, {x = pos.x - 4, y = pos.y - 4, z = pos.z},pos, CONST_ANI_ICE) end
		if math.random(1,20) < 10 then
		addEvent(doSendMagicEffect,delay + 200, pos ,41)
		else
		addEvent(doSendMagicEffect,delay + 200, pos ,43)
		end
	end,	
	
	Area = AREA_CIRCLE3X3
	}
	,{Name="Ghost"}, 1)
	
function onCastSpell(cid, var)
	return doCombat(cid, combat, var)
end

- - - Updated - - -

Except when you add parameters which you can change, such as effect and that in some kind of list.
 
I don't really see what you're trying to achieve by posting random spells..

The point of the whole editor is to make making spells easy, fun and simple to do.
I know very well the editor has certain limits, especially at more advanced and complex spells; "Sort of making it able to for example, trigger another combat if you hit a target, or send random effects on tile.".
The big question is: do you really need that feature? In my opinion those effects are overkill and if you want them, making it using a script is easier.

The editor is straight-forward and should stay straight-forward, like Remere's Map Editor.

Unless I don't understand you (which is very likely, as you post random, totally different, spells without decent commentary), I see no point into it..


If you want to bind e.g. OnTargetCreature events to a certain effect, or so, come up with some idea as well to visualize it correctly.
 
Excuse me again TGYoshi, I used min damage 15 and max damage 40 for a spell..Well, the thing is, I've tested the spell with a lvl 40 ml 10 character, hits 30's. Tested the same with a character lvl 140 ml 50, hits 30's. Is there any way to make the spell damage output depends on the character's lvl and magic? Also, kinda find a bug, when I set combat_healing, set the effect (Green sparkles in my case) and try to use the magic inside a pz, the magic works but doesn't show the effect, while outside pz it does. Using TFS 0.3.6pl1
 
Excuse me again TGYoshi, I used min damage 15 and max damage 40 for a spell..Well, the thing is, I've tested the spell with a lvl 40 ml 10 character, hits 30's. Tested the same with a character lvl 140 ml 50, hits 30's. Is there any way to make the spell damage output depends on the character's lvl and magic?
In the min/max damage box you can use the variables level and maglevel.
This would work: 100 + level*5 + maglevel*10

Also, kinda find a bug, when I set combat_healing, set the effect (Green sparkles in my case) and try to use the magic inside a pz, the magic works but doesn't show the effect, while outside pz it does. Using TFS 0.3.6pl1
Not exactly a bug, just go to Spell => Properties, and un-tick Agressive.
 
Thanks for the fast reply! When I could rep you again I will, you truly deserve it. And sorry for my nooby question x)
 
A new update is coming up, either today or tomorrow.

RqJHe.png


The main update are conditions. The above spell will inflict everyone hit with the usual damage, but also a condition: Fire, which will burn you 10 times for 50 damage, every second =P.

Changelog till now;
Code:
== Bugs ==
- Fixed working directory/FileNotFound on Windows XP systems
- Fixed UI on small resolutions
- Fixed rendering glitch on size change
- Fixed the (Graphics) failure at render failure once out-of-bounds
- Fixed occasions where the application refused to play with the spacebar

== Changes ==
- Better name generation for new brushes
- Moved total editor time settings to Spell => Properties
- Damage types are loaded with a name identifier now
- Custom Timebar control, which replaces the old scrollbar
- New 'Play' button looks
- Severely improved the speed of sprite loading
- Changed identifying strings for distance effects/target distance effects to something more logic
- Disabled 'Action Names' view by default now
- Corrected tabbing in the Lua script

== Additions ==
- Changed rendering panel looks, renders some shadow now & moved render to fit
- Image cache on startup, consumes less memory for duplicate .spr images
- Condition support added (Has to be expanded more)
- Added a Grid ground image

Things that are left to do includes conditions on the caster itself and serialization of them.
 
Update released.

Re-download SpellCreator from the opening post.
You also have to replace the resources.xml and eventually add resc/Grid.gif to your old folder if you want it.

Enjoy =3.
 
I don't really see what you're trying to achieve by posting random spells..

The point of the whole editor is to make making spells easy, fun and simple to do.
I know very well the editor has certain limits, especially at more advanced and complex spells; "Sort of making it able to for example, trigger another combat if you hit a target, or send random effects on tile.".
The big question is: do you really need that feature? In my opinion those effects are overkill and if you want them, making it using a script is easier.

The editor is straight-forward and should stay straight-forward, like Remere's Map Editor.

Unless I don't understand you (which is very likely, as you post random, totally different, spells without decent commentary), I see no point into it..


If you want to bind e.g. OnTargetCreature events to a certain effect, or so, come up with some idea as well to visualize it correctly.

Well aint that hard, if you actually simulate the code with luainterface, The only thing that would be needed is to simulate the most basic functions in otserv.



gWcYF.png


XML:
<?xml version="1.0" encoding="utf-8" ?>
<SpecialEffect Name="Falling From the skies">
  <Template Type="onTargetTile">
    addEvent(
    function(pos)
    doSendDistanceShoot({x = pos.x - !!offset!!, y = pos.y - !!offset!!, z = pos.z}, pos, !!fallingeffect!!)
    addEvent(doSendMagicEffect, 250, pos, !!inpacteffect!!)
    end,
    math.random(!!timerandommin!!,!!timerandommax!!),
    pos)
    end
  </Template>
  <Parameter Name="offset" valuetype ="number" valuemin="4" valuemax="6" Description="Offset from where it should start falling from."/>
  <Parameter Name="fallingeffect" valuetype="distanceeffect"/>
  <Parameter Name="inpacteffect" valuetype ="effect"/>
  <Parameter Name="timerandommin" valuetype ="number" valuemin="100" valuemax="600"/>
  <Parameter Name="timerandommax" valuetype ="number" valuemin="400" valuemax="800"/>
</SpecialEffect>

it doesnt need to be hard to make it simple either.(though i could have put more effort into the UI).

I can try to make some code that can simulate most basic things in spell mechanics.
 
Yea I see, but that's not something I currently aim for.
As far as I know the editor is used because of the graphical view of the spell, not because of the features, since Lua itself will of course allow zillions of more possibilities.

Maybe later, but that's for sure not my focus.

In the progress of developing such an application several things have to be taken in mind. It includes the fact that such expansions don't have as much value as the application itself isn't known enough around the OT-related community.
Once it gets something which is being regularly used around, it could be worth expanding with plugins like RME did.
 
A nice update could be update it to be able to use formulas for damage like this one:

5 + (level / 4) + (maglevel * 1.2)

:D

- - - Updated - - -

Things I've found so far is that unticking Agressive from a Healing spell still doesn't show the animation in pz. And doesn't heal, I used 20 min damage and 30 max damage, still doesn't heal but shows the effects outside pz. No error messages in console. Here's the script.

Lua:
-- SpellCreator generated.

-- =============== COMBAT VARS ===============
-- Areas/Combat for 0ms
local combat0_Brush = createCombatObject()
setCombatParam(combat0_Brush, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
setCombatParam(combat0_Brush, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatArea(combat0_Brush,createCombatArea({{3}}))
function getDmg_Brush(cid, level, maglevel)
	return (20)*-1,(30)*-1 
end
setCombatCallback(combat0_Brush, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush")

-- =============== CORE FUNCTIONS ===============
local function RunPart(c,cid,var,dirList,dirEmitPos) -- Part
	if (isCreature(cid)) then
		doCombat(cid, c, var)
		if (dirList ~= nil) then -- Emit distance effects
			local i = 2;
			while (i < #dirList) do
				doSendDistanceShoot(dirEmitPos,{x=dirEmitPos.x-dirList[i],y=dirEmitPos.y-dirList[i+1],z=dirEmitPos.z},dirList[1])
				i = i + 2
			end		
		end
	end
end

function onCastSpell(cid, var)
	local startPos = getCreaturePosition(cid)
	RunPart(combat0_Brush,cid,var)
	return true
end

And this is in spells.xml:

XML:
<instant name="Cure" words="esuna" lvl="5" maglv="0" mana="20" exhaustion="2000" prem="0" needlearn="1" selftarget="1" blockwalls="0" aggressive="0" event="script" value="Cure.lua">
	<vocation id="1"/>
	<vocation id="2"/>
	<vocation id="3"/>
	<vocation id="4"/>
	<vocation id="5"/>
	<vocation id="6"/>
	<vocation id="8"/>
	<vocation id="7"/>
	<vocation id="9"/>
	<vocation id="10"/>
</instant>

It consumes mana too, but doesn't do anything other than showing me a fancy green spark.

- - - Updated - - -

And btw, I'm using TFS 0.3.6pl1 Crying Damson
 
A nice update could be update it to be able to use formulas for damage like this one:

5 + (level / 4) + (maglevel * 1.2)

:D
I'll get onto that =P, someday.

- - - Updated - - -

Things I've found so far is that unticking Agressive from a Healing spell still doesn't show the animation in pz. And doesn't heal, I used 20 min damage and 30 max damage, still doesn't heal but shows the effects outside pz. No error messages in console. Here's the script.

Lua:
-- SpellCreator generated.

-- =============== COMBAT VARS ===============
-- Areas/Combat for 0ms
local combat0_Brush = createCombatObject()
setCombatParam(combat0_Brush, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
setCombatParam(combat0_Brush, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatArea(combat0_Brush,createCombatArea({{3}}))
function getDmg_Brush(cid, level, maglevel)
	return (20)*-1,(30)*-1 
end
setCombatCallback(combat0_Brush, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush")

-- =============== CORE FUNCTIONS ===============
local function RunPart(c,cid,var,dirList,dirEmitPos) -- Part
	if (isCreature(cid)) then
		doCombat(cid, c, var)
		if (dirList ~= nil) then -- Emit distance effects
			local i = 2;
			while (i < #dirList) do
				doSendDistanceShoot(dirEmitPos,{x=dirEmitPos.x-dirList[i],y=dirEmitPos.y-dirList[i+1],z=dirEmitPos.z},dirList[1])
				i = i + 2
			end		
		end
	end
end

function onCastSpell(cid, var)
	local startPos = getCreaturePosition(cid)
	RunPart(combat0_Brush,cid,var)
	return true
end

And this is in spells.xml:

XML:
<instant name="Cure" words="esuna" lvl="5" maglv="0" mana="20" exhaustion="2000" prem="0" needlearn="1" selftarget="1" blockwalls="0" aggressive="0" event="script" value="Cure.lua">
	<vocation id="1"/>
	<vocation id="2"/>
	<vocation id="3"/>
	<vocation id="4"/>
	<vocation id="5"/>
	<vocation id="6"/>
	<vocation id="8"/>
	<vocation id="7"/>
	<vocation id="9"/>
	<vocation id="10"/>
</instant>

It consumes mana too, but doesn't do anything other than showing me a fancy green spark.

- - - Updated - - -

And btw, I'm using TFS 0.3.6pl1 Crying Damson
To begin with, you should use negative damage to heal someone. -10 damage is 10 heal.
After, can you try to add this to the script, at it's obvious place, to see if the effect then shows in PZ?
Code:
setCombatParam(combat0_Brush, COMBAT_PARAM_AGGRESSIVE, true)

If it does, I'll add that into the editor.
 
did what you said, this is the script:

Lua:
-- SpellCreator generated.

-- =============== COMBAT VARS ===============
-- Areas/Combat for 0ms
local combat0_Brush = createCombatObject()
setCombatParam(combat0_Brush, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
setCombatParam(combat0_Brush, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatArea(combat0_Brush,createCombatArea({{3}}))
[B][U]setCombatParam(combat0_Brush, COMBAT_PARAM_AGGRESSIVE, false)[/U][/B]
function getDmg_Brush(cid, level, maglevel)
	return [B][U](5 + level/4 + maglevel * 1)*-1,(5+ level/3+maglevel*1+2)*-1[/U][/B] 
end
setCombatCallback(combat0_Brush, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush")

-- =============== CORE FUNCTIONS ===============
local function RunPart(c,cid,var,dirList,dirEmitPos) -- Part
	if (isCreature(cid)) then
		doCombat(cid, c, var)
		if (dirList ~= nil) then -- Emit distance effects
			local i = 2;
			while (i < #dirList) do
				doSendDistanceShoot(dirEmitPos,{x=dirEmitPos.x-dirList[i],y=dirEmitPos.y-dirList[i+1],z=dirEmitPos.z},dirList[1])
				i = i + 2
			end		
		end
	end
end

function onCastSpell(cid, var)
	local startPos = getCreaturePosition(cid)
	RunPart(combat0_Brush,cid,var)
	return true
end

Adding the "combat_param_aggressive= false" made the effect show in pz too.

As you can see the minimun and maximun damage are multiplied for -1 to make the number negative, still, this is what I get:
12:13 You deal 45 damage to Tester.
12:13 You lose 45 hitpoints due to an attack by Tester.

Instead of healing me, the spell hits me lmao

- - - Updated - - -

in the script, ignore the <b><u> wanted to highlight those parts in the post, forget I was using
Lua:
.

[COLOR="silver"]- - - Updated - - -[/COLOR]

Nevermind, fixed it, my solution was simply test this:

[code=lua]function getDmg_Brush(cid, level, maglevel)
	return (5 + level/4 + maglevel * 1)*1,(5+ level / 3+ maglevel * 1 + 2)*1
end

For a weird reason, if I don't multiply the formula *-1 and I do it for 1 to make it be a positive number instead of a negative one. The spell indeed does heal properly..Weird o.o
 
If you put a negative outcome via the editor it becomes negative*-1 => positive as well.
Whatever, I might add some more clearer support for this, as it's a bit vague :).
 
When I try to download it says it can't find my tibia.spr or tibia.dat, then i click on it after i browse it, and it say's that spellcreator doesn't have permission and it would let me if i ran as administrator yet it wont let me run as administrator? can somebody help?
 
Back
Top Bottom