Author Topic: scripting and model changing help  (Read 6327 times)

0 Members and 2 Guests are viewing this topic.

Offline Simon

  • Admin
  • Posts: 4906
  • aka Darkstar
    • View Profile
Re: scripting and model changing help
« Reply #15 on: November 28, 2011, 06:51:42 AM »
well it's a car chase around LV that ends with a stunt. So the handling would be way off and the stunt is impossible in VC. though I could mod it as this is just something I make for a school project. The problem would be that I am using ENB to make it looks slightly better in SA, I have some debth of field ,some reflections and also the water looks sexy as hell, so I'm not sure it would look as good as the shot I'm imagining at the moment :P

But it's always an option  :happy:

Offline Simon

  • Admin
  • Posts: 4906
  • aka Darkstar
    • View Profile
Re: scripting and model changing help
« Reply #16 on: November 28, 2011, 11:00:22 AM »
Kaneda I tried to find the first program but I couldn't find it. So I jumped over to number two, and the game just crashed, I might have misunderstood where to place the code though. Also the last one didn't work for some reason, I downloaded the latest version and tried, but each time I hit any hotkeys for the program the game crashed. I'll just have to lay flat at this point. I'll focus more on the scripting first as it is the most important part of the short movie I'm making.

I'm having trouble spawning a ped as well. I'm not sure, but as far as I remember in VC you just had to make sure you had loaded the model in the start of the script then you could spawn it. Is it more complicated in SA, I can't seem to find a tutorial that explains it well enough. And all the text tutorials I've read just leave me with nothing. I pasted their script in mine and my character just spawned and nothing happened. Not even my camera movement happened. Does anyone know?

Offline kaneda

  • Veteran Member
  • Posts: 2338
    • View Profile
    • @pump_upp - best crypto pumps on telegram !
Re: scripting and model changing help
« Reply #17 on: November 28, 2011, 12:10:06 PM »
http://www.gtaforums.com/index.php?showtopic=320333

This tut helped me immensely when coding in SA.

Post your script so we can have a looky.

Offline Simon

  • Admin
  • Posts: 4906
  • aka Darkstar
    • View Profile
Re: scripting and model changing help
« Reply #18 on: November 28, 2011, 01:14:15 PM »
I figured out how to spawn him, but now I'm looking for a way to make him smoking and how to do that, also how to go about making him take a cellphone. And perhaps make him stop looking around when just standing there, he keeps messing with some of the peds passing him which is annoying :P

Code: [Select]
DEFINE OBJECTS 3
DEFINE OBJECT SANNY BUILDER 3.03
DEFINE OBJECT NULL2 // Object number -1
DEFINE OBJECT DYN_ROADBARRIER_6 // Object number -2
DEFINE MISSIONS 0
DEFINE EXTERNAL_SCRIPTS 0 // Use -1 in order not to compile AAA script
DEFINE UNKNOWN_EMPTY_SEGMENT 0
DEFINE UNKNOWN_THREADS_MEMORY 0
{$VERSION 3.1.0027}
//-------------MAIN---------------
thread 'MAIN'
042C: set_total_missions_to 0
030D: set_max_progress 187
0997: set_total_respect_points_to 1339
01F0: set_max_wanted_level_to 0
set_wb_check_to 0
00C0: set_current_time_hours_to 11 minutes_to 30
fade 0 10
set_weather 1
select_interior 0
04E4: unknown_refresh_game_renderer_at 0.0 0.0
Camera.SetAtPos(0.0, 0.0, 800.0)
$PLAYER_CHAR = Player.Create(#NULL, -2040.0410, 914.7771, 53.9952)
07AF: $PLAYER_GROUP = player $PLAYER_CHAR group
$PLAYER_ACTOR = Actor.EmulateFromPlayer($PLAYER_CHAR)
Camera.SetBehindPlayer
Actor.Angle($PLAYER_ACTOR) = 90.0
wait 10
Player.SetClothes($PLAYER_CHAR, "SUIT1GREY", "SUIT1", Torso)
Player.SetClothes($PLAYER_CHAR, "JEANSDENIM", "JEANS", Legs)
Player.SetClothes($PLAYER_CHAR, "SNEAKERBINCBLK", "SNEAKER", Shoes)
Player.SetClothes($PLAYER_CHAR, "PLAYER_FACE", "HEAD", Head)
Player.SetClothes($PLAYER_CHAR, "CAPREDSIDE", "CAPSIDE", 16)
Player.Build($PLAYER_CHAR)
016C: restart_if_wasted_at 2027.77 -1420.52 15.99 angle 137.0 town_number 0
016D: restart_if_busted_at 1550.68 -1675.49 14.51 angle 90.0 town_number 0
Model.Load(#SOMYST)
038B: load_requested_models
009A: 1@ = create_actor_pedtype 16 model #SOMYST at -2048.4907 903.9978 53.8442
Actor.Angle(1@) = 355.6732
06B0: AS_actor 
wait 500
fade 1 1000
wait 1000
0460: set_camera_transverse_delay 0.0 time 5000
015F: set_camera_position -2047.1702 915.1419 101.3809 rotation 0.0 0.0 0.0
0160: set_camera_point_at -2037.9211 708.5321 101.8473 mode 1
wait 10000
015F: set_camera_position -2047.0410 914.7771 53.9952 rotation 0.0 0.0 0.0
0160: set_camera_point_at -2050.4253 708.5321 53.9952 mode 1
wait 30000
end_thread
« Last Edit: November 28, 2011, 01:21:15 PM by Simon »

Offline kaneda

  • Veteran Member
  • Posts: 2338
    • View Profile
    • @pump_upp - best crypto pumps on telegram !
Re: scripting and model changing help
« Reply #19 on: November 28, 2011, 01:19:59 PM »
Use that tutorial I posted a link to. You'll go through a lot of trial and error, but that's just the nature of learning to code. It's a coherent tutorial and teaches a lot about different elements (particularly those you mentioned). If you were talking about VC coding, I'd feel much more confident giving you the info you need, but my SA coding was only really in it's infancy and there was still tonnes I didn't know.

San An Studios should (repeat: SHOULD) have come with a file called SAAnim.txt (or something like that) which lists the animations that you can use. Having a character smoking though is not only a matter of executing the animation - you also have to attach the cigarette to the actor's hand, which can be tricky.
« Last Edit: November 28, 2011, 01:22:57 PM by kaneda »

Offline Simon

  • Admin
  • Posts: 4906
  • aka Darkstar
    • View Profile
Re: scripting and model changing help
« Reply #20 on: November 28, 2011, 01:24:00 PM »
I'm also wanting to have a close up of his face, would it be best to just attach a camera to him and offset it a little (dunno if it's a code that let's me do that, and if it is how would i go about doing it) or should I just try to find the best coordinates where the camera is as close as possible?


I'll look at the tutorial, just posting in case. It's always better to get a straight answer than looking through a massive tutorial. But I'll read up on it, but if you have small inputs or ideas just post them up :)

Offline kaneda

  • Veteran Member
  • Posts: 2338
    • View Profile
    • @pump_upp - best crypto pumps on telegram !
Re: scripting and model changing help
« Reply #21 on: November 28, 2011, 02:06:31 PM »
You can use an offset co-ord (the code reads something like create_offset_coord_from_actor, I can't recall off the top of my head, but it's along those lines) using the second coord reference to put the coord in front of the actor (the three coords read 0.0 0.0 0.0 - the first being left and right of the character, the second being in front and behind and third being above and below - using positive and negative coords), and you can use the integer values as your coords in the set_cam_position line (so basically if you set the three coords in your offset as 40 44 and 48, you'd use those integers as coords in your cam position). The problem with this is that you'll also need an accompanying offset coord for pointing the camera. If you use the point_at_actor opcode, it'll point at the torso of the actor, not the head.

Code: [Select]
04C4: create_coordinate  40??  44??  48?? from_actor  3416?? offset  0!  1.0!  0!
015F: set_camera_position  40??  44??!  48??!  0!  0!  0!

(The above is using VC opcodes, but you can see what I mean. You just need to dial in on the SA equivalents. I don't have an SA opcode list at hand right now. That offest creates a coord 1 point in front of the actor.)

Your best option (if you're not moving the camera too drastically while on the actor) is to use SA Camhack. You can use FOV to really get the cam in close to the model without the cam moving through the model.

Offline Simon

  • Admin
  • Posts: 4906
  • aka Darkstar
    • View Profile
Re: scripting and model changing help
« Reply #22 on: November 28, 2011, 02:15:36 PM »
Thanks man, I'll give both of them a shot, and check out which one works best. Thanks again for being so helpful :)

Offline Simon

  • Admin
  • Posts: 4906
  • aka Darkstar
    • View Profile
Re: scripting and model changing help
« Reply #23 on: November 29, 2011, 04:44:52 AM »
Ok, so I got this new scene now, where I want the cars to drive from one spot to another, and what I thought was that they would follow the road, and they kind of do but I'm having a problem because the first "car", which is a motorcycle, turns to early in a turn and just crashes and gives up trying to go to the point.


like this, I want him to turn just a little later and drive to the front of that casino.

   
Here's the code...
Code: [Select]
DEFINE OBJECTS 3
DEFINE OBJECT SANNY BUILDER 3.03
DEFINE OBJECT NULL2 // Object number -1
DEFINE OBJECT DYN_ROADBARRIER_6 // Object number -2
DEFINE MISSIONS 0
DEFINE EXTERNAL_SCRIPTS 0 // Use -1 in order not to compile AAA script
DEFINE UNKNOWN_EMPTY_SEGMENT 0
DEFINE UNKNOWN_THREADS_MEMORY 0
{$VERSION 3.1.0027}
//-------------MAIN---------------
thread 'MAIN'
042C: set_total_missions_to 0
030D: set_max_progress 187
0997: set_total_respect_points_to 1339
01F0: set_max_wanted_level_to 0
set_wb_check_to 0
00C0: set_current_time_hours_to 11 minutes_to 30
fade 0 10
set_weather 1
select_interior 0
04E4: unknown_refresh_game_renderer_at 0.0 0.0
Camera.SetAtPos(0.0, 0.0, 800.0)
$PLAYER_CHAR = Player.Create(#NULL, 2004.9397, 2263.0530, 20.6077)
07AF: $PLAYER_GROUP = player $PLAYER_CHAR group
$PLAYER_ACTOR = Actor.EmulateFromPlayer($PLAYER_CHAR)
Camera.SetBehindPlayer
Actor.Angle($PLAYER_ACTOR) = 90.0
wait 10
Player.SetClothes($PLAYER_CHAR, "SUIT1GREY", "SUIT1", Torso)
Player.SetClothes($PLAYER_CHAR, "JEANSDENIM", "JEANS", Legs)
Player.SetClothes($PLAYER_CHAR, "SNEAKERBINCBLK", "SNEAKER", Shoes)
Player.SetClothes($PLAYER_CHAR, "PLAYER_FACE", "HEAD", Head)
Player.SetClothes($PLAYER_CHAR, "CAPREDSIDE", "CAPSIDE", 16)
Player.Build($PLAYER_CHAR)
016C: restart_if_wasted_at 2027.77 -1420.52 15.99 angle 137.0 town_number 0
016D: restart_if_busted_at 1550.68 -1675.49 14.51 angle 90.0 town_number 0
  //Cars
Model.Load(#PCJ600)
038B: load_requested_models
00A5: 10@ = create_car #PCJ600 at 2161.6794 2285.7964 10.6719
Model.Load(#STRETCH)
038B: load_requested_models
00A5: 15@ = create_car #STRETCH at 2158.6794 2275.7964 10.6719
Model.Load(#CHEETAH)
038B: load_requested_models
00A5: 20@ = create_car #CHEETAH at 2155.6794 2265.7964 10.6719
Model.Load(#INFERNUS)
038B: load_requested_models
00A5: 25@ = create_car #INFERNUS at 2004.9397 2263.0530 24.6077
  //Characters
Model.Load(#SOMYST)
038B: load_requested_models
009A: 1@ = create_actor_pedtype 16 model #SOMYST at 2023.0249 2270.8730 28.8623
Model.Load(#BMYBOUN)
038B: load_requested_models
0129: 2@ = create_actor_pedtype 2 model #BMYBOUN in_car 10@ driverseat
Model.Load(#WMYBOUN)
038B: load_requested_models
0129: 3@ = create_actor_pedtype 3 model #WMYBOUN in_car 20@ driverseat
Model.Load(#WMOMIB)
038B: load_requested_models
0129: 4@ = create_actor_pedtype 4 model #WMOMIB in_car 15@ driverseat
Model.Load(#BMYMIB)
038B: load_requested_models
01C8: 5@ = create_actor_pedtype 5 model #BMYMIB in_car 15@ passenger_seat 0
023C: load_special_actor 'CLAUDE' as 10 // models 290-299
038B: load_requested_models
01C8: 6@ = create_actor_pedtype 5 model #SPECIAL10 in_car 15@ passenger_seat 1                 
   wait 500
fade 1 1000
wait 1000
067A: put_camera_on_car 15@ with_offset 13.0 13.0 13.0 point_to_car 15@ tilt 0.0 1
wait 8000
07F8: car 15@ follow_car 10@ radius 10.0
07F8: car 20@ follow_car 15@ radius 10.0 
02C2: car 10@ drive_to 2132.0757 2353.3091 10.6719   
wait 1000
 end_thread




E: I kind of figured it out, well not really, but I found a way to bypass it.
 I used this opcode
Code: [Select]
05D1: AS_actor 2@ drive_car 10@ to  2205.0559 2341.4648 10.6719 speed  5.0  2  0  5 and the first number after the speed means how he drives. 1 = follow paths, 2 = ignore paths. So I just gave him two points to drive to instead of one so that he would drive to the turn first, then drive to the other point.

this is the script I have as of now

Code: [Select]
DEFINE OBJECTS 3
DEFINE OBJECT SANNY BUILDER 3.03
DEFINE OBJECT NULL2 // Object number -1
DEFINE OBJECT DYN_ROADBARRIER_6 // Object number -2
DEFINE MISSIONS 0
DEFINE EXTERNAL_SCRIPTS 0 // Use -1 in order not to compile AAA script
DEFINE UNKNOWN_EMPTY_SEGMENT 0
DEFINE UNKNOWN_THREADS_MEMORY 0
{$VERSION 3.1.0027}
//-------------MAIN---------------
thread 'MAIN'
042C: set_total_missions_to 0
030D: set_max_progress 187
0997: set_total_respect_points_to 1339
01F0: set_max_wanted_level_to 0
set_wb_check_to 0
00C0: set_current_time_hours_to 11 minutes_to 30
fade 0 10
set_weather 1
select_interior 0
04E4: unknown_refresh_game_renderer_at 0.0 0.0
Camera.SetAtPos(0.0, 0.0, 800.0)
$PLAYER_CHAR = Player.Create(#NULL, 2004.9397, 2263.0530, 20.6077)
07AF: $PLAYER_GROUP = player $PLAYER_CHAR group
$PLAYER_ACTOR = Actor.EmulateFromPlayer($PLAYER_CHAR)
Camera.SetBehindPlayer
Actor.Angle($PLAYER_ACTOR) = 90.0
wait 10
Player.SetClothes($PLAYER_CHAR, "SUIT1GREY", "SUIT1", Torso)
Player.SetClothes($PLAYER_CHAR, "JEANSDENIM", "JEANS", Legs)
Player.SetClothes($PLAYER_CHAR, "SNEAKERBINCBLK", "SNEAKER", Shoes)
Player.SetClothes($PLAYER_CHAR, "PLAYER_FACE", "HEAD", Head)
Player.SetClothes($PLAYER_CHAR, "CAPREDSIDE", "CAPSIDE", 16)
Player.Build($PLAYER_CHAR)
016C: restart_if_wasted_at 2027.77 -1420.52 15.99 angle 137.0 town_number 0
016D: restart_if_busted_at 1550.68 -1675.49 14.51 angle 90.0 town_number 0
  //Cars
Model.Load(#PCJ600)
038B: load_requested_models
00A5: 10@ = create_car #PCJ600 at 2161.6794 2285.7964 10.6719
Model.Load(#STRETCH)
038B: load_requested_models
00A5: 15@ = create_car #STRETCH at 2158.6794 2275.7964 10.6719
Model.Load(#ELEGY)
038B: load_requested_models
00A5: 20@ = create_car #ELEGY at 2155.6794 2265.7964 10.6719
Model.Load(#INFERNUS)
038B: load_requested_models
00A5: 25@ = create_car #INFERNUS at 2004.9397 2263.0530 24.6077
  //Characters
Model.Load(#SOMYST)
038B: load_requested_models
009A: 1@ = create_actor_pedtype 16 model #SOMYST at 2023.0249 2270.8730 28.8623
Model.Load(#BMYBOUN)
038B: load_requested_models
0129: 2@ = create_actor_pedtype 2 model #BMYBOUN in_car 10@ driverseat
Model.Load(#WMYBOUN)
038B: load_requested_models
0129: 3@ = create_actor_pedtype 3 model #WMYBOUN in_car 20@ driverseat
Model.Load(#WMOMIB)
038B: load_requested_models
0129: 4@ = create_actor_pedtype 4 model #WMOMIB in_car 15@ driverseat
Model.Load(#BMYMIB)
038B: load_requested_models
01C8: 5@ = create_actor_pedtype 5 model #BMYMIB in_car 15@ passenger_seat 0
023C: load_special_actor 'CLAUDE' as 10 // models 290-299
038B: load_requested_models
01C8: 6@ = create_actor_pedtype 5 model #SPECIAL10 in_car 15@ passenger_seat 1                 
   wait 500
fade 1 1000
wait 1000
067A: put_camera_on_car 15@ with_offset -5.0 10.0 5.0 point_to_car 15@ tilt 0.0 2
wait 8000
07F8: car 15@ follow_car 10@ radius 8.0
07F8: car 20@ follow_car 15@ radius 10.0 
05D1: AS_actor 2@ drive_car 10@ to  2205.0559 2341.4648 10.6719 speed  5.0  2  0  5
wait 19000
067E: put_camera_on_actor 6@ with_offset -1.0 1.0 1.0 point_to_actor 6@ 0.0 mode 2
05D1: AS_actor 2@ drive_car 10@ to  2132.0757 2353.3091 10.6719 speed  5.0  2  0  5
wait 1000
 end_thread

I'll post some more if I find new challenges and if I figure them out I guess I can help people which also come by the problem if they check this topic in some distant future :P


E2: Why can't I find an opcode that goes like "As_ actor x@ goto actor y@" is there really no such code? I am dissapointed :(

this is turning in to a blog :3
« Last Edit: November 29, 2011, 09:51:40 AM by Simon »

Offline kaneda

  • Veteran Member
  • Posts: 2338
    • View Profile
    • @pump_upp - best crypto pumps on telegram !
Re: scripting and model changing help
« Reply #24 on: November 29, 2011, 12:09:10 PM »
Getting cars to do what you want them to is always annoying. Notice that in the game, whenever a car is driving in a cut scene it's always brief. There's typically more than one way to make a car move, so I guess you can try them until you find one that works.

Another invaluable tool is the game's default script. If you can think of an example that has a scene similar to the one you're doing - mine the default script and see how they did it.

There should be an opcode for actor A to follow actor B. If actor A and B have some distance between them, then actor B will go to where actor A is, which is essentially the same thing.

Offline VaNilla

  • next week m9
  • Veteran Member
  • Posts: 3809
    • View Profile
    • YouTube
Re: scripting and model changing help
« Reply #25 on: November 29, 2011, 02:41:01 PM »
by memory that was really REALLY buggy? or am I thinking of the one gunner did

It was bug free, not sure if Gunner made one :P

Offline Simon

  • Admin
  • Posts: 4906
  • aka Darkstar
    • View Profile
Re: scripting and model changing help
« Reply #26 on: December 06, 2011, 06:30:27 AM »
Hi it's me again, I've come to a part in the movie where I need a helicopter to chase another helicopter (in this case a hunter is chasing a maverik) is there any possible way of making the hunter shoot at the maverik as it has machineguns? or would I have to do that in another way? I'm guessing a whole helicopter chase would be better to do just me and someone else on SAMP, but if it's easier or even possible in scripting I'd like to give it a go.

Dunno if anyone knows, but I'm just putting the question out there so if someone knows, give me a heads up.

Offline kaneda

  • Veteran Member
  • Posts: 2338
    • View Profile
    • @pump_upp - best crypto pumps on telegram !
Re: scripting and model changing help
« Reply #27 on: December 06, 2011, 12:20:53 PM »
Helicopters are tricky. You can spawn the two choppers and try this:

Code: [Select]
032C: car  28640?? ram  28644??
I've never used it, so I don't know if 28644?? refers to an actor or another vehicle. Looking through the game's default scm might shed some light on that. You would have to have your target chopper moving though, so you could give it a destination to fly to, or you could just fly that one yourself.

Code: [Select]
0464: put_actor  9940?? into_turret_on_car  9872?? at_car_offset  .4242! -.0679!  1.1322! unknown  3? angle  270! with_weapon  27?
You could use that to have the attacking chopper at least appear to be shooting. You may have to tinker with the offset to position your actor so that it doesn't look too stupid though. I don't know if this works with choppers, but it does with just about every other vehicle.

Another option might be to just get a six star wanted level and let a police heli chase you. Set your chopper's immunities so that it never takes damage and you can try to finagle some convincing shots.

Offline Simon

  • Admin
  • Posts: 4906
  • aka Darkstar
    • View Profile
Re: scripting and model changing help
« Reply #28 on: December 08, 2011, 02:30:44 AM »
Thanks for the answer Kaneda!  :D
I haven't actually gotten that far in to the scene yet, but on my search for heli/flying opcodes I stumbled across these

Code: [Select]
0841: flying_vehicle 114@ use_secondary_gun 1
Code: [Select]
084E: flying_vehicle 149@ use_primary_gun 1
Which I'm guessing is what I was looking for. Though the part where you said helicopters were tricky... I get you. because I can't seem to make the motor stop. So everytime they spawn they just fly off somewhere. I'm spawning them on a roof though, do you think that is the thing causing it? I've tried to use

Code: [Select]
096A: enable_flying_helis 0
but it didn't do anything. tried both 0 and 1 btw. Not sure if there are more possible numbers, but I'm guessing not. I guess I'll try spawning them on the ground, to see if I get another result. I'll tell you how it goes, but if you drop time in between this and that. Be sure to leave any advice you have!

Offline kaneda

  • Veteran Member
  • Posts: 2338
    • View Profile
    • @pump_upp - best crypto pumps on telegram !
Re: scripting and model changing help
« Reply #29 on: December 08, 2011, 02:55:43 AM »
Well my experience with helis is limited at best. When I did helis for TG3, I spawned three of them on the Callahan bridge and told them to fly 20 points above their spawn points (co-ords X Y 10.0 to X Y 30.0, for example). I don't know that I even put pilots into the seats for those. The big problem comes when you want a heli to stop at designated point and hover - they always seem to waver all over the place.

I never thought of those two opcodes for the heli guns - good call. It doesn't seem that they'll be firing at a designated target, but I guess if the shooting heli is pointing in the general direction of the target, that's all ya need.

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal