Boss fight help
- WaspUK1966
- Posts: 135
- Joined: Sat Aug 09, 2014 9:17 am
Boss fight help
I've followed the online video tutorial to set up and code boss fights (really helpful!). But that code uses a monster that is already placed on the map and is visible to the player once they enter the area. Is it possible to spawn a monster instead, then code it for a boss fight? That way, the player doesn't know what's coming? Or would that be too complex? (getting the spawned monster's ID etc). Any ideas?
George
George
Re: Boss fight help
I don't know, if it's possible to register a spawned monster for a bossfight. maybe by using advanced scripting skills.
But when I came to the same problem in my mod I solved it that way that I placed my monster at an unaccessable place on the map and teleported it for the bossfight near to the party...
But when I came to the same problem in my mod I solved it that way that I placed my monster at an unaccessable place on the map and teleported it for the bossfight near to the party...
Re: Boss fight help
"advanced scripting skills"
it's one line
or if you add it in the middle of the boss fight, two lines
it's one line
Code: Select all
bossFightObject.bossfight:addMonster(monsterObject.monster)
Code: Select all
bossFightObject.bossfight:addMonster(monsterObject.monster)
bossFightObject.bossfight:recomputeTotal()
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: Boss fight help
A snippet from the script I use to auto-spawn a Uggardian:
Code: Select all
function NewFireBoss()
local fireBoss;
do fireBoss = spawn("uggardian", party.level, 11, 15, 1, 0);
fireBoss.monster:setLevel(3);
fireBoss.monster:setMaxHealth(600);
boss_fight_1.bossfight:addMonster(fireBoss.monster);
end
end
Re: Boss fight help
The question seems answered already; but here is an example of a spawned boss fight that I built a few months ago.
https://www.dropbox.com/s/w2jgjrzh3y6jo ... l.zip?dl=0
It's more than a few lines. It adds six existing monsters into the Boss fight, along side of the Boss that gets spawned into the dungeon when the party steps on a trigger. This one counts down the enemies as you eliminate them, and notices the main boss by name when killed.
https://www.dropbox.com/s/w2jgjrzh3y6jo ... l.zip?dl=0
It's more than a few lines. It adds six existing monsters into the Boss fight, along side of the Boss that gets spawned into the dungeon when the party steps on a trigger. This one counts down the enemies as you eliminate them, and notices the main boss by name when killed.
- WaspUK1966
- Posts: 135
- Joined: Sat Aug 09, 2014 9:17 am
Re: Boss fight help
Thanks for that! Now I can spawn the monster as intended :
What I'm trying to do is open a gate once it dies. How do I do that? I've tried using OnDie function, or setAchievement() but can't get them to work..
George
Code: Select all
function startviperBossFight()
local viperBoss = spawn("viper_root", party.level, 17, 4, 3, 0)
boss_fight_viper.bossfight:addMonster(viperBoss.monster)
boss_fight_viper.bossfight:activate()
end
What I'm trying to do is open a gate once it dies. How do I do that? I've tried using OnDie function, or setAchievement() but can't get them to work..
George
Re: Boss fight help
Something like this should do it:
Code: Select all
function BossDeath
-- end the boss fight
boss_fight_viper.bossfight:deactivate();
my_boss_door.door:open(); -- let the party leave
end
function startviperBossFight()
local viperBoss;
do viperBoss = spawn("viper_root", party.level, 17, 4, 3, 0);
viperBoss.monster:addConnector("onDie", self.go.id, "BossDeath")
boss_fight_viper.bossfight:addMonster(viperBoss.monster);
boss_fight_viper.bossfight:activate();
end
end
- WaspUK1966
- Posts: 135
- Joined: Sat Aug 09, 2014 9:17 am
Re: Boss fight help
Thanks for that, Azel. Works as intended now. Still on a learning curve as far as LOG2 coding goes. Slightly different from LOG1. Keep using old code by mistake! But I'll get there eventually. Help much appreciated as always.
George
George
Re: Boss fight help
No problem. I too am only now pushing a bit harder to apply my programming skills more properly under the Grimrock framework. Things don't always play nice with my .Net developer experience lol.
Personally, I'm not a fan of LUA at all. It reminds me of Jquery/Ajax, and how these scripting languages "enable" the abuse that web developers put on the presentation layer of software development. I find a lot of contradictions in how LUA functions, and even in how it is explained.
Example: http://www.lua.org/pil/p1.html
The beginning of the LUA Preface:

Even the Grimrock scripting reference has contradictions that only diminish after "reading between the lines" (eg, "CrystalComponent:setCooldown(number) leads us to a successful, my_crystal.crystal:setCooldown(60)" ... whereas "MonsterAttackComponent:getAttackPower() leads to a failure if you try, my_monster.monsterattack:getAttackPower()"). Granted, once you find out what went wrong you realize it was your fault for not understanding the Scripting Reference better, but at the end of the day it still feels quite sloppy, imo.
But I digress...
In the Spawn code I wrote in this thread, it does hardcode X, Y, Elevation, and Facing numbers. I believe the best practice is to instead put a "dummy object" in the location that you want to spawn the monster at, and reference its coordinates instead. But I'm too lazy to do that lol
Oh and no offense to anyone who loves LUA. This is just my personal take as a non-scripter. I recognize the talent of plenty of talented LUA dev's in this community
Personally, I'm not a fan of LUA at all. It reminds me of Jquery/Ajax, and how these scripting languages "enable" the abuse that web developers put on the presentation layer of software development. I find a lot of contradictions in how LUA functions, and even in how it is explained.
Example: http://www.lua.org/pil/p1.html
The beginning of the LUA Preface:
... and then at the end of the Preface:Currently, many programming languages are concerned with how to help you write programs with hundreds of thousands of lines. For that, they offer you packages, namespaces, complex type systems, a myriad of constructions, and thousands of documentation pages to be studied.
They start by chastising other programming languages for hiding large amounts of code behind libraries and type systems... and then follows up by bragging about how LUA uses libraries and type systems, which hide large amounts of codeA great part of the power of Lua comes from its libraries. This is not by chance. One of the main strengths of Lua is its extensibility through new types and functions.

Even the Grimrock scripting reference has contradictions that only diminish after "reading between the lines" (eg, "CrystalComponent:setCooldown(number) leads us to a successful, my_crystal.crystal:setCooldown(60)" ... whereas "MonsterAttackComponent:getAttackPower() leads to a failure if you try, my_monster.monsterattack:getAttackPower()"). Granted, once you find out what went wrong you realize it was your fault for not understanding the Scripting Reference better, but at the end of the day it still feels quite sloppy, imo.
But I digress...

In the Spawn code I wrote in this thread, it does hardcode X, Y, Elevation, and Facing numbers. I believe the best practice is to instead put a "dummy object" in the location that you want to spawn the monster at, and reference its coordinates instead. But I'm too lazy to do that lol
Oh and no offense to anyone who loves LUA. This is just my personal take as a non-scripter. I recognize the talent of plenty of talented LUA dev's in this community

Re: Boss fight help
The script_entity itself is the perfect source of coordinates.