Maybe i was searching not long enough, but anyway:
Is there(in legend of grimrock editor) function like "isAlive" for monsters? I am trying to create a situation in which player can open a door after 3 herders die. Is it possible?
monster lock or smth ;d [SOLVED]
-
Kaold
monster lock or smth ;d [SOLVED]
Last edited by Kaold on Fri Jul 11, 2014 10:39 pm, edited 1 time in total.
Re: monster lock or smth ;d
There is this recent thread:
viewtopic.php?f=14&t=6586&p=69612&hilit ... ter#p69612
and I found this method from Ryeath Greystalk using an onDie hook and a counter. It was located here:
viewtopic.php?f=14&t=5221&hilit=on+die+counter
viewtopic.php?f=14&t=6586&p=69612&hilit ... ter#p69612
and I found this method from Ryeath Greystalk using an onDie hook and a counter. It was located here:
viewtopic.php?f=14&t=5221&hilit=on+die+counter
Re: Requestion some specific helpful tips
Postby Ryeath_Greystalk » Fri Mar 22, 2013 8:35 pm
Aleitheo,
In the dungeon I am working on I have a room that may be similar to what you are trying to accomplish. There are probably a few ways to do it but I will explain how I managed to accomplish it.
In my room i have a door which I named OfficeDoor1 and a secret door named OfficeDoor2. The layout is simple, when the party walks in a hidden pressure plate closes the door behind them. Once the party accomplishes a particular task in the room I then have 4 snails spawn in, one in each corner. The snails are custom assets using the cloneObject() function.
To clone the snails you would go into your dungeons Mod_Assets/scripts/monsters folder and add the following text.
Code: Select all
cloneObject{
name = "officesnail",
baseObject = "snail",
onDie = function(self)
OfficeCounter:decrement()
end,
}
This will create a copy of the snail and name it officesnail. You could name yours something else, such as doorsnail, or funny_looking_snail etc. It will keep all the same attributes as the regular snail, but with the addition of the onDie hook. The onDie hook will cal a function when the snail dies. In this case I have a counter, named OfficeCounter, that will decrement by 1 when the snail dies.
If you take this code and put it in your Mod_Assets/Scripts/Monsters file and save it, then reload your dungeon in the editor, you should now find an officesnail in your entities list (or whatever you named yours.) If you wanted to use a herder just change the baseObject to herder etc.. Just be sure you put a counter in the dungeon with the same name as what you use i the monsters onDie function or the game will crash.
getting back to my room, once the 4 snails spawn, each time one is killed the counter goes down by 1 untill the last one dies and the counter hits 0.
When the counter hits 0, 3 things happen ( I have the counter connected to 3 items), 1 the door named OfficeDoor2 opens up, 2 a spawner behind that door spawns a mini boss herder, 3 a script prints some gibberish on the screen to make it look like the herder is saying something in mushroom language.
the miniboss herder is again a cloned monster. I use this text
Code: Select all
cloneObject{
name = "officeherder",
baseObject = "herder",
health = 250,
onDie = function(self)
OfficeDoor1:open()
end,
}
Here I copied a herder but just gave it more life to make a little bit longer fight. Notice I also used an onDie hook so that when the miniboss dies the OfficeDoor1 that the party came in through opens up and they can go about thier dungeon exploring. Agai yo can copy that to the monsters file, save it and reload the dungeon and the officeherder should show up in the entities list.
There you have examples of how using the onDie hook with a cloned monster can create siffect results in the game.
A valuable tool is to download the assets pack that lists what the default assets used in the game are. That can be found here http://www.grimrock.net/modding/asset-pack/ (big thank you goes out to komag and Neikun for showing me the way there) For example I wanted to make a swarm of spiders, but make them weaker than normal, so I just looked up spider in the assets pack, saw what the regular specs are and changed mine to this
Code: Select all
cloneObject{
name = "weakspider",
baseObject = "spider",
health = 50,
attackPower = 12,
accuracy = 3,
exp = 25,
}
If you compare to the standard spider I lowered the health, attackPower, accuracy and of course the exp. These are for more to establish a panic in the player when this swarm comes at them at a time when a normal spider is a tough fight.
One thing to mention with the way I use the onDie hook to decrement the counter. For some wierd reason if you use kill the monster using the 'K' key, the counter will decrement but it won't trigger the effect. You have to physically kill the snail just like in the real game. You can read about it here viewtopic.php?f=14&t=5090
Also I mention a 3rd item when the snails all die. I link the counter to a script, and on the script I have this
Code: Select all
function angryMushroom()
hudPrint("\"Harg arlu nago inagoa ish!")
hudPrint("Nago lugah raga ISHGANU!!!\"")
end
This just prints some gibberish on the screen.
Hope some of this helps. I came here nowing next to nothing about this stuff and I have learned a lot just reading these forums. There is a ton of good info here.
Good luck
Currently conspiring with many modders on the "Legends of the Northern Realms"project.
"You have been captured by a psychopathic diety who needs a new plaything to torture."
Hotel Hades
"You have been captured by a psychopathic diety who needs a new plaything to torture."
Hotel Hades
-
Kaold
Re: monster lock or smth ;d
Nice, thanks for this solutions, but i was looking(just 4 fun i guess ;d) for solution without a counter(and hidden press plates ofc), smth like a
but im not sure how to acomplish that(im quite new with this modding/programming stuff ;d)
Should i behave like sb in examples u gave me, i mean create a Cloneobject with onDie = function(self)?
Code: Select all
if herder_swarm_1:getMonsterState() == "dead" and
herder_4:getMonsterState() == "dead" and
herder_3:getMonsterState() == "dead" then
dungeon_secret_door_12:open()
else
dungeon_secret_door_12:close()
endShould i behave like sb in examples u gave me, i mean create a Cloneobject with onDie = function(self)?
Re: monster lock or smth ;d
I think something like this should work. Just connect this to a timer which checks this periodically:
The only gotcha here is that in your original stuff you have a herder swarm which is a little more tricky so in my example I had just replaced it with an individual monster. Those monster groups are replaced with two individual monsters when the game starts so there is no herder_swarm_1 ID anymore, instead there's two herders with automatically generated IDs. If you want to use a monster group, you could scan a certain area of the level with entitiesAt() and count the herder entities but at that point, using onDie hooks probably become an easier solution.
Code: Select all
function checkHerders()
if monster_1 and
monster_2 and
monster_3 then
secret_door:close()
else
secret_door:open()
timer:deactivate()
end
endSteven Seagal of gaming industry
-
Kaold
Re: monster lock or smth ;d
Nice, this is exactly what i was searching for. (it should have "or" instead of "and" but it was not the heart of a problem) It's very precious knowledge, that simple ID of a monster contain info "is he alive or not" Thanks 4 help.