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

    1. GTANet.com

    1. GTA Online

      1. Los Santos Summer Special
      2. The Diamond Casino Heist
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Frontier Pursuits
      2. Find Lobbies & Outlaws
      3. Help & Support
    3. Crews

    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. Grand Theft Auto Series

    2. GTA VI

      1. St. Andrews Cathedral
    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
    6. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
    7. GTA III

      1. Guides & Strategies
      2. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

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

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

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

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

    1. Announcements

    2. Support

    3. Suggestions

sueey

How to do it

Recommended Posts

sueey

I wanna know that:

 

I wanna create a ped with weapon?How i can do it?

 

before that,I tried,but failed.I want somebody which can code will help me!

 

thankx! xmas.gifcookie.gifxmas.gifcookie.gif

Share this post


Link to post
Share on other sites
random_download

 

:request0247: request_model #ARMY0247: request_model #M4:loop0001: wait 0 ms00D6: if 10248:   model #ARMY available0248:   model #M4 available004D: jump_if_false ££loop009A: @0 = create_actor #ARMY 4 at X Y Z01B2: give_actor @0 weapon  #M4 ammo  600249: release_model #ARMY0249: release_model #M4

 

Request the gun and actor models, spawn the actor and then give him the gun, release the models afterwards.

Share this post


Link to post
Share on other sites
sueey

and how to make a ped can attack CJ with weapon? rampage_ani.giframpage_ani.gif

Share this post


Link to post
Share on other sites
Demarest
random's such a sweetheart for posting code when you wouldn't inlove.gif Have you bothered to search existing code or the opcode database? If you search for the word kill, the answer will be obvious.

Share this post


Link to post
Share on other sites
sueey

oh,gosh!I cant spawn a ped,though spawned,he stays in the air,what's wrong? turn.gif

Share this post


Link to post
Share on other sites
Demarest
Stays in the air? Sounds as if you're looping the spawn and with an inaccurate Z. If you POST YOUR CODE (caps since you missed it last time), maybe we can know for sure, eh?

Share this post


Link to post
Share on other sites
michael-z

i had peds with chain guns(now that was fun) sigh.gif

Share this post


Link to post
Share on other sites
sueey

The code is written by my friend:

Problem:Spawn 1 ped,the code spawn 2 the ped can't stand on ground!

HELP,I'm making a mission,so i need a ped! rampage_ani.gif

 

 

 

004F: create_thread ££RequestActor1......:RequestActor10247: request_model #BMYBE00D6: if 08248: NOT model #BMYBE available004D: jump_if_false ££CreateActor10001: wait 0 ms0002: jump ££RequestActor1:CreateActor1009A: $130 = create_actor 24 #BMYBE at 2492.00 -1677.0 13.33;0173: set_actor $130 z_angle_to  90.00249: release_model #BMYBE004E: end_thread

Share this post


Link to post
Share on other sites
Demarest

More accurate would be

:RequestActor103A4: name_thread 'MYACTOR'0247: request_model #BMYBE:CreateActor10001: wait  0 ms00D6: if 00248: model #BMYBE available004D: jump_if_false ££CreateActor1009A: @0 = create_actor 4 #BMYBE at 2492.00 -1677.0 13.330249: release_model #BMYBE01C2: remove_references_to_actor @0004E: end_thread

 

 

My guess then is that the create_thread is getting looped. That still shouldn't do it though since you're not releasing the actor. Not sure why "your friend" used DMA, but that's a no no. Copy/pasting lines is a good way to preserve syntax, but you have to make sure to customize it. Otherwise, I don't see why it wouldn't work. Try mine and double check to make sure the create_thread isn't getting looped.

Share this post


Link to post
Share on other sites
sueey

Works well!

 

The ped will walk away when he spawn,Can i use"00a1" to freeze the ped's walking?

 

I mean that

 

009A: @0 = create_actor 4 #BMYBE at 2455.98 -1708.90 13.59

 

 

change to

 

00a1:@0 = put_actor_at 4 #BMYBE at 2455.98 -1708.90 13.59 

 

 

I think that hard!? Shifty41s_beerhatsmilie2.gif

Share this post


Link to post
Share on other sites
Demarest

00A1 looks like this

00A1: put_actor $PLAYER_ACTOR at  2464.03 -1687.61  12.51

You can't just change the way the line looks. You're programming for the engine. Also, you can't put actor anywhere until you create it. Referring to @0 as if it's an actor at all before creating actor will crash the game.

 

There's several options, none of which will I guarantee will work since Hammer recently revealed that many "old" opcodes are defunct and I haven't looked into it more yet. However, telling him to walk to where he already is would do it. As would telling actor to stand still. As would initiating a wait state... You can't just ask how to do everything. You have to show some initiative, investigate the code, etc. Since I've had SA, I've mostly been playing it. My goal is to refamiliarize myself with this and that. In your case, if I wanted to make an actor stand still, I would think "Hey, in A Home In The Hills, they had the 4 Triads standing still. Let's look there to see how." See what I mean?

Share this post


Link to post
Share on other sites
sueey

I know what you mean!

 

Cuz i am a green hand in SA mission coding!Many things that i ain't know! xmas.gif

Share this post


Link to post
Share on other sites
sueey

Thankx to Demarest!!

I know how to give a weapon to a spawned ped!!

 

 

:MYACTOR_103A4: name_thread 'MYACTOR'0247: request_model #WMYAMMO  0247: request_model #M4:MYACTOR_30001: wait  0 ms00D6: if  00248:   model #WMYAMMO available  0248:   model #M4 available004D: jump_if_false ££MYACTOR_3009A: @0 = create_actor  4 #WMYAMMO at  2485.17 -1666.32  13.34 01B2: give_actor @0 weapon 31 ammo 500249: release_model #WMYAMMO  0249: release_model #M401C2: remove_references_to_actor @0 ;; Like turning an actor into a random pedestrian004E: end_thread

 

 

 

Now the last the problem is how to freeze the ped move,i will see my existing code![/size=14] xmas.gifinlove.gif

Share this post


Link to post
Share on other sites
Demarest
Good job. However your is models loaded loop has a fault that could cause your game to crash some of the time. Read the Builder readme to brush up on how to assign the if's parameter. In this case, it should be a 1 instead of a 0.

Share this post


Link to post
Share on other sites
OuTLawZ-GoSu

Where do you put this code?

 

I put it like this:

 

 

:RequestActor103A4: name_thread 'MYACTOR'0247: request_model 18:CreateActor10001: wait  50 ms00D6: if 500248: model 18 available004D: jump_if_false ££CreateActor1009A: @0 = create_actor 4 18 at 2485.17 -1666.32 13.340249: release_model 1801C2: remove_references_to_actor @0004E: end_thread                   ;-------------Mission 0---------------

 

 

I'm new to modding so I dont understand how much of the code works.

 

 

Share this post


Link to post
Share on other sites
random_download

change the line "00D6: if 50" to "00D6: if 0" as you have one condtion. 50 is invalid for an if opcode. You will also need to search for "004F:" and add "004F: create_thread ££RequestActor1" there.

Share this post


Link to post
Share on other sites
OuTLawZ-GoSu

Did all that, still not spawning.

Share this post


Link to post
Share on other sites
random_download

If you did that, the actor will spawn. It will spawn as soon as the game starts however, and if the player is not near it then the actor may fall through the floor as the col files aren't loaded yet. Better would be to have a check for a keypress to spawn the actor eg:

 

 

:keypressloop0001: wait  50 ms00D6: if 000E1:   key_pressed  0  19004D: jump_if_false ££keypressloop0247: request_model 18:CreateActor10001: wait 0 ms00D6: if 00248: model 18 available004D: jump_if_false ££CreateActor100A0: store_actor $PLAYER_ACTOR position_to @1 @2 @[email protected] += [email protected] += 5.0009A: @0 = create_actor 4 18 at @1 @2 @30249: release_model 1801C2: remove_references_to_actor @00001: wait 1000 ms0002: jump ££keypressloop

 

Share this post


Link to post
Share on other sites
GivingItAllUpInHere

Won't this line

 

01C2: remove_references_to_actor @0

 

make the actor act like a ped and dissapear when the player goes a bit away from the actor?

 

Instead of doing this:

 

00A0: store_actor $PLAYER_ACTOR position_to @1 @2 @3

@3 += 1.2

@2 += 5.0

 

you can use:

 

04C4: create coordinate @1 @2 @3 from actor $PLAYER_ACTOR offset 1.2 5.0 0.0

Share this post


Link to post
Share on other sites
OuTLawZ-GoSu

How can I make it so the actors load when you get close, like parked cars.

 

 

@Givin, That makes them disapear also. (04C4: create coordinate @1 @2 @3 from actor $PLAYER_ACTOR offset 1.2 5.0 0.0 )

Share this post


Link to post
Share on other sites
GivingItAllUpInHere

Parked cars have a fixed location which is defined in the beginning of the script,to do it with actors you need a fixed location where a actor would spawn when you're close,let's say the actor will spawn at position 2488.562 -1666.864 12.8757

 

You use:

 

00FE: actor $PLAYER_ACTOR 0 ()near point 2488.562 -1666.864 12.8757 radius 7.5 7.5 7.5

 

(opcode conditional) That is for when the player is in a radius of about 7.5

that must be in a loop.

 

What do you mean

04C4: create coordinate @1 @2 @3 from actor $PLAYER_ACTOR offset 1.2 5.0 0.0

makes them dissapear? it shouldn't,I still think it's that

01C2: remove_references_to_actor @0

 

Paste all of your code (not the whole mission script) just the parts that has to do with the actor spawning.

Share this post


Link to post
Share on other sites
OuTLawZ-GoSu

This is what I got:

 

 

:keypressloop0001: wait  50 ms00D6: if 000E1:   key_pressed  0  19004D: jump_if_false ££keypressloop0247: request_model 111:CreateActor10001: wait 0 ms00D6: if 00248: model 111 available004D: jump_if_false ££CreateActor1;;00A0: store_actor $PLAYER_ACTOR position_to @1 @2 @3;;@3 += 1.2;;@2 += 5.0 04C4: create coordinate @1 @2 @3 from actor $PLAYER_ACTOR offset 1.2 5.0 0.0009A: @0 = create_actor 4 111 at @1 @2 @30249: release_model 11101C2: remove_references_to_actor @00001: wait 1000 ms0002: jump ££keypressloop

 

 

They all spawn fine, just when I get far, they disapear.

Share this post


Link to post
Share on other sites
Demarest

Removing references to an actor WILL make them disappear. The thread as it sits is not designed to allow for an actor to hang about, so you need to dismiss him immediately.

 

random's code had some errors in it. Not only does it reference the player before ensuring he exists, but it uses a wait 1000 instead of a key release check. Would look more like

:spawnped03A4: name_thread 'PEDSPWN':keypressloop0001: wait  250 ms00D6: if 000E1:   key_pressed  0  19004D: jump_if_false ££keypressloop0247: request_model 111038B: load_requested_models:CreateActor10001: wait 0 ms00D6: if 00248: model 111 available004D: jump_if_false ££CreateActor100D6: if  00256:   player $PLAYER_CHAR defined004D: jump_if_false ££CreateActor204C4: create coordinate @1 @2 @3 from actor $PLAYER_ACTOR offset  0.0  5.0 -1.0009A: @0 = create_actor 4 111 at @1 @2 @30249: release_model 11101C2: remove_references_to_actor @0:keypressloop20001: wait 100 ms00D6: if 000E1:   key_pressed  0  19004D: jump_if_false ££keypressloop0002: jump ££keypressloop2:CreateActor20249: release_model 1110002: jump ££keypressloop

 

 

As for "parked peds" there is no easy way like a generator. However, using a proximity sniff as GIAUIH suggested works fine. Just be sure to include an exit sniff as well. Doing so will actually preserve the ped for as long as you're in the sphere you set up. The following is an example of a simulated parked car. I will let you convert it for a ped to give you practise with the code. I used vars to set it up in a skeleton fashion to make it easier to impliment with what you're looking to do with it.

:[email protected] =  [email protected] =  [email protected] =  [email protected] =  100.003A4: name_thread 'LEVSPWN':SPAWNLOOP0001: wait  250 ms00D6: if  00256:   player $PLAYER_CHAR defined004D: jump_if_false ££SPAWNLOOP00D6: if  000FE:   actor $PLAYER_ACTOR  0 ()near_point  @1  @2 @3 radius @31 @31 @31004D: jump_if_false ££SPAWNLOOP0247: request model #HUNTER038B: load requested models:SPAWNLOOP20001: wait  0 ms00D6: if  00248:   model #HUNTER available004D: jump_if_false ££SPAWNLOOP200A5: @0 = create_car #HUNTER at   @1  @2 @30175: set_car @0 z_angle_to  180.00249: release_model #HUNTER:SPAWNLOOP30001: wait  250 ms00D6: if  00256:   player $PLAYER_CHAR defined004D: jump_if_false ££SPAWNLOOPEND00D6: if  2180FE:   NOT   actor $PLAYER_ACTOR  0 ()near_point  @1  @2 @3 radius @31 @31 @310119:   car @0 wrecked004D: jump_if_false ££SPAWNLOOP3:SPAWNLOOPEND01C3: remove_references_to_car @00002: jump ££SPAWNLOOP

 

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.