Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. Red Dead Redemption 2

      1. Gameplay
      2. Missions
      3. Help & Support
    2. Red Dead Online

      1. Gameplay
      2. Find Lobbies & Outlaws
      3. Help & Support
    1. Crews & Posses

      1. Recruitment
    2. Events

    1. GTA Online

      1. Arena War
      2. After Hours
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Grand Theft Auto Series

    3. GTA Next

    4. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    5. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA Mods
    6. GTA Chinatown Wars

    7. GTA Vice City Stories

    8. GTA Liberty City Stories

    9. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    10. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    11. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    12. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    13. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    3. Featured Mods

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption

    2. Rockstar Games

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Programming
      5. Movies & TV
      6. Music
      7. Sports
      8. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. News

    2. Forum Support

    3. Site Suggestions

Ransom1

Some code help

Recommended Posts

Ransom1

Hi I'm back for help I know some of yas remember me. Well coding has slipped my mind quite well but I'm working on getting a banner made for GTA.

 

Well I wanna get a pic of cops behind cop cars shooting at badguys, i've just tried to get the actors up first, however they won't quit dropping over and over again. Theres one that should be by a sign thats under a billboard, but he keeps falling above the billboard towards that spot. The one on the street drops a foot or two off the ground to his street spot. However, after a moment they both just go back to where they started falling (the guy by the sign never reaches the ground, poor fella). I'm wondering why the guy by the sign is being created up there if I am defining the height at which they are created.

 

Most of coding is outta my mind I'm fresh again so I need some help.

 

 

:labelcops0001: wait 250 ms0247: request_model #COP00D6: if 00248: is_model_available #COP004D: jump_if_false ££labelcops009A: $copper1 = create_actor  4 #COP at -841.74 -662.87  33.0009A: $robber1 = create_actor  4 #COP at -831.68 -649.18  10.94  :LabelCOORDCHECK0001: wait 350 ms00D6: if  100ED:   actor $copper1  0 ()near_point_on_foot -841.74 -662.87 radius  1.0  1.000ED:   actor $robber1  0 ()near_point_on_foot -831.68 -649.18 radius  1.0  1.0004D: jump_if_false ££Recoordinate0002: jump ££LabelCOORDCHECK :Recoordinate0001: wait 350 ms00A1: put_actor $copper1 at  -841.74 -662.87  33.000A1: put_actor $robber1 at  -831.68 -649.18  10.940223: set_actor $copper1 health_to  1000223: set_actor $robber1 health_to  1000002: jump ££LabelCOORDCHECK

 

 

 

Share this post


Link to post
Share on other sites
Ransom1

Trying an ending thread just makes them stand on the curb together, away from their spots. I have no idea why.

 

 

:labelcops0001: wait 250 ms0247: request_model #COP00D6: if 00248: is_model_available #COP004D: jump_if_false ££labelcops009A: $copper1 = create_actor  4 #COP at -841.74 -662.87  33.0009A: $robber1 = create_actor  4 #COP at -831.68 -649.18  10.94  0001: wait 350 ms00A1: put_actor $copper1 at  -841.74 -662.87  33.000A1: put_actor $robber1 at  -831.68 -649.18  10.940223: set_actor $copper1 health_to  1000223: set_actor $robber1 health_to  100004E: end_thread

 

Share this post


Link to post
Share on other sites
jacob.

Alright, you've got a few problems.. such as continuing to request the model even after its already been requested, and most important of all, having the opposite effect you desire in your conditional jump. Try this:

 

 

:labelrequest0247: request_model #COP:labelcops0001: wait 250 ms00D6: if 00248: is_model_available #COP004D: jump_if_false ££labelcops009A: $copper1 = create_actor  4 #COP at -841.74 -662.87  33.0009A: $robber1 = create_actor  4 #COP at -831.68 -649.18  10.94  :LabelCOORDCHECK0001: wait 350 ms00D6: if  100ED:   actor $copper1  0 ()near_point_on_foot -841.74 -662.87 radius  1.0  1.000ED:   actor $robber1  0 ()near_point_on_foot -831.68 -649.18 radius  1.0  1.0004D: jump_if_false ££LabelCOORDCHECK:Recoordinate0001: wait 350 ms00A1: put_actor $copper1 at  -841.74 -662.87  33.000A1: put_actor $robber1 at  -831.68 -649.18  10.940223: set_actor $copper1 health_to  1000223: set_actor $robber1 health_to  1000002: jump ££LabelCOORDCHECK

 

Share this post


Link to post
Share on other sites
Ransom1

Hmm now theres a stiff on the road (in the right place) and I saw the other guy starting above the billboard to fall yet again. They both died in correct places. One on streets stayed there dead, below the billboard guy disappeared after lying dead in the right spot for 2 seconds. They are somehow falling to their deaths? Through the underworld?

 

[sM]Boss was helping me then he went to sleep.. I really need to recap on this coding stuff more.. thx for post anyways.

Edited by Ransom1

Share this post


Link to post
Share on other sites
jacob.

Hmm.. now that I look at the code, it's still majorly flawed. It's running itself in an infinite loop.

 

I'll use one actor in this explanation.

 

It puts COP1 at -841.74 -662.87 33.0.

It then checks if COP1 is "near" -841.74 -662.87 33.0.

If so, it puts COP1 at -841.74 -662.87 33.0.

 

See the problem? He's just gonna get teleported to -841.74 -662.87 33.0 over and over and over and over again..

Share this post


Link to post
Share on other sites
Ransom1

I see.. well going back to end thread, the guys are just hugging on the curve again. This is very complicated... this was my 2nd end thread code attempt.

 

I can only think that its 009A: creating actors that is messing up and needs to be changed somehow.

 

Unless I must make some sort of endless loop for some odd reason.

 

 

:labelrequest0247: request_model #COP :labelcops0001: wait 250 ms00D6: if 00248: is_model_available #COP004D: jump_if_false ££labelcops009A: $copper1 = create_actor  4 #COP at -841.74 -662.87  33.0009A: $robber1 = create_actor  4 #COP at -831.68 -649.18  10.940223: set_actor $copper1 health_to  1000223: set_actor $robber1 health_to  100  :recoordinate0001: wait 800 ms00A1: put_actor $copper1 at  -841.74 -662.87  33.000A1: put_actor $robber1 at  -831.68 -649.18  10.940223: set_actor $copper1 health_to  1000223: set_actor $robber1 health_to  10000D6: if  100ED:   actor $copper1  0 ()near_point_on_foot -841.74 -662.87 radius  3.0  3.000ED:   actor $robber1  0 ()near_point_on_foot -831.68 -649.18 radius  3.0  3.0004D: jump_if_false ££recoordinate004E: end_thread

 

Edited by Ransom1

Share this post


Link to post
Share on other sites
random_download

You could try this instead of constantly putting them in one place, not sure if it will work though:

 

:labelrequest0247: request_model #COP:labelcops0001: wait 250 ms00D6: if 00248: is_model_available #COP004D: jump_if_false ££labelcops009A: $copper1 = create_actor  4 #COP at -841.74 -662.87  33.0009A: $robber1 = create_actor  4 #COP at -831.68 -649.18  10.940223: set_actor $copper1 health_to  1000223: set_actor $robber1 health_to  10004D7: lock_actor $copper1 in_current_position  104D7: lock_actor $robber1 in_current_position  1004E: end_thread

 

If the actors are spawning higher than where you want them, just lower the Z coord a little.

Share this post


Link to post
Share on other sites
mbell

random_download's code looks like it should work fine.

 

One thing that I found that helped me out was the police roadblock opcode:

 

04C0: create police roadblock at  -394.586639 1738.558350 41.883945 -388.895538 1749.3000659 43.336990 0 

 

It accomplishes your goal of putting cops behind cop cars very nicely. The only trick will be to get them to fire at the badguys. I seem to recall reading something about threat levels somewhere; maybe you can make the robbers a threat to the cops somehow.

 

One other thing...the roadblock will spawn such that it is facing the direction you approach from, no matter which order you define the coordinates.

Share this post


Link to post
Share on other sites
Ransom1

Thanks all especially Random that worked.. but now I can't get this fella to hold a weapon. Could it be because of frozen position?

 

 

:labelrequest0001: wait 250 ms00D6: if 00248: is_model_available #COP004D: jump_if_false ££labelrequest0247: request_model #COP009A: $copper1 = create_actor  4 #COP at -841.74 -662.87  10.2009A: $robber1 = create_actor  4 #COP at -831.68 -649.18  9.9; Robber10223: set_actor $copper1 health_to  1000223: set_actor $robber1 health_to  100020E: actor $copper1 look_at_actor $robber1      020E: actor $robber1 look_at_actor $copper104D7: lock_actor $copper1 in_current_position  104D7: lock_actor $robber1 in_current_position  1 0002: jump ££labelnowkill 004E: end_thread :labelnowkill0001: wait 250 ms 00D6: if 00248: is_model_available #chromegun004D: jump_if_false ££labelnowkill0247: request_model #chromegun01B2: give_actor $copper1 weapon  19 ammo  9999;; Load the weapon model before using this01B9: set_actor $copper1 armed_weapon_to  19004E: end_thread   

 

Share this post


Link to post
Share on other sites
spaceeinstein

Are you suppose to request the model before checking if that model is available?

 

And this is pointless

0002: jump ££labelnowkill

004E: end_thread

It'll never end the thread because it jumps to the next thread.

 

 

 

Share this post


Link to post
Share on other sites
Ransom1

You're absolutely correct space smile.gif hes holding it. Now to try some things out. This is a good crash course on models. I left that end thread there on accident, I was trying lotsa stuff before.

 

p.s. I noticed my old work in your all-in-one mod, I should note that the coordinates modification is from that SPEEDO mod, I just made it activate/deactivate with sphere:

 

Co-ordinates-Speedo Mod - Spin & LaZaznboi

Edited by Ransom1

Share this post


Link to post
Share on other sites
Ransom1

Now the problem is any weapon they use, they will run after shooting and shoot again, I suppose I can deal with that if its not fixable, but I really wanted a shotgun held. However, that knocks down the dummy and he doesnt get back up to be shot again (the cop just runs in place forever). I don't know why or how to fix this? Can somebody point me in the right direction? I am willing to edit other files to get rid of the shotgun knockdown.

 

My effort to work around it by recreating the shot down actor (to get endless shooting) have failed. This was the code, including the last label for the recreation attempt. It failed beacuse after the dummy shot down, nothing happened different.

 

--- p.s. labelplayernear is because i was informed on the IRC that you have to be close because the ground isn't loaded and actors fall. Therefore I dont need to lock the dummy, but I do still need to lock the cop as he attempts to run torwards the dummy when he falls on the ground.

 

 

:labelplayernear  0001: wait 250 ms00D6: if 00057:   player $PLAYER_CHAR  0 ()in_cube -819.72 -633.41  10.0 -869.99 -686.11  13.0004D: jump_if_false ££labelplayernear0247: request_model #COP :labelcops0001: wait 250 ms00D6: if 00248: is_model_available #COP004D: jump_if_false ££labelcops009A: $copper1 = create_actor  4 #COP at -841.74 -662.87  10.2009A: $robber1 = create_actor  4 #COP at -831.68 -649.18  9.90223: set_actor $copper1 health_to  1000223: set_actor $robber1 health_to  90000 020E: actor $copper1 look_at_actor $robber1      020E: actor $robber1 look_at_actor $copper10350: unknown_actor $robber1 not_scared_flag  104D7: lock_actor $copper1 in_current_position  104D7: lock_actor $robber1 in_current_position  10247: request_model #COLT45:labelnowkill0001: wait 50 ms 00D6: if 00248: is_model_available #COLT45004D: jump_if_false ££labelnowkill01B2: give_actor $copper1 weapon 17 ammo 9999;; Load the weapon model before using this01B9: set_actor $copper1 armed_weapon_to 1701CB: actor $copper1 kill_actor $robber1   :labelfight 0001: wait 50 ms 00D6: if 0031D:   actor $749 hit_by_weapon  17004D: jump_if_false ££labelfight               01C2: remove_references_to_actor $robber1009A: $robber1 = create_actor  4 #COP at -831.68 -649.18  9.901CB: actor $copper1 kill_actor $robber1 0002: jump ££labelfight

 

Edited by Ransom1

Share this post


Link to post
Share on other sites
Ransom1

so em... I guess noone has a suggestion for me

Share this post


Link to post
Share on other sites
Demarest

Sorry. I would've posted sooner but had a lot going on. I've been dealing with peds more lately and wow, there's so many thing you can assign to them. I don't think anybody truly understands the limitations and behaviors very well confused.gif

 

I'm pretty sure that the shotgun knockdown is unavoidable. Why not use a different weapon? Have you tried telling the robber to run away from the copper? I can pretty much guarantee that the game's max health and/or armor for anybody tops off at 32,767 (if that). MAYBE the overinflated health might even have something to do with it? Not sure now that the Builder auto-steers vartypes. Last guess I have is that you're checking to see if actor $749 has been hit by weapon. I don't know who that's supposed to be, but it isn't the robber. If it's somebody you created, you shouldn't be giving him a DMA. Use local vars or if you insist on globals, use a custom name. Also, you're if actor hit by weapon, remove reference to him makes no sense. I can't say for sure, but I would think that the copper would stop shooting at him altogether. I DO know that that code is never getting run due to the $749 thing.

 

General coding advice: Use if player defined before checking to see where he is. Request both models at the same time and check for them at the same time. Use local variables when able. Oh, and when checking for if model available, go ahead and use wait 0. No need to go higher.

Share this post


Link to post
Share on other sites
Ransom1

Ah Demarest my old hero I was wondering if you were gonna avoid me this time smile.gif

 

Wow my extremely simple mistake.. I dont know how I missed it.. but thank you for pointing out this silly mistake (its usually something dumb like that ruining my code). I guess after 6+ hours just for this I got very antsy and annoyed.

 

Thanks for all the input, but I have the desired effect. I couldn't get the ped to go invincible, as one said it may be because of the actor kill actor opcode.

 

Now the ped is just regenerating which is making the cop shoot infinite times (with a cycle of running in place but oh well).

 

I may not be through yet but I think so. Thank you people. After this I'm gonna see how my buddy is doing for getting this desired effect in GTA3 (which is harder he tells me).

 

So again in the end I made a work-around, not the best but I shouldn't waste time with code I will trash after a screenshow smile.gif.

Edited by Ransom1

Share this post


Link to post
Share on other sites
Demarest

Maybe if actor robber hit, clear copper objective or set behavior to stand still? Then of course once the new guy spawned, he'd continue shooting. Just a thought.

 

Tell your buddy to post or something. Most of my ped experience is in GTA3 and it is most definitely constricting. Maybe we could compare notes.

Share this post


Link to post
Share on other sites
Ransom1

Okay, will do, thank you. Hes had some troubles because theres no camhack for gta3, so he'll have to scm code some camera change or something.

 

My work is done, thanks again everyone. Heres the pic I took (perhaps to be changed). Of course, I will only use the middle portion.

 

user posted image

 

I plan to photoshop the light squares.

Edited by Ransom1

Share this post


Link to post
Share on other sites
Demarest
Wow! That's actually inline with what I was doing with GTA3. At least in appearance.

Share this post


Link to post
Share on other sites
Thesord

Well, I'm the person that Ransom mentioned to be working on the similar gta3 scene..

 

I've only acquired 5.0 of the mission builder some minutes ago, and have just started coding over a stripped scm..

 

I've done this so far:

 

:LabelVCP0001: wait 250 ms00D6: if 280E0: NOT is_player_driving $PLAYER_CHAR0256:	is_defined $PLAYER_CHAR00E1:	is_key_pressed  0  19004D: jump_if_false ££LabelVCP0055:	put_player_at $PLAYER_CHAR 1140.035 -642.4124 14.9727:LabelVCP_CAR0001: wait 250 ms0247:	request_model #POLICE00D6: if 0 0248:	is_model_available #POLICE004D: jump_if_false ££LabelVCP_CAR00A5:	create_car #POLICE 1141.743 -653.8894 14.9275 $VCP_CAR_10175:	set_car_z_angle $VCP_CAR_1  180.000A5:	create_car #POLICE 1143.698 -660.6692 14.9619 $VCP_CAR_20175:	set_car_z_angle $VCP_CAR_2  0.0004E:	end_thread

 

 

It is crashing when it reaches the create car part, as I've tested the earlier part that is run... Basically I just wanted to spawn the cars with those angles and after that build on the code.

 

I haven't coded in scm for a while, so forgive any possibly ridiculous mistakes suicidal.gif

 

 

Edited by Thesord

Share this post


Link to post
Share on other sites
Demarest

I offer 4.7 for download. I recommend it over 5.0.

 

Your keypress check should be more tightly timed. Your player defined check should complete before is player driving. Your request model should come after put_player (outside of the loop). An if available loop should have wait 0. And before end thread, you should have release_model and remove_references to both cars.

Share this post


Link to post
Share on other sites
Thesord

Ah Demarest, as helpful as you always were tounge.gif

 

There were some things you mentioned that confused me: firstly, the request_model is already after the put_player opcode (thus being outside of the loop) and then about using wait 0 ms on a is_available condition, well, I've always used 250 ms for that opcode, and it worked fine (on vc though, and I did test it with wait 0 before the condition in the second label, and it still crashes).

 

I made the changes you suggested:

 

 

:LabelVCP0001: wait 250 ms00D6: if 2 0256:	is_defined $PLAYER_CHAR80E0:	NOT is_player_driving $PLAYER_CHAR00E1:	is_key_pressed  0  19004D: jump_if_false ££LabelVCP0055:	put_player_at $PLAYER_CHAR 1140.035 -642.4124 14.9727 0001: wait 2500 ms:LabelVCP_CAR_MODEL0247: request_model #POLICE:LabelVCP_CAR0001: wait 250 ms00D6: if 00248: is_model_available #POLICE004D: jump_if_false ££LabelVCP_CAR0001: wait 100 ms00A5: create_car #POLICE 1143.698 -660.6692 14.9619 $VCP_CAR_1  0249:	release_model #POLICE 01C3:	cleanup_car $VCP_CAR_1004E: end_thread

 

 

For debugging, I added an opcode to set the player's armour to 100 (removed it when posting) right before the create_car opcode, and it crashes without setting the armour or creating the car, so I believe the problem is how the model loading is handled, and I'm not sure how to fix it.

 

By the way, why do you find 4.7 better than 5.0?

 

Thanks for the help.

 

 

Share this post


Link to post
Share on other sites
Demarest

There were some things you mentioned that confused me: firstly, the request_model is already after the put_player opcode (thus being outside of the loop)
No. You initially had it inside the 2nd loop. Notice you moved it? wink.gif

 

 

and then about using wait 0 ms on a is_available condition, well, I've always used 250 ms for that opcode, and it worked fine
Well of course it works fine. But knowing how and when to use waits shows an understanding of what you're doing with them. MOST of the time, is model available is satisfied VERY rapidly. Waits greater than 0 aren't necessary because even using 0, it barely loops at all. For example on the waits front, you still have WAY too many.

 

You still aren't allowing the if player defined to complete before using a player-related command though. Also, there's no need for labels in places you never jump to directly. Here's how the last code you posted should look (notice the use of local vars?):

:LabelVCP0001: wait 250 ms00D6: if 0 0256:	is_defined $PLAYER_CHAR004D: jump_if_false ��LabelVCP00D6: if 180E0:	NOT is_player_driving $PLAYER_CHAR00E1:	is_key_pressed  0  19004D: jump_if_false ��LabelVCP0055:	put_player_at $PLAYER_CHAR 1140.035 -642.4124 14.9727 0247: request_model #POLICE:LabelVCP_CAR0001: wait 0 ms00D6: if 00248: is_model_available #POLICE004D: jump_if_false ��LabelVCP_CAR00A5: create_car #POLICE 1143.698 -660.6692 14.9619  [email protected]: release_model #POLICE 01C3: cleanup_car  [email protected]: end_thread

 

 

By the way, why do you find 4.7 better than 5.0?
Oh, I'm not going to be able to remember all the reasons since it's been so long since I had to make the argument. A big part is conformity. MANY people used 4.7 (and earlier, but compatible versions) for a LONG time. When Barton released 5.0, he among other things changed the syntax. So now people had even more versions of code had to be known/learned/understood. Not radically different, but still. 4.7 still used DMA and that can easily be considered important for a number of reasons. Darkpact hasn't been released for GTA3, but it requires a DMA compliant Builder. Last but not least, I have a scm.ini update I released for 4.7 that unlocks/clarifies quite a few opcodes that weren't usable before it, including the GTA3 specific jump_if_true! Your call though.

Share this post


Link to post
Share on other sites
Thesord

I'm using 5.0 at the moment, will use it for this modification, just a preference tounge.gif

 

I tried that code (and understand the improvements it has over mine), but it still crashes when I press the key. The thread is working, as something happens when the key is pressed (crashes, in this case). I'm sure it is not conflicting with other code because it is the stripped scm included with the mission builder.

 

Demarest: Don't know what came over me, I move it for the obvious reason you stated and then forget why I did it.. xD

Share this post


Link to post
Share on other sites
Demarest
I see nothing that would crash it. But Barton's stripped's weren't very stripped at all. Use the one I released as it truly is stripped of EVERYTHING you don't need.

Share this post


Link to post
Share on other sites
Thesord

Well Demarest, I compiled your stripped scm code with 4.7, and then decompiled the scm with 5.0 and then recompiled with the added code:

 

 

DEFINE VERSION 5.00002: jump ££Label004364DEFINE MEMORY  17245:Label0043640002: jump ££Label0043B8DEFINE OBJECTS  3DEFINE OBJECT (no name)                  ; This is an unused object. You can put anything here.DEFINE OBJECT INDHELIX_BARRIER           ; Object number -1DEFINE OBJECT LOD_LAND014                ; Object number -2:Label0043B80002: jump ££Label0043CCDEFINE MISSIONS  0;-------------MAIN---------------:Label0043CC03A4: name_thread "MAIN"01F0: set_max_wanted_level_to  60111: set_wasted_busted_check_to  0 (disabled)00C0: set_current_time  12  003F7: load_island_data  0  0053: $PLAYER_CHAR = create_player #NULL at  811.875 -939.9375  35.750171: set_player $PLAYER_CHAR z_angle_to  180.001F5: $PLAYER_ACTOR = create_emulated_actor_from_player $PLAYER_CHAR0373: set_camera_directly_behind_player0363: toggle_model_render_at  1027.25 -933.75  15.0 radius  50.0 object -1 (INDHELIX_BARRIER)  003B6: replace_model_at  1027.25 -933.75  15.0 radius  50.0 from -1 (INDHELIX_BARRIER) to -2 (LOD_LAND014)01B6: set_weather  0034B: staunton_complete  0352: set_actor $PLAYER_ACTOR skin_to "PLAYER"0353: refresh_actor $PLAYER_ACTOR016A: fade  1 (back)  1000 ms01B4: set_player $PLAYER_CHAR frozen_state  1 (unfrozen)01B7: release_weather004F: create_thread ££Label00445E :Label00445E0001: wait  250 ms00D6: if  00256:   player $PLAYER_CHAR defined004D: jump_if_false ££Label00445E00D6: if  180E0:   NOT   player $PLAYER_CHAR driving00E1:   key_pressed  0  19004D: jump_if_false ££Label00445E0055: put_player $PLAYER_CHAR at  1140.062 -642.4375  15.00247: request_model #POLICE:Label00449B0001: wait  0 ms00D6: if  00248:   model #POLICE available004D: jump_if_false ££Label00449B00A5:  116 = create_car  1143.688 at -660.6875  14.9375  [email protected]: release_model #POLICE01C3: remove_references_to_car  [email protected] ;; Like turning a car into any random car004E: end_thread:Label0044C90001: wait  250 ms0002: jump ££Label0044C9

 

 

Still crashes confused.gif

Share this post


Link to post
Share on other sites
nubbel

Im not sure, but

 

 

116 = create_car  1143.688 at -660.6875  14.9375  [email protected]

 

 

looks wrong!

Share this post


Link to post
Share on other sites
Thesord

Indeed it was, thanks for spotting that nubbel smile.gif

 

I got the car spawn working, although now I'm facing a different problem: when I spawn the actors, replicas are spawned wth them. I spawn 2 cops, and a replica appears to the side of each cop (so basically 4 cops are spawning with only 2 opcodes being used). The code is:

 

:Label00445E0001: wait  250 ms00D6: if  00256:   player $PLAYER_CHAR defined004D: jump_if_false ££Label00445E00D6: if  180E0:   NOT   player $PLAYER_CHAR driving00E1:   key_pressed  0  19004D: jump_if_false ££Label00445E0055: put_player $PLAYER_CHAR at  1138.358 -653.1821 14.93190247: request_model #POLICE0247: request_model #COP:Label00449B0001: wait  50 ms00D6: if  10248:   model #POLICE available0248:   model #COP available004D: jump_if_false ££Label00449B00A5: [email protected] = create_car  #POLICE 1141.461 -656.598 14.534800A5: [email protected] = create_car  #POLICE 1142.096 -650.2039 14.5711009A:	create_actor  [email protected]  1 #COP at  1143.986 -651.3826 14.9669 009A:	create_actor  [email protected]  1 #COP at 1144.008 -655.4609 14.96730175:	set_car_z_angle  [email protected]  -12.00175:	set_car_z_angle  [email protected]  185.0020A:	set_car_door_status [email protected]  7020A:	set_car_door_status [email protected]  70249: release_model #POLICE0249: release_model #COP01C3: remove_references_to_car  [email protected] ;; Like turning a car into any random car  01C3: remove_references_to_car  [email protected] ;; Like turning a car into any random car004E: end_thread

 

Share this post


Link to post
Share on other sites
Demarest

Only reason I could think is that you're allowing the main thread to run into that as well as using a create_thread. But I would think that would create 4 police cars as well. MAYBE not if one removed_references before the other hit create_car.

 

Your create cop commands use flag 1, which is meant for player 2. Doubt that would do that, but it's still wrong. You want 4 for civmale or 6 for cop (not that they will act like cops, but commiting crimes in their vicinity WILL net a wanted level). Also, I've never seen a locked door status being 7. And last but not least, where you have your remove_references to car commands you need a pair of cleanup_actor commands as well.

Share this post


Link to post
Share on other sites
Ransom1

hmm Boss I just loaded this up and I am getting 1 actor behind each cop car as planned. I'm not sure why you are seeing duplicates. I warped after about 10 seconds, tryin to figure out what if key pressed button was to warp (satisfy if statement).

Share this post


Link to post
Share on other sites
Thesord

Ah.. Thanks once more..

 

I believe it's the main running into the thread, as I'm able to use the put_char twice.. blush.gif About the cleanup_actor, I didn't forget about that, just wanted to get the spawning working firstly. Related to the flag, I'm using flag 1 because it basically doesn't do anything, and if I'm not mistaken, makes the damage multiplier the same as of player1. Finally, I used the status of the doors as 7 because Luke (Smithers) told me so on irc, after I asked which value to use as the second parameter of the door status opcode to make all doors unlocked.

 

Tried changing the code (putting the main loop before the thread) and it worked, no more duplicates smile.gif

I'm going to attempt the shooting part tomorrow.

 

Thanks once more Demarest.

Edited by Thesord

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • 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.