Re: Ask a simple question, get a simple answer
Posted: Thu Jan 05, 2017 8:16 am
The lightning_bolt_blast has an irritating behaviour (like all the other blasts have). What if you spawn something else? e.g. "barrel_crate_block"
Official Legend of Grimrock Forums
http://grimrock.net/forum/
THOM wrote:The lightning_bolt_blast has an irritating behaviour (like all the other blasts have). What if you spawn something else? e.g. "barrel_crate_block"
Aren't you spawning blasts at the wrong level number? In your dungeon, the level number is 5Killcannon wrote:Interestingly enough if I do this:Isaac wrote:The function is called once, but each pass through the x loop usually comes with a full pass through the y loop, [7 passes through the y loop, if fmax == 3].
Is this nested loop intended just for spawning a set number of lightning bolts in fixed positions?
**If so, there might be a simpler way to script it.
It doesn't work either, and 22, 9 is the location of the pressure plate. I don't think this script could any simpler than that. It's still faithfully printing "Yes 2" though, and printing it once.Code: Select all
function frostexplosion() spawn("lightning_bolt_blast", 1, 22, 9, 0, 1) print("Yes 2") end
Seriously? ..... I... well slap a dunce cap on me and call me stupid. I'd been playing with the map positions in the project to keep them 'geographically' together as I added and removed maps. I somehow was under the impression that the 'level' coordinate in the function referred to the spell caster level, not the maps number in the list; and that the elevation was the 'level' everyone was speaking about. Don't ask me how I came up with that, as I seriously don't remember. Though it all makes sense to me now and I cannot believe how silly this has all been.alois wrote: Aren't you spawning blasts at the wrong level number? In your dungeon, the level number is 5
Also, the "else part" stops the loop as soon as x = 0 and y = 0, i.e., halfway through the loops.
Alois
If you do not want to remember the level number, you can use "spawn(object,party.level,x,y,facing,elevation)". In this way, the spawned object is in the same level as the party.Killcannon wrote:Seriously? ..... I... well slap a dunce cap on me and call me stupid. I'd been playing with the map positions in the project to keep them 'geographically' together as I added and removed maps. I somehow was under the impression that the 'level' coordinate in the function referred to the spell caster level, not the maps number in the list; and that the elevation was the 'level' everyone was speaking about. Don't ask me how I came up with that, as I seriously don't remember. Though it all makes sense to me now and I cannot believe how silly this has all been.alois wrote: Aren't you spawning blasts at the wrong level number? In your dungeon, the level number is 5
Also, the "else part" stops the loop as soon as x = 0 and y = 0, i.e., halfway through the loops.
Alois
Thanks Alois for downloading and checking out the files for me, and thanks to everyone else as I led them through a maze of misinformation and misunderstanding on my part.
Thx you were a great help!akroma222 wrote:Hey billb52,billb52 wrote:Hi All, Can anyone help with 'swamp_dead_tree' I want to be able to click on the hole in the tree to retrieve/place objects in or out of hole and have a connector
that will activate/deactivate door etc. I have set baseObject = "altar" on swamp_dead_tree defineObject and added class = "Surface", class = "Clickable" and
class = "Socket" but cannot get any item to be in the hole altering offset/size vec. Am I barking up the wrong tree here? Is there a better way PLS Help
here is a simple definition of swamp_dead_tree with added Surface and Clickable components
Add an item like long_sword to it in the editor - then change the offset/size vec etcIf you wanted to use a Socket component then change the Surface component for this Socket componentSpoilerShowCode: Select all
defineObject{ name = "swamp_dead_tree_new", baseObject = "base_obstacle", components = { { class = "Model", model = "assets/models/env/swamp_dead_tree.fbx", staticShadow = true, }, -----------------------------cut pasted from asset pack 2 - base objects { class = "Surface", offset = vec(0, 0.85, 0.2), size = vec(1.3, 0.65), --debugDraw = true, }, { class = "Clickable", offset = vec(0, 0.85+0.4, 0.2), size = vec(1.3, 0.8, 0.65), --debugDraw = true, }, ------------------------------ }, placement = "floor", editorIcon = 172, automapTile = "trees", minimalSaveState = true, }
Again you will need to change the offset - this is straight from the asset pack Torch HolderAlternatively, to simply make an item retrievable from the swamp tree hole - dont add any components and just use:SpoilerShowCode: Select all
{ class = "Socket", offset = vec(0.05, 1.53, -0.25), rotation = vec(0, -20, -90), onAcceptItem = function(self, item) return (item.go.name == "...item_that_fits..." or item.go.name == "...another_item_that_fits...") and self:count() == 0 end, },
This - im fairly sure - is how the Island Master's letter is placed in the Forest Oak hole (in Grimrock 2's forest)Code: Select all
item_that_fits:setWorldPosition(vec(x, y ,z)) item_that_fits:setWorldRotationAngles(x, y ,z)
Code: Select all
onDie = function(self)
print(self.go.id)
end,
Code: Select all
function spawnMonster()
local m = spawn("myMonster", 1, 1, 1, 1, 0)
m.monster.onDie = function(self)
print(self.go.id)
end
end
zimberzimber wrote:How do I modify a hook through scripts outside outside of a definition?
...Addendum: Pre-existing hooks can have connectors applied dynamically; but these connected functions cannot cancel the event/action.minmay wrote:You cannot dynamically modify hooks, but you can always define a hook that calls a function you can dynamically change
Code: Select all
function died(monster) print('A spawned '..monster.go.name.." just died!") end
function think(monster) print('A spawned '..monster.go.name.." thought of something!") end
function poof()
local dX,dY = getForward(party.facing)
local M = spawn("crowern",party.level, party.x+dX, party.y+dY, (party.facing+2)%4, party.elevation)
M.monster:addConnector("onDie", self.go.id, "died")
M.brain:addConnector("onThink", self.go.id, "think")
end
poof()