Weather and fog scripts to JS

For AI and campaign script related discussions and questions

Weather and fog scripts to JS

Postby Berserk Cyborg » 13 Dec 2017, 02:31

Branch.

I have the weather scripts done which was simple as ever. Oddly, the music was set from these scripts so I moved that to both rules.js files. Each of the three files use a setCampaignNumber(num) though I have not checked if it is useful anymore.

Because skirmish does not include the fog/weather scripts, the music has likely been incorrectly using the frontend music for some time now. Also implies weather particles do not show up for urban and rocky maps.

Now what to do with fog code (daynight files in here)? Maybe salvage NoQ's fog patch? In any case this marks the end of WZScript dependence.

Mod idea for weather:
Spoiler:


Edit: Buildbot is broken again.
User avatar
Berserk Cyborg
Code contributor
Code contributor
 
Posts: 554
Joined: 26 Sep 2016, 19:56

Re: Weather and fog scripts to JS

Postby NoQ » 13 Dec 2017, 03:32

My fog patch had the problem of me cannot into opengl. So i made it work with trial and error, but i've no idea if it's like anyhow correct (: The scripting part was fine though, i guess.

Berserk Cyborg wrote:Mod idea for weather:
Spoiler:

Sounds awesome :3 I guess this way it would also actually disable units hit by lightning.
User avatar
NoQ
Special
Special
 
Posts: 6138
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: Weather and fog scripts to JS

Postby Berserk Cyborg » 14 Dec 2017, 21:32

Here is a patch for the weather (campaign only right now). Like what I did with the tech levels, I could include it along with rule.js if that is preferred. There is one problem where savegames are not loading because it says scriptstate.es is corrupted... not sure what is up with that.

Added setCampaignNumber(num) as it does have a couple of uses and I also saw no difference with the absence of the fog stuff with this patch.

0001-Move-weather-scripts-to-JS.patch
(48.6 KiB) Downloaded 27 times
User avatar
Berserk Cyborg
Code contributor
Code contributor
 
Posts: 554
Joined: 26 Sep 2016, 19:56

Re: Weather and fog scripts to JS

Postby Per » 20 Dec 2017, 02:13

Berserk Cyborg wrote:Here is a patch for the weather (campaign only right now). Like what I did with the tech levels, I could include it along with rule.js if that is preferred. There is one problem where savegames are not loading because it says scriptstate.es is corrupted... not sure what is up with that.

Added setCampaignNumber(num) as it does have a couple of uses and I also saw no difference with the absence of the fog stuff with this patch.

0001-Move-weather-scripts-to-JS.patch

IIRC, if you remove globals from wzscript, old savegames will no longer load.

Patch looks good to me.
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
 
Posts: 3744
Joined: 03 Aug 2006, 19:39

Re: Weather and fog scripts to JS

Postby Berserk Cyborg » 20 Dec 2017, 17:29

I should say that the patch creates broken saves. Claims no script contexts were found with scriptState.es and then goes back to the main menu. Or maybe that file is now obsoleted without any wzscripts around?
User avatar
Berserk Cyborg
Code contributor
Code contributor
 
Posts: 554
Joined: 26 Sep 2016, 19:56

Re: Weather and fog scripts to JS

Postby Per » 20 Dec 2017, 22:25

Berserk Cyborg wrote:I should say that the patch creates broken saves. Claims no script contexts were found with scriptState.es and then goes back to the main menu. Or maybe that file is now obsoleted without any wzscripts around?

Ah, it does not expect that there is no wzscript context to be created from the savegame anymore. Fixed in f0930756a32ef8310818abcb022609c8f582621c. Your patch seems to work now.
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
 
Posts: 3744
Joined: 03 Aug 2006, 19:39

Re: Weather and fog scripts to JS

Postby Berserk Cyborg » 20 Dec 2017, 23:13

Pushed b016f609d704ce4df022e3a89f4f70f6eaabbee7. I enabled weather for multiplay; Hopefully that does not cause problems. As for old saves, we can just delete the scriptState.es file and they will load.

I also fixed an ancient bug #983.

I guess the data/base/script/data and data/base/script/text directories are useless now and can be deleted.
User avatar
Berserk Cyborg
Code contributor
Code contributor
 
Posts: 554
Joined: 26 Sep 2016, 19:56

Re: Weather and fog scripts to JS

Postby Per » 21 Dec 2017, 01:21

I pushed deletes for all remaining base wzscripts except basic.slo, where I just removed the stuff I am certain is no longer used.
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
 
Posts: 3744
Joined: 03 Aug 2006, 19:39


Return to Scripting

cron