Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
I've been playing around with that thing lots yesterday.. still havn't gotten very far.
I tried to get a herder to go pull a lever when they spot the party, but it seems it's more complicated than i first thought.
Some of the basic herder stuff (like chasing after the party) i couldn't get rid of, so it kindof conflicted with moving toward a lever.... then i went on trying the tricksterbrain instead and that got REALLY messy.
defineObject{
name = "herder_test",
baseObject = "herder",
components = {
{
class = 'Brain',
onThink = function(self)
if self.partyLastSeen ~= 0 then
self:goTo("lever_1")
end
end
}
}
}
Harder can't operate devices, it doesn't have the animation for it.
ooo. nice one!
I'll have to try that tomorrow. I totally missed the "goTo" function.
i was playing around with giving it the MonsterOperateDeviceComponent, and pointed the animation to the attack anim.... and got it to actually play that once i managed to lure it over to a lever..
function speedUp()
herderTest.move:setCooldown(0)
herderTest.move:setAnimationSpeed(5)
herderTest.turn:setCooldown(0)
herderTest.turn:setAnimationSpeed(5)
end
speedUp()
Runaway herder coming through.
Would be cool to hook this up to occur when the herder is on fire, seeing as there is a "BurningMonsterComponent". No idea how to handle that one though.
If you placed a floor trigger in front of the lever_2 which activates a Script, which the floor trigger is activated by Monster only, the door could open I think? I don't know the Script for this.
state = "begin"
function onThink(self)
if state == "begin" and self.partyLastSeen ~= 0 then
if self:goTo("lever_1") then
state = "operate"
end
end
if state == "operate" then
lever_1.lever:toggle()
state = "end"
end
end
just call herder_ai_test.script.onThink(self) from the onThink hook. But floor trigger works too of course.
defineObject{
name = "herder_test",
baseObject = "herder",
components = {
{
class = 'Brain',
onThink = function(self)
if self.partyLastSeen ~= 0 then
while lever_1.getPosition ~= self.getPosition do
self:goTo("lever_1")
else
self:Operate("lever_1")
end
end
end
}
}