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

Use with crosshair

hxzr

New Member
Joined
Feb 4, 2010
Messages
156
Reaction score
0
As we all know basically every item can be used with a crosshair(clientside), but you need to make sure that the server recieves the target your crosshair is pointing at, either if it's a tile, a player and so on..

In spells(runes), which lines defines and makes sure of that you are pointing the rune at an enemy (and therefore casts the magic on him)? do you have to index a combatarea? and whatnot? I'm very slow in my brains, it's like the wheel is spinning but the hamster is dead SO EXPLAIN WITH AWESOMENESS!

Just need to get everything clear so I can easily force this function with either a condition_param spam or an entire "if" spell..
 
oldConditionAccuracy = false

in config.lua

change the 'false' to 'true'

Not relevant... This has nothing to do with the fact;

A few runes can be casted on targets without targeting them, others need you to target them before you can even aim the crosshair on them.
 
Not relevant... This has nothing to do with the fact;

A few runes can be casted on targets without targeting them, others need you to target them before you can even aim the crosshair on them.

You understand the difference, I don't see why you can't do it yourself

Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ICEAREA)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE)
setAttackFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 5, 5, 1.4, 2.8, 40, 70)

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

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

Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ICEAREA)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -1, -10, -1, -15, 5, 5, 1.8, 3, -20, -40)

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

You can see the difference here is
Code:
local area = createCombatArea(AREA_CIRCLE3X3)
setCombatArea(combat, area)
 
You understand the difference, I don't see why you can't do it yourself

Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ICEAREA)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE)
setAttackFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 5, 5, 1.4, 2.8, 40, 70)

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

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

Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ICEAREA)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -1, -10, -1, -15, 5, 5, 1.8, 3, -20, -40)

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

You can see the difference here is
Code:
local area = createCombatArea(AREA_CIRCLE3X3)
setCombatArea(combat, area)

Both of those can be used with a crosshair, and the thing is, I can't really tell why and that's what I want to find out, out of a blank .LUA file, what do I have to add to use it with crosshair? Oh dear I suck at explaining.

My goal is anyhow to use an action script (tons of transforms and whatnot) but want to file it within spells, (function onCastSpell/spells.xml etc) but read the bold text for a more straight forward answer.. this just turns worse for every minute i think about it :)
 
Now after reading whatever I just said I'll make myself (ROFL) clear;

If you take sudden death.lua, you erase everything in it. You can still use the rune around but nothing happens on "cast". But if you add like;

Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)

function onCastSpell(cid, var)

if getPlayerStorageValue(cid, 14755) == -1 then
doSendAnimatedText(getCreaturePosition(cid), "SUCCESS!", math.random(1,255))
end
return doCombat(cid, combat, var)
end
While writing this test.lua I actually had to test my way forward and I found out that it is the Combat things that makes you able to aim your rune on anyone without targeting them. But then to go further into this, what can you define a creature position with? getCreaturePosition(cid) puts the success on you, getCreaturePosition(getCreatureTarget(cid)) puts it on top of the target that gets affected by the spell (you need to have a target) but if you use this without targeting someone, what value should the (pos) be to put the doAnimatedText on top of who you aim at?

I don't want any wild guesses like this forum seem to be great at..
 
you should have _needtarget="0"_ in xml and ...


Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -1, -60, -1, -60, 5, 5, 4, 7)


function hello(cid, pos)
    doSendAnimatedText(pos, "SUCCESS!", math.random(1,255))
end

setCombatCallback(combat, CALLBACK_PARAM_TARGETTILE, "hello")


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

SD example
 
I'll have to bump this cause I don't really get what puts the exact difference in an instant spell and rune spell?
 
i hope this info help you, its some info about "var"


-exura -> instant, non aggressive, self target

var.type = 1
var.number = cid of caster
var.string = nil
var.pos = nil


-Firebomb -> rune, needtarget = 0, with area

var.type = 2
var.number = nil
var.string = nil
var.pos = clicking pos


-hells core -> instant, self target, with area

var.type = 1
var.number = caster cid
var.string = nil
var.pos = nil

if you need more tests, tell me
 
Back
Top