Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. The Criminal Enterprises
      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. Support

    3. Suggestions

*DO NOT* SHARE MEDIA OR LINKS TO LEAKED COPYRIGHTED MATERIAL. Discussion is allowed.

[HELP] Spawn ped and set behavior?


kal-el5676
 Share

Recommended Posts

Yo guys. I just want to spawn a ped at my coods, i want it to walk around aimlessly, i want to be able to choose whether it's aggressive or not, and i want to repeat this several times for many peds. No weapons. Please help! Thanks!

Link to comment
Share on other sites

I need the code, duh.

So you want a code that spawns a ped on your coords and can set its behavior(pedtype?)?

Link to comment
Share on other sites

Well, yes, but i have tried using different ped types and the ped continues to just stand there. i tried using ped type 7 or whatever the ballas is to make it aggressive and no luck. i am using a stripped scm. dunno if that matters.

 

Oh, and like i said i want it to walk around, not just stand there.

Edited by kal-el5676
Link to comment
Share on other sites

Well, yes, but i have tried using different ped types and the ped continues to just stand there. i tried using ped type 7 or whatever the ballas is to make it aggressive and no luck. i am using a stripped scm. dunno if that matters.

 

Oh, and like i said i want it to walk around, not just stand there.

Remove the Actor References with Actor.RemoveReferences and he will walk around but he can disapear!

Just set his pedtype to 23 and then use 077A on all pedtypes you want smile.gif

Link to comment
Share on other sites

Ok, your gonna have to level with me. i suck at coding. Which is the remove references opcode? where do i put it? and please explain the 077A thing.

 

 

The code i'm using:

 

{$CLEO .cs}//-------------MAIN---------------thread 'DINOS'0A95: enable_thread_saving:Threadwait 0Model.Load(#FAM3)ifModel.Available(#FAM3)jf @Thread009A: [email protected] = create_actor_pedtype 23 model #FAM3 at 2.0 0.0 0.00A93: end_custom_thread 

 

Link to comment
Share on other sites

 

Ok, your gonna have to level with me. i suck at coding. Which is the remove references opcode? where do i put it? and please explain the 077A thing.

 

 

The code i'm using:

 

{$CLEO .cs}//-------------MAIN---------------thread 'DINOS'0A95: enable_thread_saving:Threadwait 0Model.Load(#FAM3)ifModel.Available(#FAM3)jf @Thread009A: [email protected] = create_actor_pedtype 23 model #FAM3 at 2.0 0.0 0.00A93: end_custom_thread 

 

 

{$CLEO .cs}//-------------MAIN---------------//You dont need this lolthread 'DINOS'//0A95: enable_thread_saving you don't need this!:IFwait 0if00E1:   player 0 pressed_key 8jf @IF04C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset 0.0 0.0 5.0 :Threadwait 0Model.Load(#FAM3):Checkwait 0ifModel.Available(#FAM3)jf @Check009A: [email protected] = create_actor_pedtype 23 model #FAM3 at [email protected] [email protected] [email protected]: set_actor [email protected] acquaintance 4 to_actors_pedtype 6 // Sets the Actor to make him aggresive to Pedtype 6(Cops)Actor.RemoveReferences([email protected])Model.Destroy(#FAM3)0A93: end_custom_thread 

 

The Code starts when you press G then the Actor you use will spawn before you!

Link to comment
Share on other sites

Appreciate it, but i want it to spawn always, not with a prompt. also, he is not aggressive. I want to use this for multiple actors, so i need it to be repeated as well.

Link to comment
Share on other sites

  • 2 weeks later...

WILL SOMEONE PLEASE HELP ME? I realise it's a dumb question, but i'm not a coder. I'm sitting here pulling my hair out trying to get this to work. I cant spawn a ped via 2dfx cuz it's always the wrong ones. i cant set the id numbers. i can spawn a ped but it just stands there. i want to, set it to aggressive or not, and have it walk around randomly. no hit this button, just spawn all the time. i know this is simple which is why it's driving me bonkers!!! someone PLEASE help! suicidal.gifsuicidal.gifsuicidal.gifsuicidal.gifsuicidal.gif

 

And i have searched EVERYWHERE so please don't say that.

Edited by kal-el5676
Link to comment
Share on other sites

 

{$CLEO}thread 'DINOS':IFwait 0if00E1:   player 0 pressed_key 8jf @IF04C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset 0.0 0.0 5.0:Threadwait 0Model.Load(#FAM3):Checkwait 0ifModel.Available(#FAM3)jf @Check009A: [email protected] = create_actor_pedtype 7 model #FAM3 at [email protected] [email protected] [email protected]: AS_actor [email protected] kill_actor $PLAYER_ACTORwait 200 msjump @IF

 

 

Link to comment
Share on other sites

Is this done with a prompt? i appreciate it but i want it to spawn all the time not by pressing a button. also i want it repeated numerous times at multiple coords. i don't want it to appear in front of me everytime. please read the thread next time.

Edited by kal-el5676
Link to comment
Share on other sites

  • 10 years later...
  • 3 months later...

{$Cleo}
0000:
while true
01F5: [email protected] = get_player_actor 0 
0208: [email protected] = random_float_in_ranges 30.0 -30.0
0208: [email protected] = random_float_in_ranges 30.0 -30.0
04C4: store_coords_to [email protected] [email protected] [email protected] from_actor [email protected] with_offset [email protected] [email protected] 0.0
02C0: store_to [email protected] [email protected] [email protected] ped_path_coords_closest_to [email protected] [email protected] [email protected]
0376: [email protected] = create_random_actor_at [email protected] [email protected] [email protected]
060B: set_actor [email protected] decision_maker_to 1 //check below set 0 to  6 you liking 
05DE: AS_actor [email protected] walk_around_ped_path
0187: [email protected] = create_marker_above_actor [email protected]  //this marker just to show ped where they spawn you can remove it 
wait  1000    
01C2: remove_references_to_actor [email protected] // Like turning an actor into a random pedestrian
end

{
060B: set_actor [email protected] decision_maker_to 1

Decision Maker 0 - the behavior of the actor in the group
Decision Maker 1 - Model behavior
Decision Maker 2 - the usual model
Decision Maker 3 - brave behavior
Decision Maker 4 - cowardly behavior
Decision Maker 5 - Fire behavior
Decision Maker 6 - train driver (?)
}

 

remember this peds spawn only if there is peds path (where you see a lot peds walking)

 

why  ? because no sense at all they even spawn in water ? or you fly that's why interior they wont spawn

  • Like 1
Link to comment
Share on other sites

  • 1 year later...
AlbertWesker
On 2/28/2021 at 2:04 PM, Strs said:

{$Cleo}
0000:
while true
01F5: [email protected] = get_player_actor 0 
0208: [email protected] = random_float_in_ranges 30.0 -30.0
0208: [email protected] = random_float_in_ranges 30.0 -30.0
04C4: store_coords_to [email protected] [email protected] [email protected] from_actor [email protected] with_offset [email protected] [email protected] 0.0
02C0: store_to [email protected] [email protected] [email protected] ped_path_coords_closest_to [email protected] [email protected] [email protected]
0376: [email protected] = create_random_actor_at [email protected] [email protected] [email protected]
060B: set_actor [email protected] decision_maker_to 1 //check below set 0 to  6 you liking 
05DE: AS_actor [email protected] walk_around_ped_path
0187: [email protected] = create_marker_above_actor [email protected]  //this marker just to show ped where they spawn you can remove it 
wait  1000    
01C2: remove_references_to_actor [email protected] // Like turning an actor into a random pedestrian
end

{
060B: set_actor [email protected] decision_maker_to 1

Decision Maker 0 - the behavior of the actor in the group
Decision Maker 1 - Model behavior
Decision Maker 2 - the usual model
Decision Maker 3 - brave behavior
Decision Maker 4 - cowardly behavior
Decision Maker 5 - Fire behavior
Decision Maker 6 - train driver (?)
}

 

remember this peds spawn only if there is peds path (where you see a lot peds walking)

 

why  ? because no sense at all they even spawn in water ? or you fly that's why interior they wont spawn

This is awesome. Do you by chance know how I can make the peds kill the player and what opcode to use in this script? Because I added 05E2: AS_actor [email protected] kill_actor $PLAYER_ACTOR  and it doesn't seem to work. Any help would be appreciated.

Link to comment
Share on other sites

your ped which should kill player 


0747: clear_acquaintance 0 of_actors_pedtype [email protected] to_actors_pedtype 0 //0 to remove if this pedtype respect pedtype 0 which is player pedtype 
0747: clear_acquaintance 1 of_actors_pedtype [email protected] to_actors_pedtype 0 //1 to remove if this pedtype Likes pedtype 0 which is player pedtype 
then you add this to hate player 
077B: clear_actor [email protected] acquaintance 4 to_actors_pedtype 0 //4 is hate most badly to pedtype 0 player type

your ped which should kill player 

0747: clear_acquaintance 0 of_actors_pedtype [email protected] to_actors_pedtype 0 //0 to remove if this pedtype respect pedtype 0 which is player pedtype 
0747: clear_acquaintance 1 of_actors_pedtype [email protected] to_actors_pedtype 0 //1 to remove if this pedtype Likes pedtype 0 which is player pedtype 
then you add this to hate player 

077A: set_actor [email protected] acquaintance 4 to_actors_pedtype 0 //4 is hate most badly to pedtype 0 player type

this is ok but after re start game after you save then it works 
0746: set_acquaintance 4 of_actors_pedtype 23 to_actors_pedtype 0 //pedtype 23 is your ped type if you use as balas you use 7


if you want instant effect you use this
077A: set_actor [email protected] acquaintance 4 to_actors_pedtype 0

Edited by Strs
i forgot
Link to comment
Share on other sites

AlbertWesker
6 hours ago, Strs said:

Thanks for your reply, your help is much appreciated. I have been playing around with your code, but I can't seem to get it working the way i had in mind. It does make the peds attack me. but for some reason they run away when I fight back.

 

I'm actually trying to make them behave like zombies. I'm trying to spawn in about 14 peds that I can choose, like fam1, fam2, fam3 etc. that attack the player, and the moment the ped dies, they respawn again.

 

Similair to the VC mod in this video at 2:45. But i'm trying to make it for SA off course. You got any tips for me?

 

Link to comment
Share on other sites

19 hours ago, AlbertWesker said:

Because I added 05E2: AS_actor [email protected] kill_actor $PLAYER_ACTOR  and it doesn't seem to work. Any help would be appreciated.

 

opcode 05E2: should work

but i assume the construct of your script is bad

or you gave a new task to the actor

so same advice as always: please post your script

  • Like 1
Link to comment
Share on other sites

just use enemy zombies pedtype to 23 (special) or 7 (Ballas) or 9 (Vagos) they hate badly player and yea you can choose any skin but what matters is pedtype never use families pedtype 8 for enemy they run away most of time they dont attack back and if you look above i give  this 

{
060B: set_actor [email protected] decision_maker_to 1

Decision Maker 0 - the behavior of the actor in the group
Decision Maker 1 - Model behavior
Decision Maker 2 - the usual model
Decision Maker 3 - brave behavior
Decision Maker 4 - cowardly behavior
Decision Maker 5 - Fire behavior
Decision Maker 6 - train driver (?)
}

 

you can use this Decision Maker 3 - brave behavior or this Decision Maker 0 - the behavior of the actor in the group other ped run from players and if possible take a look in some zombies mods how they done so some idea you can get 

Edited by Strs
hmm
  • Like 1
Link to comment
Share on other sites

AlbertWesker
2 hours ago, Strs said:

just use enemy zombies pedtype to 23 (special) or 7 (Ballas) or 9 (Vagos) they hate badly player and yea you can choose any skin but what matters is pedtype never use families pedtype 8 for enemy they run away most of time they dont attack back and if you look above i give  this 

{
060B: set_actor [email protected] decision_maker_to 1

Decision Maker 0 - the behavior of the actor in the group
Decision Maker 1 - Model behavior
Decision Maker 2 - the usual model
Decision Maker 3 - brave behavior
Decision Maker 4 - cowardly behavior
Decision Maker 5 - Fire behavior
Decision Maker 6 - train driver (?)
}

 

you can use this Decision Maker 3 - brave behavior or this Decision Maker 0 - the behavior of the actor in the group other ped run from players and if possible take a look in some zombies mods how they done so some idea you can get 

Thanks for your insight. I'm gonna try to figure it out!

Link to comment
Share on other sites

AlbertWesker

Okay, so I've been trying some things out and have been reading alot and compared to other zombie scripts, and now i'm able to actually spawn in the actor and make him kill the player.

 

Thanks Strs, because you brought me on the right track. 

The only things I haven't figured out yet are respawing the actor when he's dead, so he's like a returning zombie, Right now the actor doesn't respawn after being killed.

 

I'm still figuring how to make the script spawn 14 or so peds with models I choose. 

 

As for ZAZ, this is the script i'm working with right now.  

 

 

:ZOMBIE
script_name 'ZOMBIE' 
06D7: enable_train_traffic 0 
06D0: enable_emergency_traffic 0 
01EB: set_traffic_density_multiplier_to 0.0 
03DE: set_pedestrians_density_multiplier_to 0.0 
0923: enable_air_traffic 0 

0000:
while true
01F5: [email protected] = get_player_actor 0 
04C4: store_coords_to [email protected] [email protected] [email protected] from_actor [email protected] with_offset [email protected] [email protected] 0.0
02C0: store_to [email protected] [email protected] [email protected] ped_path_coords_closest_to [email protected] [email protected] [email protected]
0376: [email protected] = create_random_actor_at [email protected] [email protected] [email protected]
060B: set_actor [email protected] decision_maker_to 65536
05DE: AS_actor [email protected] walk_around_ped_path
0489: set_actor [email protected] muted 1 
0946: set_actor [email protected] actions_uninterupted_by_weapon_fire 1 
Actor.SetWalkStyle([email protected], "OLDMAN")
03FE: set_actor [email protected] money 0
0332: set_actor [email protected] bleeding 1
wait  1000    
01C2: remove_references_to_actor [email protected]
jump @ZOMBIE1

 

:ZOMBIE1
077A: set_actor [email protected] acquaintance 4 to_actors_pedtype 0
05E2: AS_actor [email protected] kill_actor $PLAYER_ACTOR

jump @ZOMBIE2

 

:ZOMBIE2
wait 0  
if
   Actor.Dead([email protected])
   jump @ZOMBIE1
terminate_this_script           

 

 

Link to comment
Share on other sites

as i thought, here's the main problem

01C2: remove_references_to_actor 0@
jump @ZOMBIE1

:ZOMBIE1
077A: set_actor 0@ acquaintance 4 to_actors_pedtype 0
05E2: AS_actor 0@ kill_actor $PLAYER_ACTOR

 

01C2: remove_references_to_actor 0@  <--- this code release the actor instance [email protected], so he didn't exist anymore for the script

 

so these codes don't work because references_to_actor [email protected] was already removed

077A: set_actor [email protected] acquaintance 4 to_actors_pedtype 0
05E2: AS_actor [email protected] kill_actor $PLAYER_ACTOR

 

Furthermore, after creating the actor and giving behaviour, it needs to keep the code looping, and let it run through some conditional checks while looping,
checking if player_char is still present, checking if the actor is not dead, checking if the actor is not far away.
If actor is dead or far way, THEN REMOVE REFERENCE TO ACTOR (opcode 01C2:) and then script can restart and spawn again the actor

 

I wrote the script in high level syntax
Recompile the script, then you can see it in classical low level syntax
We recommand to learn high level, read this tutorial

 

{$CLEO .cs}
script_name 'ZOMBIE' 
06D7: enable_train_traffic 0 
06D0: enable_emergency_traffic 0 
01EB: set_traffic_density_multiplier_to 0.0 
03DE: set_pedestrians_density_multiplier_to 0.0 
0923: enable_air_traffic 0 

while true
    wait 0
    if 
        0256:   player $PLAYER_CHAR defined
    then
        01F5: 0@ = get_player_actor 0
        0208: 1@ = random_float_in_ranges 30.0 -30.0
        0208: 2@ = random_float_in_ranges 30.0 -30.0 
        04C4: store_coords_to 0@ 1@ 2@ from_actor 0@ with_offset 1@ 2@ 0.0
        02C0: store_to 0@ 1@ 2@ ped_path_coords_closest_to 0@ 1@ 2@
        0376: 0@ = create_random_actor_at 0@ 1@ 2@
        060B: set_actor 0@ decision_maker_to 65536
        05DE: AS_actor 0@ walk_around_ped_path
        0489: set_actor 0@ muted 1 
        0946: set_actor 0@ actions_uninterupted_by_weapon_fire 1 
        Actor.SetWalkStyle(0@, "OLDMAN")
        03FE: set_actor 0@ money 0
        0332: set_actor 0@ bleeding 1
        //077A: set_actor 0@ acquaintance 4 to_actors_pedtype 0
        05E2: AS_actor 0@ kill_actor $PLAYER_ACTOR

        while 0256:   player $PLAYER_CHAR defined
            wait 0
            if
                not Actor.Dead(0@)
            then
                if
                    80F2: not  actor 0@ near_actor $PLAYER_ACTOR radius 120.0 120.0 sphere 0
                then
                    break
                end
            else
                break
            end
        end
        
        01C2: remove_references_to_actor 0@
        
    end
end

 

 

 

  • Like 1
Link to comment
Share on other sites

AlbertWesker

Thanks ZAZ, you truly are a lifesaver, the script works perfectly now, I appreciate you taking the time to help me out . I'm also gonna take my time and read the tutorial since I've got a lot to learn when it comes to syntaxes, my coding skills are pretty basic at this point. 👍

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.