Ask a simple question, get a simple answer
Re: Ask a simple question, get a simple answer
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"
-
- Posts: 73
- Joined: Sun Apr 12, 2015 2:57 pm
Re: Ask a simple question, get a simple answer
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"
Irritating at this point is putting it lightly, I did go ahead and try a barrel_crate_block, beach_crab, and plate_cuirass. None of them spawned when triggered. I tried a different map with the same result. Out of curiosity. I went back to the puzzle that I know was working fine earlier before running into this problem and it is no longer working. So... ~tosses papers into the air~ ... I guess the dungeon is broke? Funny thing is, the puzzles that I used the spawner object with still work fine.
Re: Ask a simple question, get a simple answer
Have you edited the dungeon File by hand? Maybe something went wrong then.
Re: Ask a simple question, get a simple answer
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
Also, the "else part" stops the loop as soon as x = 0 and y = 0, i.e., halfway through the loops.
Alois
-
- Posts: 73
- Joined: Sun Apr 12, 2015 2:57 pm
Re: Ask a simple question, get a simple answer
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.
Re: Ask a simple question, get a simple answer
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.
Alois
Re: Ask a simple question, get a simple answer
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)
- zimberzimber
- Posts: 432
- Joined: Fri Feb 08, 2013 8:06 pm
Re: Ask a simple question, get a simple answer
How do I modify a hook through scripts outside outside of a definition?
For example, I want this to apply to a monster...
But only if I define it through a script entity. Something like...
For example, I want this to apply to a monster...
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
My asset pack [v1.10]
Features a bit of everything!
Features a bit of everything!
Re: Ask a simple question, get a simple answer
You cannot dynamically modify hooks, but you can always define a hook that calls a function you can dynamically change - that's why the hook framework was created to do this automatically for you.
This still won't let you add hooks to dynamically created Components though.
This still won't let you add hooks to dynamically created Components though.
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: Ask a simple question, get a simple answer
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
Example:
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()