Ask a simple question, get a simple answer
Re: Ask a simple question, get a simple answer
Cool, hope it works out. Report the results - and I'd love to play test it too!
Also, if you take the Patrol route in an open area, you might want to include some obstacles between the monster and the party so that players are not able to use projectiles to simply "snipe" the monster while its on patrol. A well placed tree or rock can keep the monster visible without violating the "open area" aesthetics, yet protect the monster from sniping; thus forcing players to activate the Aggro Trigger in order to properly engage in the battle.
Also, if you take the Patrol route in an open area, you might want to include some obstacles between the monster and the party so that players are not able to use projectiles to simply "snipe" the monster while its on patrol. A well placed tree or rock can keep the monster visible without violating the "open area" aesthetics, yet protect the monster from sniping; thus forcing players to activate the Aggro Trigger in order to properly engage in the battle.
- Duncan1246
- Posts: 404
- Joined: Mon Jan 19, 2015 7:42 pm
Re: Ask a simple question, get a simple answer
My start point is that outdoors in LG2 deserves specific mod design, not an indoor with walls of trees and water canals instead of stone walls. So it means pretty big free spaces where the true limits are the dangers like monsters: if it"s a hunting trip, it"s the players who areAzel wrote:Cool, hope it works out. Report the results - and I'd love to play test it too!
Also, if you take the Patrol route in an open area, you might want to include some obstacles between the monster and the party so that players are not able to use projectiles to simply "snipe" the monster while its on patrol. A well placed tree or rock can keep the monster visible without violating the "open area" aesthetics, yet protect the monster from sniping; thus forcing players to activate the Aggro Trigger in order to properly engage in the battle.
hunted rather then monsters. Who wants really to encounter a monster in a forest ride? If monsters walk on their way, the better is to choose an other way if possible and to fight only when it's not...
A few months and if you agree, I would ask you for testing!
Duncan
The Blue Monastery (LOG1)
download at:http://www.nexusmods.com/grimrock/mods/399/?
Finisterrae(LOG2)
download at:http://www.nexusmods.com/legendofgrimrock2/mods/61/?
download at:http://www.nexusmods.com/grimrock/mods/399/?
Finisterrae(LOG2)
download at:http://www.nexusmods.com/legendofgrimrock2/mods/61/?
Re: Ask a simple question, get a simple answer
@Duncan a very simple example to get you started:
Code: Select all
onThink = function(self)
return self:moveForward() or self:turnLeft() or self:wait()
end
- Duncan1246
- Posts: 404
- Joined: Mon Jan 19, 2015 7:42 pm
Re: Ask a simple question, get a simple answer
Thanks Petri, it's what I need to startpetri wrote:@Duncan a very simple example to get you started:
Code: Select all
onThink = function(self) return self:moveForward() or self:turnLeft() or self:wait() end
Duncan
The Blue Monastery (LOG1)
download at:http://www.nexusmods.com/grimrock/mods/399/?
Finisterrae(LOG2)
download at:http://www.nexusmods.com/legendofgrimrock2/mods/61/?
download at:http://www.nexusmods.com/grimrock/mods/399/?
Finisterrae(LOG2)
download at:http://www.nexusmods.com/legendofgrimrock2/mods/61/?
Re: Ask a simple question, get a simple answer
Hello everyone,
I have been checking these forums for months now - getting help through other forum members questions and I thought that it was finally time to ask a direct question for a specific issue.
I am trying to put three particular items on a floor trigger to open some mine_door_spears nearby. The items are dropped - not placed, so an alcove is not wanted. Once the items are dropped they open the door_ spear, but I need the items to be destroyed. I wanted it to only accept three specific items, and any other item dropped is obviously lost. I have used a script_auto_trigger to achieve this, but dropping any item opens the spear doors.
I have looked through the forums, but I am unable to make the script work. I have added destroy terms, but that just crashes back to the editor.
Any help would be appreciated.
I have been checking these forums for months now - getting help through other forum members questions and I thought that it was finally time to ask a direct question for a specific issue.
I am trying to put three particular items on a floor trigger to open some mine_door_spears nearby. The items are dropped - not placed, so an alcove is not wanted. Once the items are dropped they open the door_ spear, but I need the items to be destroyed. I wanted it to only accept three specific items, and any other item dropped is obviously lost. I have used a script_auto_trigger to achieve this, but dropping any item opens the spear doors.
I have looked through the forums, but I am unable to make the script work. I have added destroy terms, but that just crashes back to the editor.
Any help would be appreciated.
SpoilerShow
function execute(trigger)
function surfaceContains(surface, item)
for v,i in surface:contents() do
if i.go.name == item then return true
end
end
end
function spawnSecretItems()
if surfaceContains(floor_trigger_12.surface, "blue_gem") or
surfaceContains(floor_trigger_12.surface, "green_gem") or
surfaceContains(floor_trigger_12.surface, "red_gem") then
mine_door_spear_79.door:open()
else
mine_door_spear_79.door:close()
end
end
end
self.go.floortrigger:addConnector('onActivate',self.go.id,'execute')
function surfaceContains(surface, item)
for v,i in surface:contents() do
if i.go.name == item then return true
end
end
end
function spawnSecretItems()
if surfaceContains(floor_trigger_12.surface, "blue_gem") or
surfaceContains(floor_trigger_12.surface, "green_gem") or
surfaceContains(floor_trigger_12.surface, "red_gem") then
mine_door_spear_79.door:open()
else
mine_door_spear_79.door:close()
end
end
end
self.go.floortrigger:addConnector('onActivate',self.go.id,'execute')
Re: Ask a simple question, get a simple answer
I don't see a proper condition in your if statement, but this looks simpler :
Code: Select all
local gem = { "blue_gem", "green_gem", "red_gem" }
for i = 1,3 do
if floor_trigger_12:isActivated and
surfaceContains( floor_trigger_12.surface, gem [ i ] ) == true
then mine_door_spear_79.door:open()
item:destroy()
end end
Re: Ask a simple question, get a simple answer
Frenchie, thank you for the assistance.
I didn't properly elaborate on what I was trying to achieve, which is why I am getting the "function arguments expected near 'and." or when I remove the 'and' I receive the
"function arguments expected near 'surfaceContains'."
I would like the blue gem to open mine_spear_door_79, the green gem for the next, and red for the last. Not only do the gems open an individual door, but they spawn items in each of their designated areas.
In all honesty, I have made various convoluted messes that either don't work at all, or just allow any item to be dropped on the trigger.
I understand the concept of each line of script, but then I just ruin it by adding other codes.
I didn't properly elaborate on what I was trying to achieve, which is why I am getting the "function arguments expected near 'and." or when I remove the 'and' I receive the
"function arguments expected near 'surfaceContains'."
I would like the blue gem to open mine_spear_door_79, the green gem for the next, and red for the last. Not only do the gems open an individual door, but they spawn items in each of their designated areas.
SpoilerShow
local gem = { "blue_gem", "green_gem", "red_gem" }
for i = 1,3 do
if floor_trigger_12:isActivated
surfaceContains( floor_trigger_12.surface, gem [ i ] ) == true
then mine_door_spear_79.door:open()
and mine_door_spear_80.door:open()
and mine_door_spear_81.door:open()
item:destroy()
end end
self.go.floortrigger:addConnector('onActivate',self.go.id,'execute')
for i = 1,3 do
if floor_trigger_12:isActivated
surfaceContains( floor_trigger_12.surface, gem [ i ] ) == true
then mine_door_spear_79.door:open()
and mine_door_spear_80.door:open()
and mine_door_spear_81.door:open()
item:destroy()
end end
self.go.floortrigger:addConnector('onActivate',self.go.id,'execute')
I understand the concept of each line of script, but then I just ruin it by adding other codes.
Re: Ask a simple question, get a simple answer
Is there a way to "flip" an object when spawning it? In other words, I want the facing to be the same, but the actual orientation of the mesh to be pointing the opposite direction. An analogy might be the "flip horizontal" or "flip vertical" functions in most image editors (where changing facing would be analogous to rotating 90 degrees).
Thanks for any help anyone can provide.
Thanks for any help anyone can provide.
Re: Ask a simple question, get a simple answer
If spawning via script, set the desired direction with the facing parameter to the spawn function; if spawning via spawner, position the spawner to point in the intended direction.Eburt wrote:Is there a way to "flip" an object when spawning it? In other words, I want the facing to be the same, but the actual orientation of the mesh to be pointing the opposite direction. An analogy might be the "flip horizontal" or "flip vertical" functions in most image editors (where changing facing would be analogous to rotating 90 degrees).
Thanks for any help anyone can provide.
spawn(object, level, x, y, facing, elevation, [id])
Spawns a new object at given position on a dungeon level where x and y specify the x- and y-coordinates on the map and level is a level index. facing must be a number between 0 and 3 and it indicates the following directions: 0=north, 1=east, 2=south, 3=west. id parameter is optional. If given it must be an unique id in the context of the dungeon. If not given an unique id is automatically generated.
Re: Ask a simple question, get a simple answer
1. Rotating 180 degrees is not the same thing as flipping.Isaac wrote:If spawning via script, set the desired direction with the facing parameter to the spawn function; if spawning via spawner, position the spawner to point in the intended direction.Eburt wrote:Is there a way to "flip" an object when spawning it? In other words, I want the facing to be the same, but the actual orientation of the mesh to be pointing the opposite direction. An analogy might be the "flip horizontal" or "flip vertical" functions in most image editors (where changing facing would be analogous to rotating 90 degrees).
Thanks for any help anyone can provide.
2. Eburt specifically said that they do not want the facing to change.
The answer is no, you can't. You can rotate models in their asset definiton, and you can rotate the entire GameObject with the various versions of setWorldRotation(), but there is no way to flip anything since that is a change in the actual shape of the mesh; there's a reason "flip" is separated from rotation options in image/model editors. Try to mirror your keyboard around one axis IRL, it's impossible. You would have to make a separate, flipped version of the mesh.
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.