Bit Blot Forum

Aquaria => Modding => Topic started by: Linearity on August 31, 2009, 06:21:57 am

Title: Adding an entity, can't see it
Post by: Linearity on August 31, 2009, 06:21:57 am
Please help a n00b.

I'm trying to add an entity per the Modding Guide. It's an entity called "Bob" with a simple "bobbing" idle animation. The animation uses a single bone called "head" that is associated with a picture of Naija's head, which I pulled from a working mod.

When I go to add the entity in the editor, I can see a preview in the entity menu that looks like Naija's head; so far so good. But when I paste it, all I get is a minuscule little white dot that doesn't looks like Naija no matter how far I zoom in. Does anybody know why this would happen? I'd appreciate any insight you can give me; I've been experimenting and searching the forums for two days.

Here's my code. My graphics directory contains a directory called "bob" and within that there is a file called "head.png".

bob.lua:
Code: [Select]
dofile("scripts/entities/entityinclude.lua")

function init(me)
setupBasicEntity(
me,
"", -- texture
4, -- health
2, -- manaballamount
2, -- exp
1, -- money
48, -- collideRadius
STATE_IDLE, --initState
90, -- sprite width
90, -- sprite height
1, -- particle "explosion" type (see particleEffects.txt)
1, -- 0/1 hit other entities off/on
4000, -- updateCull -1: disabled, default: 4000
)

entity_setEntityType(me, ET_ENEMY)
entity_initSkeletal(me, "bob")
entity_setState(me, STATE_IDLE)

--entity_animate(me, "idle", LOOP_INF)

end

-- after nodes have inited
function postInit(me)
end

function update(me, dt)
entity_updateMovement(me, dt)
end

function enterState(me)
--if entity_isState(me, STATE_IDLE) then
-- entity_animate(me, "idle", -1)
--end
end

function exitState(me)
end

function damage(me, attacker, bone, damageType, dmg)
--return false
end

function animationKey(me, key)
end

function hitSurface(me)
end

function songNote(me, note)
end

function songNoteDone(me, note)
end

function song(me, song)
end

function activate(me)
end

bob.xml:
Code: [Select]
<AnimationLayers>
    <AnimationLayer />
</AnimationLayers>
<Bones>
    <Bone idx="0" gfx="bob/head" pidx="-1" name="head" fh="0" fv="0" gc="0" cr="0" cp="0 0" />
</Bones>
<Animations>
    <Animation name="idle">
        <Key e="0 0 1 -13 -360 0 0 0 0 0 0 0 0 0 0 0 " />
        <Key e="0.6 0 0 -35 -358 0 0 0 0 0 0 0 0 0 0 0 " />
        <Key e="1.2 0 1 -13 -360 0 0 0 0 0 0 0 0 0 0 0 " />
    </Animation>
</Animations>

entitygroups.txt:
Code: [Select]
GROUP:Creatures
crotoid
moneye
nautilus
bob bob/head

GROUP:Plants
healthPlant

Title: Re: Adding an entity, can't see it
Post by: Edwards on August 31, 2009, 07:21:35 am
Sounds like a syntax error somewhere in bob.lua.  I can't see what it is for sure right off-hand (although it looks like you have either an extraneous comma or a missing argument at the end of your setupBasicEnt function), but you can find out where it is by commenting out large sections of the code (as I see you've already tried, but you should comment out the function headers as well), and reloading the level to see if the entity shows up.

- Edwards
Title: Re: Adding an entity, can't see it
Post by: Yogoda on August 31, 2009, 09:40:51 pm
SetupBasicEntity, you have a comma at the end, missing a parameter :)

So, you are making Bob the Sponge, ain't you ^^ ?

Btw, is it a way to automatically check the Lua syntax ? I really loose a lot of time with these kind of things.
Title: Re: Adding an entity, can't see it
Post by: Linearity on September 01, 2009, 07:40:35 am
(http://awesomeshirts.com.au/images/shirts/awesomeface.png)

That comma was the only problem. Geez...

I guess I've never had to track down my own syntax errors before, I always get a compile error or some other error report.

Thanks very much.
Title: Re: Adding an entity, can't see it
Post by: Alec on September 01, 2009, 09:53:24 am
You should get LUA errors printed out into the debug stream. You can see them in the debug.log file, but you may also be able to turn on the in-game debug console in your mod by editing the xml file to enable debug keys, then hitting "~".

I could be wrong though, its been a while! :)
Title: Re: Adding an entity, can't see it
Post by: Alphasoldier on September 01, 2009, 04:33:56 pm
I find it amusing that after all the years of Aquaria developement that Alec doesn't know a lot about his own game any more. xD
I guess it's because of all the other things you're busy with, eh Alec?
Title: Re: Adding an entity, can't see it
Post by: Linearity on September 01, 2009, 06:04:34 pm
Which XML file do I need to edit to get that debug console or debug keys? Is it usersettings.xml? What element do I need to add?
Title: Re: Adding an entity, can't see it
Post by: Alec on September 01, 2009, 06:49:31 pm
It would be your mod's definition file (the xml file that sets various properties about your mod)

I don't remember the settings off-hand, but I'll check at some point. It might be on the aquaria wiki already?
Title: Re: Adding an entity, can't see it
Post by: Dolphin's Cry on September 02, 2009, 10:11:04 pm
I guess it's the following, although I couldn't find the right key to make it do anything:
Quote
<Properties debugMenu="1" />
Title: Re: Adding an entity, can't see it
Post by: Linearity on September 03, 2009, 04:20:34 pm
Alec said it's "~" if things are working correctly. "~" doesn't work.

Whenever the entity gets initialized, it rotates one revolution very quickly before beginning its idle animation. I cleared everything but a single key in the animation (so that the idle animation is complete inactivity) and it still does this. Anybody know why this would be?
Title: Re: Adding an entity, can't see it
Post by: Edwards on September 03, 2009, 05:03:15 pm
Whenever the entity gets initialized, it rotates one revolution very quickly before beginning its idle animation. I cleared everything but a single key in the animation (so that the idle animation is complete inactivity) and it still does this. Anybody know why this would be?
That sounds like the "unfolding" animation that everything that has an animation file goes through when it is initialized- all the bones start out at a single point, and then rotate out to their final positions.  Try adding a Mithalan or some other complex entity to the map, and see if it unfolds in sync with your entity's spin.  If it does, there's nothing you can do about it- fortunately, initialization usually occurs off-screen.

- Edwards
Title: Re: Adding an entity, can't see it
Post by: Linearity on September 04, 2009, 05:44:54 am
For context, I'm trying to "replace the main character" as another thread described. I have another entity that, when initialized, hides Naija and updates itself by mimicking her movements.

I added a Mithalan. The Mithalan doesn't really unfold visibly. Both he and Naija appear as the mod loads, and then after about a second Naija disappears and the new image appears and instantly rotates. The delay is probably the cause of my rotation problem. Any ideas? My init function for the replacement entity is pretty thin, as you can see above, so I can't imagine it simply taking too long to complete.
Title: Re: Adding an entity, can't see it
Post by: Yogoda on September 14, 2009, 09:14:19 pm
Do you still have the problem ? I have free time, I could investigate.