Jump to content

[javascript] up to date scripting reference for modding?


poVoq
 Share

Recommended Posts

Hello :)

First of congratulations for the latest release!

Anyways... I was wondering if there is an updated scripting reference available for getting into modding the game...

So far I only fund the somewhat outdated (?) references on the wiki:

http://trac.wildfiregames.com/wiki/Scripter%27s_Reference

http://trac.wildfiregames.com/wiki/Coding_Conventions#JavaScript

http://trac.wildfiregames.com/wiki/Modding_Guide

http://trac.wildfiregames.com/wiki/Mod_Layout

I would really like to look into modding camera and player behavior for a small ARPG mod prototype, however I am really not a coding genius, so I would rather only touch the JavaScript code... so how feasible is that with the current scripting possibilities?

Link to comment
Share on other sites

What do you want to change in terms of camera behaviour? If it's just changing the angle and similar things it can be done in the config files.

The player behaviour should be mostly possible to do in JavaScript, it's hard to tell for sure unless you tell us a bit more about what exactly it is that you want to do though :)

Link to comment
Share on other sites

Well, basically it would need a fixed camera, zoomed in and always following the player as well as player controls that can be triggered by hotkeys and mouse clicks. Just imagine playing Diablo in the 0AD engine and you got the basic idea.

Loot and inventory system would have to follow later... would be great if that was possible with scripts too, I gathered already that the GUI is easily scriptable, so from that side there should be no major barriers I guess.

Edit: Well the overall idea is to get a somewhat playable prototype for this idea ( http://www.wildfiregames.com/forum/index.php?showtopic=16308 ) to maybe attract a more skilled coder, so that I can focus on the graphic side of things. Besides I need to refresh my JS coding (non-)skills and have some time to kill over the holidays ;)

Edited by poVoq
Link to comment
Share on other sites

For the fixed camera you could just set the navigation hotkeys to nothing (I'm not sure if that works, but it should). (Specified in default.cfg though you should put that in a local.cfg or when it is supported in a mod.cfg) (hotkey.camera.*)

Have you tried the follow camera hotkey? (hotkey.camera.follow (default is F))

You should take a look at setCameraFollow() in gui/session/input.js, which is used by the follow camera hotkey handler.

I don't see anything preventing loot and inventories from being script-only.

Link to comment
Share on other sites

Ahh that sounds promising! I also read that hero units are in the game now (my internet is somewhat slow, so I am still on alpha 11)? Do they already have some sort of item inventory and special abilities?

So far I didn't have a look at the code itself, but I might find the time tonight. I will keep you updated on any progress I make (no promises on anything).

Link to comment
Share on other sites

Ahh your tips about the local.config were right on spot, just by playing around with it I got the basic behavior and view already (if you press F in game to have the camera follow the unit selected). A mod.cfg would be indeed nice to have, I assume it is on the road map?

Out commenting or removing the hotkey settings doesn't seem to work though, as it then seems to fall back on the ones from the default.cfg. Even setting them all to one button doesn't seem to work... maybe that is a "bug" that you can't actually remove controls in the local.cfg?

Also the main mouse buttons seem to be hard-coded, e.g. not adjustable by the config file? Switching to left_mouse button for selection and attacking would be nice, but there doesn't seem to be an option in the config file.

Next I will have a look at the actual code ;) Thanks again for the hints.

Link to comment
Share on other sites

Setting hotkeys in local.cfg afaik just adds them to those specified in default.cfg, so you'd need to change that. But I think that adding another config setting to disable some movements would be better.

Regarding the mouse buttons: Yes they are hard coded, check gui/session/input.js and look for SDL_BUTTON_LEFT and SDL_BUTTON_RIGHT.

Link to comment
Share on other sites

Slightly off topic: Speaking of mods, when will we be able to recognize new mod folders without the command line? (i.e. not "public" or "internal")

I believe the original intent was to include a UI window that allowed players to enable/disable certain mods and list priority in case there were duplicate files. Is this in the queue somewhere?

Link to comment
Share on other sites

This is the only outdated link of the ones you posted :)

Probably the first and most important part of an RPG mod would be having a single playable character and locking camera / movement onto them.

Yeah, but that one also seems the most relevant, doesn't it?

Anyways... what you mention is 95% possible with just modifying the config.cfg which I have done already. However this currently only works if one would fork 0 A.D. as it's own code base, as (like written above) there is no dedicated mod.cfg yet, and the local.cfg does only overwrite and not replace the default.config.

Would be great if those issues could be addressed, as I assume this could be relevant to a variety of potential mods.

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