Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

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

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

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

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

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

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

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

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

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

    1. GTA Mods

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

      1. Documentation
    3. Mod Showroom

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

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

    2. Rockstar Collectors

    1. Off-Topic

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

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

    2. Forum Support

    3. Suggestions

(SA) Store pedestrian's current task?


Irsis
 Share

Recommended Posts

Hi everyone, is there a way to store ped's current task in variable?

I have a mod, which make player can interact with pedestrian and replied by waving back(animation) at player. But after ped perform the animation, they stay in the place and dont do anything like they done before performing animation.

I dont want to use 'ped walk into ped path' opcode because it will ruin his original task. (For example: his original task is to stay put, after performing animation they will walk away, ruin his original task)

Is there a solution for this? Thank you

@ZAZ @Strs

 

Link to comment
Share on other sites

On Tue Aug 13 2019 at 9:18 AM, thalilmythos said:

disembark istantly actor could work.

 

23 hours ago, ZAZ said:

post your script

Im sorry my bad. Turns out random ped didnt lose original task even after performing animation coded by external script.

 

New question.

Can we store actor/car/object into cleo global variable? For example:

- 1st script

If

Actor [email protected] defined

Jf blabla

0AB3: var 100 = [email protected]

 

- 2nd script

If

Actor [email protected] defined

Jf blabla

0AB4: [email protected] = var 100

If

Not [email protected] == [email protected]

Jf blabla

 

Im trying to avoid catching the same random ped catched by another script.

Edited by Irsis
Link to comment
Share on other sites

 

Test the script below to see how to detect all peds around

red smoke above actor indicates each catched actor

{$CLEO .cs}
:RandomActor
thread 'RANDACT' 

:RDACT_11
wait 0 
if 
0256:   player $PLAYER_CHAR defined 
jf @RDACT_11

gosub @RDACT_Loop 
wait 0 
jump @RDACT_11 

:RDACT_Loop
31@ = 0 
27@ = 0 

:RDACT_MainLoop
0085: 30@ = 31@ 
29@ = 0 

:RDACT_innerLoop
if and
056D:   actor 30@ defined 
803C:   not  $PLAYER_ACTOR == 30@
jf @RDACT_Skip 
04C4: create_coordinate 25@ 26@ 28@ from_actor 30@ offset 0.0 0.0  1.2
095C: create_smoke_at 25@ 26@ 28@ velocity 0.0 0.0 1.0 RGBA 1.0 0.0  0.0  1.0 size 0.5 last_factor 0.1//red 
095C: create_smoke_at 25@ 26@ 28@ velocity 0.0 0.0 3.0 RGBA 1.0 0.0  0.0  1.0 size 0.5 last_factor 0.1//red 
095C: create_smoke_at 25@ 26@ 28@ velocity 0.0 0.0 5.0 RGBA 1.0 0.0  0.0  1.0 size 0.5 last_factor 0.1//red 

27@ += 1 
jump @RDACT_continue 

:RDACT_Skip
30@ += 1 
29@ += 1 
29@ > 127 
jf @RDACT_innerLoop 

:RDACT_continue
31@ += 256 
if or
27@ > 24 
31@ > 35584 
jf @RDACT_MainLoop 
return

 

 

 

 

 

then test this script, it use opcode 0AE1 to detect all peds around

{$CLEO .cs}
:RandomActor_Cleo4_OPCODE_0AE1
thread 'RANDACT'
wait 5000

while true
wait 0
    if
        0256:   player $PLAYER_CHAR defined 
    then
        gosub @restore
        gosub @RandomActor_sub
        wait 1000
    end
end

:restore
for 27@ = 0 to 20 step 1
0@(27@,32i) = -1
end
27@ = 0
0@(23@,32i) = 0
return



:RandomActor_sub
for 27@ = 0 to 20
00A0: store_actor $PLAYER_ACTOR position_to 29@ 30@ 31@
    if
        0AE1:   0@(27@,32i) = random_actor_near_point 29@ 30@ 31@ in_radius 50.0 find_next 1 pass_deads 1
    then
        04C4: create_coordinate 25@ 26@ 28@ from_actor 0@(27@,32i) offset 0.0 0.0  1.2
        095C: create_smoke_at 25@ 26@ 28@ velocity 0.0 0.0 1.0 RGBA 1.0 0.0  0.0  1.0 size 0.5 last_factor 0.1//red 
        095C: create_smoke_at 25@ 26@ 28@ velocity 0.0 0.0 3.0 RGBA 1.0 0.0  0.0  1.0 size 0.5 last_factor 0.1//red 
        095C: create_smoke_at 25@ 26@ 28@ velocity 0.0 0.0 5.0 RGBA 1.0 0.0  0.0  1.0 size 0.5 last_factor 0.1//red 

    end
end
return

 

 

 

 

 

 

 

 

 

 

Edited by ZAZ
Link to comment
Share on other sites

Another GTA Fan

um... couldn't you just remove references to the ped after you've interacted with them using that mod?

When you remove references to an actor, it basically turns them into a pedestrian so they should return back to walking around and doing what pedestrains do.

 

You said you've got a mod that lets you interact with peds, but after they've performed the animation, they just stand still, right? Just remove their references afterwards, unless I'm missing the point here?

Link to comment
Share on other sites

@ZAZ Both script still catching the same ped? And about my earlier question, can i store actor into cleo global variable? If i cant, how can i store them and retrieve them in another script so i can check if they are the same ped or not? Thank you

1 hour ago, Recommended said:

um... couldn't you just remove references to the ped after you've interacted with them using that mod?

When you remove references to an actor, it basically turns them into a pedestrian so they should return back to walking around and doing what pedestrains do.

 

You said you've got a mod that lets you interact with peds, but after they've performed the animation, they just stand still, right? Just remove their references afterwards, unless I'm missing the point here?

What if ped's job is standing(security ped for example) and after interacted them then use remove reference, they will just walk away. They lost their original task, which is to stay put.

Beside, I'll never use remove reference after using 0AE1. it will screw your other script that also meddling with random peds.

Link to comment
Share on other sites

Another GTA Fan

oh I see now. In that case, this will work:

 

0687: clear_actor [email protected] task

 

I also use a mod that allows me to talk to any ped, so I have this code clear up the animations when no longer being used. It works totally fine for me, and the ped/actor's return back to whatever they're doing, including if they run from a script where they act like guards, etc. This shouldn't break their script.

Link to comment
Share on other sites

39 minutes ago, Recommended said:

oh I see now. In that case, this will work:

 

 

0687: clear_actor [email protected] task

 

 

I also use a mod that allows me to talk to any ped, so I have this code clear up the animations when no longer being used. It works totally fine for me, and the ped/actor's return back to whatever they're doing, including if they run from a script where they act like guards, etc. This shouldn't break their script.

Its okay. like my earlier post, turns out random ped wont lose their task even after performing animation. so 'disembark instantly' and 'clear actor task' isnt necessary. but thanks for your help

Link to comment
Share on other sites

thalilmythos

You could make the actor do the animation with the first script, and catch him doing the animation in the second script.

It would work like this

Script one: Actor [email protected] perform animation

Script 2:

store player position
Get random actor [email protected] at player's position. (i believe Junior explained to you how to do this somwhere around the forums)

If actor [email protected] performing animation

:stillperforming
if 
not actor [email protected] performing animation
jf @still performing

This is where you say the actor stand still right? Well, make him do whatever it's going to do,
 

Edited by thalilmythos
Link to comment
Share on other sites

44 minutes ago, thalilmythos said:

You could make the actor do the animation with the first script, and catch him doing the animation in the second script.

It would work like this

Script one: Actor [email protected] perform animation

Script 2:

store player position
Get random actor [email protected] at player's position. (i believe Junior explained to you how to do this somwhere around the forums)

If actor [email protected] performing animation

:stillperforming
if 
not actor [email protected] performing animation
jf @still performing

This is where you say the actor stand still right? Well, make him do whatever it's going to do,
 

Problem about ped stand still, actor task, etc. Is pretty much solved.

 

The new problem is about the possibility of storing actor into var and retrieve it in another script, so i wont catching the same ped.

 

About your example, what if ped didnt do particular animation?

Scenario:

 

- Script 1

[email protected] Catch random actor

If

Actor [email protected] defined

Jf

 

- Script 2

[email protected] catch random actor

If

Actor [email protected] defined

Jf

--> how to check if actor [email protected] from script 2 is different from Script 1? Using cleo global var?

Link to comment
Share on other sites

Let say you have these two separate script file:

Script_Example_One.cs

[...]
009A: [email protected] = create_actor_pedtype 4 model #MALE01 at 0.0 0.0 0.0
0AB3: var 100 = [email protected]
[...]

Script_Example_Two.cs

[...]
0AE1: [email protected] = random_actor_near_point [email protected] [email protected] [email protected] in_radius 10.0 find_next 1 pass_deads 1
if
056D:   actor [email protected] defined
jf @Somewhere_Around_This_Script
0AB4: [email protected] = var 100
if
003B:   [email protected] == [email protected]  // (int) check if this script catch the same actor from the first script (notice var is 100)
jf @Somewhere_Around_This_Script
[you finally catch the same actor]
[now do something in this part]

I hope this helps.

Link to comment
Share on other sites

1 hour ago, In45do said:

Let say you have these two separate script file:

Script_Example_One.cs

[...]
009A: [email protected] = create_actor_pedtype 4 model #MALE01 at 0.0 0.0 0.0
0AB3: var 100 = [email protected]
[...]

Script_Example_Two.cs

[...]
0AE1: [email protected] = random_actor_near_point [email protected] [email protected] [email protected] in_radius 10.0 find_next 1 pass_deads 1
if
056D:   actor [email protected] defined
jf @Somewhere_Around_This_Script
0AB4: [email protected] = var 100
if
003B:   [email protected] == [email protected]  // (int) check if this script catch the same actor from the first script (notice var is 100)
jf @Somewhere_Around_This_Script
[you finally catch the same actor]
[now do something in this part]

I hope this helps.

So its possible to store actor/object/vehicle into cleo global var? Not just float/Integer value? Thanks

Link to comment
Share on other sites

  • 2 weeks later...

topic was (SA) Store pedestrian's current task?

i was about to help but looks like you got what you looking for 

by reading title (SA) Store pedestrian's current task?i thought you need script to store task of ped what he was doing example if he was attacking some one or doing anything if he dies and you can restore that task and paste to any ped so new ped do same thing as ped who dies or you can copy task and paste to all peds so all peds do same thing :) 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

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