Any way to destroy entities?
Any way to destroy entities?
Looks like we can spawn entities but I don't see any documentation about destroying them. It's not a monster (it's a wall tapestry) so I can't fake the destruction by killing the monster. Anyone have a clever solution?
Re: Any way to destroy entities?
No solution, but I want to know also if this is possible. I want to destroy dungeon_lamps to make it dark.
Re: Any way to destroy entities?
There's no way to destroy or remove entities with script at the moment and I can't think of any workarounds right off the top of my head for tapestries either (monsters and items can often be teleported away).
You should be able to deactivate lamps.Whalefish wrote:I want to destroy dungeon_lamps to make it dark.
Steven Seagal of gaming industry
- djoldgames
- Posts: 107
- Joined: Fri Mar 23, 2012 11:28 pm
- Contact:
Re: Any way to destroy entities?
This will be the most awaited editor feature (opposite to spawn()).
For now it is only one choise only for items/monstares by using the teleportere.
- Build in your dungeon inaccesible room for your discarted items
- when specific item is placed on the floor, there must be a trigger (hidden pressure plate) connected to function1
- in function1 you must spawn the teleport (set triggered by item, invisible, silent, target to inaccesible room) if item is the right item
- build function2 connected to timer (1 second)
- in function2 disable the spawned teleport
- and activate them and after activate the counter
I thinig this might be working, but there will be too more spawned teleporters in the dungeon )
For now it is only one choise only for items/monstares by using the teleportere.
- Build in your dungeon inaccesible room for your discarted items
- when specific item is placed on the floor, there must be a trigger (hidden pressure plate) connected to function1
- in function1 you must spawn the teleport (set triggered by item, invisible, silent, target to inaccesible room) if item is the right item
- build function2 connected to timer (1 second)
- in function2 disable the spawned teleport
- and activate them and after activate the counter
I thinig this might be working, but there will be too more spawned teleporters in the dungeon )
[MAP] Interactive Maps of Isle Nex - using Google maps technology
[MOD] Eye of the Beholder: Waterdeep Sewers - recreation for Grimrock
www.oldgames.sk
[MOD] Eye of the Beholder: Waterdeep Sewers - recreation for Grimrock
www.oldgames.sk
- Montis
- Posts: 340
- Joined: Sun Apr 15, 2012 1:25 am
- Location: Grimrock II 2nd playthrough (hard/oldschool)
Re: Any way to destroy entities?
There's also a workaround with blockages (you can destroy those). If I have time later, I might post a small tutorial on how to create removable tunnel blockages.
Also, aren't tapestries destroyable anyway? At least the ones from the main game?
Also, aren't tapestries destroyable anyway? At least the ones from the main game?
- Montis
- Posts: 340
- Joined: Sun Apr 15, 2012 1:25 am
- Location: Grimrock II 2nd playthrough (hard/oldschool)
Re: Any way to destroy entities?
Create a destructible tunnel blockage (will only look good from one direction):
add the following to your objects.lua
add the following to your objects.lua
Code: Select all
cloneObject{
name = "destructible_cave_in",
baseObject = "dungeon_cave_in", -- you might want to change this to temple_cave_in or the prison one
brokenModel = "assets/models/env/floor_dirt.fbx", -- if anyone can find a better standard model for this, give me a shout
health = 50, -- adjust this to your needs
evasion = -1000,
hitEffect = "hit_dust",
hitSound = "impact_generic",
onProjectileHit = function()
return false -- projectiles (arrows and such) shouldn't be able to destroy it
end,
onHit = false, -- this is used to negate the "indestructible" property
onDie = function(self)
-- when blockage is destroyed, spawn 2-5 rocks
rocks = math.random(1,4)+1
for i = 1,rocks do
spawn("rock", self.level, self.x, self.y, i%4)
end
end
}
Re: Useful scripts repository
Is there any possibility set the destruction only by defined weapon (for example pickaxe)?Montis wrote:Create a destructible tunnel blockage
Will also spawn a random amount of rocks when destroyed.
add the following to your objects.luaThen simply place it in a tunnel.SpoilerShowCode: Select all
cloneObject{ name = "destructible_cave_in", baseObject = "dungeon_cave_in", -- you might want to change this to temple_cave_in or the prison one brokenModel = "assets/models/env/floor_dirt.fbx", -- if anyone can find a better standard model for this, give me a shout health = 50, -- adjust this to your needs evasion = -1000, hitEffect = "hit_dust", hitSound = "impact_generic", onProjectileHit = function() return false -- projectiles (arrows and such) shouldn't be able to destroy it end, onHit = false, -- this is used to negate the "indestructible" property onDie = function(self) -- when blockage is destroyed, spawn 2-5 rocks rocks = math.random(1,4)+1 for i = 1,rocks do spawn("rock", self.level, self.x, self.y, i%4) end end }
Notes:-----
- This will only look good from one direction. If you want to create a tunnel that is destructible from two sides, you have to add a script in the "onDie" function. Beware of infinite loops though.
original thread for discussion/questions:
viewtopic.php?f=14&t=3357
Re: Useful scripts repository
Yes, there is.tymur wrote:
Is there any possibility set the destruction only by defined weapon (for example pickaxe)?
It's a bit complicated but it's doable.
First, you must clone the party with an onAttack hook, like this:
Code: Select all
cloneObject{
name = "party",
baseObject = "party",
onAttack = function (self, weapon)
return damage.whatWeapon(self, weapon)
end,
}
Code: Select all
cloneObject{
name = "barrel",
baseObject = "barrel_crate_block",
onDamage = function (self, dmg, dmgType)
return damage.checkDamage(self, dmg, dmgType)
end,
}
then copy these scripts:
Code: Select all
usedWeapon = ""
function checkDamage(self, dmg, dmgType)
if usedWeapon == "pickaxe" then
usedWeapon = ""
return true
else
usedWeapon = ""
return false
end
end
function whatWeapon(self, weapon)
if weapon then
usedWeapon = weapon.name
end
return true
end
Re: Useful scripts repository
Than you very much, it very useful.crisman wrote:Yes, there is.tymur wrote:
Is there any possibility set the destruction only by defined weapon (for example pickaxe)?
It's a bit complicated but it's doable.
First, you must clone the party with an onAttack hook, like this:Then, clone the object you want to be destroyed by a specific weapon. (I use barrels/crates for example)Code: Select all
cloneObject{ name = "party", baseObject = "party", onAttack = function (self, weapon) return damage.whatWeapon(self, weapon) end, }
In the editor, place a script_entity and rename it as "damage".Code: Select all
cloneObject{ name = "barrel", baseObject = "barrel_crate_block", onDamage = function (self, dmg, dmgType) return damage.checkDamage(self, dmg, dmgType) end, }
then copy these scripts:That should do the trick.Code: Select all
usedWeapon = "" function checkDamage(self, dmg, dmgType) if usedWeapon == "pickaxe" then usedWeapon = "" return true else usedWeapon = "" return false end end function whatWeapon(self, weapon) if weapon then usedWeapon = weapon.name end return true end