Jump to content

Teleport with fade


turbocharger

Recommended Posts

turbocharger

Hello friends, need a bit of help with a small script here,

 

What I want to achieve:

 - Player enters the sphere

- The screen fades to black for a moment

- In the meantime while the screen is black, the player is teleported to another location

- A text appears in the lower right part of the screen "Big Smoke"

- Screen "un-fades" and gameplay continues

 

What I'm currently achieving with my script:

- Player enters the sphere

- The screen fades to black and remains like that.

 

I can hear the player's footsteps/game carries on, but it's just that the screen remains black. How do I remove the fade after teleportation?

Also, instead of a red sphere I would like a yellow bobbing marker to appear (like ENEX markers), which would trigger the teleportation.

 

I'm doing this in main.scm, not a CLEO script. Here's the code:

 

thread 'TELEPORT' 

:TELE_11
wait 0 
if 
   Player.Defined($PLAYER_CHAR)
else_jump @TELE_11 
if 
00FF:   actor $PLAYER_ACTOR 1 -394.5266 -2023.6575 23.2606 radius 1.0 1.0 1.0  
else_jump @TELE_11  
fade 0 500
repeat
wait 0
until 816B:   not fading 
Actor.PutAt($PLAYER_ACTOR, -350.223, -2015.2135, 23.4376)
00BA: show_text_styled GXT 'INTRO_1' time 500 style 2  // Big Smoke
jump @TELE_11 

 

A little help please?

 

Thanks!

Link to comment
Share on other sites

fade 0 500// FADE IN
wait 500
fade 1 500// FADE OUT

 

  • Like 1
Link to comment
Share on other sites

turbocharger

Thanks a bunch. 👍

 

What about that yellow bobbing marker? How do I summon it, instead of the regular red sphere?

Link to comment
Share on other sites

 

disable red cylinder:
00FF:   actor $PLAYER_ACTOR 1 <-- 0 instead 1

 

0A40: 3@ = create_entrance_marker_at -394.52 -2023.65 23.2 color 14

 

 

 

Edited by ZAZ
  • Like 1
Link to comment
Share on other sites

turbocharger

Oh I get it - basically you set the red sphere to appear invisible and placed the enex marker at the same spot. Brilliant.

Thanks a lot.

 

I apologize for my lack of basic SCM coding knowledge, I went down the 3D modelling path instead. Although as the time goes on, coding seems more and more attractive.

 

Would it be okay if I contacted you via private messages in case of additional questions in future?

 

Link to comment
Share on other sites

Be sure to keep track of your 3D entrance marker and to remove it when no longer needed. There's only room for 5 in the pool, and some are used by the game scripts. The 3D entrance marker data is saved, like pickups, blips, cargens, etc, so you don't want them to pile up and clog the pool.

 

Edited by OrionSR
  • Like 1
Link to comment
Share on other sites

turbocharger

Well, I'm using a 'clean' main.scm with everything deleted (the one that comes with map cleaner).

 

The thing is, I want this marker to appear at all times, so it teleports you to the interior whenever you want. That means I can only 4 more additional markers on the map at the same time?

 

Would using external (CLEO) scripts bypass this limit?

 

What is the max limit for car gens and pickups in a single main.scm file?

 

Currently, I have about 10 car generators and this one marker in my main.scm.

Link to comment
Share on other sites

41 minutes ago, turbocharger said:

Would using external (CLEO) scripts bypass this [Entrance Marker] limit?

No. A limit adjuster might be able to increase the size of the pool, but all you really need is one, and that's pretty easy to manage in a custom main since you can store that handle in a global variable. The most common example are that airport terminal scripts, which remove the previous marker and places it when CJ is near. So whichever script is waiting to teleport CJ can also have a larger radius trigger for moving the marker. You won't need more than one unless you want to view more than one at a time.
 

41 minutes ago, turbocharger said:

What is the max limit for car gens and pickups in a single main.scm file?

Sanny's SCM documentation includes information on standard game limits.

Cargens: Max 500, but you want to leave a lot of room for streamed cargens from the binary IPL files. There are 208 "SCM" cargens in a standard game, an extra 120 or so has never been a problem in my custom saves. You could probably push this to 400 before you start to need alternative cargen strategies.

 

Pickups: Max 620, but you need to leave a lot of room for dropped money and weapons from dead peds. A normal new game includes 555 pickups, and it's pretty tough to add many more without clogging the pool. Once most of the collectible pickups are collected there's usually plenty of room in the pool unless you are on a continuous gang war rampage and leaving lots of dropped pickups behind.
 

Edited by OrionSR
  • Like 1
Link to comment
Share on other sites

turbocharger
25 minutes ago, OrionSR said:

No. A limit adjuster might be able to increase the size of the pool, but all you really need is one, and that's pretty easy to manage in a custom main since you can store that handle in a global variable. The most common example are that airport terminal scripts, which remove the previous marker and places it when CJ is near. So whichever script is waiting to teleport CJ can also have a larger radius trigger for moving the marker. You won't need more than one unless you want to view more than one at a time.

In order to achieve this, I'd probably need to code something along the lines of:

- if actor player actor is in area x y z, radius __

- then (remove the marker at other location and proceed with spawning new marker)

- else jump at (the beginning of the thread)

 

I will try do this later on my own, just checking if I'm on the right path? I'll check those airport terminals in the original game.

 

25 minutes ago, OrionSR said:

Cargens: Max 500, but you want to leave a lot of room for streamed cargens from the binary IPL files. There are 208 "SCM" cargens in a standard game, an extra 120 or so has never been a problem in my custom saves. You could probably push this to 400 before you start to need alternative cargen strategies.

 

Pickups: Max 620, but you need to leave a lot of room for dropped money and weapons from dead peds. A normal new game includes 555 pickups, and it's pretty tough to add many more without clogging the pool. Once most of the collectible pickups are collected there's usually plenty of room in the pool unless you are on a continuous gang war rampage and leaving lots of dropped pickups behind.

So if I understood correctly, in my case, that's about 400 car generators in main.scm, and after that I'd have to use CLEO scripts?

For pickups, 555+ pickups in main.scm, then I have to use CLEO scripts?

 

Doubt I'll need more than SCM allows, but it's good to know.

Edited by turbocharger
Link to comment
Share on other sites

18 minutes ago, turbocharger said:

In order to achieve this, I'd probably need to code something along the lines of:

- if actor player actor is in area x y z, radius __

- then (proceed with spawning the marker)

- else jump at (the beginning of the thread)

Yes, that's a good start, but you'll probably want to continue on to check if the player is close enough to that point to teleport. And eventually check for other locations as well. There's a running script limit of 96, so you'll probably want to group similar codes together.

Another limit to be aware of is the size of the main script area; 200,000 bytes. Everything in main.scm before the missions needs to fit in this limit; global variable space, object definitions, mission definitions, external scripts definitions, the MAIN script, and all the sniffer scripts that manage game flow and trigger external scripts and missions.

 

30 minutes ago, turbocharger said:

and after that I'd have to use CLEO scripts?

No, not really. You can do pretty much anything in main.scm that you can do in a cleo script, if you enable cleo opcodes. Cleo scripts wouldn't be necessary unless you were running out of room for running scripts. More efficient coding strategies would probably be a better solution. 

The limits for pickups and cargens are hard coded. Cleo scripts still need to work within these limits since this data is saved. Limit adjusters can increase the size of the pools, or you could use other strategies. For pickups, you could have a script remove and replace a large batch of pickups as the player moves between the cities or country areas. Removing cargens is possible but problematic. It would be easier to use a trigger radius script to spawn vehicles when CJ is near, similar to the teleport codes.

I doubt you'll run into any of these limits soon, but it's good to plan ahead. Check out how main.scm uses relatively small scripts in the main script area to trigger external scripts that do the heavy lifting, and work towards that example.

  • Like 1
Link to comment
Share on other sites

turbocharger

Got it. Thanks a lot, you've been very helpful, very detailed and informative replies.

 

One more thing, is it problematic for the game to load cars/pickups that are very far apart (but are below the max number of cars/pickups limit)? Say, I have 15 car generators in Los Santos docks area and 15 cars north of San Fierro (Bay area) which are pretty much diagonal opposites on the map. Does the game 'care' about the spatial distance between cars, or solely the number of cars? I'd like to avoid having to script trigger radii for cars/pickups, is why I'm asking.

Link to comment
Share on other sites

4 hours ago, turbocharger said:

Does the game 'care' about the spatial distance between cars, or solely the number of cars?

Yes, but maybe not the way you are thinking. Car generators aren't the same as the vehicles they create. They're just pawns that wait until the player is near before spawning an actual vehicle, and there's another limit to the number of active vehicles that can be present on the map. So if you put too many cargens in a small area they won't all be able to spawn at the same time, and this can impact the number of random traffic vehicles that can spawn. If you were to spawn vehicles with a script to simulate a cargen, then that script would be subject to the same limits. I forget what the active vehicle limit is, but it's fairly small; maybe around 50.

Pickups work in pretty much the same way; they are pawns that spawn an object when the player is near. The object limits are much higher; I've seen screenshots of 100 to 150 pickups in a small area. But overloading the object pool tends to cause crashes. I don't have much experience with this issue so I'm not really sure what to expect.

For now though, I'd suggest staying safely within the normal game limits. Worry about extending those limits with trigger scripts and other fancy tricks when you gain more experience with your teleport codes.

  • Like 1
Link to comment
Share on other sites

7 hours ago, turbocharger said:

Does the game 'care' about the spatial distance between cars

yes.. it does 'care'.. for example.. we all know that (in the original script "main.scm") sometimes FCR-900 or NRG500 doesn't spawn (in some cases only FCR900 spawns) when you completed all the tests with golden at bike school.. here is an original coordinates of these bikes..

 

014B: $PARKED_FREEWAY = init_car_generator #FREEWAY color -1 -1 force_spawn 1 alarm 0 door_lock 0 min_delay 0 max_delay 10000 at 1174.76 1364.832 10.1203 angle 280.0355 
014B: $PARKED_FCR900 = init_car_generator #FCR900 color -1 -1 force_spawn 1 alarm 0 door_lock 0 min_delay 0 max_delay 10000 at 1174.999 1366.479 10.1203 angle 282.2258 
014B: $PARKED_NRG500 = init_car_generator #NRG500 color -1 -1 force_spawn 1 alarm 0 door_lock 0 min_delay 0 max_delay 10000 at 1174.467 1368.359 10.1203 angle 283.0546

and this is the edited version of me...

014B: $PARKED_FREEWAY = init_car_generator #FREEWAY color -1 -1 force_spawn 1 alarm 0 door_lock 0 min_delay 0 max_delay 10000 at 1174.2 1365.0 11.0 angle 270.0 
014B: $PARKED_FCR900 = init_car_generator #FCR900 color -1 -1 force_spawn 1 alarm 0 door_lock 0 min_delay 0 max_delay 10000 at 1174.2 1369.0 11.0 angle 270.0 
014B: $PARKED_NRG500 = init_car_generator #NRG500 color -1 -1 force_spawn 1 alarm 0 door_lock 0 min_delay 0 max_delay 10000 at 1174.2 1373.0 11.0 angle 270.0 

when you looked at the Y coordinates you will see 2 units between each bikes and it seems they are not enough to spawn all three together.. at first i gave three units and tested it but it wasn't enough.. after that i gave at least four units in order to make them spawn healthy..

 

Oh one more important thing.. i highly suggest you to get in to your desired vehicle, press Ctrl+Shift+C onto the Sanny Builder's new page and get the proper coordinates.. using CJ's body will definitely give you wrong results but if you get in a vehicle the Sanny will take the center of the cars coordinates (i think you guys are calling it dummy or offset) 🙂

 

Edit: I found an example of center mass or center of ambulance.. (i'm sorry.. even though i have knowledge of AutoCAD drawing and modelling is a different leauge 😃)

 

spacer.png

 

Blue dot is the center point..I also have another suggestion.. if you have a wall near to your spot you should give more distance between this wall.. in some cases the vehicle may get too close to the wall or even get stuck..

Edited by ArmanCan
  • Like 2
Link to comment
Share on other sites

turbocharger
2 hours ago, OrionSR said:

They're just pawns that wait until the player is near before spawning an actual vehicle

This answered my question. I was worried that, in case they kept vehicles spawned at all times, it could potentially create performance issues.

This simplifies things. I think original game limits are just enough for me. Then there's also the limit adjuster, but it's also good to know how to bypass those limits shall the need arise.

 

@ArmanCan So, 4 units are the magical number. Good to know!

1 hour ago, ArmanCan said:

i highly suggest you to get in to your desired vehicle, press Ctrl+Shift+C onto the Sanny Builder's new page and get the proper coordinates.. using CJ's body will definitely give you wrong results but if you get in a vehicle the Sanny will take the center of the cars coordinates

Yes, I use this method. Even then, it isn't perfect sometimes but it's nothing a bit of calibration with trial and error can't fix.

 

1 hour ago, ArmanCan said:

(i'm sorry.. even though i have knowledge of AutoCAD drawing and modelling is a different leauge 😃)

AutoCAD is an amazing tool, I use it for my job, but 3D stuff is love. 😍 Soothes the mind and soul after work.

 

1 hour ago, ArmanCan said:

I also have another suggestion.. if you have a wall near to your spot you should give more distance between this wall.. in some cases the vehicle may get too close to the wall or even get stuck..

Yep, I experienced it myself. Learned my lesson, heh. 

 

Some great answers here, lots of experience in one place. I was delighted to partake in this conversation, thank you all for these useful tips and insights!

Link to comment
Share on other sites

52 minutes ago, turbocharger said:

@ArmanCan So, 4 units are the magical number. Good to know!

not always.. it was just an example of my issue.. you should test over and over again to get the best results 🙂

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.