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.

Research into recording player actions and replaying the


elsewhat
 Share

Recommended Posts

For the next major release of Scene Director https://www.gta5-mods.com/scripts/scene-directorI'm planning to implement a feature for recording the actions of the player and replaying them automatically afterwards.

 

Unfortunately, I'm having some issues with playing back player movements.

 

In the API there are three different ways of playing back player movements:

  1. AI::TASK_FOLLOW_WAYPOINT_RECORDING
  2. AI::TASK_GO_STRAIGHT_TO_COORD
  3. AI::TASK_FOLLOW_POINT_ROUTE

Alternative 1: AI::TASK_FOLLOW_WAYPOINT_RECORDING

AI::TASK_FOLLOW_WAYPOINT_RECORDING is the one used most in the scripts. Unfortunately, it requires that the waypoints are read from resources (x64f.rdf/levels/gta5/waypointrec.rdf).

Example:

AI::REQUEST_WAYPOINT_RECORDING("agency3a_michael_5");....AI::TASK_FOLLOW_WAYPOINT_RECORDING(0, "agency3a_michael_5", 0, 296, -1);

Would be interesting to find out how and where the waypoint recordings are stored. But since I need to record actions on the fly it is not really an alternative.

 

Alternative 2 AI::TASK_GO_STRAIGHT_TO_COORD

 

This API works quite well, but the ped pauses once he's finished one task, before continuing to the next. Since I need to record 1-5 waypoint pr second for a smooth motion, it doesn't work in my case.

Here's my working code for it (actorRecording is the vector I've stored the recorded Vector3 locations)

//Attempt: AI::TASK_GO_STRAIGHT_TO_COORD - Kind of works, but the actor pauses between each coord before moving to the nextTaskSequence actorSeq;AI::OPEN_SEQUENCE_TASK(&actorSeq);    //0xec17e58, 0xbac0f10b, 0x3f67c6af, 0x422d7a25, 0xbd8817db, 0x916e828c -> "motionstate_idle", "motionstate_walk", "motionstate_run", "motionstate_actionmode_idle", and "motionstate_actionmode_walk"//not really necessaryAI::TASK_FORCE_MOTION_STATE(0, 0xbac0f10b, 0);for (int i =0; i < actorRecording.size(); i++) {    ActorRecordingItem recordingItem = actorRecording[i];    AI::TASK_GO_STRAIGHT_TO_COORD(0, recordingItem.getLocation().x, recordingItem.getLocation().y, recordingItem.getLocation().z, 2.0f, -1, recordingItem.getHeading(), 0);}AI::CLOSE_SEQUENCE_TASK(actorSeq);AI::TASK_PERFORM_SEQUENCE(actorPed, actorSeq);AI::CLEAR_SEQUENCE_TASK(&actorSeq);

Alternative 3: AI::TASK_FOLLOW_POINT_ROUTE

 

This one is also used a handful of times in the scripts. It should be trivial to implement but it just doesn't work as it should.

The TASK_EXTEND_ROUTE commands are ignored. Instead the the ped runs to coordinates x=0, y=0.

If you don't issue any TASK_EXTEND_ROUTE commands, the ped does nothing.

 

Below is my current code. The parameters here to TASK_EXTEND_ROUTE are currently double (a futile experiment based on that the scripts use double), but the same effect happens if they're float (ie Vector3.x/y/z).

I also find it a bit strange that the TASK_EXTEND_ROUTE is never directly connected to TASK_FOLLOW_POINT_ROUTE.

TaskSequence actorSeq;AI::OPEN_SEQUENCE_TASK(&actorSeq);AI::TASK_FLUSH_ROUTE();AI::TASK_EXTEND_ROUTE(1379.367554, 3173.189209, 40.455093);AI::TASK_EXTEND_ROUTE(1380.481201, 3170.556885, 40.426697);AI::TASK_EXTEND_ROUTE(1383.024658, 3164.550049, 40.414001);AI::TASK_FOLLOW_POINT_ROUTE(0, 2.0f, 0);AI::CLOSE_SEQUENCE_TASK(actorSeq);AI::TASK_PERFORM_SEQUENCE(actorPed, actorSeq);AI::CLEAR_SEQUENCE_TASK(&actorSeq);

Any input from other mod makers on what works or not? I hope we can get AI::TASK_FOLLOW_POINT_ROUTE to work

Edited by elsewhat
Link to comment
Share on other sites

Recording of player state/actions is working fine. The issue is with how to playback these actions afterwards.

Remember I need to playback different actions for each of the actors (currently supporting 9 actors).

 

Which native are you refering to when you say AI::TASK_FOLLOW ?

I dont't know of any native which accepts key presses as input.

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.