Page 11 of 14

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

Posted: 25 Dec 2016, 01:54
by Alpha993
CAM_VICTORY_OFFWORLD doesn't have access to callback. This is an offworld mission where you only need a single unit to reach the crashed transport area. CAM_VICTORY_STANDARD requires you to kill all the units, which isn't needed in this level.

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

Posted: 25 Dec 2016, 02:14
by Berserk Cyborg
Did not notice that... But off world missions should have access to extra win conditions in the future. You could try using camNextLevel directly which might work.

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

Posted: 27 Dec 2016, 22:47
by Alpha993
Currently in need of a way to access colours as the downed team is supposed to have the same colour as the player.
Edit:
Current commits of JS, constructive criticism is welcome. Changed victory conditions so that units are transferred only if the transport is alive (victory flag = 1).
Will a break in

Code: Select all

//victory condition: transport must be alive
            if (downedTransportUnits[i].health !== NULLOBJECT)
            {
                playSound(successSound);
                customVictoryFlag = 1;
            }
stop the for loop?

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

Posted: 29 Dec 2016, 22:59
by Berserk Cyborg
There are also .wrf files that you need to edit for each level(cam2 here). Typically you just need to delete the the .vlo/.slo lines associated with that specific level and add this to the end of it:

directory "script/campaign"
file JAVASCRIPT "X.js"
(where X is the name of the javascript file for that level. Look at what I did for cam1end.wrf here).

Other than that 2-1 looks good.
Edit: A break there would work. Also you could move some of your global variables into the functions themselves.

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

Posted: 30 Dec 2016, 00:26
by Per
Alpha993 wrote:Currently in need of a way to access colours as the downed team is supposed to have the same colour as the player.
I think this information should be available in the playerData array, in the colour member field. Or do you need a way to set it?

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

Posted: 30 Dec 2016, 00:34
by Alpha993
This is the particular snippet of WZScript I have yet to convert

Code: Select all

	createAlliance(newPlayer, curPlayer);
//make player 0 (newPlayer) units belong to player 1 (curPlayer)

    //save the old colour so we can set it back again
    oldColour = getPlayerColour(curPlayer);

	newColour = getPlayerColour(newPlayer);
	setPlayerColour(newColour, curPlayer);	//make curPlayer units newPlayer colour
A similar thing, if I remember correctly, should happen in ... Gamma 3? When Nexus takes over Gamma Team's base in the north.


Also, apparently I inverted this part

Code: Select all

curPlayer	int	1
newPlayer	int	0
when setting the alliance, human player being 0 and AI being 1 instead of 1/0, but I don't see how much of a difference this would make, except having to flip the variables in WZScript. Shouldn't pose any problem in JS, as long as everything is scripted correctly.

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

Posted: 30 Dec 2016, 00:43
by Per
Ok, I added a changePlayerColour(player, colour) function now (2e3d23d0a5896d42f3160f675665e4e1df982024).

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

Posted: 30 Dec 2016, 01:07
by Alpha993
Am I correct in assuming that changePlayerColour accepts the colour ID as input?

Code: Select all

changePlayerColour(downedTransportTeam, 0);
Something like this.

Many thanks for the function, by the way, very appreciated. :3

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

Posted: 30 Dec 2016, 02:36
by Berserk Cyborg
@Per Could you add something like this to the scripts (taken from cam2ax.slo):

Code: Select all

forceDamageObject(X, Y);
where X is either a droid or structure and Y is the remaining health percentage of that object.

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

Posted: 30 Dec 2016, 18:01
by Alpha993
I'm starting the conversion work on cam2b/bx, just so we don't overlap our efforts.

Edit: Alright, I'm a bit lost as to how to make artifacts drop from specific buildings (i.e. the heavy factory in the base directly north on CAM_2B).

Nevermind, just had to delve a bit deeper into the use of JSON. Group management is definitely going to be an interesting challenge.

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

Posted: 30 Dec 2016, 23:53
by Per
Added setHealth(object, health %) in 62a7c961683266d7ce53fdd23b3fe913d9b9b01a. Not tested, though :-)

The colour is an ID, similar in range to player IDs.

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

Posted: 31 Dec 2016, 01:40
by Berserk Cyborg
Per wrote:Added setHealth(object, health %) in 62a7c961683266d7ce53fdd23b3fe913d9b9b01a. Not tested, though :-)
Tested it and it works (for droids/structures anyway). Thanks!

Seeing as I am almost done with 2-a I will take cam 2-2 and related sub-missions.

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

Posted: 31 Dec 2016, 01:46
by Alpha993
Haven't tested my scripts for SUB_2_1, but if someone would do it, I would very much appreciate it. :3

... though I know I should test my own stuff. :oops:

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

Posted: 31 Dec 2016, 06:12
by Berserk Cyborg
Alpha993 wrote:Haven't tested my scripts for SUB_2_1
Just did. Had to fix a few things though. Those 'S' levels do not need label files since the only coordinates that change are the transporter exit point and the next level. Also simplified your 2-1x script.

Also you need to make the four rocket cyborgs near the upper left corner of the map a group and give them an order of CAM_ORDER_ATTACK and add the objective blip for this mission (there are three more unused base blips should you wish to setup bases. the LZ one is not needed). And the unit transfer stuff is currently broken upon going to 2-b.

blip data (look at prox2-1)
updated sub 2-1 files:
base.zip
(3.79 KiB) Downloaded 199 times

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

Posted: 31 Dec 2016, 13:47
by Alpha993
Is there a function to set up radar blips? I've looked at the libcampaign documentation, but I don't see a function that can set them up, though I can only see enumBlips or hackAddMessage with PROX_MSG type being involved.
As for groups, I could use some guidance, since I have to manage groups in 2b too.

Also, I'm interested into the logic train of thought behind the changes, aside the use of the newly made setHealth and the use of world units in sub_2_1s.