Jump to content

Help


Wonderinguy

Recommended Posts

Wonderinguy

Can you tell whats wrong with this script, whenever I start the new game it crashes:

 

 

create_thread @TEST

 

 

 

:TEST0001: wait 00247: request_model #WFYSEX038b: load_requested_models00d6: if and0248: model #WFYSEX available004d: jump_if_false @TEST009a: $actor00 = create_actor 22 #WFYSEX at 2497.671 -1631.852 13.410510172: $actorangle = actor $actor00 z_angle0173: set_actor $actor00 z_angle_to 0

 

 

I wanted to finish it but when I started it like this it crashed.

Link to comment
Share on other sites

 

I wanted to finish it but when I started it like this it crashed.

 

Which IS actually because you didn't finish it, basically. Your thread has no end, therefore when the code hits the last opcode it continues down to the following code, and crashes there. There should always some kind of ending in threads, be it an end_thread or jump opcode (of course only the former is true 'ending').

 

There are other problems in your code, though not something that will crash the game:

-Don't put request_model in a loop; you only need to do it once. Looping opcodes which are meant to be used only once frequently has bad results/symptoms and even if it is apparently harmless (such as looping request_model), it is bad practice.

 

-038B: load_requested_models is useless in SA; 0247 already loads the model. Many people still use this (even R* did) but this has no effect in SA, so exclude it from your code to save space and time.

 

-Don't use global variables all the time; use local vars. Only use global vars when you actually require them, such as needing to access that var from a different thread; otherwise, use locals.

 

-Lastly, I can't know since I've no idea what you're trying to accomplish and you said that this is unfinished code, but do you need that 0172 there?

Link to comment
Share on other sites

Wonderinguy

So the code should be something like this:

 

:TEST0001: wait 000d6: if and0248: model #WFYSEX available004d: jump_if_false @TEST009a: $actor00 = create_actor 22 #WFYSEX at 2497.671 -1631.852 13.410510173: set_actor $actor00 z_angle_to 0end_thread

 

 

 

Link to comment
Share on other sites

No, it shouldn't. If you don't use request_model at all you won't ever make the actor spawn, you see?

 

Instead:

 

:TEST0247: request_model #WFYSEX:TEST_CHECK0001: wait 000d6: if and0248: model #WFYSEX available004d: jump_if_false @TEST_CHECK009a: $actor00 = create_actor 22 #WFYSEX at 2497.671 -1631.852 13.41051//0172 ist totally unnecessary at this point (as far as I could deduce) because you're overriding it with the very next opcode0173: set_actor $actor00 z_angle_to 0//Release the model, now that the actor has been spawned:0249: release_model #WFYSEX//..... whatever you want to do with the actor can be put here, preferably within a new label//at the end we need an opcode to tell the game that it shouldn't read further, end_thread for a one-time thread or jump @TEST_whatever if it's to be executed/checked in a loop

 

 

Link to comment
Share on other sites

My understanding was that if you don't specify an angle, actors are spawned to z_angle 0 anyways, no?

 

@SteaVor: I think he just meant that section. Still, you get bonus points for including the release model.

 

Before "ending" the thread, you should also remove references to the actor.

Link to comment
Share on other sites

 

My understanding was that if you don't specify an angle, actors are spawned to z_angle 0 anyways, no?

Of course! happy.gif

 

@SteaVor: I think he just meant that section.

I would've seen it the same way if he hadn't begun with :TEST in his reply.

Link to comment
Share on other sites

  • 1 month later...
Wonderinguy

I was just testing this for the mission I just scripted, its a very short mission.

But I didn't get a chance to test it cause whenever I script something (like starting

clothes) ZoneAlarm program shuts down the game automaticaly and leaving a notice that gta_sa.exe behave suspiciously. Now I am reinstalling the SA and I will tell you will my mission work.

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.