What was that reason?vexed wrote:They had a reason for all that ugliness...
Javascript API documentation
Re: Javascript API documentation
- milo christiansen
- Regular
- Posts: 749
- Joined: 02 Jun 2009, 21:23
- Location: Perrinton Michigan
Re: Javascript API documentation
I did some prelim planing for cam 4 porting and it looks like I need at least:
setScrollParams
addStructure
setDroidKills
addMessage
startMission
removeDroid
One function that would be nice would be:
droid GetDroidFromID(ID int)
but the new map embedded names functionality looks very cool so it would mostly be to make porting easier
setScrollParams
addStructure
setDroidKills
addMessage
startMission
removeDroid
One function that would be nice would be:
droid GetDroidFromID(ID int)
but the new map embedded names functionality looks very cool so it would mostly be to make porting easier
In general, if you see glowing, pulsating things in the game, you should click on them.
- Demigod Game Ganual
- Demigod Game Ganual
Re: Javascript API documentation
Implemented setScrollParams, addStructure and loadLevel (was startMission).
What is the purpose (use for) of setDroidKills?
I will need more time to implement addMessage(), as I wish to do that properly.
What is the purpose (use for) of setDroidKills?
I will need more time to implement addMessage(), as I wish to do that properly.
- Goth Zagog-Thou
- Regular
- Posts: 1582
- Joined: 06 Jan 2007, 08:08
- Location: Delta Base
- Contact:
Re: Javascript API documentation
setDroidKills was to make the Tac Sergeant a Sergeant when the campaign starts.
Re: Javascript API documentation
I'm looking for random() ...
upd: Found it, Math.random()
upd: Found it, Math.random()
Maps | Tower Defense | NullBot AI | More NullBot AI | Scavs | More Scavs | Tilesets | Walkthrough | JSCam
Re: Javascript API documentation
would orderDroidStatsLoc() be more intuitive if named orderDroidBuild() ?
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
-- https://warzone.atlassian.net/wiki/display/GO
Re: Javascript API documentation
What's the difference between me and selectedPlayer - won't they always be the same?
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
-- https://warzone.atlassian.net/wiki/display/GO
Re: Javascript API documentation
No. me == player running the script. selectedPlayer == player currently being controlled by the human player at this client. For AI scripts, it is usually always the case that me != selectedPlayer.
Re: Javascript API documentation
Does the droidCanReach() function use pathfinding (ignoring player structures) to find out if a droid can get from A to B? If so, would it be possible to instead of just returning true/false to return an object {accessible:<boolean>, dist:<distance>} ?
Reason: I plan on doing some checks with certain droid tasks to ensure they can get to destination from where they are, but often will also be doing distBetweenTwoPoints afterwards - it would be nice if, having already done hard work in droidCanReach(), I could get more accurate distance from droidCanReach() and thus not have to call distBetweenTwoPoints().
Reason: I plan on doing some checks with certain droid tasks to ensure they can get to destination from where they are, but often will also be doing distBetweenTwoPoints afterwards - it would be nice if, having already done hard work in droidCanReach(), I could get more accurate distance from droidCanReach() and thus not have to call distBetweenTwoPoints().
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
-- https://warzone.atlassian.net/wiki/display/GO
Re: Javascript API documentation
No. It uses cached data. So it is very fast, but somewhat limited.aubergine wrote:Does the droidCanReach() function use pathfinding (ignoring player structures) to find out if a droid can get from A to B?
Re: Javascript API documentation
Does the cache include some info on distance of the path though? Even if it's not overly accurate, it would enable me to see if the actual path from A to B is much longer than distBetweenTwoPoints and act accordingly...
BTW, thanks for your patience & help!
BTW, thanks for your patience & help!
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
-- https://warzone.atlassian.net/wiki/display/GO
Re: Javascript API documentation
No, it does not.
Re: Javascript API documentation
Yes. Good idea. I have made the change, but left an alias for orderDroidStatsLoc to give you time to change your scripts.aubergine wrote:would orderDroidStatsLoc() be more intuitive if named orderDroidBuild() ?
Re: Javascript API documentation
I have added an 'experience' property to droids, and setDroidExperience(droid, experience) to set it. Note that in wzscript, the value passed in to setDroidKills() would get multiplied by 100, but not divided by the same amount when returned with getDroidKills()... Now it is not multiplied by anything, so you may need to change the value you intended to pass in. (The value is read with floating point precision.)milo christiansen wrote: setDroidKills
droid GetDroidFromID(ID int)
droidFromId(id) also added. Pass in an ID, get a droid out. If you feel the need to use this for new code, you are doing something wrong. Avoid using, please
Re: Javascript API documentation
Suppose i store a droid in a global variable, and this droid dies. How can a script notice that?
Maps | Tower Defense | NullBot AI | More NullBot AI | Scavs | More Scavs | Tilesets | Walkthrough | JSCam