I was just creating a few spells for the fun of it really, and I attempted to create a spell which fires 3 daggers in a straight-line across a single space (so 3 daggers fired forwards, but all in the same starting space. I had assumed that by setting offsetX to different values, I could throw them in a horizontal line.
However, I don't know if I am just not using the correct values or the function is indeed broken. Has anyone else had any luck firing projectiles using shootProjectiles using offset values != 0?
shootProjectile() offset values not working?
- JohnWordsworth
- Posts: 1397
- Joined: Fri Sep 14, 2012 4:19 pm
- Location: Devon, United Kingdom
- Contact:
shootProjectile() offset values not working?
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.
Re: shootProjectile() offset values not working?
Try this:
(not exactly what you wanted, but hey, it works - kinda... )
(not exactly what you wanted, but hey, it works - kinda... )
Code: Select all
defineSpell{
name = "knives",
uiName = "Throw Knives",
skill = "spellcraft",
level = 1,
runes = "AC",
manaCost = 1,
onCast = function(champ, x, y, direction, skill)
local dx,dy = getForward(party.facing)
local x,y = party.x + dx, party.y + dy
if party.facing == 0 or party.facing == 2 then
shootProjectile("throwing_knife", party.level, x+0.2, y, party.facing, 10, 1.5, 1, 0, 0, 0, 10, false, true)
shootProjectile("throwing_knife", party.level, x, y, party.facing, 10, 1.5, 1, 0, 0, 0, 10, false, true)
shootProjectile("throwing_knife", party.level, x-0.2, y, party.facing, 10, 1.5, 1, 0, 0, 0, 10, false, true)
else
shootProjectile("throwing_knife", party.level, x, y-0.2, party.facing, 10, 1.5, 1, 0, 0, 0, 10, false, true)
shootProjectile("throwing_knife", party.level, x, y, party.facing, 10, 1.5, 1, 0, 0, 0, 10, false, true)
shootProjectile("throwing_knife", party.level, x, y+0.2, party.facing, 10, 1.5, 1, 0, 0, 0, 10, false, true)
end
end
}
- JohnWordsworth
- Posts: 1397
- Joined: Fri Sep 14, 2012 4:19 pm
- Location: Devon, United Kingdom
- Contact:
Re: shootProjectile() offset values not working?
Ahh, this looks spot on. Never thought of using non-integer values for the x,y coordinates. Can't wait to test tomorrow
. Many thanks!
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.