Boss dies' not timer activate..HELP

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!
Post Reply
User avatar
Mysterious
Posts: 226
Joined: Wed Nov 06, 2013 8:31 am

Boss dies' not timer activate..HELP

Post by Mysterious »

Hi guys. I having a problem with this script. When the boss die's the (timer_2) does not activated for some reason, even though it checks if the boss is dead. Can I get some help on this please thxs :) Oh and timer_2 connects to the: function Die1()

Code: Select all

boss2timer.timer:stop()
message = "DRACO: First you enter my fort and now you desacrate my tomb...DIE!!"


function bossmodetomb()
party.party:shakeCamera(1, 1)
hudPrint(message)
boss2timer.timer:start()
	end

function bossstart2()

hudPrint("Shadow: Lets do this, or we will die.")
spawn("mummy3",2,14,15,3,0,"boss2draco")

spawn("tomb_key",2,14,15,3,0,"tomb_key_a")
boss2draco.monster:addItem(tomb_key_a.item)

boss2draco.monster:setHealth(300)
boss2draco.monster:setMaxHealth(300) 
boss_fight_draco.bossfight:addMonster(boss2draco.monster)
boss_fight_draco.bossfight:activate()
boss2timer.timer:stop()
Draco_Dont_Steal_1.script.bossdeaddraco()

	end

function bossdeaddraco()

if boss2draco.monster:getHealth() == 0 then
boss_fight_draco.bossfight:deactivate()
timer_2.timer:start()

end
	end

function Die1()	
playSound("screaming_1")
end
User avatar
Mysterious
Posts: 226
Joined: Wed Nov 06, 2013 8:31 am

Re: Boss dies' not timer activate..HELP

Post by Mysterious »

bump sorry need help bad on this
Scotty
Posts: 69
Joined: Fri Nov 07, 2014 2:59 pm

Re: Boss dies' not timer activate..HELP

Post by Scotty »

The problem is that you're calling bossdeaddraco() right at the start of the fight (when he'd be at full health) and then never again. What you want to be using is the onDie hook, which will activate a function when a monster dies. So change the bossdeaddraco() function to this:

Code: Select all

function bossdeaddraco()
boss_fight_draco.bossfight:deactivate()
timer_2.timer:start()
end
(since the if statement is irrelevant if it's being called on his death anyway)
Add a connector from the boss monster, select "onDie", and select bossdeaddraco().

Let me know if that works!
User avatar
Mysterious
Posts: 226
Joined: Wed Nov 06, 2013 8:31 am

Re: Boss dies' not timer activate..HELP

Post by Mysterious »

Hi thxs for the help but I still can get the code to work. The mummy is spawned and I don't know how to code in the ondie hook in the script. I think I very lost on this dam, I spent hours on this lol. Bad scripter I am lol.
Scotty
Posts: 69
Joined: Fri Nov 07, 2014 2:59 pm

Re: Boss dies' not timer activate..HELP

Post by Scotty »

If the mummy is sitting there in the editor, you can just click on it, and there should be an add connector button on the right panel.

If the mummy is spawned in at some later point you will have to add the connector in your script somewhere AFTER the spawn happens.
To put in a connector in the script, it's structured like this:

my_monster.monster:addConnector("onDie", "my_script", "my_function")

So yours should be something like:
boss2draco.monster:addConnector("onDie, "whateveryourscriptentityiscalled", "bossdeaddraco")

Don't worry, you'll get the hang of it!
User avatar
Mysterious
Posts: 226
Joined: Wed Nov 06, 2013 8:31 am

Re: Boss dies' not timer activate..HELP

Post by Mysterious »

Hi Scotty I got this to work. Thxs for the help, one line made it work wow :)

Code: Select all

boss2timer.timer:stop()
message = "DRACO: First you enter my fort and now you desacrate my tomb...DIE!!"

--Altar connects to this Script--

function bossmodetomb()
party.party:shakeCamera(1, 1)
hudPrint(message)
boss2timer.timer:start()
	end


--boss2timmer conects to this Script (3 Sec interval)--

function bossstart2()

hudPrint("Shadow: Lets do this, or we will die.")
spawn("mummy3",2,14,15,3,0,"boss2draco")
spawn("tomb_key",2,14,15,3,0,"tomb_key_a")
boss2draco.monster:addItem(tomb_key_a.item)
	boss2draco.monster:setHealth(300)
	boss2draco.monster:setMaxHealth(300) 
boss_fight_draco.bossfight:addMonster(boss2draco.monster)
boss_fight_draco.bossfight:activate()
boss2timer.timer:stop()
boss2draco.monster:addConnector("onDie","Draco_Dont_Steal_1","bossdeaddraco")
	end

function bossdeaddraco()

boss_fight_draco.bossfight:deactivate()
timer_2.timer:start()
	end

--timer_2 conects to this Script (2 sec interval)--

function BossScream()

playSound("screaming_1")
	end
Thxs again now I can use this for other boss fights :)
Post Reply