Jump to content

Some modding questions


Phoenix4646
 Share

Recommended Posts

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.

Link to comment
Share on other sites

@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 :P). But thanks for the answer :)

Link to comment
Share on other sites

  • 1 month later...

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 :P) 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 by Phoenix4646
Link to comment
Share on other sites

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".

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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):

Link to comment
Share on other sites

That is exactly what I've done :P
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?

Link to comment
Share on other sites

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 function

When 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 by Phoenix4646
Link to comment
Share on other sites

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).

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...