Function accessible locs like in 0.3

Started by KAKAN, Aug 04, 2015, 07:08 AM

Previous topic - Next topic

KAKAN

Credits:- @soulshaker, @KAKAN aka me
What did I do?
Ans. Removed the pickups and added spheres

Add this on script load, before any other spheres
[spoiler]   locslike03();[/spoiler]

and this all in functions
[spoiler="Functions 1"]function onSphereEntered( player, sphere )
{
switch( sphere.ID )
  {
case 0:
player.Pos = Vector( -933.277, -351.746, 7.22692 ); // To bank locker
break;
case 1:
player.Pos = Vector( -933.531, -351.39, 17.8038 ); // From bank locker
break;
case 2:
player.Pos = Vector( -555.477, 788.2, 97.5104 ); // To Office Buliding Lift(UP)
break;
case 3:
player.Pos = Vector( -562.089, 782.275, 22.8768 ); // To Office Buliding Lift(DOWN)
break;
case 4:
player.Pos = Vector( 140.503, -1366.83, 13.1827 ); // To Lawyers Office
break;
case 5:
player.Pos = Vector( 145.115, -1373.62, 10.432 ); // From Lawyers Office
break;
case 6:
player.Pos = Vector( 531.82, -127.311, 31.8522 ); // To Roof access near malibu #1
break;
case 7:
player.Pos = Vector( 531.851, -111.883, 10.7477 ); // From Roof access near malibu #1
break;
case 8:
player.Pos = Vector( 456.443, 30.3307, 34.8713 ); // To Roof access near malibu #2
break;
case 9:
player.Pos = Vector( 481.619, 30.4486, 11.0712 ); // From Roof access near malibu #2
break;
case 10:
player.Pos = Vector( -943.87, 1077.19, 11.0946 ); // To Lovefist
break;
case 11:
player.Pos = Vector( -888.268, 1054.37, 14.689 ); // From Lovefistcase
break;
case 12:
player.Pos = Vector( -820.836, 1355.72, 66.4525 ); // To Roof Access in Downtown #1
break;
case 13:
player.Pos = Vector( -828.593, 1304.96, 11.5887 ); // From Roof Access in Downtown #1
break;
case 14:
player.Pos = Vector( -1423.86, 941.064, 260.276 ); // To Bloodring
break;
case 15:
player.Pos = Vector( -1088.61, 1312.74, 9.50517 ); // From Bloodring
break;
case 16:
player.Pos = Vector( -1412.4, 1159.08, 266.689 ); // To Racetrack(Stadium)
break;
case 17:
player.Pos = Vector( -1086.57, 1352.84, 9.50517 ); // From Racetrack(Stadium)
break;
case 18:
player.Pos = Vector(  -445.71, 1127.11, 56.6909 ); // To VCN Building
break;
case 19:
player.Pos = Vector( -408.424, 1114.92, 11.0709 ); // From VCN Building
break;
case 20:
player.Pos = Vector( -444.803, 1253.35, 77.4241 ); // To Roof Access in Downtown #2
break;
case 21:
player.Pos = Vector( -449.452, 1252.74, 11.767 ); // From Roof Access in Downtown #2
break;
case 22:
player.Pos = Vector( -880.359, 1159.52, 17.8184 ); // To V Rock(Near Lovefist)
break;
case 23:
player.Pos = Vector( -872.045, 1161.86, 11.16 ); // From V Rock(Near Lovefist)
break;
case 24:
player.Pos = Vector( -1332.08, 1453.91, 299.146 ); // To Dirtring
break;
case 25:
player.Pos = Vector( -1105.68, 1333.03, 20.07 ); // From Dirtring
break;
case 26:
player.Pos = Vector( -890.945, 1066.15, 75.8666 ); // To Lovefist roof
break;
case 27:
player.Pos = Vector( -887.988, 1046.99, 14.4515 ); // From Lovefist roof
break;
return0;
  }
}[/spoiler]

[spoiler="Functions 2"]function locslike03( )
{
CreateSphere(null, 1 Vector(-935.85,-351.315,17.8038), RGB(0, 0, 200), 1.5);
CreateSphere(null, 1 Vector(-936.923,-351.838,7.22692), RGB(0, 0, 200), 1.5);
CreateSphere(null, 1 Vector(-557.433,782.167,22.8768), RGB(0, 0, 200), 1.5);
CreateSphere(null, 1 Vector(-551.781,787.953,97.5104), RGB(0, 0, 200), 1.5);
CreateSphere(null, 1 Vector(142.726,-1372.82,10.432), RGB(0, 0, 200), 1.5);
CreateSphere(null, 1 Vector(139.562,-1369.64,13.1827), RGB(0, 0, 200), 1.5);
CreateSphere(null, 1 Vector(531.76,-118.642,13.337), RGB(0, 0, 200), 1.5);
CreateSphere(null, 1 Vector(531.655,-131.936,32.5095), RGB(0, 0, 200), 1.5);
CreateSphere(null, 1 Vector(475.792,30.4263,12.0714), RGB(0, 0, 200), 1.5);
CreateSphere(null, 1 Vector(462.603,30.3705,30.9712), RGB(0, 0, 200), 1.5);
CreateSphere(null, 1 Vector(-893.381,1054.55,15.6737), RGB(0, 0, 200), 1.5);
CreateSphere(null, 1 Vector(-940.18,1077.63,11.0946), RGB(0, 0, 200), 1.5);
CreateSphere(null, 1 Vector(-829.876,1309.94,11.5467), RGB(0, 0, 200), 1.5);
CreateSphere(null, 1 Vector(-813.565,1354.24,66.4603), RGB(0, 0, 200), 1.5);
CreateSphere(null, 1 Vector(-1090.55,1311.23,9.50517), RGB(0, 0, 200), 1.5);
CreateSphere(null, 1 Vector(-1443.39,936.094,262.411), RGB(0, 0, 200), 1.5);
CreateSphere(null, 1 Vector(-1089.59,1351.05,9.50517), RGB(0, 0, 200), 1.5);
CreateSphere(null, 1 Vector(-1414.77,1155.04,267.429), RGB(0, 0, 200), 1.5);
CreateSphere(null, 1 Vector(-410.452,1118.05,11.0709), RGB(0, 0, 200), 1.5);
CreateSphere(null, 1 Vector(-449.024,1128.07,56.6909), RGB(0, 0, 200), 1.5);
CreateSphere(null, 1 Vector(-448.446,1249.33,11.767), RGB(0, 0, 200), 1.5);
CreateSphere(null, 1 Vector(-448.35,1249.3,77.3986), RGB(0, 0, 200), 1.5);
CreateSphere(null, 1 Vector(-874.715,1159.56,11.1825), RGB(0, 0, 200), 1.5);
CreateSphere(null, 1 Vector(-877.507,1160.53,17.8152), RGB(0, 0, 200), 1.5);
CreateSphere(null, 1 Vector(-1108.33,1331.05,20.1156), RGB(0, 0, 200), 1.5);
CreateSphere(null, 1 Vector(-1426.24,1507.62,302.902), RGB(0, 0, 200), 1.5);
CreateSphere(null, 1 Vector(-892.953,1048.69,15.6737), RGB(0, 0, 200), 1.5);
CreateSphere(null, 1 Vector(-893.477,1050.26,75.8666), RGB(0, 0, 200), 1.5);
}[/spoiler]
oh no

Sebastian

And you gave me credits because... ? :)
By the way, I guess there is a limit for spheres too, am I right @Stormeus ?
Can you tell us the limit ?

Also, I remember once I used spheres in LU. I used like 30 spheres or something like that.
All of them were there, but only 15 or something like that were visible. Rest of them were invisible.
I guess this will happen in VC:MP too, so if anybody can test that, that info will be very useful.

KAKAN

Ahh, I was testing it and it just works fine, just make a cmd using the last vector and see, its working
oh no

KAKAN

Code Updated.
New update includes:-
A smaller radius of the sphere

Future Updates:-
Add a sound with the code, so that when a player enters the sphere, he'll get a sound
oh no


DizzasTeR


soulshaker

When you are using someone's hard work of collecting locs, You should give the credits
nvm, nice that you changed to spheres. I too hate the pickups, but got not time to convert the script

KAKAN

I already gave the credits, can't u see?
oh no

Thijn

Quote from: KAKAN on Aug 04, 2015, 10:02 AMI already gave the credits, can't u see?
You gave credits to Sseebbyy, not soulshaker ;)



This script can be greatly reduced, btw.
LocsLike03 <- [
Vector( -933.277, -351.746, 7.22692 ), // To bank locker
Vector( -933.531, -351.39, 17.8038 ), // From bank locker
Vector( -555.477, 788.2, 97.5104 ), // To Office Buliding Lift(UP)
Vector( -562.089, 782.275, 22.8768 ), // To Office Buliding Lift(DOWN)
Vector( 140.503, -1366.83, 13.1827 ), // To Lawyers Office
Vector( 145.115, -1373.62, 10.432 ), // From Lawyers Office
Vector( 531.82, -127.311, 31.8522 ), // To Roof access near malibu #1
Vector( 531.851, -111.883, 10.7477 ), // From Roof access near malibu #1
Vector( 456.443, 30.3307, 34.8713 ), // To Roof access near malibu #2
Vector( 481.619, 30.4486, 11.0712 ), // From Roof access near malibu #2
Vector( -943.87, 1077.19, 11.0946 ), // To Lovefist
Vector( -888.268, 1054.37, 14.689 ), // From Lovefistcase
Vector( -820.836, 1355.72, 66.4525 ), // To Roof Access in Downtown #1
Vector( -828.593, 1304.96, 11.5887 ), // From Roof Access in Downtown #1
Vector( -1423.86, 941.064, 260.276 ), // To Bloodring
Vector( -1088.61, 1312.74, 9.50517 ), // From Bloodring
Vector( -1412.4, 1159.08, 266.689 ), // To Racetrack(Stadium)
Vector( -1086.57, 1352.84, 9.50517 ), // From Racetrack(Stadium)
Vector(  -445.71, 1127.11, 56.6909 ), // To VCN Building
Vector( -408.424, 1114.92, 11.0709 ), // From VCN Building
Vector( -444.803, 1253.35, 77.4241 ), // To Roof Access in Downtown #2
Vector( -449.452, 1252.74, 11.767 ), // From Roof Access in Downtown #2
Vector( -880.359, 1159.52, 17.8184 ), // To V Rock(Near Lovefist)
Vector( -872.045, 1161.86, 11.16 ), // From V Rock(Near Lovefist)
Vector( -1332.08, 1453.91, 299.146 ), // To Dirtring
Vector( -1105.68, 1333.03, 20.07 ), // From Dirtring
Vector( -890.945, 1066.15, 75.8666 ), // To Lovefist roof
Vector( -887.988, 1046.99, 14.4515 ), // From Lovefist roof
];

function place03Spheres()
{
for( local i = 0; i < LocsLike03.len(); i++ ) {
CreateSphere(null, 1, LocsLike03[ i ], RGB(0, 0, 200), 1.5);
}
}

function onSphereEntered( player, sphere )
{
if ( sphere.ID < LocsLike03.len() && LocsLike03[ sphere.ID ] ) {
player.Pos = LocsLike03[ sphere.ID ];
}
}
(Untested, but you get the point)

KAKAN

Okay thanks, anyways given credits to...
Let me test ur script thijin
oh no

KAKAN

I just tested it, it didn't work, it doesn't teleport me to anywhere
oh no

Thijn

Ah, of course. You get teleported to the sphere position. In that case you'd need to add something like this:
LocsLike03 <- [
 [ Vector(-935.85,-351.315,17.8038), Vector( -933.277, -351.746, 7.22692 ) ], // To bank locker
 [ Vector(-936.923,-351.838,7.22692), Vector( -933.531, -351.39, 17.8038 )], // From bank locker
 [ Vector(-557.433,782.167,22.8768), Vector( -555.477, 788.2, 97.5104 )], // To Office Buliding Lift(UP)
 [ Vector(-551.781,787.953,97.5104), Vector( -562.089, 782.275, 22.8768 )], // To Office Buliding Lift(DOWN)
 [ Vector(142.726,-1372.82,10.432), Vector( 140.503, -1366.83, 13.1827 )], // To Lawyers Office
 [ Vector(139.562,-1369.64,13.1827), Vector( 145.115, -1373.62, 10.432 )], // From Lawyers Office
 [ Vector(531.76,-118.642,13.337), Vector( 531.82, -127.311, 31.8522 )], // To Roof access near malibu #1
 [ Vector(531.655,-131.936,32.5095), Vector( 531.851, -111.883, 10.7477 )], // From Roof access near malibu #1
 [ Vector(475.792,30.4263,12.0714), Vector( 456.443, 30.3307, 34.8713 )], // To Roof access near malibu #2
 [ Vector(462.603,30.3705,30.9712), Vector( 481.619, 30.4486, 11.0712 )], // From Roof access near malibu #2
 [ Vector(-893.381,1054.55,15.6737), Vector( -943.87, 1077.19, 11.0946 )], // To Lovefist
 [ Vector(-940.18,1077.63,11.0946), Vector( -888.268, 1054.37, 14.689 )], // From Lovefistcase
 [ Vector(-829.876,1309.94,11.5467), Vector( -820.836, 1355.72, 66.4525 )], // To Roof Access in Downtown #1
 [ Vector(-813.565,1354.24,66.4603), Vector( -828.593, 1304.96, 11.5887 )], // From Roof Access in Downtown #1
 [ Vector(-1090.55,1311.23,9.50517), Vector( -1423.86, 941.064, 260.276 )], // To Bloodring
 [ Vector(-1443.39,936.094,262.411), Vector( -1088.61, 1312.74, 9.50517 )], // From Bloodring
 [ Vector(-1089.59,1351.05,9.50517), Vector( -1412.4, 1159.08, 266.689 )], // To Racetrack(Stadium)
 [ Vector(-1414.77,1155.04,267.429), Vector( -1086.57, 1352.84, 9.50517 )], // From Racetrack(Stadium)
 [ Vector(-410.452,1118.05,11.0709), Vector(  -445.71, 1127.11, 56.6909 )], // To VCN Building
 [ Vector(-449.024,1128.07,56.6909), Vector( -408.424, 1114.92, 11.0709 )], // From VCN Building
 [ Vector(-448.446,1249.33,11.767), Vector( -444.803, 1253.35, 77.4241 )], // To Roof Access in Downtown #2
 [ Vector(-448.35,1249.3,77.3986), Vector( -449.452, 1252.74, 11.767 )], // From Roof Access in Downtown #2
 [ Vector(-874.715,1159.56,11.1825), Vector( -880.359, 1159.52, 17.8184 )], // To V Rock(Near Lovefist)
 [ Vector(-877.507,1160.53,17.8152), Vector( -872.045, 1161.86, 11.16 )], // From V Rock(Near Lovefist)
 [ Vector(-1108.33,1331.05,20.1156), Vector( -1332.08, 1453.91, 299.146 )], // To Dirtring
 [ Vector(-1426.24,1507.62,302.902), Vector( -1105.68, 1333.03, 20.07 )], // From Dirtring
 [ Vector(-892.953,1048.69,15.6737), Vector( -890.945, 1066.15, 75.8666 )], // To Lovefist roof
 [ Vector(-893.477,1050.26,75.8666), Vector( -887.988, 1046.99, 14.4515 )], // From Lovefist roof
];

function onScriptLoad()
{
place03Spheres();
}

function place03Spheres()
{
 for( local i = 0; i < LocsLike03.len(); i++ ) {
  CreateSphere(null, 1, LocsLike03[ i ][0], RGB(0, 0, 200), 1.5);
 }
}

function onSphereEntered( player, sphere )
{
 if ( sphere.ID < LocsLike03.len() && LocsLike03[ sphere.ID ] ) {
  player.Pos = LocsLike03[ sphere.ID ][1];
 }
}

KAKAN

Got it, still then I prefer to use to the old  style
oh no

Diego^

BRL's Developer.