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. PC
      2. Gameplay
      3. Missions
      4. Help & Support
    2. Red Dead Online

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

      1. Recruitment
    2. Events

    1. GTA Online

      1. Diamond Casino & Resort
      2. DLC
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Grand Theft Auto Series

    3. GTA 6

    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 IV 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 SA Mods
    10. GTA Vice City

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

      1. Guides & Strategies
      2. Help & Support
      3. GTA III 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

Sign in to follow this  
ceedj

Peds thread

Recommended Posts

ceedj

EDIT: I figured it out! Thanks for the help guys! The code is down below.

 

biggrin.gif

 

This thread is for my (and whoever else's) continuing education on peds/actors, and how to make them move about. This is mostly for my own use, however, if you are a somewhat experienced coder, you may enjoy using this (along with Racer_S's Cam Hack) for filming to FRAPS. Hopefully, this will turn into a "catch all" for all things peds.

 

I use Barton's ViceBuilder1.3 to edit and compile my scripts, but I understand he doesn't want the software distributed any more, and I'm not going to argue with that. It's what I use and am comfortable with; this is just a hobby and I in no way intend to become a master at scm scripting. But it is fun, and others may get some use for this, so why not? I'll just be posting peices of code; it's up to you what you do with them.

 

(I'm not sure about posting scm's. The master I use is based on one of Barton's "Stripped" scm's, and I don't know if that counts. If it becomes possible, I may post that as well as the mini code.)

 

I'll also be continuing my own education here, so if anyone has any constructive thoughts on how to improve something, please share it! We'll all be appreciative.

 

A word to the new coders (I'm still new too!): Whatever you code with, study, study, STUDY! I can't stress enough how important it is to study exsisting code (R*'s and other user code) to understand how things work. This really applies to ANY kind of coding, but it is important nonetheless. Read as much as you can, and don't be afriad to ask logical, thought out question. Most of the vets around here won't "give" you anything, but I've noticed that they all seem very willing to help point you in the right direction; after all, the sastifaction of figuring it out and making something happen the way you wanted it to is a far bigger reward that the work you put into it. I myself was giddy for two hours after getting two peds on the screen at the same time.

 

The original text of this post just dealt with what I wanted to do (machinima) and how I should go about doing it. I spent a MASSIVE amount of time just trying to find information; that's part of why I'm doing this.

Edited by ceedj

Share this post


Link to post
Share on other sites
random_download

I think that it may be easier to execute script commands in real-time using Spooky's method for what you are doing. That way you can change the commands in-game without having to start a new game. To create a ped, request the model and then use the 009A opcode and then use 011a with parameter 0 to make it stay still. You can also make it so that there are no peds on the street by setting their density to 0. You can find other opcodes to help you from the opcode database (link is in my sig).

 

If I where you I would use an empty script and set the car and ped density to 0 so there are no random cars/actors. Then I would use spooky's dll to execute all the opcodes to create the peds etc. in real-time.

Share this post


Link to post
Share on other sites
ceedj

Can someone change my topic title? To something like "Partial Success; still need a bit of help."

 

I'll post the details later when I get home, but the gist of it is I got my camera and one actor; I think I would like to add another actor at the same time, and then link the two so I can call the "make_actors converse" tag.

 

There is some invaluable information to had (mostly here, but a few offsite as well); it's a shame it's so hard to find.

 

Anyway, more later! lol.gif

Share this post


Link to post
Share on other sites
ceedj

 

I think that it may be easier to execute script commands in real-time using Spooky's method for what you are doing. That way you can change the commands in-game without having to start a new game. To create a ped, request the model and then use the 009A opcode and then use 011a with parameter 0 to make it stay still. You can also make it so that there are no peds on the street by setting their density to 0. You can find other opcodes to help you from the opcode database (link is in my sig).

 

If I where you I would use an empty script and set the car and ped density to 0 so there are no random cars/actors. Then I would use spooky's dll to execute all the opcodes to create the peds etc. in real-time.

Thanks, that's mostly what I've been doing. I grabbed a blank main.scm and started putting a few strings in. Like I said, I got one ped; I'm looking over the original scm to figure out how to place two at the same time, and make them talk to each other. I also found the wait-state flags, so it would be nice to be able to string a few commands in a loop/random situation. It would be even BETTER if I could assign keypresses to the wait states/converstaion starter.

 

I was also thinking about a few warp points, so I can easily go to a shooting location, set my camera, drop the acotrs and go. But I'm still playing with it for now.

 

Here's the code I used to generate the actors, courtesy...well, someone here. I've been through so many pages these last few days, I don't even know my own name!

 

 

:KeyPressed00D6: if 080E1: NOT key_pressed 0 13004D: jump_if_false ££CreateCoord0001: wait 0 ms0002: jump ££KeyPressed:CreateCoord04C4: create_coordinate $Fish $Sock $CatFood from_actor $PLAYER_ACTOR offset 0.0 6.0 0.00001: wait 0 ms0002: jump ££RequestActor1:RequestActor10247: request_model #HMYAP00D6: if 08248: NOT model #HMYAP available004D: jump_if_false ££CreateActor10001: wait 0 ms0002: jump ££RequestActor1:CreateActor1009A: $Actor1 = create_actor 4 #HMYAP at $Fish $Sock $CatFood0001: wait 0 ms0002: jump ££ReleaseActor1:ReleaseActor10249: release_model #HMYAP0001: wait 250 ms0002: jump ££KeyPressed

 

 

What might be the best way to call a second actor to roughly the same posistion, but on the other side? (I can figure the co-ordinates, just need a bit of guidance on setting up more than one at a time).

 

Thanks, still searching! lol.gif

 

EDIT: PS, I wouldn't want to get rid of the other cars/peds. I need a "little" life in the city.

Edited by ceedj

Share this post


Link to post
Share on other sites
random_download

Assigning key presses is no problem:

 

:iskeypressed0001: wait 250 ms00D6: if 000E1: key_pressed 0 <key number>jf ££iskeypressed0372: set_actor_wait_state

 

Share this post


Link to post
Share on other sites
ceedj
Assigning key presses is no problem:

 

:iskeypressed0001: wait 250 ms00D6: if 000E1: key_pressed 0 <key number>jf ££iskeypressed0372: set_actor_wait_state

 

So am I to take it that this would be theoretically possible then?

 

 

:iskeypressed0001: wait 250 ms00D6: if 000E1: key_pressed 0 <key number>jf ££iskeypressed03F9: make actors myactor1 myactor2  converse in  999999999 ms

 

 

How many iskeypressed sections can I have? Is there a litmit? I have a list of the key_presses; is it possible to add more? I suppose for now I could use the "car" functions, since I'll only be moving the player around to get good camera shots.

 

How about this: I'd like three groups of two actors, each with their own key press animations. I'm not asking anyone to do this, but only IF it can be done. Can I hook a key mapper somewhere to this?

 

Thanks again! lol.gif

Share this post


Link to post
Share on other sites
random_download

You can only use keys which are used as controls through scm, eg. crouch, shoot etc. You could use hotkeys like F1 etc. by making an external application, then making a hotkey and executing a little bit of scm code when it is pressed. I could make it for you if you want, but you will need to tell me exactly what scm code you want executed.

Share this post


Link to post
Share on other sites
ceedj
You can only use keys which are used as controls through scm, eg. crouch, shoot etc. You could use hotkeys like F1 etc. by making an external application, then making a hotkey and executing a little bit of scm code when it is pressed. I could make it for you if you want, but you will need to tell me exactly what scm code you want executed.

I'm going over the actor flags now, to decide which ones I want to use. Thanks very much for the offer (and the help); I'll post back again once I figure out what I'm doing. :-)

 

Share this post


Link to post
Share on other sites
ceedj

Success!

 

I have created a small script (with the help of a few scripts I found, thanks to gtavchq and random_download). As I mentioned earlier, I want to film some peds, and this script helps do just that. With Racer_S's CameraHack3.0c, I'm able to get in nice and close, and not even mess with the peds.

 

But the peds are the real groovy part of this; you can key up to 10 on-demand animations for a ped. This script calls for two peds to be generated, which is what I'll be using, but I hope to expand upon it as my storytelling needs change. Since there are only ten mapable keys on foot, the animations are split between the two, with one shared conversation amination. (You can take out the second ped if you like, and get 10 animations to choose from at once). I also plan to produce more of these small scripts with different sets of peds and animation definitions pre-set up, so I can call up different actors on the fly (well, reloading my scm and starting a new game, but it would still be quicker than trying to deal with just one script).

 

All of the animations in the world are worth diddly if you punch the ped you're trying to film. Which is where Racer's CamHack comes in. CamerHack has a neat little feature call "Camera Lock", and this will pretty much lock the "move around with the player" part of the camera, leaving you free to move yourself out of frame and perform the delightful "Don't Shoot Me!" animation. Beware of key setups though; there are a few that may conflict with the camera, like the FOV control, which shares one of the weapon select buttons. Not a huge issue though.

 

To use this, load the script into a stripped scm, via Barton's awesome ViceBuilder (do a search). Start CamHack (or don't, if you just want to mess with your peds, you sicko), and start a new game of Vice. See below for key controls.

 

Editing the file (please, feel free to point out any optimizations I could be making, as I just learned all about this over the last couple of days):

 

To change peds, simply change the #PEDNAME in the code, like this:

 

0247: request_model #HMYST

 

becomes

 

0247: request_model #PGa

 

Hunt the net for Spinnie's actors and models pack, which has all of the ped and in game model pictures labled with the code.

 

To change the animation, change the number after $Ped1 (or $Ped2) in this line: (see codes below)

 

0372: set_actor_wait_state $Ped1 03 2000 ms

 

to say, this:

 

0372: set_actor_wait_state $Ped1 15 2000 ms

 

You can change the milliseconds if you like, but if you hold a key down, the animation will loop! Neat-o-riffic!

 

The Conversation part has it's own opcode:

 

03F9: make_actors $Ped1 $Ped2 converse_in 2000 ms

 

If your peds run away after being scared by gunfire, press Sprint (Return on my setup) to generate new peds.

 

You can adjust the peds relative posistion to you from creation in this line(s):

 

04C4: create_coordinate $Fish $Sock $CatFood from_actor $PLAYER_ACTOR offset 1.0 1.0 0.0

 

Adjust the offset to your liking, but peds wont speak to each other from too far away.

 

Below the code is a map I made of the keys I reassigned, and what they do now. Below THAT, are the selections of animations to choose from. I hope some of this helps anyone who may find this information useful.

 

I'd like to explore the #SPECIAL actor tag a bit more; maybe a cameo by Sonny Forelli? I'm also looking to put in some warp points, so you don't have to travel 800 miles for a good camera shot. Anyway, enough from me. Thanks for the help and information, here's the code:

 

 

\\At the end of the bunches of "create_thread" stuff, put this in after the\\last line:004F: create_thread ££InitKeyPressed\\This code goes before the "Mission 0" headong, but after eveything else\\near the end of the file. Make sure there is a space between the last line of\\this code and the first line of the Mission 0 header. Many thanks to gtavchq,\\random downlader and all the smart people at gtaforums.com. And please,\\be kind to your peds.:InitKeyPressed00D6: if 080E1: NOT key_pressed 0 16004D: jump_if_false ££CreateCoord0001: wait 0 ms0002: jump ££InitKeyPressed:OldPedCleanup0001: wait 250 ms009b: destroy_actor $Ped1009b: destroy_actor $Ped20001: wait 250 ms0002: jump ££CreateCoord:CreateCoord04C4: create_coordinate $Fish $Sock $CatFood from_actor $PLAYER_ACTOR offset 0.0 1.0 0.00001: wait 0 ms0002: jump ££RequestActor1:RequestActor10247: request_model #HMYST00D6: if 08248: NOT model  available #HMYST004D: jump_if_false ££CreateActor10001: wait 0 ms0002: jump ££RequestActor1:CreateActor1009A: $Ped1 = create_actor 4 #HMYST at $Fish $Sock $CatFood0001: wait 0 ms0002: jump ££ReleaseActor1:ReleaseActor10249: release_model #HMYAP0001: wait 250 ms0002: jump ££CreateCoord2:CreateCoord204C4: create_coordinate $Fish $Sock $CatFood from_actor $PLAYER_ACTOR offset 1.0 1.0 0.00001: wait 0 ms0002: jump ££RequestActor2:RequestActor20247: request_model #PGa00D6: if 08248: NOT model  available #PGa004D: jump_if_false ££CreateActor20001: wait 0 ms0002: jump ££RequestActor2:CreateActor2009A: $Ped2 = create_actor 4 #PGa at $Fish $Sock $CatFood0001: wait 0 ms0002: jump ££ReleaseActor2:ReleaseActor20249: release_model #PGa0001: wait 250 ms0002: jump ££AnimationKey:AnimationKey0001: wait 50 ms00D6: if 000E1: key_pressed 0 19004D: jump_if_false ££AnimationKey203F9: make_actors $Ped1 $Ped2 converse_in 2000 ms0001: wait 0 ms0002: jump ££AnimationKey:AnimationKey20001: wait 50 ms00D6: if 000E1: key_pressed 0 18004D: jump_if_false ££AnimationKey30372: set_actor_wait_state $Ped1 03 2000 ms0001: wait 0 ms0002: jump ££AnimationKey  :AnimationKey30001: wait 50 ms00D6: if 000E1: key_pressed 0 6004D: jump_if_false ££AnimationKey40372: set_actor_wait_state $Ped2 19 2000 ms0001: wait 0 ms0002: jump ££AnimationKey:AnimationKey40001: wait 50 ms00D6: if 000E1: key_pressed 0 15004D: jump_if_false ££AnimationKey50372: set_actor_wait_state $Ped1 31 2000 ms0001: wait 0 ms0002: jump ££AnimationKey:AnimationKey50001: wait 50 ms00D6: if 000E1: key_pressed 0 7004D: jump_if_false ££AnimationKey60372: set_actor_wait_state $Ped2 33 2000 ms0001: wait 0 ms0002: jump ££AnimationKey:AnimationKey60001: wait 50 ms00D6: if 000E1: key_pressed 0 5004D: jump_if_false ££AnimationKey70372: set_actor_wait_state $Ped1 21 2000 ms0001: wait 0 ms0002: jump ££AnimationKey     :AnimationKey70001: wait 50 ms00D6: if 000E1: key_pressed 0 17004D: jump_if_false ££AnimationKey80372: set_actor_wait_state $Ped2 24 2000 ms0001: wait 0 ms0002: jump ££AnimationKey:AnimationKey80001: wait 50 ms00D6: if 000E1: key_pressed 0 13004D: jump_if_false ££AnimationKey90372: set_actor_wait_state $Ped1 25 2000 ms0001: wait 0 ms0002: jump ££AnimationKey:AnimationKey90001: wait 50 ms00D6: if 000E1: key_pressed 0 14004D: jump_if_false ££AnimationKey100372: set_actor_wait_state $Ped2 10 2000 ms0001: wait 0 ms0002: jump ££AnimationKey:AnimationKey100001: wait 50 ms00D6: if 000E1: key_pressed 0 3004D: jump_if_false ££CleanupHook0372: set_actor_wait_state $Ped1 15 2000 ms0001: wait 0 ms0002: jump ££AnimationKey:CleanupHook00D6: if 000E1: key_pressed 0 16004D: jump_if_false ££AnimationKey0001: wait 0 ms0002: jump ££OldPedCleanup

 

 

Key bindings:(Original Code Key|Wait State Code|In Game Button/Key Press)

 

3 15 - Surprised, steps backwards (look/turret up/down)

5 21 - Sit Down/Stand Up (prev weapon)

6 19 - Hand Gestures 2 (aim/target) Player must not have any weapons.

7 16 - Stick 'Em Up! (next weapon)

13 25 - Ten second animation; take something from chest pocket, hand it to someone, put two things away.(camera) Camera must be lockedf.

14 10 - Turn 180 degrees, face Angle. Camera must be locked and Player away from peds. (jump)

15 31 - Hand Gestures 2 (enter/exit vehicle)

16 Generate two peds (sprint) Includes cleanup of old peds.

17 24 - Sitting down, look around, stand. (shoot/attack) Camera must be locked and Player away from peds.

18 03 - Lean back, look l & r (crouch) Camera must be locked and Player away from peds

19 (look behind) Conversation: Camera must be locked.

 

*Number 19 is it's own code.

 

Wait State Codes (thanks to CyQ)

 

01 - stand still, look around

02 - stand still, hands behind back

03 - lean back, look l&r

08 - number 2 then scratch head

09 - bounce off, stumble backwards

10 - turn 180 degrees then face angle

11 - number 9, then scratch head

12 - bend over, catch breath

13 - #2 for 5 seconds

14 - step away, bend down, then elbow-attack direction faced

15 - surprised, step backwards

16 - hail taxi

17 - one step backward then hands in air (stick-em-up)

18 - #15

19 - hand gestures #1

20 - #12 then #3

21 - sit down/stand up

23 - stand up

24 - sitting down, look around, then stand up

25 - 10 sec anim, take something from chest-pocket, hand to someone, put two things away

30 - fall over backwards (like busted or dying)

31 - hand gesture #2

33 - kick floor

28, 29, 32, 34 - crash the game

34-999 does nothing.

 

Almost forgot, BIG BIG thanks to Barton for the great ReadMe file, and PatrickW, for the outstanding "almost translated to BASIC" copy of the main.scm, enabling my tiny mind to grap all of this. cookie.gif

Edited by ceedj

Share this post


Link to post
Share on other sites
ceedj

Figured out the "Special" actors (Phil, Sonny, Lance, etc) Use this (don't forget the create_thread!) and copy the rest of the AnimateKey codes from the above post code. (You can have two or more actors or peds; this is just for simplicities sake)

 

 

:InitKeyPressed00D6: if 080E1: NOT key_pressed 0 16004D: jump_if_false ££CreateCoord0001: wait 0 ms0002: jump ££InitKeyPressed:OldPedCleanup0001: wait 250 ms009b: destroy_actor $Ped10001: wait 250 ms0002: jump ££CreateCoord:CreateCoord04C4: create_coordinate $Fish $Sock $CatFood from_actor $PLAYER_ACTOR offset 0.0 1.0 0.00001: wait 0 ms0002: jump ££RequestActor1:RequestActor1023C: load_special_actor 1 "IGPHIL"  \\Same idea, DIFFERENT OPCODE! Be careful when you change these.00D6: if 0823D: NOT special_actor  1 loaded \\Same idea, DIFFERENT OPCODE! Be careful when you change these.004D: jump_if_false ££CreateActor10001: wait 0 ms0002: jump ££RequestActor1:CreateActor1009A: $Ped1 = create_actor 4 #SPECIAL01 at $Fish $Sock $CatFood0001: wait 0 ms0002: jump ££ReleaseActor1:ReleaseActor10296: release_special_actor #SPECIAL01 \\Same idea, DIFFERENT OPCODE! Be careful when you change these.0001: wait 250 ms0002: jump ££AnimationKey

 

 

More to come! rah.gif

Edited by ceedj

Share this post


Link to post
Share on other sites
PatrickW

I like your attitude towards SCM coding, and I'm sure you get all the help you needed, if you keep up that atttitude.

 

There are some comments I would like to make about your code. Not to put you down, but to help you improve as SCM coder:

1) Some of your jump-opcodes can be left out; If the label you're jumping to, is immidiatly behind the jump itself, you can just leave out the jump, as it will continue to execute the code after that label anyway.

 

2) many of your wait-opcodes are not needed; not every jump needs to be preceeded by a wait-opcode; In general wait-opcodes are needed in loops, every loops needs at least 1 wait-opcode, or the game might hangup.

 

3) Your "wait for actor-model loaded"-loops are missing a wait opcode. Here they are needed, or the game might hangup.

 

4) Before you're using the $PLAYER_ACTOR or $PLAYER_ACTOR, you should always include a "if player defined"-check. This check should be redone after each wait-opcode, before you access the player actor again.

 

I've gone over your code, and corrected al the above mentioned points. I also combined the creation of the two actors, into 1 piece of code.

 

 

\\At the end of the bunches of "create_thread" stuff, put this in after the\\last line:004F: create_thread ££InitKeyPressed\\This code goes before the "Mission 0" headong, but after eveything else\\near the end of the file. Make sure there is a space between the last line of\\this code and the first line of the Mission 0 header. Many thanks to gtavchq,\\random downlader and all the smart people at gtaforums.com. And please,\\be kind to your peds.:InitKeyPressed0001: wait 0 ms00D6: if 000E1: key_pressed 0 16004D: jump_if_false ££InitKeyPressed:CreateCoord0001: wait 0 ms00D6: if  00256:   player $PLAYER_CHAR defined004D: jump_if_false ££CreateCoord04C4: create_coordinate $ped1_x $ped1_y $ped1_z from_actor $PLAYER_ACTOR offset 0.0 1.0 0.004C4: create_coordinate $ped2_x $ped2_y $ped2_z from_actor $PLAYER_ACTOR offset 1.0 1.0 0.00247: request_model #HMYST0247: request_model #PGa:WaitActors0001: wait 0 ms00D6: if 10248: model  available #HMYST0248: model  available #PGa004D: jump_if_false ££WaitActors009A: $Ped1 = create_actor 4 #HMYST at $ped1_x $ped1_y $ped1_z009A: $Ped2 = create_actor 4 #PGa at $ped2_x $ped2_y $ped2_z0249: release_model #HMYAP0249: release_model #PGa:AnimationKey0001: wait 50 ms00D6: if 000E1: key_pressed 0 19004D: jump_if_false ££AnimationKey203F9: make_actors $Ped1 $Ped2 converse_in 2000 ms0002: jump ££AnimationKey:AnimationKey200D6: if 000E1: key_pressed 0 18004D: jump_if_false ££AnimationKey30372: set_actor_wait_state $Ped1 03 2000 ms0002: jump ££AnimationKey  :AnimationKey300D6: if 000E1: key_pressed 0 6004D: jump_if_false ££AnimationKey40372: set_actor_wait_state $Ped2 19 2000 ms0002: jump ££AnimationKey:AnimationKey400D6: if 000E1: key_pressed 0 15004D: jump_if_false ££AnimationKey50372: set_actor_wait_state $Ped1 31 2000 ms0002: jump ££AnimationKey:AnimationKey500D6: if 000E1: key_pressed 0 7004D: jump_if_false ££AnimationKey60372: set_actor_wait_state $Ped2 33 2000 ms0002: jump ££AnimationKey:AnimationKey600D6: if 000E1: key_pressed 0 5004D: jump_if_false ££AnimationKey70372: set_actor_wait_state $Ped1 21 2000 ms0002: jump ££AnimationKey    :AnimationKey700D6: if 000E1: key_pressed 0 17004D: jump_if_false ££AnimationKey80372: set_actor_wait_state $Ped2 24 2000 ms0002: jump ££AnimationKey:AnimationKey800D6: if 000E1: key_pressed 0 13004D: jump_if_false ££AnimationKey90372: set_actor_wait_state $Ped1 25 2000 ms0002: jump ££AnimationKey:AnimationKey900D6: if 000E1: key_pressed 0 14004D: jump_if_false ££AnimationKey100372: set_actor_wait_state $Ped2 10 2000 ms0002: jump ££AnimationKey:AnimationKey1000D6: if 000E1: key_pressed 0 3004D: jump_if_false ££CleanupHook0372: set_actor_wait_state $Ped1 15 2000 ms0002: jump ££AnimationKey:CleanupHook00D6: if 000E1: key_pressed 0 16004D: jump_if_false ££AnimationKey009b: destroy_actor $Ped1009b: destroy_actor $Ped20002: jump ££CreateCoord

 

 

BTW: I'm glad you like my "structured" main.scm smile.gif , I use it myself also allmost on a daily basis, to study R* code, and lookup stuff.

 

 

 

 

 

 

 

 

 

Share this post


Link to post
Share on other sites
ceedj

Patrick,

 

Thanks for the comments; this kind of constructive help is exactly what I'm looking for.

 

1) About the jump opcodes, I figured that out today. I also figured out the gosub command, which was REAL helpful in cleaning up my actor/car cleanups.

 

2) About the wait opcodes, Most of the code pieces I've been studying have these, so I left them. But I understand how the concept of threads and labels work a little better, and I can see I can lose a few of them.

 

3) This has been completely rebuilt. Not sure if it's quite right, but it's better. biggrin.gif

 

4) I like what you did, combining the coords and such, but I'm not sure about some of it's use, as I pretty much rebuilt my code from scratch. How can I best describe this...

 

The kind of things I'm looking to do with this requires a massive of amount of the game sitting around waiting for me to press keys. These key presses include:

 

Spawn 1 Ped

Spawn 2 Peds

Spawn 3 Peds

Spawn 4 Peds

Spawn Car

Spawn Car 2

Cleanup All

Any animations I wish to perform on the fly (these will be a combination of four key presses)

 

All in all, I think I came up with almost 70 different combinations to be used to have my Peds be created and "act." (20 animations for 1 ped, 12 each for two peds, 11 spread across three peds, and 7 spread across 4 peds, plus the spawning keys. All at the same time)

 

Because I may want a set of peds at A and three peds at B, I need separate labels for them all, because I never know how many peds or groups I may need (hence the point of this script). I want the engine to drop what ever ped or set I choose (via my key press) and then just get back to waiting. I don't see much point in setting up separate XYZ points for every ped, since they spawn in relation to where Tommy is, although I can see it being useful for "real mission coders" (i.e. not me). But I do thank you for the rewrite; it did confirm some thoughts I had about combining.

 

I do have a couple of questions though, if you wouldn't mind...

 

1) Should I make separate threads for each of my main actions? i.e., a thread for waiting, a thread for creating the peds/cars, and a thread for animation. Would performance be affected?

 

2) I'd like to add a Ped Selection to this somehow. I read on another post how gtavchq made a selector for teleporting to different places. Can I use something like this for ped selection? For example, You choose the keypress to spawn two peds, and you can choose (via text or pictures) which one. Can I put a string in my request model setup to facilitate this?

 

2a) On that same note, I'd also like to be able to use ACTORS as well, like Sonny, etc. I know how to do it, but would I be able to set up an if statement that checks if I'm requesting a SPECIAL ACTOR or a normal ped model? The limit of 19 doesn't matter, since I've set a limit of 10 peds on screen at once. Can this be done?

 

3) I'm having a helluva time trying to figure out this piece of code. It's spinnie's XYZ coords code, but I lopped out the car section, since I didn't need it. Anyway, I keep getting a "Too Many Parameters" error from the third line in LabelWalking:

 

 

After the FIRST player location setup (in the alley) add:; Enable/Disable speedo & damage meters (1/0)0004: $SHOW_METERS = 1?; Enable/Disable xyz viewer (1/0)0004: $SHOW_XYZ = 1?Somewhere with the other create_threads add :004F: create_thread ££LabelMetersThen addin this block somewhere in the main part ::LabelMeters0001: wait 50& ms00D6: if 0?00E0: player $PLAYER_CHAR driving004D: jump_if_false ££LabelWalking03C1: store_player_car $PLAYER_CHAR [email protected]:LabelSpeedo0001: wait 50? ms00D6: if 0?0442: player $PLAYER_CHAR in_car [email protected]: jump_if_false ££LabelMeters00D6: if 0?81C1: NOT car [email protected] stopped004D: jump_if_false ££LabelStopped; get KPH02E3: [email protected] = car [email protected] speed0011: [email protected] *= 4!008C: [email protected] = float_to_int [email protected]; get MPH0084: [email protected] = [email protected]: [email protected] = int_to_float [email protected]: [email protected] /= 7.936!0011: [email protected] *= 5!008C: [email protected] = float_to_int [email protected]:  $DAMAGE = car  [email protected] health0014:  $DAMAGE /=  10?; Show KPH0086:  $SPEED = [email protected]: if  0?0038:   $SHOW_METERS ==  1?004D: jump_if_false ££LabelStopped04F7: unknown_status_text  $SPEED  0?  2? "SPEEDO"04F7: unknown_status_text  $DAMAGE  1?  3? "DAMAGE"0002: jump ££LabelSpeedo:LabelStopped00AA: [email protected] = car [email protected] xpos, [email protected] = car [email protected] ypos, [email protected] = car [email protected] zpos0011: [email protected] *= 100!008C: [email protected] = float_to_int [email protected]: [email protected] *= 100!008C: [email protected] = float_to_int [email protected]: [email protected] *= 100!008C: [email protected] = float_to_int [email protected]:  $DAMAGE = car  [email protected] health0014:  $DAMAGE /=  10?0004:  $SPEED = 0?00D6: if  0?0038:   $SHOW_XYZ ==  1?004D: jump_if_false ££LabelStopped20302: text_4numbers_lowpriority "COORD" [email protected] [email protected] [email protected] 0? 50? ms 1?:LabelStopped200D6: if  0?0038:   $SHOW_METERS ==  1?004D: jump_if_false ££LabelMeters04F7: unknown_status_text  $SPEED  0?  2? "SPEEDO"04F7: unknown_status_text  $DAMAGE  1?  3? "DAMAGE"0002: jump ££LabelMeters:LabelWalking0151: remove_status_text  $DAMAGE0151: remove_status_text  $SPEED0054: [email protected] = player $PLAYER_CHAR xpos, [email protected] = player $PLAYER_CHAR ypos, [email protected] = player $PLAYER_CHAR zpos0011: [email protected] *= 100!008C: [email protected] = float_to_int [email protected]: [email protected] *= 100!008C: [email protected] = float_to_int [email protected]: [email protected] *= 100!008C: [email protected] = float_to_int [email protected]: [email protected] = player $PLAYER_CHAR z angle008C: [email protected] = float_to_int [email protected]: if  0?0038:   $SHOW_XYZ ==  1?004D: jump_if_false ££LabelMeters0302: text_4numbers_lowpriority "COORD2" [email protected] [email protected] [email protected] [email protected] 50? ms 1?0002: jump ££LabelMetersAdd the following strings to american.gxt in the MAIN section :COORD - ~b~Coords: ~g~~1~X, ~1~Y, ~1~ZCOORD2 - ~b~Coords: ~g~~1~X, ~1~Y, ~1~Z. ~b~Angle: ~g~~1~SPEEDO - KPH:DAMAGE - Dam.:

 

 

As I said, I removed the "car" sections. It looks like it was done in an older compiler, so I dropped all the "?" and "!" marks. If it were an integer-float problem, I could understand, but it won't compile because of that 0054 opcode (where it get's the coords from the player). If I take out the [email protected] = player blah blah zpos line, it complies, but the game crashes? What could be the problem here? (for some reason, Barton's CodeMaker refuses to work for me) Is is the differences in compiler versions, and I need the version 1.3 opcode?

 

4) My new cleanup code uses gosubs. Can I lose the wait codess I have here, or do I need them, as the enigne is bouncing around a bit?

 

 

:Create1PedWait00D6: if 100E1: key_pressed 0 500E1: key_pressed 0 16004D: jump_if_false ££Create2PedsWait0050: gosub ££Old1PedCleanup0001: wait 0 ms0050: gosub ££Pick1Ped0001: wait 0 ms0002: jump ££CreateCoordGrp1Ped

 

 

I think that's all for now. I'll post my updated code later; for now, I have some more research to do.

 

Thanks again!

Edited by ceedj

Share this post


Link to post
Share on other sites
Craig Kostelecky

 

3) I'm having a helluva time trying to figure out this piece of code. It's spinnie's XYZ coords code, but I lopped out the car section, since I didn't need it. Anyway, I keep getting a "Too Many Parameters" error from the third line in LabelWalking:

 

0054: [email protected] = player $PLAYER_CHAR xpos, [email protected] = player $PLAYER_CHAR ypos, [email protected] = player $PLAYER_CHAR zpos

 

That's the opcode that's the issue. In the older builders (0.22) that opcode had those parameters. But in the newer builders (1.3 and up) that same opcode should look like this:

 

0054: store_player $PLAYER_CHAR position_to [email protected] [email protected] [email protected]

 

 

 

EDIT: Here's that entire section of code in 1.3-1.5 format:

 

; Enable/Disable speedo & damage meters (1/0)0004: $SHOW_METERS = 1;; integer values ; Enable/Disable xyz viewer (1/0)0004: $SHOW_XYZ = 1;; integer values Somewhere with the other create_threads add :004F: create_thread ££LabelMeters  Then addin this block somewhere in the main part ::LabelMeters0001: wait 50 ms 00D6: if 0 00E0:   player $PLAYER_CHAR driving 004D: jump_if_false ££LabelWalking 03C1: [email protected] = player $PLAYER_CHAR car :LabelSpeedo0001: wait 50 ms 00D6: if 0 0442:   player $PLAYER_CHAR in_car [email protected] 004D: jump_if_false ££LabelMeters 00D6: if 0 81C1:   NOT   car [email protected] stopped 004D: jump_if_false ££LabelStopped ; get KPH02E3: [email protected] = car [email protected] speed 0011: [email protected] *= 4.0;; floating-point values 008C: [email protected] = float_to_integer [email protected] ; get MPH0084: [email protected] = [email protected];; integer values and handles 008D: [email protected] = integer_to_float [email protected] 0015: [email protected] /= 7.936;; floating-point values 0011: [email protected] *= 5.0;; floating-point values 008C: [email protected] = float_to_integer [email protected] 0227: $DAMAGE = car [email protected] health 0014: $DAMAGE /= 10;; integer values ; Show KPH0086: $SPEED = [email protected];; floating-point values only 00D6: if 0 0038:   $SHOW_METERS == 1;; integer values 004D: jump_if_false ££LabelStopped 04F7: status_text $SPEED 0 line 2 "SPEEDO" 04F7: status_text $DAMAGE 1 line 3 "DAMAGE" 0002: jump ££LabelSpeedo :LabelStopped00AA: store_car [email protected] position_to [email protected] [email protected] [email protected] 0011: [email protected] *= 100.0;; floating-point values 008C: [email protected] = float_to_integer [email protected] 0011: [email protected] *= 100.0;; floating-point values 008C: [email protected] = float_to_integer [email protected] 0011: [email protected] *= 100.0;; floating-point values 008C: [email protected] = float_to_integer [email protected] 0227: $DAMAGE = car [email protected] health 0014: $DAMAGE /= 10;; integer values 0004: $SPEED = 0;; integer values 00D6: if 0 0038:   $SHOW_XYZ == 1;; integer values 004D: jump_if_false ££LabelStopped2 0302: text_4numbers "COORD" [email protected] [email protected] [email protected] 0 50 ms 1 :LabelStopped200D6: if 0 0038:   $SHOW_METERS == 1;; integer values 004D: jump_if_false ££LabelMeters 04F7: status_text $SPEED 0 line 2 "SPEEDO" 04F7: status_text $DAMAGE 1 line 3 "DAMAGE" 0002: jump ££LabelMeters :LabelWalking0151: remove_status_text $DAMAGE 0151: remove_status_text $SPEED 0054: store_player $PLAYER_CHAR position_to [email protected] [email protected] [email protected] 0011: [email protected] *= 100.0;; floating-point values 008C: [email protected] = float_to_integer [email protected] 0011: [email protected] *= 100.0;; floating-point values 008C: [email protected] = float_to_integer [email protected] 0011: [email protected] *= 100.0;; floating-point values 008C: [email protected] = float_to_integer [email protected] 0170: [email protected] = player $PLAYER_CHAR z_angle 008C: [email protected] = float_to_integer [email protected] 00D6: if 0 0038:   $SHOW_XYZ == 1;; integer values 004D: jump_if_false ££LabelMeters 0302: text_4numbers "COORD2" [email protected] [email protected] [email protected] [email protected] 50 ms 1 0002: jump ££LabelMeters 

 

Edited by Craig Kostelecky

Share this post


Link to post
Share on other sites
ceedj
3) I'm having a helluva time trying to figure out this piece of code. It's spinnie's XYZ coords code, but I lopped out the car section, since I didn't need it. Anyway, I keep getting a "Too Many Parameters" error from the third line in LabelWalking:

 

0054: [email protected] = player $PLAYER_CHAR xpos, [email protected] = player $PLAYER_CHAR ypos, [email protected] = player $PLAYER_CHAR zpos

 

That's the opcode that's the issue. In the older builders (0.22) that opcode had those parameters. But in the newer builders (1.3 and up) that same opcode should look like this:

 

0054: store_player $PLAYER_CHAR position_to [email protected] [email protected] [email protected]

 

AWESOME! This has had me stuck for a while.

 

Since I have your attention, how hard would it be for me to slug this code into GTA:LC. I REALLY have a few primo shooting locations (Staunton especially) that I would love to use. Would it be possible to put a version of LC in and maybe put this code into a stripped scm (no missions, but everything unlocked)? I have version 1 of LC, but all the peds and gangs are the same. Would something like this be possible?

 

Thanks again!

Share this post


Link to post
Share on other sites
ceedj

Ok, here's my updated code so far. I still need to:

 

Set up the rest of the animations (the HORROR!)

 

Set up the teleporter (the EASY way to go "on location")

 

Set up the cars/actor selection process.

 

Keys so far:

 

Pre Wea + Sprint = Create 1 Ped

Pre Wea + Look Behind = Create 2 Peds

Pre Wea + Enter/Exit = Create 3 Peds

Pre Wea + Target/Aim = Create 4 Peds

Pre Wea + Crouch = Create Car

Pre Wea + Fire = Create Car 2

Pre Wea + Action = Clear EVERYTHING

 

Spawn Two peds and hit

Next Weapon+Look Behind to make them converse (this will be changed to a four key combo, like the next one)

 

Spawn a Ped and hit

Next Weapon+Enter/Exit+Target+Fire to make him look both ways. Hold to continue animation.

 

I'd like to use Pre Wea + Jump = Disable Player Control, but I'm having difficulty trying to figure out how to call this state. I can write if fine, but I'd like to set up an if/or statement to turn it on or off (you won't control the player, but you should theorectically still be able to press keys and invoke spawns. I think.)

 

Anyway, look it over if you like, and if you have any pointers, or you just want to rob it like a scurvy dog, feel free! Thanks for checking it out! biggrin.gif

 

 

(in the create_threads section)004F: create_thread ££Create1PedWait(before Mission 0):Create1PedWait00D6: if 100E1: key_pressed 0 500E1: key_pressed 0 16004D: jump_if_false ££Create2PedsWait0050: gosub ££Old1PedCleanup0001: wait 0 ms0050: gosub ££Pick1Ped0001: wait 0 ms0002: jump ££CreateCoordGrp1Ped:Create2PedsWait0001: wait 0 ms00D6: if 100E1: key_pressed 0 500E1: key_pressed 0 19004D: jump_if_false ££Create3PedsWait0050: gosub ££Old2PedsCleanup0001: wait 0 ms0050: gosub ££Pick2Peds0001: wait 0 ms0002: jump ££CreateCoordGrp2Ped1:Create3PedsWait0001: wait 0 ms00D6: if 100E1: key_pressed 0 500E1: key_pressed 0 15004D: jump_if_false ££Create4PedsWait0050: gosub ££Old3PedsCleanup0001: wait 0 ms0050: gosub ££Pick3Peds0001: wait 0 ms0002: jump ££CreateCoordGrp3Ped1:Create4PedsWait0001: wait 0 ms00D6: if 100E1: key_pressed 0 500E1: key_pressed 0 6004D: jump_if_false ££CreateCarWait0050: gosub ££Old4PedsCleanup0001: wait 0 ms0050: gosub ££Pick4Peds0001: wait 0 ms0002: jump ££CreateCoordGrp4Ped1:CreateCarWait0001: wait 0 ms00D6: if 100E1: key_pressed 0 500E1: key_pressed 0 18004D: jump_if_false ££CreateCar2Wait0050: gosub ££OldCarCleanup0001: wait 0 ms0050: gosub ££PickCar0001: wait 0 ms0002: jump ££CarCoords:CreateCar2Wait0001: wait 0 ms00D6: if 100E1: key_pressed 0 500E1: key_pressed 0 17004D: jump_if_false ££KillAllWait0050: gosub ££OldCar2Cleanup0001: wait 0 ms0050: gosub ££PickCar0001: wait 0 ms0002: jump ££Car2Coords:KillAllWait0001: wait 0 ms00D6: if 100E1: key_pressed 0 500E1: key_pressed 0 4004D: jump_if_false ££Grp1Anim0050: gosub ££KillAllCleanup0001: wait 0 ms0002: jump ££Create1PedWait:Old1PedCleanup009b: destroy_actor $Grp1Ped0051: return:Old2PedsCleanup009b: destroy_actor $Grp2Ped1009b: destroy_actor $Grp2Ped20051: return:Old3PedsCleanup009b: destroy_actor $Grp3Ped1009b: destroy_actor $Grp3Ped2009b: destroy_actor $Grp3Ped30051: return:Old4PedsCleanup009b: destroy_actor $Grp4Ped1009b: destroy_actor $Grp4Ped2009b: destroy_actor $Grp4Ped3009b: destroy_actor $Grp4Ped40051: return:OldCarCleanup00A6: destroy_car [email protected]: return:OldCar2Cleanup00A6: destroy_car [email protected] 0051: return:KillAllCleanup009b: destroy_actor $Grp1Ped009b: destroy_actor $Grp2Ped1009b: destroy_actor $Grp2Ped2009b: destroy_actor $Grp3Ped1009b: destroy_actor $Grp3Ped2009b: destroy_actor $Grp3Ped3009b: destroy_actor $Grp4Ped1009b: destroy_actor $Grp4Ped2009b: destroy_actor $Grp4Ped3009b: destroy_actor $Grp4Ped400A6: destroy_car [email protected]: destroy_car [email protected]: return:Pick1Ped0051: return:Pick2Peds0051: return:Pick3Peds0051: return:Pick4Peds0051: return:PickCar0051: return:CreateCoordGrp1Ped0001: wait 0 ms00D6: if  00256:   player $PLAYER_CHAR defined004D: jump_if_false ££CreateCoordGrp1Ped04C4: create_coordinate $Fish $Sock $CatFood from_actor $PLAYER_ACTOR offset 0.0 1.0 0.00247: request_model #HMYST038B: load_requested_models:CreateGrp1Ped00D6: if 00248: model  #HMYST available004D: jump_if_false ££CreateGrp1Ped009A: $Grp1Ped = create_actor 4 #HMYST at $Fish $Sock $CatFood0001: wait 0 ms0249: release_model #HMYST0002: jump ££Grp1Anim:CreateCoordGrp2Ped10001: wait 0 ms00D6: if  00256:   player $PLAYER_CHAR defined004D: jump_if_false ££CreateCoordGrp2Ped104C4: create_coordinate $Fish $Sock $CatFood from_actor $PLAYER_ACTOR offset 0.0 1.0 0.00001: wait 0 ms0247: request_model #PGa038B: load_requested_models:CreateGrp2Ped100D6: if 00248: model  #PGa available004D: jump_if_false ££CreateGrp2Ped1009A: $Grp2Ped1 = create_actor 4 #PGa at $Fish $Sock $CatFood0001: wait 0 ms0249: release_model #PGa:CreateCoordGrp2Ped20001: wait 0 ms00D6: if  00256:   player $PLAYER_CHAR defined004D: jump_if_false ££CreateCoordGrp2Ped204C4: create_coordinate $Fish $Sock $CatFood from_actor $PLAYER_ACTOR offset 0.0 1.0 0.00001: wait 0 ms0247: request_model #HMOST038B: load_requested_models:CreateGrp2Ped200D6: if 00248: model  #HMOST available004D: jump_if_false ££CreateGrp2Ped2009A: $Grp2Ped2 = create_actor 4 #HMOST at $Fish $Sock $CatFood0001: wait 0 ms0249: release_model #HMOST0002: jump ££Grp1Anim:CreateCoordGrp3Ped10001: wait 0 ms00D6: if  00256:   player $PLAYER_CHAR defined004D: jump_if_false ££CreateCoordGrp3Ped104C4: create_coordinate $Fish $Sock $CatFood from_actor $PLAYER_ACTOR offset 0.0 1.0 0.00001: wait 0 ms0247: request_model #WFYRI038B: load_requested_models:CreateGrp3Ped100D6: if 00248: model  #WFYRI available004D: jump_if_false ££CreateGrp3Ped1009A: $Grp3Ped1 = create_actor 4 #WFYRI at $Fish $Sock $CatFood0001: wait 0 ms0249: release_model #WFYRI:CreateCoordGrp3Ped20001: wait 0 ms00D6: if  00256:   player $PLAYER_CHAR defined004D: jump_if_false ££CreateCoordGrp3Ped204C4: create_coordinate $Fish $Sock $CatFood from_actor $PLAYER_ACTOR offset 0.0 1.0 0.00001: wait 0 ms0247: request_model #WFYBE038B: load_requested_models:CreateGrp3Ped200D6: if 00248: model  #WFYBE available004D: jump_if_false ££CreateGrp3Ped2009A: $Grp3Ped2 = create_actor 4 #WFYBE at $Fish $Sock $CatFood0001: wait 0 ms0249: release_model #WFYBE:CreateCoordGrp3Ped30001: wait 0 ms00D6: if  00256:   player $PLAYER_CHAR defined004D: jump_if_false ££CreateCoordGrp3Ped304C4: create_coordinate $Fish $Sock $CatFood from_actor $PLAYER_ACTOR offset 0.0 1.0 0.00001: wait 0 ms0247: request_model #WFYG1038B: load_requested_models:CreateGrp3Ped300D6: if 00248: model  #WFYG1 available004D: jump_if_false ££CreateGrp3Ped3009A: $Grp3Ped3 = create_actor 4 #WFYG1 at $Fish $Sock $CatFood0001: wait 0 ms0249: release_model #WFYG10002: jump ££Grp1Anim:CreateCoordGrp4Ped10001: wait 0 ms00D6: if  00256:   player $PLAYER_CHAR defined004D: jump_if_false ££CreateCoordGrp4Ped104C4: create_coordinate $Fish $Sock $CatFood from_actor $PLAYER_ACTOR offset 0.0 1.0 0.00001: wait 0 ms0247: request_model #WMYPI038B: load_requested_models:CreateGrp4Ped100D6: if 00248: model  #WMYPI available004D: jump_if_false ££CreateGrp4Ped1009A: $Grp4Ped1 = create_actor 4 #WMYPI at $Fish $Sock $CatFood0001: wait 0 ms0249: release_model #WMYPI:CreateCoordGrp4Ped20001: wait 0 ms00D6: if  00256:   player $PLAYER_CHAR defined004D: jump_if_false ££CreateCoordGrp4Ped204C4: create_coordinate $Fish $Sock $CatFood from_actor $PLAYER_ACTOR offset 0.0 1.0 0.00001: wait 0 ms0247: request_model #WMYRI038B: load_requested_models:CreateGrp4Ped200D6: if 00248: model  #WMYRI available004D: jump_if_false ££CreateGrp4Ped2009A: $Grp4Ped2 = create_actor 4 #WMYRI at $Fish $Sock $CatFood0001: wait 0 ms0249: release_model #WMYRI:CreateCoordGrp4Ped30001: wait 0 ms00D6: if  00256:   player $PLAYER_CHAR defined004D: jump_if_false ££CreateCoordGrp4Ped304C4: create_coordinate $Fish $Sock $CatFood from_actor $PLAYER_ACTOR offset 0.0 1.0 0.00001: wait 0 ms0247: request_model #WMYST038B: load_requested_models:CreateGrp4Ped300D6: if 00248: model  #WMYST available004D: jump_if_false ££CreateGrp4Ped3009A: $Grp4Ped3 = create_actor 4 #WMYST at $Fish $Sock $CatFood0001: wait 0 ms0249: release_model #WMYST:CreateCoordGrp4Ped40001: wait 0 ms00D6: if  00256:   player $PLAYER_CHAR defined004D: jump_if_false ££CreateCoordGrp4Ped404C4: create_coordinate $Fish $Sock $CatFood from_actor $PLAYER_ACTOR offset 0.0 1.0 0.00001: wait 0 ms0247: request_model #MALE01038B: load_requested_models:CreateGrp4Ped400D6: if 00248: model  #MALE01 available004D: jump_if_false ££CreateGrp4Ped4009A: $Grp4Ped4 = create_actor 4 #MALE01 at $Fish $Sock $CatFood0001: wait 0 ms0249: release_model #MALE010002: jump ££Grp1Anim:CarCoords0001: wait  50 ms00D6: if  00256:   player $PLAYER_CHAR defined004D: jump_if_false ££CarCoords00D6: if  080E0:   NOT   player $PLAYER_CHAR driving004D: jump_if_false ££CarCoords0172:  [email protected] = actor $PLAYER_ACTOR z_angle04C4: create_coordinate  [email protected]  [email protected]  [email protected] from_actor $PLAYER_ACTOR offset  4.0  0.0  0.00247: request_model #DELUXO038B: load_requested_models:CreateCar0001: wait  0 ms00D6: if  00248:   model #DELUXO available004D: jump_if_false ££CreateCar00A5:  [email protected] = create_car #DELUXO at  [email protected]  [email protected]  [email protected]: set_car  [email protected] z_angle_to  [email protected]: release_model #DELUXO01C3: remove_references_to_car  [email protected];; Like turning a car into any random car0001: wait  400 ms0002: jump ££Grp1Anim	:Car2Coords0001: wait  50 ms00D6: if  00256:   player $PLAYER_CHAR defined004D: jump_if_false ££Car2Coords00D6: if  080E0:   NOT   player $PLAYER_CHAR driving004D: jump_if_false ££Car2Coords0172:  [email protected] = actor $PLAYER_ACTOR z_angle04C4: create_coordinate  [email protected]  [email protected]  [email protected] from_actor $PLAYER_ACTOR offset  4.0  0.0  0.00247: request_model #DELUXO038B: load_requested_models:CreateCar20001: wait  0 ms00D6: if  00248:   model #DELUXO available004D: jump_if_false ££CreateCar200A5:  [email protected] = create_car #DELUXO at  [email protected]  [email protected]  [email protected]: set_car  [email protected] z_angle_to  [email protected]: release_model #DELUXO01C3: remove_references_to_car  [email protected];; Like turning a car into any random car0001: wait  400 ms0002: jump ££Grp1Anim:Grp1Anim0001: wait 50 ms00D6: if 1 00E1: key_pressed 0 700E1: key_pressed 0 19004D: jump_if_false ££AnimationKey203F9: make_actors $Grp2Ped1 $Grp2Ped2 converse_in 200000 ms0002: jump ££Grp1Anim:AnimationKey20001: wait 50 ms00D6: if 300E1: key_pressed 0 700E1: key_pressed 0 1500E1: key_pressed 0 600E1: key_pressed 0 17004D: jump_if_false ££Create1PedWait0372: set_actor_wait_state $Grp1Ped 03 2000 ms0002: jump ££Grp1Anim

 

 

Let's call this Vice Studios Ver. 0.3a

 

rah.gif

 

EDIT: Killed a typo in the code.

 

EDIT2: Killed some waits, per Patrick's suggestions. Also added player defined checks to all CreateCoords sections.

 

EDIT3: Fixed some silly cut & paste errors. Should be proper now.

Edited by ceedj

Share this post


Link to post
Share on other sites
Craig Kostelecky

Adding the code to LC should be done the same way as it is for Vice City. In fact I just tested the code in my last reply and it works fine. I did not add the entries to the gxt, but it looks like everything's working properly.

Edited by Craig Kostelecky

Share this post


Link to post
Share on other sites
ceedj

Thanks, but I was referring to my overall code (now helpfully named Vice Studios)

 

I think as long as it's the same enigne though, it should work.

 

Vice Studios, Liberty Branch? sigh.gif

 

EDIT: By the way, my car spawn code was from a post of yours on this site. Thanks. happy.gif

Edited by ceedj

Share this post


Link to post
Share on other sites
Craig Kostelecky

If you use that code in LC, you'll probably want to disable the LabelCARSPAWN and LabelCAR2SPAWN threads as the key_presses might conflict. But other than that issue, it should work without any flaws.

Share this post


Link to post
Share on other sites
PatrickW

I'm amazed by your progress, I like where this is going...

 

Code-review:

You're still missing some important "if player defined" checks, e.g. below label "CreateCoordGrp2Ped1", you're accessing $PLAYER_ACTOR to create new coordinates. During the wait for the keypress that triggered this, you executed wait-opcodes, so here you should first do a "if player defined" check, before refering to the $PLAYER_ACTOR. Similar situation accur at other places. (Missing these might cause your mod to crash at unpredictable times).

 

Also I would estimate that about 80% of your wait-opcodes, are not needed, but on the bright side: these won't kill you, they just make your code bigger and your mod slower...

 

 

 

 

Share this post


Link to post
Share on other sites
ceedj

Thanks for the encouragement. I'm pretty amazed myself, since I didn't know much about this until four days or so ago.

 

I made the changes to my code above as per your suggestions. I left the smaller waits (and the two after creation car waits) because I'm paranoid. With all the waiting for key's I'll be asking this thing to do, I'd rather it not crash. A little slow? I can reshoot when it doesn't burn. But to redo an entire setup (create all the actors, cars, warp, etc) would really annoy me.

 

Anywho, I'll be hopefully working on the peds selection next, followed by the animation strings (that is a job for when I need to spend 8 hours screaming about how one missplaced dot screwed all my strings up).

 

Thanks again guys, for all the help!

 

EDIT: It just occurred to me that with all these wait codes (almost 70 when I'm finished), I should wonder about prioitizing things. Most of the waiting will be involved with the animations, but I still need it to check for new spawns. As it is right now, I have it checking for a keypress at the animation part; if it gets one, it play through and moves on to the next animation wait. If it gets no response, it heads back to the beginning for the Create1PedWait, and cycling all the way through again. Is there a more effcient way to do this, or am I eventually going to run into a wall?

 

EDIT DOS: It also occurred to me that Random Download's suggestion of a linkable "hotkey" program is fantatsic, and would be just about the sweetest thing since, well, EVER. Imagine the customablity (!?), pressing two keys for EVERYTHING instead of two or four. Anyway, if you're still interested by the time I get it finished, that would fantabulous.

Edited by ceedj

Share this post


Link to post
Share on other sites
random_download

Sure, I will make it now if you want. It will basically execute some opcodes once you press the hotkey, however I'm not too sure about having jumps/if checks in the code at the moment, but something like a wait_state opcode can be done easily.

Share this post


Link to post
Share on other sites
ceedj

A BREAKTHROUGH!

 

No, but you can select your peds now!

 

This is a small piece of code, but it took me forever to figure out. Dunno why, because it seems ridiculously easy when I look at it now.

 

To Pick a Ped:

 

Press Pre Wea + Sprint to drop a cop.

 

Press Next Wea to scroll through the peds. I really, REALLY tried to put in something to let you go backwards, but nothing I tried would a) skip of 7 in reverse or b)skip past zero to the last picture, 106, so you get to see them all. Luckily, there's photo packs online, so you can scout to see which ped you'd like to use.

 

Press Enter/Exit to keep the ped. Congratulations! You now own a custom ped.

 

That does nothing. Yet.

 

CARS! I think I'll set up the car selection stuff next. Not sure about the special actor loads though. That may be tricky.

 

Oh yah, here's the code: Pick-A-Ped

 

 

:Create1PedWait0001: wait 250 ms00D6: if  00256:   player $PLAYER_CHAR defined004D: jump_if_false ££Create1PedWait00D6: if 100E1: key_pressed 0 500E1: key_pressed 0 16004D: jump_if_false ££Create1PedWait0050: gosub ££Old1PedCleanup0001: wait 250 ms0050: gosub ££ThePeds0001: wait 250 ms0002: jump ££CreateCoordsGrp1Ped:Old1PedCleanup009b: destroy_actor $Grp1Ped0051: return:ThePeds0004: $PedSelect = 00002: jump ££ShowPed:PedSelectForward 0001: wait 250 ms00D6: if 000E1: key_pressed 0 7004D: jump_if_false ££PedSelect0002: jump ££SevenCheck:PedSelect00D6: if 000E1: key_pressed 0 15004D: jump_if_false ££PedSelectForward009b: destroy_actor $Tmp1Ped0051: return:SevenCheck00D6: if 00038: $PedSelect == 7004D: jump_if_false ££NPed0008: $PedSelect += 1 :NPed0008: $PedSelect += 100D6: if 00038: $PedSelect == 107004D: jump_if_false ££ShowPed0004: $PedSelect = 10002: jump ££ShowPed :ShowPed 0001: wait 250 ms00D6: if  00256:   player $PLAYER_CHAR defined004D: jump_if_false ££ShowPed04C4: create_coordinate $Fish $Sock $CatFood from_actor $PLAYER_ACTOR offset 0.0 1.0 0.00247: request_model $PedSelect038B: load_requested_models:ShowPed200D6: if 00248: model  $PedSelect available004D: jump_if_false ££ShowPed2009b: destroy_actor $Tmp1Ped009A: $Tmp1Ped = create_actor 4 $PedSelect at $Fish $Sock $CatFood0001: wait 250 ms0249: release_model $PedSelect0002: jump ££PedSelectForward:CreateCoordsGrp1Ped0001: wait 250 ms00D6: if  00256:   player $PLAYER_CHAR defined004D: jump_if_false ££CreateCoordsGrp1Ped04C4: create_coordinate $Fish $Sock $CatFood from_actor $PLAYER_ACTOR offset 0.0 1.0 0.00247: request_model $PedSelect038B: load_requested_models $PedSelect:CreateGrp1Ped00D6: if 00248: model  $PedSelect available004D: jump_if_false ££CreateGrp1Ped009A: $Grp1Ped = create_actor 4 $PedSelect at $Fish $Sock $CatFood0001: wait 250 ms0249: release_model $PedSelect0002: jump ££Create1PedWait

 

 

Press Pre Wea again to load a new ped. Fun for mintues. Kids will love it, then hate it, then bring it back in five years for "nostalgia." Order now!

 

dozingoff.gif

Share this post


Link to post
Share on other sites
ceedj

Vice Studios is pleased to announce a limited working agreement with the Peds of Vice City, at our new home on Prawn Island. The Peds will not actually do anything, but they have agreed to show up. Peds have brought their cars as well...

 

Right then, what we've got here is this:

 

- Selectable choice of all working Vice City Peds (special actors may or may not be added)

- Selectable choice of all working vehicles in Vice City (fly a Police Maverick!)

- Up to ten peds on the screen at once (animation routine not completed yet)

- Peds look at you, making placement a breeze

- 4 Levels of Peds: 1 Ped, 2 Peds, 3 Peds, 4 Peds

- Two separate Car selection routines

- New deletion scheme

- Overall speed adjustment - Key input is slower, but game speed much better

 

This one was tricky in some spots. I figured out that local and global operation opcodes are different codes altogether, something not explained too clearly in any of the tutorials I've seen around. After understanding this, my number of crashes went WAY down, and I was able to do a very tiny operation check in the generator section.

 

Just press a key combination, and you drop a ped or a car, or a group of peds, etc. Here's the key set up:

 

Pre Wea + Sprint = Create 1 Ped

Pre Wea + Look Behind = Create 2 Peds

Pre Wea + Enter/Exit = Create 3 Peds

Pre Wea + Target/Aim = Create 4 Peds

Pre Wea + Crouch = Create Car

Pre Wea + Fire = Create Car 2

Pre Wea + Action = Clear EVERYTHING

 

To Delete Peds/Objects, hit Camera plus Sprint, Camera + Look Behind, etc.

 

The selection process works like this. You press Pre Wea + Sprint and a Cop falls into place. Press Next Weapon to advance a ped, and Pre Wea to go back. Press Enter/Exit to accept this ped. When you move your player, the ped will spawn accordingly. Take time to set the player where you want the ped, then accept it. Doing this near a vehicle will make the player get in, so watch out for this. I may set it to another key if it becomes a problem. Input on this is very much welcome.

 

When you create 2, 3, or 4 peds, the selection process is the same, except that when you accept the first ped, the second selection drops next to the first one. Move your player to where you want the ped to drop, and accept. Repeat for 3rd and 4th peds. I'm assuming a good analog stick would work wonders here; mine sucks so I don't know.

 

Car selection works the same, except you get a choice of two single cars. The two cars selections are independent of each other.

 

IF YOU PRESS A COMMAND TO GENERATE NEW PEDS, YOU WILL LOSE THE PEDS OF THAT GROUP. In other words, if you have a set of two peds drop, and then spawn another two peds, the first two will be gone. This is done on purpose, since I don't need more than ten peds at any one time. Use combinations of the groups to get smaller or bigger crowds. I'll bet someone does West Side Story...

 

Stuff still to do: There is a (sorta) player skin changer in there, except I haven't yet figured out how to call the special tags as a list, or get him into ped clothes. That may or may not get finished. I've also decided to skip on the teleporter as well; since you can choose any vehicle and go anywhere, what's the point? I'll save the resources for the animation and state routines, which I hope to get into soon. But I've got a good framework here, and I'm going to really enjoy working with this setting.

 

Thanks to everyone who has commented and helped me on this weird, yet pretty cool project; I learned way more than I ever thought I would in a week!

 

Enjoy Vice Studios, V0.4!

 

(in the create_threads section)004F: create_thread ££Create1PedWait(before Mission 0):Create1PedWait0001: wait 0 ms00D6: if 100E1: key_pressed 0 500E1: key_pressed 0 16004D: jump_if_false ££Delete1PedWait0050: gosub ££Old1PedCleanup0050: gosub ££Pick1Ped :Delete1PedWait00D6: if 100E1: key_pressed 0 1300E1: key_pressed 0 16004D: jump_if_false ££Create2PedsWait0050: gosub ££Old1PedCleanup:Create2PedsWait0001: wait 0 ms00D6: if 100E1: key_pressed 0 500E1: key_pressed 0 19004D: jump_if_false ££Delete2PedsWait0050: gosub ££Old2PedsCleanup0050: gosub ££Pick2Peds:Delete2PedsWait00D6: if 100E1: key_pressed 0 1300E1: key_pressed 0 19004D: jump_if_false ££Create3PedsWait0050: gosub ££Old2PedsCleanup:Create3PedsWait0001: wait 0 ms00D6: if 100E1: key_pressed 0 500E1: key_pressed 0 15004D: jump_if_false ££Delete3PedsWait0050: gosub ££Old3PedsCleanup0050: gosub ££Pick3Peds :Delete3PedsWait00D6: if 100E1: key_pressed 0 1300E1: key_pressed 0 15004D: jump_if_false ££Create4PedsWait0050: gosub ££Old3PedsCleanup:Create4PedsWait0001: wait 0 ms00D6: if 100E1: key_pressed 0 500E1: key_pressed 0 6004D: jump_if_false ££Delete4PedsWait0050: gosub ££Old4PedsCleanup0050: gosub ££Pick4Peds:Delete4PedsWait00D6: if 100E1: key_pressed 0 1300E1: key_pressed 0 6004D: jump_if_false ££CreateCarWait0050: gosub ££Old4PedsCleanup:CreateCarWait0001: wait 0 ms00D6: if 100E1: key_pressed 0 500E1: key_pressed 0 18004D: jump_if_false ££DeleteCarWait0050: gosub ££OldCarCleanup0050: gosub ££PickCar:DeleteCarWait00D6: if 100E1: key_pressed 0 1300E1: key_pressed 0 18004D: jump_if_false ££CreateCar2Wait0050: gosub ££OldCarCleanup:CreateCar2Wait0001: wait 0 ms00D6: if 100E1: key_pressed 0 500E1: key_pressed 0 17004D: jump_if_false ££DeleteCar2Wait0050: gosub ££OldCar2Cleanup0001: wait 0 ms0050: gosub ££PickCar2:DeleteCar2Wait00D6: if 100E1: key_pressed 0 1300E1: key_pressed 0 17004D: jump_if_false ££ChangeSkinWait0050: gosub ££OldCar2Cleanup:ChangeSkinWait00D6: if 100E1: key_pressed 0 1600E1: key_pressed 0 19004D: jump_if_false ££KillAllWait0050: gosub ££PickSkin:KillAllWait0001: wait 0 ms00D6: if 100E1: key_pressed 0 500E1: key_pressed 0 4004D: jump_if_false ££Grp1Anim0050: gosub ££KillAllCleanup0002: jump ££Create1PedWait:Old1PedCleanup034F: destroy_actor_with_fade $Grp1Ped10051: return:Old2PedsCleanup034F: destroy_actor_with_fade $Grp2Ped1034F: destroy_actor_with_fade $Grp2Ped20051: return:Old3PedsCleanup034F: destroy_actor_with_fade $Grp3Ped1034F: destroy_actor_with_fade $Grp3Ped2034F: destroy_actor_with_fade $Grp3Ped30051: return:Old4PedsCleanup034F: destroy_actor_with_fade $Grp4Ped1034F: destroy_actor_with_fade $Grp4Ped2034F: destroy_actor_with_fade $Grp4Ped3034F: destroy_actor_with_fade $Grp4Ped40051: return:OldCarCleanup00A6: destroy_car [email protected]: return:OldCar2Cleanup00A6: destroy_car [email protected]: return:KillAllCleanup034F: destroy_actor_with_fade $Grp1Ped1034F: destroy_actor_with_fade $Grp2Ped1034F: destroy_actor_with_fade $Grp2Ped2034F: destroy_actor_with_fade $Grp3Ped1034F: destroy_actor_with_fade $Grp3Ped2034F: destroy_actor_with_fade $Grp3Ped3034F: destroy_actor_with_fade $Grp4Ped1034F: destroy_actor_with_fade $Grp4Ped2034F: destroy_actor_with_fade $Grp4Ped3034F: destroy_actor_with_fade $Grp4Ped400A6: destroy_car [email protected]: destroy_car [email protected]: return:Pick1Ped0001: wait 250 ms0050: gosub ££ThePeds0050: gosub ££CreateCoordPed009A: $Grp1Ped1 = create_actor 4 $PedSelect at $Fish $Sock $CatFood020F: set_actor $Grp1Ped1 look_at_player $PLAYER_CHAR0249: release_model $PedSelect0051: return:Pick2Peds0001: wait 250 ms0050: gosub ££ThePeds0050: gosub ££CreateCoordPed009A: $Grp2Ped1 = create_actor 4 $PedSelect at $Fish $Sock $CatFood020F: set_actor $Grp2Ped1 look_at_player $PLAYER_CHAR0249: release_model $PedSelect 0050: gosub ££ThePeds0050: gosub ££CreateCoordPed009A: $Grp2Ped2 = create_actor 4 $PedSelect at $Fish $Sock $CatFood020F: set_actor $Grp2Ped2 look_at_player $PLAYER_CHAR0249: release_model $PedSelect 0051: return:Pick3Peds0001: wait 250 ms0050: gosub ££ThePeds0050: gosub ££CreateCoordPed009A: $Grp3Ped1 = create_actor 4 $PedSelect at $Fish $Sock $CatFood020F: set_actor $Grp3Ped1 look_at_player $PLAYER_CHAR0249: release_model $PedSelect0050: gosub ££ThePeds0050: gosub ££CreateCoordPed009A: $Grp3Ped2 = create_actor 4 $PedSelect at $Fish $Sock $CatFood020F: set_actor $Grp3Ped2 look_at_player $PLAYER_CHAR0249: release_model $PedSelect0050: gosub ££ThePeds0050: gosub ££CreateCoordPed009A: $Grp3Ped3 = create_actor 4 $PedSelect at $Fish $Sock $CatFood020F: set_actor $Grp3Ped3 look_at_player $PLAYER_CHAR0249: release_model $PedSelect0051: return:Pick4Peds0001: wait 250 ms0050: gosub ££ThePeds0050: gosub ££CreateCoordPed009A: $Grp4Ped1 = create_actor 4 $PedSelect at $Fish $Sock $CatFood020F: set_actor $Grp4Ped1 look_at_player $PLAYER_CHAR0001: wait 0 ms0249: release_model $PedSelect0050: gosub ££ThePeds0050: gosub ££CreateCoordPed009A: $Grp4Ped2 = create_actor 4 $PedSelect at $Fish $Sock $CatFood020F: set_actor $Grp4Ped2 look_at_player $PLAYER_CHAR0249: release_model $PedSelect0050: gosub ££ThePeds0050: gosub ££CreateCoordPed009A: $Grp4Ped3 = create_actor 4 $PedSelect at $Fish $Sock $CatFood020F: set_actor $Grp4Ped3 look_at_player $PLAYER_CHAR0249: release_model $PedSelect0050: gosub ££ThePeds0050: gosub ££CreateCoordPed009A: $Grp4Ped4 = create_actor 4 $PedSelect at $Fish $Sock $CatFood020F: set_actor $Grp4Ped4 look_at_player $PLAYER_CHAR0249: release_model $PedSelect0051: return:PickCar0050: gosub ££TheCars0050: gosub ££CreateCoordCar00A5:  [email protected] = create_car $CarSelect at  [email protected]  [email protected]  [email protected]: set_car  [email protected] z_angle_to 3150249: release_model $CarSelect01C3: remove_references_to_car  [email protected];; Like turning a car into any random car0001: wait  400 ms0051: return  :PickCar20050: gosub ££TheCars0050: gosub ££CreateCoordCar00A5:  [email protected] = create_car $CarSelect at  [email protected]  [email protected]  [email protected]: set_car  [email protected] z_angle_to 3150249: release_model $CarSelect01C3: remove_references_to_car  [email protected];; Like turning a car into any random car0001: wait  400 ms0051: return:PickSkin0050: gosub ££ThePeds:SkinCheck00D6: if  00256:   player $PLAYER_CHAR defined004D: jump_if_false ££SkinCheck0169: set_fade_color 5 5 5016A: fade 0 () 500 ms0001: wait 500 ms03BF: set_player $PLAYER_CHAR ignored_by_everyone_to 1 (true)01B4: set_player $PLAYER_CHAR frozen_state 0 (frozen)0352: set_actor $PLAYER_ACTOR skin_to "IGSONNY"038B: load_requested_models0353: refresh_actor $PLAYER_ACTOR016A: fade 1 (back) 500 ms0001: wait 500 ms03BF: set_player $PLAYER_CHAR ignored_by_everyone_to 0 (false)01B4: set_player $PLAYER_CHAR frozen_state 1 (unfrozen)0249: release_model $PedSelect0051: return:ThePeds0004: $PedSelect = 10002: jump ££ShowPed:PedSelectForward 0001: wait 0 ms00D6: if 000E1: key_pressed 0 7004D: jump_if_false ££PedSelectBack0002: jump ££NSevenCheck:PedSelectBack 0001: wait 0 ms00D6: if 000E1: key_pressed 0 5004D: jump_if_false ££PedSelect0002: jump ££PSevenCheck:PedSelect0001: wait 0 ms00D6: if 000E1: key_pressed 0 15004D: jump_if_false ££PedSelectForward009b: destroy_actor $Tmp1Ped0051: return:NSevenCheck00D6: if 00038: $PedSelect == 6004D: jump_if_false ££NPed0008: $PedSelect += 2 :NPed0008: $PedSelect += 100D6: if 00038: $PedSelect == 107004D: jump_if_false ££ShowPed0004: $PedSelect = 10002: jump ££ShowPed:PSevenCheck00D6: if 00038: $PedSelect == 9004D: jump_if_false ££PPed000C: $PedSelect -= 2 :PPed000C: $PedSelect -= 100D6: if 00038: $PedSelect == 0004D: jump_if_false ££ShowPed0004: $PedSelect = 1060002: jump ££ShowPed :ShowPed 0001: wait 250 ms00D6: if  00256:   player $PLAYER_CHAR defined004D: jump_if_false ££ShowPed04C4: create_coordinate $Fish $Sock $CatFood from_actor $PLAYER_ACTOR offset 0.0 1.5 0.00247: request_model $PedSelect038B: load_requested_models:ShowPed200D6: if 00248: model  $PedSelect available004D: jump_if_false ££ShowPed2009b: destroy_actor $Tmp1Ped009A: $Tmp1Ped = create_actor 4 $PedSelect at $Fish $Sock $CatFood020F: set_actor $Tmp1Ped look_at_player $PLAYER_CHAR0001: wait 250 ms0249: release_model $PedSelect0002: jump ££PedSelectForward:CreateCoordPed0001: wait 250 ms00D6: if  00256:   player $PLAYER_CHAR defined004D: jump_if_false ££CreateCoordPed04C4: create_coordinate $Fish $Sock $CatFood from_actor $PLAYER_ACTOR offset 0.0 1.5 0.00247: request_model $PedSelect038B: load_requested_models:CreatePed00D6: if 00248: model  $PedSelect available004D: jump_if_false ££CreatePed0051: return:TheCars0004: $CarSelect = 1300002: jump ££ShakeItUp:CarSelectForward 0001: wait 0 ms00D6: if 000E1: key_pressed 0 7004D: jump_if_false ££CarSelectBack0002: jump ££N180Check :CarSelectBack 0001: wait 0 ms00D6: if 000E1: key_pressed 0 5004D: jump_if_false ££CarSelect0002: jump ££P180Check:CarSelect0001: wait 0 ms00D6: if 000E1: key_pressed 0 15004D: jump_if_false ££CarSelectForward00A6: destroy_car [email protected]: return:N180Check00D6: if 00038: $CarSelect == 179004D: jump_if_false ££NCar0008: $CarSelect += 5 :NCar0008: $CarSelect += 100D6: if 00038: $CarSelect == 237004D: jump_if_false ££ShakeItUp0004: $CarSelect = 1300002: jump ££ShakeItUp:P180Check00D6: if 00038: $CarSelect == 185004D: jump_if_false ££PCar000C: $CarSelect -= 5 :PCar000C: $CarSelect -= 100D6: if 00038: $CarSelect == 129004D: jump_if_false ££ShakeItUp0004: $CarSelect = 2360002: jump ££ShakeItUp:ShakeItUp 0001: wait  250 ms00D6: if  00256:   player $PLAYER_CHAR defined004D: jump_if_false ££ShakeItUp00D6: if  080E0:   NOT   player $PLAYER_CHAR driving004D: jump_if_false ££ShakeItUp0172:  [email protected] = actor $PLAYER_ACTOR z_angle04C4: create_coordinate  [email protected]  [email protected]  [email protected] from_actor $PLAYER_ACTOR offset  0.0  4.0  0.00247: request_model $CarSelect038B: load_requested_models:JustWhatINeeded0001: wait  250 ms00D6: if  00248:   model $CarSelect available004D: jump_if_false ££JustWhatINeeded00A6: destroy_car [email protected]:  [email protected] = create_car $CarSelect at  [email protected]  [email protected]  [email protected]: set_car  [email protected] z_angle_to 3150249: release_model $CarSelect01C3: remove_references_to_car  [email protected];; Like turning a car into any random car0001: wait  400 ms0002: jump ££CarSelectForward:CreateCoordCar0001: wait  250 ms00D6: if  00256:   player $PLAYER_CHAR defined004D: jump_if_false ££CreateCoordCar              00D6: if  080E0:   NOT   player $PLAYER_CHAR driving004D: jump_if_false ££CreateCoordCar0172:  [email protected] = actor $PLAYER_ACTOR z_angle04C4: create_coordinate  [email protected]  [email protected]  [email protected] from_actor $PLAYER_ACTOR offset  0.0  4.0  0.00247: request_model $CarSelect038B: load_requested_models:CreateCar00D6: if 00248: model  $CarSelect available004D: jump_if_false ££CreateCar0051: return:Grp1Anim0001: wait 250 ms00D6: if 100E1: key_pressed 0 700E1: key_pressed 0 19004D: jump_if_false ££AnimationKey203F9: make_actors $Grp2Ped1 $Grp2Ped2 converse_in 200000 ms0002: jump ££Grp1Anim:AnimationKey20001: wait 250 ms00D6: if 300E1: key_pressed 0 700E1: key_pressed 0 1500E1: key_pressed 0 600E1: key_pressed 0 17004D: jump_if_false ££Create1PedWait0372: set_actor_wait_state $Grp1Ped 03 2000 ms0002: jump ££Grp1Anim

 

 

Enjoy, and please, don't play with your peds in public. Or was that private? Hmm...

 

EDIT = Removed conditionals, because they were dumb, and so was I.

Edited by ceedj

Share this post


Link to post
Share on other sites
random_download

 

00D6: if 00039: [email protected] == 10050: gosub ££ThePeds

 

Can you do that? wow.gif I thought only jump_if_false or jump_if_true could be used in if blocks.

Also, this code will change an actors skin to whatever model you choose:

 

set_actor_skin $actor, "IGBuddy"load_requested_modelsrefresh_actor_skin $actor

GTA: MA code, but I'm sure you can figure it out.

Share this post


Link to post
Share on other sites
PatrickW
00D6: if 00039: [email protected] == 10050: gosub ££ThePeds

 

Can you do that? wow.gif I thought only jump_if_false or jump_if_true could be used in if blocks.

 

No, you can't....

In these cases, the conditions are simply ignored, and the gosub is always executed.

 

But if you look though the code, you'll find that all instances where this construction is used, the variable that is tested, is always set to the correct value prior to the test, so all these conditions are true anyway.

 

To be short: all the

00D6: if 00039: [email protected] == ....

should be removed, where they are folowed by a gosub. As far as I can see this will not influence the behaviour, but it will de-clutter the code.

Share this post


Link to post
Share on other sites
ceedj

@Patrick: You are right. That WAS pretty silly, now that I think about it. Oh well, this is how I learn! biggrin.gif

 

@Random: Yeah, I have that code in the :SkinCheck section, but I need to figure out how to make those selections as variables, like I can do with the ped skins.

 

Good calls guys; anything else I can fix?

 

EDIT: @Random: In your program idea, it sounds like it would be something that would execute simple one or two line opcode commands (like set_actor $Blah wait_state 23). Could this be set up from an .ini file? So I can test it and see which key combinations work best? I think the best way is to give peds 1, 1-2, and 1-2-3 the most control, since four in a group are mostly set dressing.

 

Would key presses such as this be mappable?

 

Single Characters(A-Z,1-10,F Keys?)

Ctrl

Shift

Alt

Ctrl + Shift

Ctrl + Alt

Alt + Shift (is this possible?)

 

This way, I can give most of the peds almost eveything. Are actor flags able to be called live like this too? Say I decided I want a ped to go all crazy and run away. Can we set the actor_flag = (number)?

 

Anyway, just some ideas. Thanks!

 

EDIT: I compiled this with BW MB 1.5, but it crashed on load. Recompiled with 1.3, works fine. Yes, before you ask, I did change the version number. Will I gain anything by switching to 1.5 (I don't use the F1 feature and I type out the opcodes when I write it)? Does 1.5 do anything that is considered "must have?"

Edited by ceedj

Share this post


Link to post
Share on other sites
PatrickW
I compiled this with BW MB 1.5, but it crashed on load. Recompiled with 1.3, works fine. Yes, before you ask, I did change the version number. Will I gain anything by switching to 1.5 (I don't use the F1 feature and I type out the opcodes when I write it)? Does 1.5 do anything that is considered "must have?"

It has some important memory-corruption bug fixed, although barton never revealed the details about it.

The problem with starting to use V1.5 is, that it is not enough to just change the version-id in the source, because some of the opcodes have had their params rearanged ( barton never was into this backwards compatibility thing smile.gif ).

Luckily, he added an excelent conversion tool.

 

This you should just open your V1.3 source in V1.5, and choose "compiler->source converter".

This will give you a copy of your file, which is converted to V1.5 format.

 

 

Share this post


Link to post
Share on other sites
Craig Kostelecky

I think the code is exactly the same between 1.3 and 1.5. You shouldn't have to convert at all. That being said, I have no idea why code that worked in 1.3 doesn't work with 1.5.

Share this post


Link to post
Share on other sites
random_download
I think the code is exactly the same between 1.3 and 1.5. You shouldn't have to convert at all. That being said, I have no idea why code that worked in 1.3 doesn't work with 1.5.

Wouldn't it be to do with parameter names being changed in the vice_scm.ini? I suppose you could just use the old one if that was the case.

 

@ceedj: Yes it will be able to use any key on the keyboard. Setting actor flags will work too, only thing I'm not sure about would be jumps, which also rules out if checks. Executing something like:

 

009A: $Grp1Ped1 = create_actor 4 $PedSelect at $Fish $Sock $CatFood

0372: set_actor_wait_state $Grp1Ped 03 2000 ms

 

Is no problem, I will just need to take a look at the compiled scm to make sure that the vars are correct.

Share this post


Link to post
Share on other sites
ceedj

 

I think the code is exactly the same between 1.3 and 1.5. You shouldn't have to convert at all. That being said, I have no idea why code that worked in 1.3 doesn't work with 1.5.

Wouldn't it be to do with parameter names being changed in the vice_scm.ini? I suppose you could just use the old one if that was the case.

 

@ceedj: Yes it will be able to use any key on the keyboard. Setting actor flags will work too, only thing I'm not sure about would be jumps, which also rules out if checks. Executing something like:

 

009A: $Grp1Ped1 = create_actor 4 $PedSelect at $Fish $Sock $CatFood

0372: set_actor_wait_state $Grp1Ped 03 2000 ms

 

Is no problem, I will just need to take a look at the compiled scm to make sure that the vars are correct.

Random - What I'm thinking is that we leave all the ped and car creation to the game engine; there are certainly enough double key presses to facilitate this. I was thinking more along the lines of leaving the keymapper to do the animation work. That would lose about 10 wait states in the scm, and it may respond a bit better when using FRAPS (since the program isn't trying to decide which key it's ready for).

 

I still need a little time to work out the details, but most of the code will be one or two line things. (these are not real opcodes; this is just for example)

 

0000: set_actor_crouch

0001: set_actor_wait $Grp1Ped1 31 2000 ms

etc

 

In fact, now that I think of it, none of the opcodes I plan on using are more than two lines, and none do an "if" check. So this should be easy.

 

Ped Vars:

$Grp1Ped1

$Grp2Ped1

$Grp2Ped2

$Grp3Ped1

$Grp3Ped2

$Grp3Ped3

$Grp4Ped1

$Grp4Ped2

$Grp4Ped3

$Grp4Ped4

 

Animation Vars: Depends on the opcode; give me a few days to figure it out.

 

Can we use combo keys? I was thinking it might be best to set all animations based on ONE keyset, and then use different combos for different actors. For example, if key K is the Gesture 1 animation for Grp1Ped1, then CTRL K would be for Grp2Ped1, SHIFT K for Grp2Ped2, ALT K for Grp3Ped1, CTRL SHIFT K for Grp3Ped2 and CTRL ALT K for Grp3Ped3. We can use the F keys for the Grp4Ped1-4, since they won't be doing that much at once anyway.

 

If all this is possible, give me a few days to work out the final details. My scm is pretty much done (I tweaked the placement values, redfined some creation keys.

 

Thanks for all the help on this. I will have a nice suprise for you guys later this evening.

bbq.gif

 

EDIT: If you say all keys, does that mean the F keys as well? Could we link those too, like (example) F2, SHIFT F2, CRTL F2, ATL F2, etc?

 

There is one minor problem: if you try to call an animation for an actor that doesn't exsist, the game will crash to the desktop. Even if we could find an opcode like is_actor_defined, it would require a loop, which we can't do with this hook. I have no problem accepting this limitation; if you have no ped selected, bully to you for trying an animation key.

 

I'd also like to express my thanks for your help with this project. This will save me (and others) loads of time setting up, and we can spend more time filming, or harassing, our Peds. Cheers! cool.gif

Edited by ceedj

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.
Note: Your post will require moderator approval before it will be visible.

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.

Sign in to follow this  

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