Ask a simple question, get a simple answer
Re: Ask a simple question, get a simple answer
@IttaBitta I think you need to have a script object named "zim_functions" in your dungeon, then you set it to "external" and point to the script file, and be sure to add it to your init.lua as well
Re: Ask a simple question, get a simple answer
Hi, folks!
May be someone know, is there an easy way to make item:trowItem() function deal actual damage to the party? Changing AttackPower of projectile does nothing, as well as setting CastByChampion. May be there is a hidden flag, that tells that the projectile was cast by a monster? I'm really don't want to rewrite onProjectileHit() function, with my noobish scripting skills that would be a disaster
May be someone know, is there an easy way to make item:trowItem() function deal actual damage to the party? Changing AttackPower of projectile does nothing, as well as setting CastByChampion. May be there is a hidden flag, that tells that the projectile was cast by a monster? I'm really don't want to rewrite onProjectileHit() function, with my noobish scripting skills that would be a disaster

Re: Ask a simple question, get a simple answer
Could you describe this in more detail?Adrageron wrote: ↑Tue Nov 10, 2020 6:08 pm May be someone know, is there an easy way to make item:trowItem() function deal actual damage to the party? Changing AttackPower of projectile does nothing, as well as setting CastByChampion. May be there is a hidden flag, that tells that the projectile was cast by a monster?
Is this for a weapon or item thrown at the party by a monster?
Or is it a weapon that damages a party member when it is thrown? (by them?)
The monster component has a throwItem function.
Code: Select all
MonsterComponent:throwItem(item, height, attackPower)
Re: Ask a simple question, get a simple answer
It is for an item (dart or arrow) trown at the party by a trap. I can emulate it by placing invisible monster there, but it looks like an ugly solution
This projectile hits party for 1-3 damage.

Code: Select all
class = "Controller",
{
class = "Spawner",
name = "missile",
spawnedEntity = "dart",
},
{
class = "Controller",
onActivate = function(self)
self.go:playSound("dark_bolt_launch")
local dir = self.go.facing-2
if dir<0 then dir = dir+4 end
local missile = self.go:spawn(self.go.missile:getSpawnedEntity())
missile:setWorldPositionY(missile:getWorldPositionY()+1.5)
missile.item:setFragile(true)
missile.item:throwItem(dir,20)
missile.projectile:setAttackPower(100)
-- missile.projectile:setCastByChampion(1)
return false
end,
},
Re: Ask a simple question, get a simple answer
Do you have a different asset pack with a party definition in it? Or did you remember to put the 'zimscripts' object in your dungeon?IttaBitta wrote: ↑Tue Nov 10, 2020 6:54 am Thanks for all your help, btw
More mod mishaps - I tried to use Zimber's assets and I've had a lot of trouble
Trouble one:
things lead me to think it wants me to 'merge' zim_party with my party definition... but I don't know where or WHAT that definition is.
Now my own question: How would I make it so when I press a button it checks if there is certain items on an alcove and if so then it destroys them and spawn a different one? (Like a stick and a rock would turn into a cudgel.)
Grey Island mod(WIP): http://www.grimrock.net/forum/viewtopic ... 99#p123699
Re: Ask a simple question, get a simple answer
SurfaceComponent triggers script that loops through contents, checks their names, then surface:addItem(spawn("cudgel").item)
- Zo Kath Ra
- Posts: 940
- Joined: Sat Apr 21, 2012 9:57 am
- Location: Germany
Re: Ask a simple question, get a simple answer
If you want code, Isaac will provide it

Here's just the functions you need:
1)
https://github.com/JKos/log2doc/wiki/Co ... -component --> SurfaceComponent:contents()
Code: Select all
-- Iterate over all items on the surface
for index, item in surface:contents() do
print(index, item.go.id)
end
GameObject:destroyDelayed()
http://www.grimrock.net/forum/viewtopic ... 66#p121766
Re: Ask a simple question, get a simple answer
What kind of if then would I use to check for a certain item (a skull) placed into an alcove?
Re: Ask a simple question, get a simple answer
Technically the material is one-sided by default. One can define a two-sided material, and it will show from both sides...However the shadows generated for a single sided model will not look right.
The real question is how are you planning to use it? Is it merely ceiling decoration... where the player will not walk on the top side? If that's the case, you can use a script to flip the models 180 degrees.
Example; start a new project/map, and place a dungeon_floor_01 object on elevation level 1 so that you can look upwards at it. Type the following into the console.
If you are only using a few of these, then it makes sense to just script the change in a script _entity. If you want to place a bunch of these, or if they must look like stone from both sides, then you should define a new asset, and include a duplicate model component, with the necessary flip included in the definition.
Like this:

The real question is how are you planning to use it? Is it merely ceiling decoration... where the player will not walk on the top side? If that's the case, you can use a script to flip the models 180 degrees.
Example; start a new project/map, and place a dungeon_floor_01 object on elevation level 1 so that you can look upwards at it. Type the following into the console.
Code: Select all
dungeon_floor_01_1.model:setRotationAngles(0,0,180)
Like this:
Code: Select all
defineObject{
name = "dungeon_floor_01_flipped",
baseObject = "dungeon_floor_01",
components = {
{
class = "Model",
name = 'flipped',
model = "assets/models/env/dungeon_floor_01.fbx",
staticShadow = true,
offset = vec(0,-0.015),
onInit = function(self) self.go.flipped:setRotationAngles(0,0,180) end,
},
},
}
