MarkSmartRemark
Lua-Noob in Training :D
- Joined
- Jan 27, 2010
- Messages
- 139
- Reaction score
- 3
Hi guys,
Theres alot of teleport/createportal scripts out there that do cool things but im practicing scripting some WoW-like spells and tried to come up w something that i havent seen yet w help from andu.
What it does is the following
-When player casts spell he begins to cast and channel energy to create a portal for him and friends to be able to get to their hometowns.
- If hes in combat he cannot cast the spell. If he enters combat while casting (someone pks or monster comes in screen) the spell will be cancelled.
-The spell will also cancel if he moves or changes direction. (He needs to concentrate to make the portal so leave him the f*ck alone )
-There will be an arrow warning people at the hometown position that players are arriving!
-Lastly, it has a pretty easy config for effects cast time etc...
The spell has one last issues before its 100% complete.
Once again, main credits to Andu for giving me the cast time and pointers to most of the spell!
EDIT: Updated and Added Teleport Removal and some animated texts.
Theres alot of teleport/createportal scripts out there that do cool things but im practicing scripting some WoW-like spells and tried to come up w something that i havent seen yet w help from andu.
What it does is the following
-When player casts spell he begins to cast and channel energy to create a portal for him and friends to be able to get to their hometowns.
- If hes in combat he cannot cast the spell. If he enters combat while casting (someone pks or monster comes in screen) the spell will be cancelled.
-The spell will also cancel if he moves or changes direction. (He needs to concentrate to make the portal so leave him the f*ck alone )
-There will be an arrow warning people at the hometown position that players are arriving!
-Lastly, it has a pretty easy config for effects cast time etc...
The spell has one last issues before its 100% complete.
- I would like to add a party feature. Right now i know how to make it check if player is in a party. but i do not know how to make it check if the player is in the player who made the teleports party. So if im in another party, i can go in the teleport that you created. I want it to have a bit of a team-feel.
Once again, main credits to Andu for giving me the cast time and pointers to most of the spell!
Code:
-- >>Script by Tabz!<< --
--{Credits: Spell Mechanics by Andu; Helped from Zyntax}
--.::.CONFIG.::.--
local config = {
channeling_time = 10.0, --- Duration of Cast Time.
dist_eff = CONST_ANI_SMALLHOLY, --- Cast time Distance Effect.
cancel_eff = CONST_ME_POFF, --- Effect if spell is canceled.
tp_duration = 30, --- Duration of Teleport before it vanishes.
cooldown = 60, --- Cooldown time for this spell (Exhaustion)? [seconds]
cd_storage = 107, --- Cooldown StorageID -- Cancel Effect.
distanceEffects = { --- Cast Time Distance Effects Config.
[1] = {from = {x = 0, y = 2}},
[2] = {from = {x = 1, y = 2}},
[3] = {from = {x = 2, y = 1}},
[4] = {from = {x = 2, y = 0}},
[5] = {from = {x = 2, y = -1}},
[6] = {from = {x = 1, y = -2}},
[7] = {from = {x = 0, y = -2}},
[8] = {from = {x = -1, y = -2}},
[9] = {from = {x = -2, y = -1}},
[10] = {from = {x = -2, y = 0}},
[11] = {from = {x = -2, y = 1}},
[12] = {from = {x = -1, y = 2}}
}
}
local function deleteTeleport(cpos)
local teleport = getTileItemById(cpos, 1387)
if(teleport.uid > 0) then
doRemoveItem(teleport.uid)
end
return true
end
local check = 0
local v = config.distanceEffects
local function distanceShoot(cid, oldPos, oldDir, nvar)
local cpos = {x=getCreaturePosition(cid).x, y=getCreaturePosition(cid).y, z=getCreaturePosition(cid).z, stackpos=1}
local newPos = getCreaturePosition(cid)
local newDir = getCreatureLookDirection(cid)
if isCreature(cid) == true then
local pos = getCreaturePosition(cid)
if oldDir == newDir and oldPos.x == newPos.x and oldPos.y == newPos.y and oldPos.z == newPos.z and getCreatureCondition(cid, CONDITION_INFIGHT) == false then
if check > #v then
for x = 1, config.tp_duration do
local n = config.tp_duration - x
addEvent(doSendAnimatedText, x * 1000, cpos, n > 0 and tostring(n), TEXTCOLOR_DARKRED)
addEvent(doSendAnimatedText, 15000, cpos, "Org Port!", TEXTCOLOR_DARKRED)
addEvent(doSendAnimatedText, 30000, cpos, "Closed!", TEXTCOLOR_DARKRED)
end
doCreateTeleport(1387, getTownTemplePosition(getPlayerTown(cid)), cpos)
doSendMagicEffect(getTownTemplePosition(getPlayerTown(cid)), 55)
doSendMagicEffect(pos, 3)
doSendMagicEffect(pos, 49)
else
doSendDistanceShoot({x = pos.x + v[check].from.x, y = pos.y + v[check].from.y, z = pos.z}, pos, config.dist_eff)
addEvent(distanceShoot, (config.channeling_time * 1000 / (#v)), cid, oldPos, getCreatureLookDirection(cid))
end
check = check + 1
else
check = #v
doSendMagicEffect(pos, config.cancel_eff)
end
end
end
function onCastSpell(cid, var)
if exhaustion.check(cid, config.cd_storage) then
doPlayerSendCancel(cid, "Your Portal spell still has "..exhaustion.get(cid, config.cd_storage).." seconds on cooldown.")
return false
end
local cpos = {x=getCreaturePosition(cid).x, y=getCreaturePosition(cid).y, z=getCreaturePosition(cid).z, stackpos=1}
local nvar = var
check = 1
addEvent(distanceShoot, (config.channeling_time * 1000 / (#v)), cid, getCreaturePosition(cid), getCreatureLookDirection(cid), nvar)
exhaustion.set(cid, config.cd_storage, config.cooldown)
addEvent(deleteTeleport, (((config.tp_duration+config.channeling_time)+1)*1000), cpos)
return true
end
EDIT: Updated and Added Teleport Removal and some animated texts.
Last edited: