Page 22 of 25
Re: Javascript API documentation
Posted: 01 May 2013, 15:48
by NoQ
We have a new alliancesType constant, which is ALLIANCES_UNSHARED; it describes a new game mode that is similar to ALLIANCES_TEAMS but research is no longer shared or transfered between allies.
Re: Javascript API documentation
Posted: 03 May 2013, 05:05
by Shadow Wolf TJC
aubergine wrote:rules.js uses alliancesType for victory conditions - so things like Enhanced SitRep Mod and Contingency Mod might be affected, but it should be trivial to make them adapt to the change. Speaking of which, what exactly is the change - been frantic IRL recently and not been keeping up with the qtscript changes...
It's OK. Development of Contingency is currently focusing on the more stable 3.1 versions. It hasn't been ported to 3.2 yet, and from the looks of things, I may have to wait for 3.2 to stabilize before porting it over.
Re: Javascript API documentation
Posted: 18 May 2013, 08:44
by NoQ
23da1f18915bd0e7c811672fffb3f39944ab5669 probably wasn't a good idea
i was sure i was fixing a typo, and then i thought that 3.1 users need to be able to read the docs too
Re: Javascript API documentation
Posted: 18 May 2013, 11:42
by Per
There will probably be more people learning the scripting stuff and the docs when 3.2 is released
Re: Javascript API documentation
Posted: 18 May 2013, 11:43
by Per
Two new scripting functions added to support temporary vision (like the scanner sweep in starcraft 2):
addSpotter(x, y, player, range, type, expiry) -- Add an invisible viewer at a given position for given player that shows map in given range. type is zero for vision reveal, or one for radar reveal. The difference is that a radar reveal can be obstructed by ECM jammers. expiry, if non-zero, is the game time at which the spotter shall automatically be removed. The function returns a unique ID that can be used to remove the spotter with removeSpotter.
removeSpotter(id) -- Remove a spotter given its unique ID.
Re: Javascript API documentation
Posted: 18 May 2013, 12:00
by Shadow Wolf TJC
Neat, though is there going to be a way for modders to create their own custom support powers or superweapons? Perhaps an eventStructureActivated() function would be needed whenever a support power or superweapon (including a LasSat Command Post) is activated? I'd imagine that the source code would also need to be modified to allow modders to create additional support/superweapon structures, each with their own powers or weapons (such as a massive EMP blast).
Re: Javascript API documentation
Posted: 18 May 2013, 12:47
by Per
Shadow Wolf TJC wrote:Neat, though is there going to be a way for modders to create their own custom support powers or superweapons?
Yes. I'm working toward it.
Re: Javascript API documentation
Posted: 20 May 2013, 06:15
by NoQ
9ac0e6ae4c87b877982564dfc479b3cb61dc24ab <=== does it mean i need to re-lecture the AIs on how to produce cyborgs? Should be quite possible, just asking.
Re: Javascript API documentation
Posted: 20 May 2013, 08:29
by Per
Hmm. Yes. I did not think of that. No way around it, though.
Re: Javascript API documentation
Posted: 20 May 2013, 13:39
by NoQ
Maybe we can make aliases for items in ini files?
Re: Javascript API documentation
Posted: 20 May 2013, 19:56
by NoQ
Something like
Code: Select all
[CybRotMgGrd]
aliasFor = CyborgLightBody
and add one more add-on to the wzconfig wrapper
Re: Javascript API documentation
Posted: 20 May 2013, 20:20
by Duha
NoQ wrote:Something like
Code: Select all
[CybRotMgGrd]
aliasFor = CyborgLightBody
and add one more add-on to the wzconfig wrapper
May be you need just js object
Code: Select all
var aliases = {'CybRotMgGrd': 'CyborgLightBody'}
You can generate template from python.
Re: Javascript API documentation
Posted: 20 May 2013, 20:24
by NoQ
I think maintaining aliases in ini files is easier than maintaining a complicated separate js file that overrides multiple API functions. I'd also surely go with js if i need to make my scripts work on both versions, but the idea is mostly about the base game: since we aim at "scripts never break", i thought it would be a useful way of keeping AIs sane after balance changes that involve adding or removing stuff.
Re: Javascript API documentation
Posted: 20 May 2013, 20:44
by Per
Wouldn't it be easier to just pass in a list of bodies to buildDroid(), with CybRotMgGrd etc as the first, and CyborgLightBody / CyborgHeavyBody as the second?
I believe it will just spit out a warning if it is given a body that does not exist, then select the next one in the list...
Re: Javascript API documentation
Posted: 20 May 2013, 21:03
by NoQ
I repeat, I have no problem with fixing my scripts. I'm having problems with the fact that they need to be fixed every time things like that happen.