Page 1 of 2

Boss fight help

Posted: Sat Jul 04, 2015 2:34 pm
by WaspUK1966
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

Re: Boss fight help

Posted: Sat Jul 04, 2015 2:38 pm
by THOM
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...

Re: Boss fight help

Posted: Sat Jul 04, 2015 6:49 pm
by minmay
"advanced scripting skills"
it's one line

Code: Select all

bossFightObject.bossfight:addMonster(monsterObject.monster)
or if you add it in the middle of the boss fight, two lines

Code: Select all

bossFightObject.bossfight:addMonster(monsterObject.monster)
bossFightObject.bossfight:recomputeTotal()

Re: Boss fight help

Posted: Sat Jul 04, 2015 7:16 pm
by Azel
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

Posted: Sat Jul 04, 2015 8:28 pm
by Isaac
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.

Re: Boss fight help

Posted: Sat Jul 04, 2015 10:58 pm
by WaspUK1966
Thanks for that! Now I can spawn the monster as intended :

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

Posted: Sat Jul 04, 2015 11:28 pm
by Azel
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

Re: Boss fight help

Posted: Sun Jul 05, 2015 8:29 pm
by WaspUK1966
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

Re: Boss fight help

Posted: Mon Jul 06, 2015 2:18 am
by Azel
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:
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.
... and then at the end of the Preface:
A 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.
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 code :shock:

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... :P

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 :mrgreen:

Re: Boss fight help

Posted: Mon Jul 06, 2015 3:03 am
by Isaac
The script_entity itself is the perfect source of coordinates.