Page 1 of 1
setHealth on a spawned monster
Posted: Tue Oct 27, 2015 4:07 am
by FeMaiden
If I spawn a monster using a script, can I then use that same script to setHealth on the monster?
I don't really understand how to make a ghoul rise up from the ground when the party approaches.
when I place them on the map, even in guard mode, they just rise up as soon as the map is loaded.
the only way around it was to put them in spawners so that they don't "spawn" and rise up until the party steps on the trigger.
but the spawner does not allow you to change the monster health.
I recently learned how to spawn a monster out of a script, but can I set it's health from there as well?
like, what I wanted was an encounter where a buttload of ghouls rise up, but they are weaker than normal ghouls, with only 100 health each.
Re: setHealth on a spawned monster
Posted: Tue Oct 27, 2015 6:28 am
by Drakkan
dealing with spawned monsters is little more complicated, I remember some thread around, however cannot find it now. Basically I think you need spawn the monster with script and add it some unique ID - then you can deal with it as regular if I am not mistaken.
If you do not want mess with that, than use just some easy workaround - for example place the real monster somewhere completely locked with teleport on it and just activate the teleport to move the monster where and when you need, which will have the same effect as spawning it.
As for undead, there is component "rise" on it, which is what you are looking for.
Regarding setting the health I am sure you are aware of basic monster components MonsterComponent:setHealth(health) and MonsterComponent:setMaxHealth(health)
Re: setHealth on a spawned monster
Posted: Tue Oct 27, 2015 7:52 am
by FeMaiden
actually,the "put a monster on the map and then teleport it in technique" is something i've been using lately lol.
I've been using that for bosses.
as for the ghoul's "rise" ability. I don't want to turn it off.
I want to appear as if the ghoul to stays until it senses the player and then rises up. I have the same problem with the ambush spider.
If i put them off the map and teleport them in, they won't have the "ambush" or "rise" effect because they will have already done it the instant the map loaded.
I don't want the monster to just "appear out of thin air"
so you say it IS possible, I just need more scripting.
I figured as much.
I know how to spawn a monster with a script.
so then all I need to do is set an id for it and then i can manipulate it's stats and even add it to a boss fight?
Re: setHealth on a spawned monster
Posted: Tue Oct 27, 2015 10:34 am
by THOM
Do something like
Code: Select all
function(self)
local warg = spawn("fjeld_warg",self.go.level,self.go.x,self.go.y,(party.facing+2)%4,self.go.elevation)
warg.monster:setLevel(3)
warg.monster:setMaxHealth(600)
warg.monster:setHealth(600)
end
Re: setHealth on a spawned monster
Posted: Fri Oct 30, 2015 12:32 am
by FeMaiden
THOM wrote:Do something like
Code: Select all
function(self)
local warg = spawn("fjeld_warg",self.go.level,self.go.x,self.go.y,(party.facing+2)%4,self.go.elevation)
warg.monster:setLevel(3)
warg.monster:setMaxHealth(600)
warg.monster:setHealth(600)
end
weird question.
I notice you setMaxHealth() first and then you setHealth()
I've been doing the health first and then max health.
is it better to set the max health first? or it doesn't matter?
it seems like it doesn't matter since I'm having the desired effect.