The official --=jscam=-- thread

For AI and campaign script related discussions and questions

Re: The official --=jscam=-- thread

Postby NoQ » 29 Nov 2016, 08:54

Hmm, are you looking into the mission where tanks are carrying an arfitact? In this case i'd expect that putting the label on the droid itself rather than its position should work, and it's worth fixing if it doesn't.
User avatar
NoQ
Special
Special
 
Posts: 6037
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: The official --=jscam=-- thread

Postby Berserk Cyborg » 03 Dec 2016, 08:13

I think I have completed 1-7/1-7s/1-1/1-1s. Also added my fix for the extra win condition for 1ca.

Only 1-ds/1-d/1end are the remaining Alpha missions. I suspect that 1-d will take a bit longer than others as it is probably one of larger campaign missions (in terms of content anyway). And there are other files related to the day-night cycle and and scavengers (have not looked at those yet) for Alpha.

Edit: For 1-D would anyone like me to remove or re-position the floating sensor tower in the water as described in http://developer.wz2100.net/ticket/4476?
Berserk Cyborg
Code contributor
Code contributor
 
Posts: 109
Joined: 26 Sep 2016, 19:56

Re: The official --=jscam=-- thread

Postby NoQ » 03 Dec 2016, 18:38

Day-night cycle is certainly dead code, and even though we could try to breath some life into it now that there's so much progress with graphics, it's not worth it to keep it in the source tree for just the reference.

I do not remember what the extra scavenger code is.

Floating sensor tower sounds like it's one of the things we should definitely fix.
User avatar
NoQ
Special
Special
 
Posts: 6037
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: The official --=jscam=-- thread

Postby Berserk Cyborg » 04 Dec 2016, 23:10

I think the extra scavenger code was just to give them Kevlar from 1-C and later for Alpha. It is currently unused and is only a texture update.

1-D is going along smoothly. The script will destroy the floating sensor tower object if it exists and I need to add morale/fallback for some enemy groups and change some factory data. Do I need to do anything with sector coordinates? Seems to be an unused or broken feature from 1-D and later.

Edit: One thing that I have not figured out is how to put multiple mission messages together. Placing multiple hackAddMessages() next to each other only executes the last sequence (the other ones are skipped). Is there another way or a fix? Currently I have something less than ideal for these situations.
Berserk Cyborg
Code contributor
Code contributor
 
Posts: 109
Joined: 26 Sep 2016, 19:56

Re: The official --=jscam=-- thread

Postby NoQ » 05 Dec 2016, 13:45

Removing the sensor from the map is certainly better than scripting to remove it.

Did you try eventVideoDone()?
User avatar
NoQ
Special
Special
 
Posts: 6037
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: The official --=jscam=-- thread

Postby Berserk Cyborg » 06 Dec 2016, 07:56

Thanks, eventVideoDone() did what I wanted. Also I will try removing the sensor from the map (it was on top of a rock like area before 3.2).
Berserk Cyborg
Code contributor
Code contributor
 
Posts: 109
Joined: 26 Sep 2016, 19:56

Re: The official --=jscam=-- thread

Postby Berserk Cyborg » 09 Dec 2016, 22:49

I removed the sensor from the 1-d map. I now have all the Alpha missions converted and should be safe enough not to trigger any errors (at least from my own tests). Criticism of the code is welcome in any aspect and I encourage anyone with time to test these missions. Campaign conversion progress.

Edit: Scavengers now wear Kevlar from 1-C and later again.
Berserk Cyborg
Code contributor
Code contributor
 
Posts: 109
Joined: 26 Sep 2016, 19:56

Re: The official --=jscam=-- thread

Postby Alpha993 » 16 Dec 2016, 16:07

And here I am again, had to make a new account since the other's mail apparently was deleted as I didn't access it for ages (thanks Microsoft) and as such I cannot recover its password.

Anyway, back on topic, I've taken an interest into Javascript just recently so I'm willing to do some scripting too. Where can I find the templates to translate them into code. i.e. How do I find out these names?
Alpha993
Rookie
Rookie
 
Posts: 16
Joined: 16 Dec 2016, 15:56
Location: Italy, Cervignano del Friuli, UD

Re: The official --=jscam=-- thread

Postby Berserk Cyborg » 18 Dec 2016, 08:13

The stats can be found here for the most part: http://betaguide.wz2100.net/stats.php

If you are to do any campaign scripting, start with sub2-1(s)(x) as I am working on cam2a. The best resources for the {.vlo, .slo} -> .js conversions would be looking through already converted levels and visiting the warzone2100 javascript API.

In fact cam2-1(s)(x) should be fairly simple as it is a smaller mission.

Edit: uploaded unfinished cam2a work (and thus updated templates file).
Berserk Cyborg
Code contributor
Code contributor
 
Posts: 109
Joined: 26 Sep 2016, 19:56

Re: The official --=jscam=-- thread

Postby Berserk Cyborg » 22 Dec 2016, 01:33

Questions(start of Beta campaign):
1. Is there a way to damage stuctures/droids easily(or modify any value they contain)? I tried changing the health values, but it keeps them at 100% no matter what I do. I did not find a script function that could do this.

2. Sending multiple transports for the player (this mission gives free units)? I am using camSendReinforcement and after the first one libcampaign complains there is one already on the map (even though it disappears) and transports for both player and enemy can not arrive.

Also starting Beta/Gamma campaign from the menu rather than progressing through the previous campaigns will leave players at a massive tech disadvantage because all we are really doing right now is unlocking weapons and structures rather than reaping the benefits of the research. Should we just use one massive research file like multi-player does rather than keep separate research files for the three campaigns?
Berserk Cyborg
Code contributor
Code contributor
 
Posts: 109
Joined: 26 Sep 2016, 19:56

Re: The official --=jscam=-- thread

Postby vexed » 22 Dec 2016, 05:53

BTW guys, make sure you specify to each other which you are converting, so you don't both do the same work.
/facepalm ...Grinch stole Warzone🙈🙉🙊 contra principia negantem non est disputandum
Super busy, don't expect a timely reply back.
User avatar
vexed
Inactive
Inactive
 
Posts: 2385
Joined: 27 Jul 2010, 02:07

Re: The official --=jscam=-- thread

Postby Alpha993 » 22 Dec 2016, 16:19

I figure we'll have to design a function that damages everything found within a certain area at the beginning of the level. Such a function is also needed to apply damage to the units near the downed transport in SUB_2_1.

Specifically, for our case:

- Find out the area which contains the droids we want to apply damage to;
- Get a list of the droids within that area;
- Apply damage to the droids;

Also, need an idea as to what these numbers refer to.
Alpha993
Rookie
Rookie
 
Posts: 16
Joined: 16 Dec 2016, 15:56
Location: Italy, Cervignano del Friuli, UD

Re: The official --=jscam=-- thread

Postby Berserk Cyborg » 22 Dec 2016, 18:55

Alpha993 wrote:Also, need an idea as to what these numbers refer to.

Those numbers are the ID for that given droid. Everything has an ID that can be shown by entering debug mode and clicking on it. Useful for doing something specific to an object.

However, since all those droids are next to each other, you can just do something similar to what you described earlier.
Berserk Cyborg
Code contributor
Code contributor
 
Posts: 109
Joined: 26 Sep 2016, 19:56

Re: The official --=jscam=-- thread

Postby Alpha993 » 22 Dec 2016, 19:41

I assume that I will also need to make a droid.json file that contains those IDs, and add those to an array.

Given that the transport has 10 units, I suppose after I'll have the droid.json file laid out I could do something like this:
var downedTransportDroids = [ ID 1, ID 2, ID 3, ID 4, ID 5, ID 6, ID 7, ID 8, ID 9, ID 10];

The function for applying damage to droids could take as input a pointer to the array (if needed) and, through a for statement, apply damage to the unit whose ID is pointed by the index.

I suppose the json file won't be needed if there's another way of accessing those ID numbers.

In pseudocode:

Code: Select all
function applyDamage (*downedTransportDroids)
{
var i = 0; //index variable initialization
for ( i = 0, i < #droids; i ++)
{
apply a random amount of damage to downedTransportDroids[i]; // function to do this should be defined in the game source
}
}


All in all, this seems to be a bit more intuitive and elegant, since we can define the droids positions in the droid.json file, thus eliminating the need to find where they are located on the map. Opinions?

Or it could be implemented this way, I suppose:

Code: Select all
 downedTransportDroids = enumArea ("crashSite", ALLIES, false);
for ( i = 0; i < #droids; i++)
{
Apply damage to downedTransportDroids.DROID[i];
}


In this case, what I want to know is if enumArea fills the array with .DROID data before .STRUCTURE data.

Edit:
This is what I came up with.
Also, I'm in need of custom victory conditions for this particular level. Namedly, I need victory to trigger once a unit enters the area.
Last edited by Alpha993 on 25 Dec 2016, 01:49, edited 1 time in total.
Alpha993
Rookie
Rookie
 
Posts: 16
Joined: 16 Dec 2016, 15:56
Location: Italy, Cervignano del Friuli, UD

Re: The official --=jscam=-- thread

Postby Berserk Cyborg » 25 Dec 2016, 01:48

You can set a extra win condition callback. Have a look at cam1-ca which shows how you can use custom win conditions. I think only one unit from the player needs to reach the transporter in the wzscript to trigger the win.
Berserk Cyborg
Code contributor
Code contributor
 
Posts: 109
Joined: 26 Sep 2016, 19:56

PreviousNext

Return to Scripting