UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

Script doing weird things

broken avatar :(
Created 11 years ago
by Soy-Yo
0 Members and 1 Guest are viewing this topic.
1,425 views
broken avatar :(
×
broken avatar :(
Location: esMadrid
Date Registered: 27 March 2015
Last active: 5 years ago
Posts
371
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
Personal Quote
JIGGLYPUFF used SING! YOU fell asleep!
Signature
×
Soy-Yo's Groups
Soy-Yo's Contact & Social LinksSoy-yoElCerdoRey
I have some problems with some pieces of script I just cannot understand. If someone can figure out what it is, I'll be very thankful.

1. This piece of script sets the path one cube is going to follow:
Code Snippet
Plaintext
nextPos = (2,0,0);
level.finalCubeTrip[ level.finalCubeTrip.size ] = addNewPos( nextPos, level.cubesPosition[ level.finalCube ] );
nextPos = (0,0,2);
level.finalCubeTrip[ level.finalCubeTrip.size ] = addNewPos( nextPos, level.finalCubeTrip[ level.finalCubeTrip.size - 1 ] );
nextPos = (0,0,-2);
level.finalCubeTrip[ level.finalCubeTrip.size ] = addNewPos( nextPos, level.finalCubeTrip[ level.finalCubeTrip.size - 1 ] );
nextPos = (-2,0,0);
level.finalCubeTrip[ level.finalCubeTrip.size ] = addNewPos( nextPos, level.finalCubeTrip[ level.finalCubeTrip.size - 1 ] );

// ...

addNewPos(n,pos) {
    newPos = pos + n;
    return newPos;
}
For the first one, it gets the position of the cube and sets the position it has to go relatively. For the next positions it gets the last position to calculate the new one.
Everything should be fine, but somehow "level.finalCubeTrip[2]" doesn't work. Just that. ???
If I print the four positions, all are printed but that. And if I print that vector, coord by coord, only x coord works.

2. This is for knowing if a player is in the cube I'm about to move:
Code Snippet
Plaintext
pl = get_players();
for( i = 0; i < pl.size; i++) {
    if( pl[i].isInCube == cube ) // isInCube = the cube where the player is; cube = the cube I'm moving
        touching[i] = pl[i];
}
No matter which cube I'm moving or where the player is, because the condition is always true (I tried to print pl[0].isInCube and cube separately and they aren't equal (0 and 15, for example)). I fixed it doing it other way but I prefer using this one.

3. Another similar: it is supposed to get the structs in one cube.
Code Snippet
Plaintext
risers = getStructArray( "principal_zone_spawners_rise","targetname" ); // get all the risers in map
for( i = 0; i < risers.size; i++ ) {
    if( risers[i] isTouching( vol ) ) // vol = a volume, different in every cube
        structs[ structs.size ] = risers[i];
}
And, again, somehow the condition is always true, so I move all risers in map.

Does anyone have any idea? :-[
Last Edit: October 25, 2015, 11:36:33 pm by Soy-Yo
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 6 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
Signature
×
MakeCents's Groups
Mapper Has released one or more maps to the UGX-Mods community.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
I noticed this:
Code Snippet
Plaintext
level.finalCubeTrip[ level.finalCubeTrip.size ] = addNewPos( nextPos, level.cubesPosition[ level.finalCube ] );
More specifically, the "level.finalCube" part and the different array. Maybe that is defined elsewhere, maybe it was a typo, I don't know. I assume it is meant to be that way, but I just figured I mention it.

Have you printed before and after it adds the vectors, in the addNewPos function?

Last Edit: October 27, 2015, 03:18:13 am by MakeCents
broken avatar :(
×
broken avatar :(
Location: esMadrid
Date Registered: 27 March 2015
Last active: 5 years ago
Posts
371
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
Personal Quote
JIGGLYPUFF used SING! YOU fell asleep!
×
Soy-Yo's Groups
Soy-Yo's Contact & Social LinksSoy-yoElCerdoRey
I noticed this:
Code Snippet
Plaintext
level.finalCubeTrip[ level.finalCubeTrip.size ] = addNewPos( nextPos, level.cubesPosition[ level.finalCube ] );
More specifically, the "level.finalCube" part and the different array. Maybe that is defined elsewhere, maybe it was a typo, I don't know. I assume it is meant to be that way, but I just figured I mention it.
That's ok. It gets the position of the final cube so I can set the next position to move relative to that.

Have you printed before and after it adds the vectors, in the addNewPos function?
I didn't try that yesterday. I've just tried it now and everything was perfect. But the funny thing is that today it prints the vectors properly. :o And I haven't changed anything, just added or deleted some prints.

But while writing this I think I realised what is happening (only for this part of the script; no idea why the rest aren't working). To make it be a circuit, when the cube moved, I deleted the first position and moved it to the end. And it seems that if a position was repeated, it was removed twice. :D Hope that change fixes it.

 
Loading ...