Phoenix4646 Posted April 3, 2015 Author Report Share Posted April 3, 2015 So I've made some placeholder models and I've been trying to implement them into 0 AD which worked fine so far.The only problem I have is with the attack sound.As everyone knows, the attack sound of a unit won't be played if the actor has no attack animation set. Now my first question would be is it still possible to somehow get the game to play the sound? And how do I export .psa animations in blender that work in 0 AD? The .psa addons in blender are for the Unreal Engine model formats and I couldn't find anything about animations in 0 AD. Quote Link to comment Share on other sites More sharing options...
niektb Posted April 3, 2015 Report Share Posted April 3, 2015 animations are exported to .dae AFAIK.Have you read this stuff? http://trac.wildfiregames.com/wiki/AnimationSynchttp://trac.wildfiregames.com/wiki/BasicAnimationImplementationhttp://trac.wildfiregames.com/wiki/AnimationExportTutorial Quote Link to comment Share on other sites More sharing options...
LordGood Posted April 6, 2015 Report Share Posted April 6, 2015 sounds are applied in the .xml simulation templates and variants are in .ogg vorbis format and tied together with xmls in the audio folder. Root through the audio assets, it's pretty straightforeward. I cant explain it too well from memory Quote Link to comment Share on other sites More sharing options...
Phoenix4646 Posted April 6, 2015 Author Report Share Posted April 6, 2015 @niektb: No, I couldn't find these links. Thanks for the almost instant reply And sorry for my late one, I already saw your post 10 minutes after but I thought I'd post again once questions regarding the process come up ... and stuff looked complicated so I thought I'd get to animating later. And then I forgot to atleast say thanks @LordGood: Yeah, I'm familiar with how the audio system in 0 AD works, that was not the problem. The problem is that attack sounds aren't played if there isn't an animation specified for attacking (you can even use an idle animation for it, it's just about having an animation *at all*). The question was if there was some workaround to get the sound to play without specifying an animation (towers and fortresses (structures) play the attack sound nonetheless while balistas and catapults (units) without an animation don't comply (for that, either check the old alphas where they didn't have attack animations or remove the attack animations from the actors for testing)), and if there's no way of doing that, then I'd need to know how to make animations for 0 AD and if they need to be in the weird .psa format (which already got answered above ). But thanks for the answer Quote Link to comment Share on other sites More sharing options...
Phoenix4646 Posted May 23, 2015 Author Report Share Posted May 23, 2015 (edited) Back with another thing I wanted to implement clips for (ranged) units and took a look at attack.js.Now, what I wanted to do was add two other things (excuse my untechnical gibberish - maybe someone could educate me ) called ClipSize and ReloadTime, contained in the same block where RepeatTime is defined. Then, when the unit is created, another variable called actualclip (or whatever you want to call it) will be set equal to ClipSize. After that, whenever the unit fires, it subtracts 1 from actualclip until it is 0. When that happens, the unit uses ReloadTime instead of RepeatTime once and sets actualclip equal to ClipSize again.However, the only thing concerning RepeatTime I found was "Attack.prototype.GetTimers", which applies the Repeat- and PrepareTimes. GetTimers is used nowhere in the whole file though. Is this one of those things that is mainly done in the engine?EDIT:: Oh yeah, and I looked at the datatypes available for schemas. So there's only positiveInteger and nonNegativeInteger. So is there no way to use a value of -1 anyway, or would I need to use ''text''? Edited May 23, 2015 by Phoenix4646 Quote Link to comment Share on other sites More sharing options...
s0600204 Posted May 23, 2015 Report Share Posted May 23, 2015 Oh yeah, and I looked at the datatypes available for schemas. So there's only positiveInteger and nonNegativeInteger. So is there no way to use a value of -1 anyway, or would I need to use ''text''? "integer" is an acceptable type, as is "decimal". Quote Link to comment Share on other sites More sharing options...
Phoenix4646 Posted May 23, 2015 Author Report Share Posted May 23, 2015 Derp... my bad. I tried to write ''Integer'' with a capital letter at the beginning. Thank you.And one more thing, about particle effects. Right now when I use a particle effect it needs to fade in first which is fine, but I need the effect to fade in faster than it usually does. Is there any way to manipulate that yet? Quote Link to comment Share on other sites More sharing options...
leper Posted May 23, 2015 Report Share Posted May 23, 2015 UnitAI.js is where you should do that change (both setting the animation and doing the actual code change). The INDIVIDUAL.COMBAT.ATTACKING state is where you want to change things. Quote Link to comment Share on other sites More sharing options...
Phoenix4646 Posted May 24, 2015 Author Report Share Posted May 24, 2015 Alright then! I got almost everything set up in UnitAI.js, I'm only having one problem. I do not know where to put the variable this.actualclip; when putting it at the start of the file (after "function UnitAI() {}" of course) the game tells me that there's a "missing variable name" and if I don't put it anywhere the variable is ''undefined'' (which makes sense of course). As a tinkerer, this is where my little coding knowledge is already at a loss. Quote Link to comment Share on other sites More sharing options...
leper Posted May 24, 2015 Report Share Posted May 24, 2015 Check UnitAI.prototype.Init. Making the clip size a property of eg the Ranged Attack would likely be the nicest way to handle this, but that would require edits to Attack.js too (mostly to the schema and adding two functions or something): Quote Link to comment Share on other sites More sharing options...
Phoenix4646 Posted May 24, 2015 Author Report Share Posted May 24, 2015 That is exactly what I've done The problem I have is with implementing the variable actualclip, e.g. the variable that defines how much ammo is left in the clip. ClipSize only defines the maximum ammo that the clip will have.Now I have no idea how I can create such a variable in the code. Or should I just do another entry for that in the Ranged Attack component? Can you even modify values in those components on the fly without it accidently acting like a tech or something like that? Quote Link to comment Share on other sites More sharing options...
leper Posted May 24, 2015 Report Share Posted May 24, 2015 Just define something like this.actualclip = this.clipsize. Then use that size when decrementing and if it reaches 0 set it to clipsize again. Quote Link to comment Share on other sites More sharing options...
Phoenix4646 Posted May 25, 2015 Author Report Share Posted May 25, 2015 (edited) Alright, now I get another error. var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack); this.clipSize = cmpAttack.GetClipSize("Ranged"); this.actualclip = this.clipSize.clipsize; warn("this was just run!");I've added this to UnitAI.prototype.Init (the warning was only for me to see when the code is run). I'm getting no problems when I am trying to control one unit (but the ''warn''-print doesn't appear), but as soon as I try to control multiple units, my commands aren't issued and I get this error:ERROR: Script message handler OnCreate failedERROR: JavaScript error: simulation/components/UnitAI.js line 3193 TypeError: cmpAttack.GetClipSize is not a function UnitAI.prototype.Init@simulation/components/UnitAI.js:3193:2 GetFormationUnitAIs@simulation/helpers/Commands.js:1402:8 commands.walk@simulation/helpers/Commands.js:116:3 ProcessCommand@simulation/helpers/Commands.js:37:3ERROR: Failed to call ProcessCommand() global script functionWhen I remove all my additions except the warning, the warning appears whenever I create a new group by selecting multiple units and issuing a command (but only on the first command issued).EDIT:: and what is done here? var cmpTimer = Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer); this.lastAttacked = cmpTimer.GetTime() - msg.lateness;What is msg.lateness? How can I modify the repeat time to be different under certain circumstances in the "Timer" part? Edited May 25, 2015 by Phoenix4646 Quote Link to comment Share on other sites More sharing options...
leper Posted May 25, 2015 Report Share Posted May 25, 2015 You can't rely on other components being constructed in Init() (only system components are guranteed to exits). You also didn't add a GetClipSize() to cmpAttack. Lateness of a timer is just when it should have fired (so how late it is). This is needed since Timers only fire once per simulation turn, so you might have to do multiple attacks per turn for your addition (I'm assuming faster fire rate). Quote Link to comment Share on other sites More sharing options...
Phoenix4646 Posted May 25, 2015 Author Report Share Posted May 25, 2015 Thing is, I did create a GetClipSize() function, otherwise the stuff I added to the ''ATTACKING'' state wouldn't work which is why this confuses me. It doesn't throw any errors there and works fine, but everytime it's in the Init function it would just give errors. Quote Link to comment Share on other sites More sharing options...
leper Posted May 25, 2015 Report Share Posted May 25, 2015 You can't rely on other components being constructed in Init(). Also see http://svn.wildfiregames.com/docs/writing-components.html#component-creation. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.