How to use the lindworm?
Re: How to use the lindworm?
Use setPosition() and/or setWorldPosition() on the object immediately after spawning it.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Re: How to use the lindworm?
I can't figure how to do this correctly!minmay wrote:Use setPosition() and/or setWorldPosition() on the object immediately after spawning it.
based on the ion spell, I have tried this:
but it works only when the party is facing 0, and the monster is in front of the party.
for the other directions, the spell is not on correct position. I 'm not sure on how the setWorldPosition works.
SpoilerShow
Code: Select all
class = "MonsterAttack",
name = "rangedAttack",
-- attackType = "projectile",
attackPower = 50,
minDistance = 2,
cooldown = 4,
animation = "rangedAttack",
sound = "lindworm_roar",
-- shootProjectile = "magma_meteor",
onAttack = function(self)
local dx,dy = getForward(self.go.facing)
local x = self.go.x + dx*2
local y = self.go.y + dy*2
local spell = spawn("magma_meteor", self.go.level, x, y, self.go.facing, self.go.elevation)
local wpos = spell:getWorldPosition()
local dx = nil
local dz = nil
if spell.facing == 0 then
dx = left and -0.1 or 0.1
dz = -1
elseif spell.facing == 1 then
dz = left and 0.1 or -0.1
dx = -1
elseif spell.facing == 2 then
dx = left and 0.1 or -0.1
dz = 1
else -- spell.facing == 3
dz = left and -0.1 or 0.1
dx = 1
end
spell:setWorldPosition(vec(wpos[1]-0.65,wpos[2]+0.25,wpos[3]+dz))
end,
Re: How to use the lindworm?
World position has global orientation, it is independent of facing. You have to adjust it depending on the facing of the caster. Your code is treating it as if the x position is local and the z position is global. All 3 positions are global. Also, you need to get rid of the lines with "left" because it will always be nil and only makes sense when it's a champion from the party casting the spell.
Also you need to check that your x and y positions are inside the map bounds, your current code will probably cause a crash if the lindworm breathes while on the edge of the map.
Also you need to check that your x and y positions are inside the map bounds, your current code will probably cause a crash if the lindworm breathes while on the edge of the map.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Re: How to use the lindworm?
thanks,minmay wrote:World position has global orientation, it is independent of facing. You have to adjust it depending on the facing of the caster. Your code is treating it as if the x position is local and the z position is global. All 3 positions are global. Also, you need to get rid of the lines with "left" because it will always be nil and only makes sense when it's a champion from the party casting the spell.
Also you need to check that your x and y positions are inside the map bounds, your current code will probably cause a crash if the lindworm breathes while on the edge of the map.
so far I ve modified the above script into this: don't know if this is good, but it works on all direction.
SpoilerShow
Code: Select all
{
class = "MonsterAttack",
name = "rangedAttack",
attackPower = 400,
minDistance = 2,
cooldown = 3,
animation = "rangedAttack",
sound = "lindworm_roar",
onAttack = function(self)
local dx,dy = getForward(self.go.facing)
local x = self.go.x + dx*2
local y = self.go.y + dy*2
local spell = spawn("magma_meteor", self.go.level, x, y, self.go.facing, self.go.elevation)
local wpos = spell:getWorldPosition()
if spell.facing == 0 then
spell:setWorldPosition(vec(wpos[1]+0.65,wpos[2]+0.25,wpos[3]+0))
elseif spell.facing == 1 then
spell:setWorldPosition(vec(wpos[1]+0,wpos[2]+0,wpos[3]-0.65))
elseif spell.facing == 2 then
spell:setWorldPosition(vec(wpos[1]-0.65,wpos[2]+0.25,wpos[3]+0))
else -- spell.facing == 3
spell:setWorldPosition(vec(wpos[1]+0,wpos[2]+0,wpos[3]+0.65))
end
end,
},
Re: How to use the lindworm?
make sure your final x and y are not negative or above 31
also why do you have the Y position different for different directions?
also why do you have the Y position different for different directions?
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Re: How to use the lindworm?
lol I don't know
while trying how to represent that in a 3d space and use some values, I finally adjust it to that, and this works nice.
did I understand this correctly?
here wpos[1] is the x , [2] the y , and [3] the z? or that does have nothing to do with that.
I'm kinda lost now!
while trying how to represent that in a 3d space and use some values, I finally adjust it to that, and this works nice.
Code: Select all
spell:setWorldPosition(vec(wpos[1]-0.65,wpos[2]+0.25,wpos[3]+0))here wpos[1] is the x , [2] the y , and [3] the z? or that does have nothing to do with that.
I'm kinda lost now!
Re: How to use the lindworm?
In Grimrock, the X world axis is west to east, the Y world axis is down to up, and the Z world axis is south to north. So for adjusting the world position position of a fired projectile, you'll want to change the X and Z positions depending on the facing of the monster. But the monster's animation will always be making the attack at the same height, regardless of which direction it's facing. So the Y world position, relative to the monster's Y position, should always be the same, and should not depend on facing.bongobeat wrote:lol I don't know
while trying how to represent that in a 3d space and use some values, I finally adjust it to that, and this works nice.
did I understand this correctly?Code: Select all
spell:setWorldPosition(vec(wpos[1]-0.65,wpos[2]+0.25,wpos[3]+0))
here wpos[1] is the x , [2] the y , and [3] the z? or that does have nothing to do with that.
I'm kinda lost now!
It is a little strange since for map coordinates (the ones used by teleporters, GameObject:setPosition(), and so on), X is west to east and Y is north to south. And in 3D modeling programs the Z axis is usually the down/up one. But this is just the way things are in Grimrock.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Re: How to use the lindworm?
Perfect ! I'm going tu use the "new" lindworm in my mod, and obviously I will put down yours names in my credits.
- Eleven Warrior
- Posts: 752
- Joined: Thu Apr 18, 2013 2:32 pm
- Location: Australia
Re: How to use the lindworm?
Thxs Bongo have added him into my mod as well awesome job bro - 9/10 Kudo's
- AndakRainor
- Posts: 674
- Joined: Thu Nov 20, 2014 5:18 pm
Re: How to use the lindworm?
How do the comments this boss makes during the fight work ? Is it linked to its brain, or some script ? I would like him to comment on other spells casts in addition to the meteor storm...