Page 156 of 396

Re: Ask a simple question, get a simple answer

Posted: Sun Sep 25, 2016 6:29 pm
by minmay
FloorTriggerComponent automatically looks for a component called "animation" and if it finds one, it will treat it as an AnimationComponent and try to play its "activate" and "deactivate" animations when the FloorTriggerComponent is activated and deactivated. You're getting the error because you don't have a "deactivate" animation defined in the AnimationComponent.
As it is, the easiest fix is to rename the AnimationComponent, like this:

Code: Select all

    defineObject{
       name = "floor_spike_trap_auto",
       baseObject = "base_floor_decoration",
       components = {
          {
             class = "Model",
             model = "assets/models/env/tomb_floor_spiketrap.fbx",
          },
          {
             class = "FloorTrigger",
             onActivate = function(self)
                self.go.biscuits:play("activate")
                self.go.tiledamager:enable()
             end,
          },
          {
             class = "Animation",
             name = "biscuits",
             animations = {
                activate = "assets/animations/env/tomb_floor_spiketrap_hit.fbx",
             },
          },
          {
             class = "TileDamager",
             attackPower = 50,
              damageType = "physical",   -- TODO: change to "pure"
              screenEffect = "damage_screen",
              cameraShake = true,
             sound = "spike_trap",
             floorTrap = true,
             enabled = false,
             onHitObstacle = function(self, obstacle)
                if obstacle.go.name == "beach_thicket_01" then return false end
             end,
             onHitMonster = function(self, monster)
                if monster.go.name == "air_elemental" then return false end
             end,
          },
          {
             class = "Controller",
             onActivate = function(self)
                self.go.biscuits:play("activate")
                self.go.tiledamager:enable()
             end,
          },
       },
       editorIcon = 284,
    }

Re: Ask a simple question, get a simple answer

Posted: Sun Sep 25, 2016 7:10 pm
by bongobeat
works very well, thanks for your replies


well, biscuit is a funny name, were you eating some biscuits when seeing this?

Re: Ask a simple question, get a simple answer

Posted: Fri Sep 30, 2016 11:58 am
by zimberzimber
How come onClickItemSlot doesn't always receive a champion?

Code: Select all

------------------------------ On Click Item Slot
			onClickItemSlot = function(self, champion, container, slot, button)
				print("self")
				print(self)
				print("champion")
				print(champion)
				print("container")
				print(container)
				print("slot")
				print(slot)
				print("button")
				print(button)
				--	Prevent item insertion/removal from hands
				if champion then
					if champion:hasCondition("frozen") then
						if slot and (button == 0 or button == 1) then
							return false
						end
					end
				end
			end,
Image

EDIT: Apparently opening the inventory fixes this. Is this just editor related?
EDIT2: It will index only the champion whose inventory was opened last

Re: Ask a simple question, get a simple answer

Posted: Sat Oct 08, 2016 5:06 am
by AndakRainor
I don't know if this was already answered but I could not find it... Is there a solution to stop spell projectiles from flying through stairs?

Re: Ask a simple question, get a simple answer

Posted: Sat Oct 08, 2016 6:27 am
by minmay
add a ProjectileColliderComponent to the stairs

Re: Ask a simple question, get a simple answer

Posted: Sat Oct 08, 2016 12:52 pm
by AndakRainor
So, a quick fix in a script entity, run on mod start:

Code: Select all

for level=1,Dungeon.getMaxLevels() do
  for e in Dungeon.getMap(level):allEntities() do
    if e.stairs and not e.projectilecollider then
      e:createComponent("ProjectileCollider"):setOffset(vec(0,0,1.5))
    end
  end 
end

Re: Ask a simple question, get a simple answer

Posted: Sun Oct 09, 2016 9:39 pm
by Eburt
I'm having trouble with a custom animation.

I export from Blender to fbx and use GrimFBX to generate the .model and .animation files. I do get a couple messages in GrimFBX, "GrimAnimation: Could not open file for writing." but it doesn't seem to matter - everything still loads into GMT just fine. I assign my materials and can play the animation correctly. I run the saved animation through GrimAnimConverter. Everything seems to work fine until I get it into game, at which point the animated portions of the model are invisible (and playing the animation doesn't seem to do anything). I've checked the bounding box and that is correct.

I also tried exporting the model from Blender to obj and importing into GMT that way. This also works fine and I can get my model to appear in-game. However, the animations don't seem to work - I assume because the .model generated from the obj only has the mesh nodes, not those associated with the bones.

Has anyone run into a similar situation? Any advice/troubleshooting steps would be much appreciated.

Re: Ask a simple question, get a simple answer

Posted: Sun Oct 09, 2016 9:58 pm
by minmay
Try this exporter instead. The pipeline you are describing isn't really functional - it generates bad model files - and I can't think of a workaround.

Re: Ask a simple question, get a simple answer

Posted: Sun Oct 09, 2016 11:11 pm
by Eburt
Thanks for the replay minmay. Unfortunately, I'm not able to get it to export correctly using that script. Can't get the model to open in GMT or Grimrock (obviously meaning I don't know if the animation worked).

I assume this is something wrong with the model itself, since importing a default asset and re-exporting works fine. Is there something that needs to be set up or configured for this to work?

Re: Ask a simple question, get a simple answer

Posted: Sun Oct 09, 2016 11:14 pm
by Isaac
Eburt wrote:Thanks for the replay minmay. Unfortunately, I'm not able to get it to export correctly using that script. Can't get the model to open in GMT or Grimrock (obviously meaning I don't know if the animation worked).

I assume this is something wrong with the model itself, since importing a default asset and re-exporting works fine. Is there something that needs to be set up or configured for this to work?
That script does work, but depends on Blender 2.71 or 2.72. The recent versions of Blender cause trouble for it. I keep both installed; current, and 2.72