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
    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 Mods
    6. GTA Chinatown Wars

    7. GTA Vice City Stories

    8. GTA Liberty City Stories

    9. GTA San Andreas

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

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

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

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

      1. Merchandising
    1. GTA Modding

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

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

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

    2. Rockstar Games

    1. Off-Topic

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

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

    2. Forum Support

    3. Site Suggestions

Sign in to follow this  
Irsis

(SA) Store pedestrian's current task?

Recommended Posts

Irsis

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

 

Share this post


Link to post
Share on other sites
thalilmythos

disembark istantly actor could work.

Share this post


Link to post
Share on other sites
ZAZ

post your script

Share this post


Link to post
Share on other sites
Irsis
Posted (edited)
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

Share this post


Link to post
Share on other sites
ZAZ
Posted (edited)

 

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

Share this post


Link to post
Share on other sites
Recommended

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?

Share this post


Link to post
Share on other sites
Irsis

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

Share this post


Link to post
Share on other sites
Recommended

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.

Share this post


Link to post
Share on other sites
Irsis
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

Share this post


Link to post
Share on other sites
thalilmythos
Posted (edited)

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

Share this post


Link to post
Share on other sites
Irsis
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?

Share this post


Link to post
Share on other sites
In45do

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.

Share this post


Link to post
Share on other sites
Irsis
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

Share this post


Link to post
Share on other sites

Join the conversation

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

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

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

×   Your previous content has been restored.   Clear editor

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

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.