Quantcast

Jump to content

» «
Photo

Peds thread

44 replies to this topic
ceedj
  • ceedj

    PEDS Creator

  • Feroci
  • Joined: 21 May 2005
  • None

#1

Posted 25 May 2005 - 08:21 PM Edited by ceedj, 27 May 2005 - 09:34 PM.

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.

random_download
  • random_download

    :o

  • Members
  • Joined: 07 Mar 2004

#2

Posted 26 May 2005 - 02:47 PM

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.

ceedj
  • ceedj

    PEDS Creator

  • Feroci
  • Joined: 21 May 2005
  • None

#3

Posted 26 May 2005 - 02:51 PM

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

ceedj
  • ceedj

    PEDS Creator

  • Feroci
  • Joined: 21 May 2005
  • None

#4

Posted 26 May 2005 - 03:04 PM Edited by ceedj, 26 May 2005 - 03:07 PM.

QUOTE (random_download @ May 26 2005, 14:47)
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!

CODE
:KeyPressed
00D6: if 0
80E1: NOT key_pressed 0 13
004D: jump_if_false ££CreateCoord
0001: wait 0 ms
0002: jump ££KeyPressed

:CreateCoord
04C4: create_coordinate $Fish $Sock $CatFood from_actor $PLAYER_ACTOR offset 0.0 6.0 0.0
0001: wait 0 ms
0002: jump ££RequestActor1

:RequestActor1
0247: request_model #HMYAP
00D6: if 0
8248: NOT model #HMYAP available
004D: jump_if_false ££CreateActor1
0001: wait 0 ms
0002: jump ££RequestActor1

:CreateActor1
009A: $Actor1 = create_actor 4 #HMYAP at $Fish $Sock $CatFood
0001: wait 0 ms
0002: jump ££ReleaseActor1

:ReleaseActor1
0249: release_model #HMYAP
0001: wait 250 ms
0002: 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.

random_download
  • random_download

    :o

  • Members
  • Joined: 07 Mar 2004

#5

Posted 26 May 2005 - 03:25 PM

Assigning key presses is no problem:
CODE
:iskeypressed
0001: wait 250 ms
00D6: if 0
00E1: key_pressed 0 <key number>
jf ££iskeypressed
0372: set_actor_wait_state

ceedj
  • ceedj

    PEDS Creator

  • Feroci
  • Joined: 21 May 2005
  • None

#6

Posted 26 May 2005 - 04:05 PM

QUOTE (random_download @ May 26 2005, 15:25)
Assigning key presses is no problem:
CODE
:iskeypressed
0001: wait 250 ms
00D6: if 0
00E1: key_pressed 0 <key number>
jf ££iskeypressed
0372: set_actor_wait_state

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

CODE

:iskeypressed
0001: wait 250 ms
00D6: if 0
00E1: key_pressed 0 <key number>
jf ££iskeypressed
03F9: 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

random_download
  • random_download

    :o

  • Members
  • Joined: 07 Mar 2004

#7

Posted 26 May 2005 - 05:29 PM

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.

ceedj
  • ceedj

    PEDS Creator

  • Feroci
  • Joined: 21 May 2005
  • None

#8

Posted 26 May 2005 - 06:08 PM

QUOTE (random_download @ May 26 2005, 17:29)
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. :-)

ceedj
  • ceedj

    PEDS Creator

  • Feroci
  • Joined: 21 May 2005
  • None

#9

Posted 27 May 2005 - 07:42 AM Edited by ceedj, 27 May 2005 - 08:45 AM.

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:

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.

:InitKeyPressed
00D6: if 0
80E1: NOT key_pressed 0 16
004D: jump_if_false ££CreateCoord
0001: wait 0 ms
0002: jump ££InitKeyPressed

:OldPedCleanup
0001: wait 250 ms
009b: destroy_actor $Ped1
009b: destroy_actor $Ped2
0001: wait 250 ms
0002: jump ££CreateCoord

:CreateCoord
04C4: create_coordinate $Fish $Sock $CatFood from_actor $PLAYER_ACTOR offset 0.0 1.0 0.0
0001: wait 0 ms
0002: jump ££RequestActor1

:RequestActor1
0247: request_model #HMYST
00D6: if 0
8248: NOT model  available #HMYST
004D: jump_if_false ££CreateActor1
0001: wait 0 ms
0002: jump ££RequestActor1

:CreateActor1
009A: $Ped1 = create_actor 4 #HMYST at $Fish $Sock $CatFood
0001: wait 0 ms
0002: jump ££ReleaseActor1

:ReleaseActor1
0249: release_model #HMYAP
0001: wait 250 ms
0002: jump ££CreateCoord2

:CreateCoord2
04C4: create_coordinate $Fish $Sock $CatFood from_actor $PLAYER_ACTOR offset 1.0 1.0 0.0
0001: wait 0 ms
0002: jump ££RequestActor2

:RequestActor2
0247: request_model #PGa
00D6: if 0
8248: NOT model  available #PGa
004D: jump_if_false ££CreateActor2
0001: wait 0 ms
0002: jump ££RequestActor2

:CreateActor2
009A: $Ped2 = create_actor 4 #PGa at $Fish $Sock $CatFood
0001: wait 0 ms
0002: jump ££ReleaseActor2

:ReleaseActor2
0249: release_model #PGa
0001: wait 250 ms
0002: jump ££AnimationKey

:AnimationKey
0001: wait 50 ms
00D6: if 0
00E1: key_pressed 0 19
004D: jump_if_false ££AnimationKey2
03F9: make_actors $Ped1 $Ped2 converse_in 2000 ms
0001: wait 0 ms
0002: jump ££AnimationKey

:AnimationKey2
0001: wait 50 ms
00D6: if 0
00E1: key_pressed 0 18
004D: jump_if_false ££AnimationKey3
0372: set_actor_wait_state $Ped1 03 2000 ms
0001: wait 0 ms
0002: jump ££AnimationKey  

:AnimationKey3
0001: wait 50 ms
00D6: if 0
00E1: key_pressed 0 6
004D: jump_if_false ££AnimationKey4
0372: set_actor_wait_state $Ped2 19 2000 ms
0001: wait 0 ms
0002: jump ££AnimationKey

:AnimationKey4
0001: wait 50 ms
00D6: if 0
00E1: key_pressed 0 15
004D: jump_if_false ££AnimationKey5
0372: set_actor_wait_state $Ped1 31 2000 ms
0001: wait 0 ms
0002: jump ££AnimationKey

:AnimationKey5
0001: wait 50 ms
00D6: if 0
00E1: key_pressed 0 7
004D: jump_if_false ££AnimationKey6
0372: set_actor_wait_state $Ped2 33 2000 ms
0001: wait 0 ms
0002: jump ££AnimationKey

:AnimationKey6
0001: wait 50 ms
00D6: if 0
00E1: key_pressed 0 5
004D: jump_if_false ££AnimationKey7
0372: set_actor_wait_state $Ped1 21 2000 ms
0001: wait 0 ms
0002: jump ££AnimationKey    

:AnimationKey7
0001: wait 50 ms
00D6: if 0
00E1: key_pressed 0 17
004D: jump_if_false ££AnimationKey8
0372: set_actor_wait_state $Ped2 24 2000 ms
0001: wait 0 ms
0002: jump ££AnimationKey

:AnimationKey8
0001: wait 50 ms
00D6: if 0
00E1: key_pressed 0 13
004D: jump_if_false ££AnimationKey9
0372: set_actor_wait_state $Ped1 25 2000 ms
0001: wait 0 ms
0002: jump ££AnimationKey

:AnimationKey9
0001: wait 50 ms
00D6: if 0
00E1: key_pressed 0 14
004D: jump_if_false ££AnimationKey10
0372: set_actor_wait_state $Ped2 10 2000 ms
0001: wait 0 ms
0002: jump ££AnimationKey

:AnimationKey10
0001: wait 50 ms
00D6: if 0
00E1: key_pressed 0 3
004D: jump_if_false ££CleanupHook
0372: set_actor_wait_state $Ped1 15 2000 ms
0001: wait 0 ms
0002: jump ££AnimationKey

:CleanupHook
00D6: if 0
00E1: key_pressed 0 16
004D: jump_if_false ££AnimationKey
0001: wait 0 ms
0002: 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

ceedj
  • ceedj

    PEDS Creator

  • Feroci
  • Joined: 21 May 2005
  • None

#10

Posted 27 May 2005 - 08:10 PM Edited by ceedj, 27 May 2005 - 09:11 PM.

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)

CODE

:InitKeyPressed
00D6: if 0
80E1: NOT key_pressed 0 16
004D: jump_if_false ££CreateCoord
0001: wait 0 ms
0002: jump ££InitKeyPressed

:OldPedCleanup
0001: wait 250 ms
009b: destroy_actor $Ped1
0001: wait 250 ms
0002: jump ££CreateCoord

:CreateCoord
04C4: create_coordinate $Fish $Sock $CatFood from_actor $PLAYER_ACTOR offset 0.0 1.0 0.0
0001: wait 0 ms
0002: jump ££RequestActor1

:RequestActor1
023C: load_special_actor 1 "IGPHIL"  \\Same idea, DIFFERENT OPCODE! Be careful when you change these.
00D6: if 0
823D: NOT special_actor  1 loaded \\Same idea, DIFFERENT OPCODE! Be careful when you change these.
004D: jump_if_false ££CreateActor1
0001: wait 0 ms
0002: jump ££RequestActor1

:CreateActor1
009A: $Ped1 = create_actor 4 #SPECIAL01 at $Fish $Sock $CatFood
0001: wait 0 ms
0002: jump ££ReleaseActor1

:ReleaseActor1
0296: release_special_actor #SPECIAL01 \\Same idea, DIFFERENT OPCODE! Be careful when you change these.
0001: wait 250 ms
0002: jump ££AnimationKey


More to come! rah.gif

PatrickW
  • PatrickW

    GTA Juggernaut

  • The Connection
  • Joined: 07 Jan 2004
  • Netherlands
  • Best Script 2013 [DYOM]
    Best Script 2012 [DYOM]

#11

Posted 29 May 2005 - 05:48 AM

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.

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.

:InitKeyPressed
0001: wait 0 ms
00D6: if 0
00E1: key_pressed 0 16
004D: jump_if_false ££InitKeyPressed

:CreateCoord
0001: wait 0 ms
00D6: if  0
0256:   player $PLAYER_CHAR defined
004D: jump_if_false ££CreateCoord

04C4: create_coordinate $ped1_x $ped1_y $ped1_z from_actor $PLAYER_ACTOR offset 0.0 1.0 0.0
04C4: create_coordinate $ped2_x $ped2_y $ped2_z from_actor $PLAYER_ACTOR offset 1.0 1.0 0.0

0247: request_model #HMYST
0247: request_model #PGa

:WaitActors
0001: wait 0 ms
00D6: if 1
0248: model  available #HMYST
0248: model  available #PGa
004D: jump_if_false ££WaitActors

009A: $Ped1 = create_actor 4 #HMYST at $ped1_x $ped1_y $ped1_z
009A: $Ped2 = create_actor 4 #PGa at $ped2_x $ped2_y $ped2_z
0249: release_model #HMYAP
0249: release_model #PGa

:AnimationKey
0001: wait 50 ms
00D6: if 0
00E1: key_pressed 0 19
004D: jump_if_false ££AnimationKey2
03F9: make_actors $Ped1 $Ped2 converse_in 2000 ms
0002: jump ££AnimationKey

:AnimationKey2
00D6: if 0
00E1: key_pressed 0 18
004D: jump_if_false ££AnimationKey3
0372: set_actor_wait_state $Ped1 03 2000 ms
0002: jump ££AnimationKey  

:AnimationKey3
00D6: if 0
00E1: key_pressed 0 6
004D: jump_if_false ££AnimationKey4
0372: set_actor_wait_state $Ped2 19 2000 ms
0002: jump ££AnimationKey

:AnimationKey4
00D6: if 0
00E1: key_pressed 0 15
004D: jump_if_false ££AnimationKey5
0372: set_actor_wait_state $Ped1 31 2000 ms
0002: jump ££AnimationKey

:AnimationKey5
00D6: if 0
00E1: key_pressed 0 7
004D: jump_if_false ££AnimationKey6
0372: set_actor_wait_state $Ped2 33 2000 ms
0002: jump ££AnimationKey

:AnimationKey6
00D6: if 0
00E1: key_pressed 0 5
004D: jump_if_false ££AnimationKey7
0372: set_actor_wait_state $Ped1 21 2000 ms
0002: jump ££AnimationKey    

:AnimationKey7
00D6: if 0
00E1: key_pressed 0 17
004D: jump_if_false ££AnimationKey8
0372: set_actor_wait_state $Ped2 24 2000 ms
0002: jump ££AnimationKey

:AnimationKey8
00D6: if 0
00E1: key_pressed 0 13
004D: jump_if_false ££AnimationKey9
0372: set_actor_wait_state $Ped1 25 2000 ms
0002: jump ££AnimationKey

:AnimationKey9
00D6: if 0
00E1: key_pressed 0 14
004D: jump_if_false ££AnimationKey10
0372: set_actor_wait_state $Ped2 10 2000 ms
0002: jump ££AnimationKey

:AnimationKey10
00D6: if 0
00E1: key_pressed 0 3
004D: jump_if_false ££CleanupHook
0372: set_actor_wait_state $Ped1 15 2000 ms
0002: jump ££AnimationKey

:CleanupHook
00D6: if 0
00E1: key_pressed 0 16
004D: jump_if_false ££AnimationKey
009b: destroy_actor $Ped1
009b: destroy_actor $Ped2
0002: 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.









ceedj
  • ceedj

    PEDS Creator

  • Feroci
  • Joined: 21 May 2005
  • None

#12

Posted 29 May 2005 - 06:33 AM Edited by ceedj, 29 May 2005 - 06:44 AM.

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:

CODE

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 ££LabelMeters

Then addin this block somewhere in the main part :
:LabelMeters
0001: wait 50& ms
00D6: if 0?
00E0: player $PLAYER_CHAR driving
004D: jump_if_false ££LabelWalking
03C1: store_player_car $PLAYER_CHAR 0@

:LabelSpeedo
0001: wait 50? ms
00D6: if 0?
0442: player $PLAYER_CHAR in_car 0@
004D: jump_if_false ££LabelMeters
00D6: if 0?
81C1: NOT car 0@ stopped
004D: jump_if_false ££LabelStopped
; get KPH
02E3: 1@ = car 0@ speed
0011: 1@ *= 4!
008C: 1@ = float_to_int 1@
; get MPH
0084: 2@ = 1@
008D: 2@ = int_to_float 2@
0015: 2@ /= 7.936!
0011: 2@ *= 5!
008C: 2@ = float_to_int 2@
0227:  $DAMAGE = car  0@ health
0014:  $DAMAGE /=  10?
; Show KPH
0086:  $SPEED = 1@
00D6: if  0?
0038:   $SHOW_METERS ==  1?
004D: jump_if_false ££LabelStopped
04F7: unknown_status_text  $SPEED  0?  2? "SPEEDO"
04F7: unknown_status_text  $DAMAGE  1?  3? "DAMAGE"
0002: jump ££LabelSpeedo

:LabelStopped
00AA: 1@ = car 0@ xpos, 2@ = car 0@ ypos, 3@ = car 0@ zpos
0011: 1@ *= 100!
008C: 1@ = float_to_int 1@
0011: 2@ *= 100!
008C: 2@ = float_to_int 2@
0011: 3@ *= 100!
008C: 3@ = float_to_int 3@
0227:  $DAMAGE = car  0@ health
0014:  $DAMAGE /=  10?
0004:  $SPEED = 0?
00D6: if  0?
0038:   $SHOW_XYZ ==  1?
004D: jump_if_false ££LabelStopped2
0302: text_4numbers_lowpriority "COORD" 1@ 2@ 3@ 0? 50? ms 1?

:LabelStopped2
00D6: if  0?
0038:   $SHOW_METERS ==  1?
004D: jump_if_false ££LabelMeters
04F7: unknown_status_text  $SPEED  0?  2? "SPEEDO"
04F7: unknown_status_text  $DAMAGE  1?  3? "DAMAGE"
0002: jump ££LabelMeters

:LabelWalking
0151: remove_status_text  $DAMAGE
0151: remove_status_text  $SPEED
0054: 1@ = player $PLAYER_CHAR xpos, 2@ = player $PLAYER_CHAR ypos, 3@ = player $PLAYER_CHAR zpos
0011: 1@ *= 100!
008C: 1@ = float_to_int 1@
0011: 2@ *= 100!
008C: 2@ = float_to_int 2@
0011: 3@ *= 100!
008C: 3@ = float_to_int 3@
0170: 4@ = player $PLAYER_CHAR z angle
008C: 4@ = float_to_int 4@
00D6: if  0?
0038:   $SHOW_XYZ ==  1?
004D: jump_if_false ££LabelMeters
0302: text_4numbers_lowpriority "COORD2" 1@ 2@ 3@ 4@ 50? ms 1?
0002: jump ££LabelMeters


Add the following strings to american.gxt in the MAIN section :
COORD - ~b~Coords: ~g~~1~X, ~1~Y, ~1~Z
COORD2 - ~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 3@ = 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?

CODE

:Create1PedWait
00D6: if 1
00E1: key_pressed 0 5
00E1: key_pressed 0 16
004D: jump_if_false ££Create2PedsWait
0050: gosub ££Old1PedCleanup
0001: wait 0 ms
0050: gosub ££Pick1Ped
0001: wait 0 ms
0002: 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!

Craig Kostelecky
  • Craig Kostelecky

    GTA:LC Team Leader

  • The Connection
  • Joined: 28 Jan 2004
  • None

#13

Posted 29 May 2005 - 06:43 AM Edited by Craig Kostelecky, 29 May 2005 - 07:23 AM.

QUOTE (ceedj @ May 29 2005, 01:33)
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:
CODE
0054: 1@ = player $PLAYER_CHAR xpos, 2@ = player $PLAYER_CHAR ypos, 3@ = 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:
CODE
0054: store_player $PLAYER_CHAR position_to 1@ 2@ 3@



EDIT: Here's that entire section of code in 1.3-1.5 format:
CODE
; 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 :
:LabelMeters
0001: wait 50 ms
00D6: if 0
00E0:   player $PLAYER_CHAR driving
004D: jump_if_false ££LabelWalking
03C1: 0@ = player $PLAYER_CHAR car

:LabelSpeedo
0001: wait 50 ms
00D6: if 0
0442:   player $PLAYER_CHAR in_car 0@
004D: jump_if_false ££LabelMeters
00D6: if 0
81C1:   NOT   car 0@ stopped
004D: jump_if_false ££LabelStopped
; get KPH
02E3: 1@ = car 0@ speed
0011: 1@ *= 4.0;; floating-point values
008C: 1@ = float_to_integer 1@
; get MPH
0084: 2@ = 1@;; integer values and handles
008D: 2@ = integer_to_float 2@
0015: 2@ /= 7.936;; floating-point values
0011: 2@ *= 5.0;; floating-point values
008C: 2@ = float_to_integer 2@
0227: $DAMAGE = car 0@ health
0014: $DAMAGE /= 10;; integer values
; Show KPH
0086: $SPEED = 1@;; 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

:LabelStopped
00AA: store_car 0@ position_to 1@ 2@ 3@
0011: 1@ *= 100.0;; floating-point values
008C: 1@ = float_to_integer 1@
0011: 2@ *= 100.0;; floating-point values
008C: 2@ = float_to_integer 2@
0011: 3@ *= 100.0;; floating-point values
008C: 3@ = float_to_integer 3@
0227: $DAMAGE = car 0@ 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" 1@ 2@ 3@ 0 50 ms 1

:LabelStopped2
00D6: 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

:LabelWalking
0151: remove_status_text $DAMAGE
0151: remove_status_text $SPEED
0054: store_player $PLAYER_CHAR position_to 1@ 2@ 3@
0011: 1@ *= 100.0;; floating-point values
008C: 1@ = float_to_integer 1@
0011: 2@ *= 100.0;; floating-point values
008C: 2@ = float_to_integer 2@
0011: 3@ *= 100.0;; floating-point values
008C: 3@ = float_to_integer 3@
0170: 4@ = player $PLAYER_CHAR z_angle
008C: 4@ = float_to_integer 4@
00D6: if 0
0038:   $SHOW_XYZ == 1;; integer values
004D: jump_if_false ££LabelMeters
0302: text_4numbers "COORD2" 1@ 2@ 3@ 4@ 50 ms 1
0002: jump ££LabelMeters

ceedj
  • ceedj

    PEDS Creator

  • Feroci
  • Joined: 21 May 2005
  • None

#14

Posted 29 May 2005 - 06:48 AM

QUOTE (Craig Kostelecky @ May 29 2005, 06:43)
QUOTE (ceedj @ May 29 2005, 01:33)
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:
CODE
0054: 1@ = player $PLAYER_CHAR xpos, 2@ = player $PLAYER_CHAR ypos, 3@ = 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:
CODE
0054: store_player $PLAYER_CHAR position_to 1@ 2@ 3@

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!

ceedj
  • ceedj

    PEDS Creator

  • Feroci
  • Joined: 21 May 2005
  • None

#15

Posted 29 May 2005 - 07:26 AM Edited by ceedj, 29 May 2005 - 09:06 AM.

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

CODE

(in the create_threads section)

004F: create_thread ££Create1PedWait

(before Mission 0)

:Create1PedWait
00D6: if 1
00E1: key_pressed 0 5
00E1: key_pressed 0 16
004D: jump_if_false ££Create2PedsWait
0050: gosub ££Old1PedCleanup
0001: wait 0 ms
0050: gosub ££Pick1Ped
0001: wait 0 ms
0002: jump ££CreateCoordGrp1Ped

:Create2PedsWait
0001: wait 0 ms
00D6: if 1
00E1: key_pressed 0 5
00E1: key_pressed 0 19
004D: jump_if_false ££Create3PedsWait
0050: gosub ££Old2PedsCleanup
0001: wait 0 ms
0050: gosub ££Pick2Peds
0001: wait 0 ms
0002: jump ££CreateCoordGrp2Ped1

:Create3PedsWait
0001: wait 0 ms
00D6: if 1
00E1: key_pressed 0 5
00E1: key_pressed 0 15
004D: jump_if_false ££Create4PedsWait
0050: gosub ££Old3PedsCleanup
0001: wait 0 ms
0050: gosub ££Pick3Peds
0001: wait 0 ms
0002: jump ££CreateCoordGrp3Ped1

:Create4PedsWait
0001: wait 0 ms
00D6: if 1
00E1: key_pressed 0 5
00E1: key_pressed 0 6
004D: jump_if_false ££CreateCarWait
0050: gosub ££Old4PedsCleanup
0001: wait 0 ms
0050: gosub ££Pick4Peds
0001: wait 0 ms
0002: jump ££CreateCoordGrp4Ped1

:CreateCarWait
0001: wait 0 ms
00D6: if 1
00E1: key_pressed 0 5
00E1: key_pressed 0 18
004D: jump_if_false ££CreateCar2Wait
0050: gosub ££OldCarCleanup
0001: wait 0 ms
0050: gosub ££PickCar
0001: wait 0 ms
0002: jump ££CarCoords

:CreateCar2Wait
0001: wait 0 ms
00D6: if 1
00E1: key_pressed 0 5
00E1: key_pressed 0 17
004D: jump_if_false ££KillAllWait
0050: gosub ££OldCar2Cleanup
0001: wait 0 ms
0050: gosub ££PickCar
0001: wait 0 ms
0002: jump ££Car2Coords

:KillAllWait
0001: wait 0 ms
00D6: if 1
00E1: key_pressed 0 5
00E1: key_pressed 0 4
004D: jump_if_false ££Grp1Anim
0050: gosub ££KillAllCleanup
0001: wait 0 ms
0002: jump ££Create1PedWait

:Old1PedCleanup
009b: destroy_actor $Grp1Ped
0051: return

:Old2PedsCleanup
009b: destroy_actor $Grp2Ped1
009b: destroy_actor $Grp2Ped2
0051: return

:Old3PedsCleanup
009b: destroy_actor $Grp3Ped1
009b: destroy_actor $Grp3Ped2
009b: destroy_actor $Grp3Ped3
0051: return

:Old4PedsCleanup
009b: destroy_actor $Grp4Ped1
009b: destroy_actor $Grp4Ped2
009b: destroy_actor $Grp4Ped3
009b: destroy_actor $Grp4Ped4
0051: return

:OldCarCleanup
00A6: destroy_car 4@
0051: return

:OldCar2Cleanup
00A6: destroy_car 5@
0051: return

:KillAllCleanup
009b: destroy_actor $Grp1Ped
009b: destroy_actor $Grp2Ped1
009b: destroy_actor $Grp2Ped2
009b: destroy_actor $Grp3Ped1
009b: destroy_actor $Grp3Ped2
009b: destroy_actor $Grp3Ped3
009b: destroy_actor $Grp4Ped1
009b: destroy_actor $Grp4Ped2
009b: destroy_actor $Grp4Ped3
009b: destroy_actor $Grp4Ped4
00A6: destroy_car 4@
00A6: destroy_car 5@
0051: return

:Pick1Ped
0051: return

:Pick2Peds
0051: return

:Pick3Peds
0051: return

:Pick4Peds
0051: return

:PickCar
0051: return

:CreateCoordGrp1Ped
0001: wait 0 ms
00D6: if  0
0256:   player $PLAYER_CHAR defined
004D: jump_if_false ££CreateCoordGrp1Ped
04C4: create_coordinate $Fish $Sock $CatFood from_actor $PLAYER_ACTOR offset 0.0 1.0 0.0
0247: request_model #HMYST
038B: load_requested_models

:CreateGrp1Ped
00D6: if 0
0248: model  #HMYST available
004D: jump_if_false ££CreateGrp1Ped
009A: $Grp1Ped = create_actor 4 #HMYST at $Fish $Sock $CatFood
0001: wait 0 ms
0249: release_model #HMYST
0002: jump ££Grp1Anim

:CreateCoordGrp2Ped1
0001: wait 0 ms
00D6: if  0
0256:   player $PLAYER_CHAR defined
004D: jump_if_false ££CreateCoordGrp2Ped1
04C4: create_coordinate $Fish $Sock $CatFood from_actor $PLAYER_ACTOR offset 0.0 1.0 0.0
0001: wait 0 ms
0247: request_model #PGa
038B: load_requested_models

:CreateGrp2Ped1
00D6: if 0
0248: model  #PGa available
004D: jump_if_false ££CreateGrp2Ped1
009A: $Grp2Ped1 = create_actor 4 #PGa at $Fish $Sock $CatFood
0001: wait 0 ms
0249: release_model #PGa

:CreateCoordGrp2Ped2
0001: wait 0 ms
00D6: if  0
0256:   player $PLAYER_CHAR defined
004D: jump_if_false ££CreateCoordGrp2Ped2
04C4: create_coordinate $Fish $Sock $CatFood from_actor $PLAYER_ACTOR offset 0.0 1.0 0.0
0001: wait 0 ms
0247: request_model #HMOST
038B: load_requested_models

:CreateGrp2Ped2
00D6: if 0
0248: model  #HMOST available
004D: jump_if_false ££CreateGrp2Ped2
009A: $Grp2Ped2 = create_actor 4 #HMOST at $Fish $Sock $CatFood
0001: wait 0 ms
0249: release_model #HMOST
0002: jump ££Grp1Anim

:CreateCoordGrp3Ped1
0001: wait 0 ms
00D6: if  0
0256:   player $PLAYER_CHAR defined
004D: jump_if_false ££CreateCoordGrp3Ped1
04C4: create_coordinate $Fish $Sock $CatFood from_actor $PLAYER_ACTOR offset 0.0 1.0 0.0
0001: wait 0 ms
0247: request_model #WFYRI
038B: load_requested_models

:CreateGrp3Ped1
00D6: if 0
0248: model  #WFYRI available
004D: jump_if_false ££CreateGrp3Ped1
009A: $Grp3Ped1 = create_actor 4 #WFYRI at $Fish $Sock $CatFood
0001: wait 0 ms
0249: release_model #WFYRI

:CreateCoordGrp3Ped2
0001: wait 0 ms
00D6: if  0
0256:   player $PLAYER_CHAR defined
004D: jump_if_false ££CreateCoordGrp3Ped2
04C4: create_coordinate $Fish $Sock $CatFood from_actor $PLAYER_ACTOR offset 0.0 1.0 0.0
0001: wait 0 ms
0247: request_model #WFYBE
038B: load_requested_models

:CreateGrp3Ped2
00D6: if 0
0248: model  #WFYBE available
004D: jump_if_false ££CreateGrp3Ped2
009A: $Grp3Ped2 = create_actor 4 #WFYBE at $Fish $Sock $CatFood
0001: wait 0 ms
0249: release_model #WFYBE

:CreateCoordGrp3Ped3
0001: wait 0 ms
00D6: if  0
0256:   player $PLAYER_CHAR defined
004D: jump_if_false ££CreateCoordGrp3Ped3
04C4: create_coordinate $Fish $Sock $CatFood from_actor $PLAYER_ACTOR offset 0.0 1.0 0.0
0001: wait 0 ms
0247: request_model #WFYG1
038B: load_requested_models

:CreateGrp3Ped3
00D6: if 0
0248: model  #WFYG1 available
004D: jump_if_false ££CreateGrp3Ped3
009A: $Grp3Ped3 = create_actor 4 #WFYG1 at $Fish $Sock $CatFood
0001: wait 0 ms
0249: release_model #WFYG1
0002: jump ££Grp1Anim

:CreateCoordGrp4Ped1
0001: wait 0 ms
00D6: if  0
0256:   player $PLAYER_CHAR defined
004D: jump_if_false ££CreateCoordGrp4Ped1
04C4: create_coordinate $Fish $Sock $CatFood from_actor $PLAYER_ACTOR offset 0.0 1.0 0.0
0001: wait 0 ms
0247: request_model #WMYPI
038B: load_requested_models

:CreateGrp4Ped1
00D6: if 0
0248: model  #WMYPI available
004D: jump_if_false ££CreateGrp4Ped1
009A: $Grp4Ped1 = create_actor 4 #WMYPI at $Fish $Sock $CatFood
0001: wait 0 ms
0249: release_model #WMYPI

:CreateCoordGrp4Ped2
0001: wait 0 ms
00D6: if  0
0256:   player $PLAYER_CHAR defined
004D: jump_if_false ££CreateCoordGrp4Ped2
04C4: create_coordinate $Fish $Sock $CatFood from_actor $PLAYER_ACTOR offset 0.0 1.0 0.0
0001: wait 0 ms
0247: request_model #WMYRI
038B: load_requested_models

:CreateGrp4Ped2
00D6: if 0
0248: model  #WMYRI available
004D: jump_if_false ££CreateGrp4Ped2
009A: $Grp4Ped2 = create_actor 4 #WMYRI at $Fish $Sock $CatFood
0001: wait 0 ms
0249: release_model #WMYRI

:CreateCoordGrp4Ped3
0001: wait 0 ms
00D6: if  0
0256:   player $PLAYER_CHAR defined
004D: jump_if_false ££CreateCoordGrp4Ped3
04C4: create_coordinate $Fish $Sock $CatFood from_actor $PLAYER_ACTOR offset 0.0 1.0 0.0
0001: wait 0 ms
0247: request_model #WMYST
038B: load_requested_models

:CreateGrp4Ped3
00D6: if 0
0248: model  #WMYST available
004D: jump_if_false ££CreateGrp4Ped3
009A: $Grp4Ped3 = create_actor 4 #WMYST at $Fish $Sock $CatFood
0001: wait 0 ms
0249: release_model #WMYST

:CreateCoordGrp4Ped4
0001: wait 0 ms
00D6: if  0
0256:   player $PLAYER_CHAR defined
004D: jump_if_false ££CreateCoordGrp4Ped4
04C4: create_coordinate $Fish $Sock $CatFood from_actor $PLAYER_ACTOR offset 0.0 1.0 0.0
0001: wait 0 ms
0247: request_model #MALE01
038B: load_requested_models

:CreateGrp4Ped4
00D6: if 0
0248: model  #MALE01 available
004D: jump_if_false ££CreateGrp4Ped4
009A: $Grp4Ped4 = create_actor 4 #MALE01 at $Fish $Sock $CatFood
0001: wait 0 ms
0249: release_model #MALE01
0002: jump ££Grp1Anim

:CarCoords
0001: wait  50 ms
00D6: if  0
0256:   player $PLAYER_CHAR defined
004D: jump_if_false ££CarCoords
00D6: if  0
80E0:   NOT   player $PLAYER_CHAR driving
004D: jump_if_false ££CarCoords
0172:  0@ = actor $PLAYER_ACTOR z_angle
04C4: create_coordinate  1@  2@  3@ from_actor $PLAYER_ACTOR offset  4.0  0.0  0.0
0247: request_model #DELUXO
038B: load_requested_models

:CreateCar
0001: wait  0 ms
00D6: if  0
0248:   model #DELUXO available
004D: jump_if_false ££CreateCar
00A5:  4@ = create_car #DELUXO at  1@  2@  3@
0175: set_car  4@ z_angle_to  0@
0249: release_model #DELUXO
01C3: remove_references_to_car  4@;; Like turning a car into any random car
0001: wait  400 ms
0002: jump ££Grp1Anim

:Car2Coords
0001: wait  50 ms
00D6: if  0
0256:   player $PLAYER_CHAR defined
004D: jump_if_false ££Car2Coords
00D6: if  0
80E0:   NOT   player $PLAYER_CHAR driving
004D: jump_if_false ££Car2Coords
0172:  0@ = actor $PLAYER_ACTOR z_angle
04C4: create_coordinate  1@  2@  3@ from_actor $PLAYER_ACTOR offset  4.0  0.0  0.0
0247: request_model #DELUXO
038B: load_requested_models

:CreateCar2
0001: wait  0 ms
00D6: if  0
0248:   model #DELUXO available
004D: jump_if_false ££CreateCar2
00A5:  5@ = create_car #DELUXO at  1@  2@  3@
0175: set_car  5@ z_angle_to  0@
0249: release_model #DELUXO
01C3: remove_references_to_car  4@;; Like turning a car into any random car
0001: wait  400 ms
0002: jump ££Grp1Anim

:Grp1Anim
0001: wait 50 ms
00D6: if 1
00E1: key_pressed 0 7
00E1: key_pressed 0 19
004D: jump_if_false ££AnimationKey2
03F9: make_actors $Grp2Ped1 $Grp2Ped2 converse_in 200000 ms
0002: jump ££Grp1Anim

:AnimationKey2
0001: wait 50 ms
00D6: if 3
00E1: key_pressed 0 7
00E1: key_pressed 0 15
00E1: key_pressed 0 6
00E1: key_pressed 0 17
004D: jump_if_false ££Create1PedWait
0372: set_actor_wait_state $Grp1Ped 03 2000 ms
0002: 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.

Craig Kostelecky
  • Craig Kostelecky

    GTA:LC Team Leader

  • The Connection
  • Joined: 28 Jan 2004
  • None

#16

Posted 29 May 2005 - 07:27 AM Edited by Craig Kostelecky, 29 May 2005 - 07:33 AM.

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.

ceedj
  • ceedj

    PEDS Creator

  • Feroci
  • Joined: 21 May 2005
  • None

#17

Posted 29 May 2005 - 07:29 AM Edited by ceedj, 29 May 2005 - 07:37 AM.

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

Craig Kostelecky
  • Craig Kostelecky

    GTA:LC Team Leader

  • The Connection
  • Joined: 28 Jan 2004
  • None

#18

Posted 29 May 2005 - 07:34 AM

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.

PatrickW
  • PatrickW

    GTA Juggernaut

  • The Connection
  • Joined: 07 Jan 2004
  • Netherlands
  • Best Script 2013 [DYOM]
    Best Script 2012 [DYOM]

#19

Posted 29 May 2005 - 07:55 AM

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




ceedj
  • ceedj

    PEDS Creator

  • Feroci
  • Joined: 21 May 2005
  • None

#20

Posted 29 May 2005 - 08:21 AM Edited by ceedj, 29 May 2005 - 08:52 AM.

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.

random_download
  • random_download

    :o

  • Members
  • Joined: 07 Mar 2004

#21

Posted 29 May 2005 - 10:31 AM

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.

ceedj
  • ceedj

    PEDS Creator

  • Feroci
  • Joined: 21 May 2005
  • None

#22

Posted 30 May 2005 - 10:09 AM

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

CODE

:Create1PedWait
0001: wait 250 ms
00D6: if  0
0256:   player $PLAYER_CHAR defined
004D: jump_if_false ££Create1PedWait
00D6: if 1
00E1: key_pressed 0 5
00E1: key_pressed 0 16
004D: jump_if_false ££Create1PedWait
0050: gosub ££Old1PedCleanup
0001: wait 250 ms
0050: gosub ££ThePeds
0001: wait 250 ms
0002: jump ££CreateCoordsGrp1Ped

:Old1PedCleanup
009b: destroy_actor $Grp1Ped
0051: return

:ThePeds
0004: $PedSelect = 0
0002: jump ££ShowPed

:PedSelectForward
0001: wait 250 ms
00D6: if 0
00E1: key_pressed 0 7
004D: jump_if_false ££PedSelect
0002: jump ££SevenCheck

:PedSelect
00D6: if 0
00E1: key_pressed 0 15
004D: jump_if_false ££PedSelectForward
009b: destroy_actor $Tmp1Ped
0051: return

:SevenCheck
00D6: if 0
0038: $PedSelect == 7
004D: jump_if_false ££NPed
0008: $PedSelect += 1

:NPed
0008: $PedSelect += 1
00D6: if 0
0038: $PedSelect == 107
004D: jump_if_false ££ShowPed
0004: $PedSelect = 1
0002: jump ££ShowPed

:ShowPed
0001: wait 250 ms
00D6: if  0
0256:   player $PLAYER_CHAR defined
004D: jump_if_false ££ShowPed
04C4: create_coordinate $Fish $Sock $CatFood from_actor $PLAYER_ACTOR offset 0.0 1.0 0.0
0247: request_model $PedSelect
038B: load_requested_models

:ShowPed2
00D6: if 0
0248: model  $PedSelect available
004D: jump_if_false ££ShowPed2
009b: destroy_actor $Tmp1Ped
009A: $Tmp1Ped = create_actor 4 $PedSelect at $Fish $Sock $CatFood
0001: wait 250 ms
0249: release_model $PedSelect
0002: jump ££PedSelectForward

:CreateCoordsGrp1Ped
0001: wait 250 ms
00D6: if  0
0256:   player $PLAYER_CHAR defined
004D: jump_if_false ££CreateCoordsGrp1Ped
04C4: create_coordinate $Fish $Sock $CatFood from_actor $PLAYER_ACTOR offset 0.0 1.0 0.0
0247: request_model $PedSelect
038B: load_requested_models $PedSelect

:CreateGrp1Ped
00D6: if 0
0248: model  $PedSelect available
004D: jump_if_false ££CreateGrp1Ped
009A: $Grp1Ped = create_actor 4 $PedSelect at $Fish $Sock $CatFood
0001: wait 250 ms
0249: release_model $PedSelect
0002: 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

ceedj
  • ceedj

    PEDS Creator

  • Feroci
  • Joined: 21 May 2005
  • None

#23

Posted 31 May 2005 - 05:51 AM Edited by ceedj, 31 May 2005 - 11:36 AM.

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!
CODE

(in the create_threads section)

004F: create_thread ££Create1PedWait

(before Mission 0)

:Create1PedWait
0001: wait 0 ms
00D6: if 1
00E1: key_pressed 0 5
00E1: key_pressed 0 16
004D: jump_if_false ££Delete1PedWait
0050: gosub ££Old1PedCleanup
0050: gosub ££Pick1Ped

:Delete1PedWait
00D6: if 1
00E1: key_pressed 0 13
00E1: key_pressed 0 16
004D: jump_if_false ££Create2PedsWait
0050: gosub ££Old1PedCleanup

:Create2PedsWait
0001: wait 0 ms
00D6: if 1
00E1: key_pressed 0 5
00E1: key_pressed 0 19
004D: jump_if_false ££Delete2PedsWait
0050: gosub ££Old2PedsCleanup
0050: gosub ££Pick2Peds

:Delete2PedsWait
00D6: if 1
00E1: key_pressed 0 13
00E1: key_pressed 0 19
004D: jump_if_false ££Create3PedsWait
0050: gosub ££Old2PedsCleanup

:Create3PedsWait
0001: wait 0 ms
00D6: if 1
00E1: key_pressed 0 5
00E1: key_pressed 0 15
004D: jump_if_false ££Delete3PedsWait
0050: gosub ££Old3PedsCleanup
0050: gosub ££Pick3Peds

:Delete3PedsWait
00D6: if 1
00E1: key_pressed 0 13
00E1: key_pressed 0 15
004D: jump_if_false ££Create4PedsWait
0050: gosub ££Old3PedsCleanup

:Create4PedsWait
0001: wait 0 ms
00D6: if 1
00E1: key_pressed 0 5
00E1: key_pressed 0 6
004D: jump_if_false ££Delete4PedsWait
0050: gosub ££Old4PedsCleanup
0050: gosub ££Pick4Peds

:Delete4PedsWait
00D6: if 1
00E1: key_pressed 0 13
00E1: key_pressed 0 6
004D: jump_if_false ££CreateCarWait
0050: gosub ££Old4PedsCleanup

:CreateCarWait
0001: wait 0 ms
00D6: if 1
00E1: key_pressed 0 5
00E1: key_pressed 0 18
004D: jump_if_false ££DeleteCarWait
0050: gosub ££OldCarCleanup
0050: gosub ££PickCar

:DeleteCarWait
00D6: if 1
00E1: key_pressed 0 13
00E1: key_pressed 0 18
004D: jump_if_false ££CreateCar2Wait
0050: gosub ££OldCarCleanup

:CreateCar2Wait
0001: wait 0 ms
00D6: if 1
00E1: key_pressed 0 5
00E1: key_pressed 0 17
004D: jump_if_false ££DeleteCar2Wait
0050: gosub ££OldCar2Cleanup
0001: wait 0 ms
0050: gosub ££PickCar2

:DeleteCar2Wait
00D6: if 1
00E1: key_pressed 0 13
00E1: key_pressed 0 17
004D: jump_if_false ££ChangeSkinWait
0050: gosub ££OldCar2Cleanup

:ChangeSkinWait
00D6: if 1
00E1: key_pressed 0 16
00E1: key_pressed 0 19
004D: jump_if_false ££KillAllWait
0050: gosub ££PickSkin

:KillAllWait
0001: wait 0 ms
00D6: if 1
00E1: key_pressed 0 5
00E1: key_pressed 0 4
004D: jump_if_false ££Grp1Anim
0050: gosub ££KillAllCleanup
0002: jump ££Create1PedWait

:Old1PedCleanup
034F: destroy_actor_with_fade $Grp1Ped1
0051: return

:Old2PedsCleanup
034F: destroy_actor_with_fade $Grp2Ped1
034F: destroy_actor_with_fade $Grp2Ped2
0051: return

:Old3PedsCleanup
034F: destroy_actor_with_fade $Grp3Ped1
034F: destroy_actor_with_fade $Grp3Ped2
034F: destroy_actor_with_fade $Grp3Ped3
0051: return

:Old4PedsCleanup
034F: destroy_actor_with_fade $Grp4Ped1
034F: destroy_actor_with_fade $Grp4Ped2
034F: destroy_actor_with_fade $Grp4Ped3
034F: destroy_actor_with_fade $Grp4Ped4
0051: return

:OldCarCleanup
00A6: destroy_car 4@
0051: return

:OldCar2Cleanup
00A6: destroy_car 5@
0051: return

:KillAllCleanup
034F: destroy_actor_with_fade $Grp1Ped1
034F: destroy_actor_with_fade $Grp2Ped1
034F: destroy_actor_with_fade $Grp2Ped2
034F: destroy_actor_with_fade $Grp3Ped1
034F: destroy_actor_with_fade $Grp3Ped2
034F: destroy_actor_with_fade $Grp3Ped3
034F: destroy_actor_with_fade $Grp4Ped1
034F: destroy_actor_with_fade $Grp4Ped2
034F: destroy_actor_with_fade $Grp4Ped3
034F: destroy_actor_with_fade $Grp4Ped4
00A6: destroy_car 4@
00A6: destroy_car 5@
0051: return

:Pick1Ped
0001: wait 250 ms
0050: gosub ££ThePeds
0050: gosub ££CreateCoordPed
009A: $Grp1Ped1 = create_actor 4 $PedSelect at $Fish $Sock $CatFood
020F: set_actor $Grp1Ped1 look_at_player $PLAYER_CHAR
0249: release_model $PedSelect
0051: return

:Pick2Peds
0001: wait 250 ms
0050: gosub ££ThePeds
0050: gosub ££CreateCoordPed
009A: $Grp2Ped1 = create_actor 4 $PedSelect at $Fish $Sock $CatFood
020F: set_actor $Grp2Ped1 look_at_player $PLAYER_CHAR
0249: release_model $PedSelect
0050: gosub ££ThePeds
0050: gosub ££CreateCoordPed
009A: $Grp2Ped2 = create_actor 4 $PedSelect at $Fish $Sock $CatFood
020F: set_actor $Grp2Ped2 look_at_player $PLAYER_CHAR
0249: release_model $PedSelect
0051: return

:Pick3Peds
0001: wait 250 ms
0050: gosub ££ThePeds
0050: gosub ££CreateCoordPed
009A: $Grp3Ped1 = create_actor 4 $PedSelect at $Fish $Sock $CatFood
020F: set_actor $Grp3Ped1 look_at_player $PLAYER_CHAR
0249: release_model $PedSelect
0050: gosub ££ThePeds
0050: gosub ££CreateCoordPed
009A: $Grp3Ped2 = create_actor 4 $PedSelect at $Fish $Sock $CatFood
020F: set_actor $Grp3Ped2 look_at_player $PLAYER_CHAR
0249: release_model $PedSelect
0050: gosub ££ThePeds
0050: gosub ££CreateCoordPed
009A: $Grp3Ped3 = create_actor 4 $PedSelect at $Fish $Sock $CatFood
020F: set_actor $Grp3Ped3 look_at_player $PLAYER_CHAR
0249: release_model $PedSelect
0051: return

:Pick4Peds
0001: wait 250 ms
0050: gosub ££ThePeds
0050: gosub ££CreateCoordPed
009A: $Grp4Ped1 = create_actor 4 $PedSelect at $Fish $Sock $CatFood
020F: set_actor $Grp4Ped1 look_at_player $PLAYER_CHAR
0001: wait 0 ms
0249: release_model $PedSelect
0050: gosub ££ThePeds
0050: gosub ££CreateCoordPed
009A: $Grp4Ped2 = create_actor 4 $PedSelect at $Fish $Sock $CatFood
020F: set_actor $Grp4Ped2 look_at_player $PLAYER_CHAR
0249: release_model $PedSelect
0050: gosub ££ThePeds
0050: gosub ££CreateCoordPed
009A: $Grp4Ped3 = create_actor 4 $PedSelect at $Fish $Sock $CatFood
020F: set_actor $Grp4Ped3 look_at_player $PLAYER_CHAR
0249: release_model $PedSelect
0050: gosub ££ThePeds
0050: gosub ££CreateCoordPed
009A: $Grp4Ped4 = create_actor 4 $PedSelect at $Fish $Sock $CatFood
020F: set_actor $Grp4Ped4 look_at_player $PLAYER_CHAR
0249: release_model $PedSelect
0051: return

:PickCar
0050: gosub ££TheCars
0050: gosub ££CreateCoordCar
00A5:  4@ = create_car $CarSelect at  1@  2@  3@
0175: set_car  4@ z_angle_to 315
0249: release_model $CarSelect
01C3: remove_references_to_car  4@;; Like turning a car into any random car
0001: wait  400 ms
0051: return  

:PickCar2
0050: gosub ££TheCars
0050: gosub ££CreateCoordCar
00A5:  5@ = create_car $CarSelect at  1@  2@  3@
0175: set_car  5@ z_angle_to 315
0249: release_model $CarSelect
01C3: remove_references_to_car  5@;; Like turning a car into any random car
0001: wait  400 ms
0051: return

:PickSkin
0050: gosub ££ThePeds

:SkinCheck
00D6: if  0
0256:   player $PLAYER_CHAR defined
004D: jump_if_false ££SkinCheck
0169: set_fade_color 5 5 5
016A: fade 0 () 500 ms
0001: wait 500 ms
03BF: 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_models
0353: refresh_actor $PLAYER_ACTOR
016A: fade 1 (back) 500 ms
0001: wait 500 ms
03BF: set_player $PLAYER_CHAR ignored_by_everyone_to 0 (false)
01B4: set_player $PLAYER_CHAR frozen_state 1 (unfrozen)
0249: release_model $PedSelect
0051: return

:ThePeds
0004: $PedSelect = 1
0002: jump ££ShowPed

:PedSelectForward
0001: wait 0 ms
00D6: if 0
00E1: key_pressed 0 7
004D: jump_if_false ££PedSelectBack
0002: jump ££NSevenCheck

:PedSelectBack
0001: wait 0 ms
00D6: if 0
00E1: key_pressed 0 5
004D: jump_if_false ££PedSelect
0002: jump ££PSevenCheck

:PedSelect
0001: wait 0 ms
00D6: if 0
00E1: key_pressed 0 15
004D: jump_if_false ££PedSelectForward
009b: destroy_actor $Tmp1Ped
0051: return

:NSevenCheck
00D6: if 0
0038: $PedSelect == 6
004D: jump_if_false ££NPed
0008: $PedSelect += 2

:NPed
0008: $PedSelect += 1
00D6: if 0
0038: $PedSelect == 107
004D: jump_if_false ££ShowPed
0004: $PedSelect = 1
0002: jump ££ShowPed

:PSevenCheck
00D6: if 0
0038: $PedSelect == 9
004D: jump_if_false ££PPed
000C: $PedSelect -= 2

:PPed
000C: $PedSelect -= 1
00D6: if 0
0038: $PedSelect == 0
004D: jump_if_false ££ShowPed
0004: $PedSelect = 106
0002: jump ££ShowPed

:ShowPed
0001: wait 250 ms
00D6: if  0
0256:   player $PLAYER_CHAR defined
004D: jump_if_false ££ShowPed
04C4: create_coordinate $Fish $Sock $CatFood from_actor $PLAYER_ACTOR offset 0.0 1.5 0.0
0247: request_model $PedSelect
038B: load_requested_models

:ShowPed2
00D6: if 0
0248: model  $PedSelect available
004D: jump_if_false ££ShowPed2
009b: destroy_actor $Tmp1Ped
009A: $Tmp1Ped = create_actor 4 $PedSelect at $Fish $Sock $CatFood
020F: set_actor $Tmp1Ped look_at_player $PLAYER_CHAR
0001: wait 250 ms
0249: release_model $PedSelect
0002: jump ££PedSelectForward

:CreateCoordPed
0001: wait 250 ms
00D6: if  0
0256:   player $PLAYER_CHAR defined
004D: jump_if_false ££CreateCoordPed
04C4: create_coordinate $Fish $Sock $CatFood from_actor $PLAYER_ACTOR offset 0.0 1.5 0.0
0247: request_model $PedSelect
038B: load_requested_models

:CreatePed
00D6: if 0
0248: model  $PedSelect available
004D: jump_if_false ££CreatePed
0051: return

:TheCars
0004: $CarSelect = 130
0002: jump ££ShakeItUp

:CarSelectForward
0001: wait 0 ms
00D6: if 0
00E1: key_pressed 0 7
004D: jump_if_false ££CarSelectBack
0002: jump ££N180Check

:CarSelectBack
0001: wait 0 ms
00D6: if 0
00E1: key_pressed 0 5
004D: jump_if_false ££CarSelect
0002: jump ££P180Check

:CarSelect
0001: wait 0 ms
00D6: if 0
00E1: key_pressed 0 15
004D: jump_if_false ££CarSelectForward
00A6: destroy_car 4@
0051: return

:N180Check
00D6: if 0
0038: $CarSelect == 179
004D: jump_if_false ££NCar
0008: $CarSelect += 5

:NCar
0008: $CarSelect += 1
00D6: if 0
0038: $CarSelect == 237
004D: jump_if_false ££ShakeItUp
0004: $CarSelect = 130
0002: jump ££ShakeItUp

:P180Check
00D6: if 0
0038: $CarSelect == 185
004D: jump_if_false ££PCar
000C: $CarSelect -= 5

:PCar
000C: $CarSelect -= 1
00D6: if 0
0038: $CarSelect == 129
004D: jump_if_false ££ShakeItUp
0004: $CarSelect = 236
0002: jump ££ShakeItUp

:ShakeItUp
0001: wait  250 ms
00D6: if  0
0256:   player $PLAYER_CHAR defined
004D: jump_if_false ££ShakeItUp
00D6: if  0
80E0:   NOT   player $PLAYER_CHAR driving
004D: jump_if_false ££ShakeItUp
0172:  0@ = actor $PLAYER_ACTOR z_angle
04C4: create_coordinate  1@  2@  3@ from_actor $PLAYER_ACTOR offset  0.0  4.0  0.0
0247: request_model $CarSelect
038B: load_requested_models

:JustWhatINeeded
0001: wait  250 ms
00D6: if  0
0248:   model $CarSelect available
004D: jump_if_false ££JustWhatINeeded
00A6: destroy_car 4@
00A5:  4@ = create_car $CarSelect at  1@  2@  3@
0175: set_car  4@ z_angle_to 315
0249: release_model $CarSelect
01C3: remove_references_to_car  4@;; Like turning a car into any random car
0001: wait  400 ms
0002: jump ££CarSelectForward

:CreateCoordCar
0001: wait  250 ms
00D6: if  0
0256:   player $PLAYER_CHAR defined
004D: jump_if_false ££CreateCoordCar              
00D6: if  0
80E0:   NOT   player $PLAYER_CHAR driving
004D: jump_if_false ££CreateCoordCar
0172:  0@ = actor $PLAYER_ACTOR z_angle
04C4: create_coordinate  1@  2@  3@ from_actor $PLAYER_ACTOR offset  0.0  4.0  0.0
0247: request_model $CarSelect
038B: load_requested_models

:CreateCar
00D6: if 0
0248: model  $CarSelect available
004D: jump_if_false ££CreateCar
0051: return

:Grp1Anim
0001: wait 250 ms
00D6: if 1
00E1: key_pressed 0 7
00E1: key_pressed 0 19
004D: jump_if_false ££AnimationKey2
03F9: make_actors $Grp2Ped1 $Grp2Ped2 converse_in 200000 ms
0002: jump ££Grp1Anim

:AnimationKey2
0001: wait 250 ms
00D6: if 3
00E1: key_pressed 0 7
00E1: key_pressed 0 15
00E1: key_pressed 0 6
00E1: key_pressed 0 17
004D: jump_if_false ££Create1PedWait
0372: set_actor_wait_state $Grp1Ped 03 2000 ms
0002: 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.

random_download
  • random_download

    :o

  • Members
  • Joined: 07 Mar 2004

#24

Posted 31 May 2005 - 09:51 AM

CODE
00D6: if 0
0039: 0@ == 1
0050: 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:
CODE
set_actor_skin $actor, "IGBuddy"
load_requested_models
refresh_actor_skin $actor
GTA: MA code, but I'm sure you can figure it out.

PatrickW
  • PatrickW

    GTA Juggernaut

  • The Connection
  • Joined: 07 Jan 2004
  • Netherlands
  • Best Script 2013 [DYOM]
    Best Script 2012 [DYOM]

#25

Posted 31 May 2005 - 10:21 AM

QUOTE (random_download @ May 31 2005, 11:51)
CODE
00D6: if 0
0039: 0@ == 1
0050: 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
CODE
00D6: if 0
0039: 0@ == ....
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.

ceedj
  • ceedj

    PEDS Creator

  • Feroci
  • Joined: 21 May 2005
  • None

#26

Posted 31 May 2005 - 11:39 AM Edited by ceedj, 31 May 2005 - 03:24 PM.

@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?"

PatrickW
  • PatrickW

    GTA Juggernaut

  • The Connection
  • Joined: 07 Jan 2004
  • Netherlands
  • Best Script 2013 [DYOM]
    Best Script 2012 [DYOM]

#27

Posted 31 May 2005 - 07:41 PM

QUOTE (ceedj @ May 31 2005, 13:39)
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.


Craig Kostelecky
  • Craig Kostelecky

    GTA:LC Team Leader

  • The Connection
  • Joined: 28 Jan 2004
  • None

#28

Posted 01 June 2005 - 03:44 AM

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.

random_download
  • random_download

    :o

  • Members
  • Joined: 07 Mar 2004

#29

Posted 01 June 2005 - 11:12 AM

QUOTE (Craig Kostelecky @ Jun 1 2005, 03:44)
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.

ceedj
  • ceedj

    PEDS Creator

  • Feroci
  • Joined: 21 May 2005
  • None

#30

Posted 01 June 2005 - 06:01 PM Edited by ceedj, 01 June 2005 - 10:48 PM.

QUOTE (random_download @ Jun 1 2005, 11:12)
QUOTE (Craig Kostelecky @ Jun 1 2005, 03:44)
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




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users