Ask a simple question, get a simple answer
- zimberzimber
- Posts: 432
- Joined: Fri Feb 08, 2013 8:06 pm
Re: Ask a simple question, get a simple answer
Is it possible to have the game perform an autosave without forcing the player to heal at a healing crystal?
Was thinking about self disabling floor triggers that autosave the game. If possible, into a different slot/name. (Not the default "Autosave" slot)
Was thinking about self disabling floor triggers that autosave the game. If possible, into a different slot/name. (Not the default "Autosave" slot)
My asset pack [v1.10]
Features a bit of everything!
Features a bit of everything!
Re: Ask a simple question, get a simple answer
What on earth are you talking about? Connectors are triggered by hooks, not the other way around. Every time a hook triggers and doesn't return false, all connectors for that hook are triggered in order. All of these connectors receive the same arguments as the hook. PartyComponent.onDrawGui connectors pass the PartyComponent and the GraphicsContext, MonsterComponent.onProjectileHit connectors pass the MonsterComponent, ItemComponent, damage, and damageType, etc.Isaac wrote:Anytime a hook fires, its arguments are passed [afaik], but what's an example of a connector triggering a hook? (~besides onInsertItem /acceptItem, or script assigned.)Connectors pass all the arguments that the hook has. A SurfaceComponent onInsertItem connector passes the SurfaceComponent and the ItemComponent.
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: Ask a simple question, get a simple answer
Is there a way to fiddle with timers and stuff so that I can make an enemy respawn in case it is not killed in given time?
- Eleven Warrior
- Posts: 745
- Joined: Thu Apr 18, 2013 2:32 pm
- Location: Australia
Re: Ask a simple question, get a simple answer
Hi all.
Has or can anyone help me make a spell of Healing? When the spell is casted it checks to see if the champ(s) is wounded if not hudPrint Champ is not hurt, if wounded hudPrint Trynadore is healed,
It need to check if the caster is a certain level, has a certain trait, and requires eart or something else.
Also need the Scroll item to show the player gestures.
Thxs for the help on this.
Has or can anyone help me make a spell of Healing? When the spell is casted it checks to see if the champ(s) is wounded if not hudPrint Champ is not hurt, if wounded hudPrint Trynadore is healed,
It need to check if the caster is a certain level, has a certain trait, and requires eart or something else.
Also need the Scroll item to show the player gestures.
Thxs for the help on this.
Re: Ask a simple question, get a simple answer
I wasn't talking about that, you seemed to be; so I asked for an example.minmay wrote:What on earth are you talking about? Connectors are triggered by hooks, not the other way around. Every time a hook triggers and doesn't return false, all connectors for that hook are triggered in order. All of these connectors receive the same arguments as the hook. PartyComponent.onDrawGui connectors pass the PartyComponent and the GraphicsContext, MonsterComponent.onProjectileHit connectors pass the MonsterComponent, ItemComponent, damage, and damageType, etc.Isaac wrote:Anytime a hook fires, its arguments are passed [afaik], but what's an example of a connector triggering a hook? (~besides onInsertItem /acceptItem, or script assigned.)Connectors pass all the arguments that the hook has. A SurfaceComponent onInsertItem connector passes the SurfaceComponent and the ItemComponent.
The original question was asking how to pass arguments with connectors [likely meaning plates and buttons, rather than user scripts]... and (erroneously) to hooks; unless I misread it.
- zimberzimber
- Posts: 432
- Joined: Fri Feb 08, 2013 8:06 pm
Re: Ask a simple question, get a simple answer
Howl3r
And this to the monster component:
The monster will not respawn if it is killed within 10 seconds after it spawned, so be sure to spawn it (rather than placing it) when the party should encounter it. (or activate via script)
Since the monster object has a short delay before destroying itself, you could add another initially disabled timer and set its interval to something like 0.5 or 1, have it activate when the monster dies, and upon it activating, it'll spawn the new monster. Don't forget to add a fancy particle effect
If you need it on a single monster, do the following:
Add a timer, name it "respawn_timer_1", make it disable self, and have the interval set to the time for the party to kill the monster.
Add a monster, name it "myMonster_1", and have it trigger the scripts "respawn" function on death.
Add a script entity, name it "respawn_script_1", and add this to it:
Make sure the interval is not too small(higher than 5), so the monster object will be deleted by the time he is ready to respawn.
If you still want to the interval to be lower than 5, you could make then "myMonster_2" checker spawn a ""myMonster_3", and have its checker spawn a "myMonster_1".
If you need it as part of a custom monster, add this component:Howl3r wrote:Is there a way to fiddle with timers and stuff so that I can make an enemy respawn in case it is not killed in given time?
Code: Select all
{
class = "Timer",
name = "respawnTimer",
timerInterval = 10,
disableSelf = true,
onActivate = function(self)
end,
},
Code: Select all
onDie = function(self)
if not self.go.respawnTimer:isEnabled() then
self:setExp(0) --Preventing infinite xp (or don't)
spawn(self.go.name, self.go.level, self.go.x, self.go.y, self.go.facing, self.go.elevation)
end
end,
Since the monster object has a short delay before destroying itself, you could add another initially disabled timer and set its interval to something like 0.5 or 1, have it activate when the monster dies, and upon it activating, it'll spawn the new monster. Don't forget to add a fancy particle effect
If you need it on a single monster, do the following:
Add a timer, name it "respawn_timer_1", make it disable self, and have the interval set to the time for the party to kill the monster.
Add a monster, name it "myMonster_1", and have it trigger the scripts "respawn" function on death.
Add a script entity, name it "respawn_script_1", and add this to it:
Code: Select all
function respawn(monster)
if not respawn_timer_1.timer:isEnabled() then
if monster.go.id == "myMonster_1" then
if not myMonster_2 then
local m = spawn(monster.go.name, monster.go.level, monster.go.x, monster.go.y, monster.go.facing, monster.go.elevation, "myMonster_2")
m.monster:addConnector("onDie", "respawn_script_1", "respawn")
respawn_timer_1.timer:enable()
else
print("error")
end
elseif monster.go.id == "myMonster_2" then
if not myMonster_1 then
local m = spawn(monster.go.name, monster.go.level, monster.go.x, monster.go.y, monster.go.facing, monster.go.elevation, "myMonster_1")
m.monster:addConnector("onDie", "respawn_script_1", "respawn")
respawn_timer_1.timer:enable()
else
print("error")
end
else
print("wrong ID")
end
else
print("The monster died")
end
end
If you still want to the interval to be lower than 5, you could make then "myMonster_2" checker spawn a ""myMonster_3", and have its checker spawn a "myMonster_1".
Last edited by zimberzimber on Sun Aug 14, 2016 8:49 am, edited 1 time in total.
My asset pack [v1.10]
Features a bit of everything!
Features a bit of everything!
- zimberzimber
- Posts: 432
- Joined: Fri Feb 08, 2013 8:06 pm
Re: Ask a simple question, get a simple answer
Eleven Warrior
From what I saw, scroll items are generated automatically.
Here: (not sure what you meant by "eart")Eleven Warrior wrote:Hi all.
Has or can anyone help me make a spell of Healing? When the spell is casted it checks to see if the champ(s) is wounded if not hudPrint Champ is not hurt, if wounded hudPrint Trynadore is healed,
It need to check if the caster is a certain level, has a certain trait, and requires eart or something else.
Also need the Scroll item to show the player gestures.
Thxs for the help on this.
Code: Select all
defineSpell{ -- Heals the caster based on their life magic skill and concentration
name = "heal",
uiName = "Heal",
gesture = 258,
manaCost = 30,
skill = "concentration",
icon = 60,
spellIcon = 1,
description = "Heal your own wounds. \nHealth restored: concentration * 10 + 30",
onCast = function(champion, x, y, direction, skill)
local reqLv = 5
local reqTrait = "wizard"
if champion:getLevel() >= reqLv and champion:hasTrait(reqTrait) then
if champion:getHealth() == champion:getMaxHealth() then
hudPrint(champion:getName().." was healed")
else
hudPrint(champion:getName().." is not wounded")
end
end
end,
}
My asset pack [v1.10]
Features a bit of everything!
Features a bit of everything!
Re: Ask a simple question, get a simple answer
Earthzimberzimber wrote:Here: (not sure what you meant by "eart")
**Requires Earth [magic] or something**
BTW: Howl3r is posting questions in both the LoG1 and LoG2 threads; but which game? (It affects the answers)
Re: Ask a simple question, get a simple answer
Oh f**k. Yeah thanks for noting me. I have been looking just through the internet for guides and haven't even noticed that a part of them are LoG 2 forums. Sorry about that :dIsaac wrote:Earthzimberzimber wrote:Here: (not sure what you meant by "eart")
**Requires Earth [magic] or something**
BTW: Howl3r is posting questions in both the LoG1 and LoG2 threads; but which game? (It affects the answers)
- zimberzimber
- Posts: 432
- Joined: Fri Feb 08, 2013 8:06 pm
Re: Ask a simple question, get a simple answer
DerpIsaac wrote:Earthzimberzimber wrote:Here: (not sure what you meant by "eart")
**Requires Earth [magic] or something**
Just need to replace concentration with earth_magic then
My asset pack [v1.10]
Features a bit of everything!
Features a bit of everything!