Quantcast

Jump to content

» «
Photo

San Andreas Enex Documentation

38 replies to this topic
Firewalker999
  • Firewalker999

    Liberty City

  • Members
  • Joined: 30 Sep 2007
  • Lithuania

#31

Posted 13 October 2008 - 01:51 PM

thanks for this

melolo
  • melolo

    Player Hater

  • Members
  • Joined: 25 Jan 2008

#32

Posted 15 February 2009 - 07:26 AM

@OrionSR:

Hi mr. helpful man. tounge.gif
Im in need of some tips about ENEX again, hope you got some. I have made most interiors accesible for "group", so hommies can enter with you into clothing shops, burgers, or whatever. BUT the problem is that mission buddies (Ryder, Smoke..) than are your "group" during mission, enter to that places... but never leave again; so you lose them, so you fail mission. (Not only that...it makes for an ugly side efect: as, say, Ryder, is stuck into the Clucking Bell interior, maybe you lost him there in the East LS clucking b., but you will find Ryder inside if you go to the clucking b. in dessert or any other place...) So... do you know some flag that would allow in-mission buddies work the ENEX properly, like the hommies do out of missions? Thanks in advance!

And a little finding i did: As i told you before, the "2" flag makes CJ to not do the open-door anim. But i though it had to be, or not be, in both "sides" of the ENEX. I found that this is not true: 27/7 don't have the "2" flag (so CJ opens door from inside), but if you put the "2" flag in the outside door (because there is a buggy door you dont want CJ to try use), works correctly. Ahem... not sure if i explained myself correctly: i mean, exterior ENEX with "2" flag, connected to interior ENEX without it, works fine. smile.gif

Hope it doesn't make my mod explode...

OrionSR
  • OrionSR

    Chain Game Development Team

  • Feroci Racing
  • Joined: 23 May 2007
  • None
  • Helpfulness Award [GTA & Modding]

#33

Posted 22 February 2009 - 08:42 PM Edited by OrionSR, 22 February 2009 - 08:46 PM.

I have not experimented with the 2 flag and don't have any plans to investigate the matter. Hopefully you'll work it all out.

My modding skills are a bit rusty. Hopefully the following information is accurate.

The group flag works on the destination side of the enex. If you enable the group flag on the Burgershot interior, then NPCs in your group should be able to follow CJ as he enters any of the exterior doors that access the Burgershot interior. In order for the group members to follow CJ back out again the group flag will need to be enabled on the exterior connections to the Burgershot.

Some missions, in particular the dating missions, check for an appropriate region. For example, with the group flag set on the Ganton Gym, Denise will follow CJ into the gym, but then will fade out and the date will fail.

Other Notes:

The group flag didn't work as expected for vehicle warps. The group members will make the transition, but will not be in/on the vehicle on the other side of the destination.

I was quite surprised to learn that some flags are read from the disc rather than, or in addition to, using the data in the save file. I noticed this when working with the burglary flags. IIRC correctly, the unknown burglary flag is always read from disc, and allows the game to possibly reuse that enex for something else. I'm not sure, but I think the regular burglary flag will enable/disable the door when the burglar mission is started or stopped when set in the save file, and will disable the "hours of operation" when set in the IPL file. I doubt this is causing any problems with your mod, but if you are getting inconsistent results from your enex settings then this might be something worth looking into.

melolo
  • melolo

    Player Hater

  • Members
  • Joined: 25 Jan 2008

#34

Posted 26 February 2009 - 03:03 AM

QUOTE (OrionSR @ Feb 22 2009, 20:42)
The group flag works on the destination side of the enex. If you enable the group flag on the Burgershot interior, then NPCs in your group should be able to follow CJ as he enters any of the exterior doors that access the Burgershot interior. In order for the group members to follow CJ back out again the group flag will need to be enabled on the exterior connections to the Burgershot.

Hi!
Yeah, i have the group flag enabled on both sides, interior and all exterior doors leading to that interior. Recruited hommies dont cause problems, they follow you in and out. It is the in-mission buddies (Ryder, Sweet...) who get trapped insisde if you enter with them. Any clue?

TheSiggi
  • TheSiggi

    Surgeon

  • Members
  • Joined: 05 Jul 2009

#35

Posted 16 August 2009 - 12:41 PM

thats very useful

thanks alot

OrionSR
  • OrionSR

    Chain Game Development Team

  • Feroci Racing
  • Joined: 23 May 2007
  • None
  • Helpfulness Award [GTA & Modding]

#36

Posted 16 August 2009 - 04:19 PM

Link to NTAuthority's topic on the temporary burglary connections:
[DOC] Burglary homes list/map, and some hints.

Enex Data in Memory:
CODE
0x00 character[7]        Name of Enex string
0x07 byte                nul terminator of string (00)
0x08 float               XinMin (X - X width/2)
0x0C float               YinMax (Y + Y width/2)
0x10 float               XinMax (X + X width/2)
0x14 float               YinMin (Y - Y width/2)
0x18 float               Z in Coord + 1.0
0x1C byte[4]             (unknown) possibly related to unknown Rot1??  - cannot decode
0x20 float               X out Coord
0x24 float               Y out Coord
0x28 float               Z out Coord + 1.0
0x2C float               Out Angle
0x30 word                door flags
0x32 byte                Interior number
0x33 byte                Sky
0x34 byte                Time On
0x35 byte                Time Off
0x36 byte                I2 (unknown)
0x37 byte                (unknown)
0x38 dword               destination address


CLEO mission subroutine that changes the destination and flags of an existing enex (from Chain Game).

CODE
// Added for completeness (untested)
{$CLEO .cm}
03A4: name_thread 'ENEXTWEAK'
0050: gosub @CG_Enex                     //    locals: 250-258
004E: end_thread

// ------------------------------------ Enex -------------------------------------- //
:CG_Enex
// Start of Enex Routines

0A8D: 250@ = read_memory 0x0096a7d8 size 4 virtual_protect 0 // pointer to pointer to enex data
0A8D: 251@ = read_memory 250@ size 4 virtual_protect 0       // start of enex data
wait 0

// Unused Interiors
0006: 252@ = 207      // source index                              //  Dillimore Police Department
0006: 253@ = 312      // destination index                         //  ^use SFPD Interior
0006: 254@ = 0x4104   // flags                                     //  unlocked, NPC Group, exterior
0050: gosub @sub_CG_Enex_Redirect

0051: return

:sub_CG_Enex_Redirect
// change the destination of an enex. Uses:                     // enex, block 25
// 250@ = pointer to pointer to enex data                       // read once early in mission
// 251@ = start of enex data                                    // read once early in mission
// 252@ = source index                                          // set before gosub
// 253@ = destination index                                     // set before gosub
// 254@ = source flags                                          // set before gosub    
// 255@ = start of source
// 256@ = address of destination pointer
// 257@ = start of destination
// 258@ = address of source flags

  0085: 255@ = 252@   // source address = source index
  0012: 255@ *= 60    // source index *= record size // 0x3C
  005A: 255@ += 251@  // += start of enex data

  0085: 256@ = 255@   // pointer address = source address
  000A: 256@ += 56    // += offset to destination pointer

  0085: 257@ = 253@   // destination address = destination index
  0012: 257@ *= 60    // *= record size // 0x3C
  005A: 257@ += 251@  // += start of enex data

  0085: 258@ = 255@   // source flag address = source address
  000A: 258@ += 48    // += offset to source flags // 0x30
 
  0A8C: write_memory 256@ size 4 value 257@ virtual_protect 0   // write new destination address in pointer
  0A8C: write_memory 258@ size 2 value 254@ virtual_protect 0   // set flags for source
0051: return






OrionSR
  • OrionSR

    Chain Game Development Team

  • Feroci Racing
  • Joined: 23 May 2007
  • None
  • Helpfulness Award [GTA & Modding]

#37

Posted 17 August 2009 - 06:53 AM

Changing Enex Data in Memory

A question was posed in another topic:
QUOTE (bull.04)
Is there a way to create Enexes in CLEO?

I tried to create an enex using CLEO but failed. The game would not recognize new enex information written to unused enex records. However, I was able to change the data of existing enexes using CLEO.

StartEnexing - CLEO script used to trigger Enexing CLEO mission using F8 keypress.
CODE
{$CLEO .cs}
0000:

while true
 wait 250
 if
   0AB0:   key_pressed 0x77    // F8
 then                                                                          
   0A94: start_custom_mission "Enexing"
 end
end


Enexing Misssion:
CODE
{$CLEO .cm}

:CG_Enexing
thread "Enexing"

// CLEO Mission that rewrites existing enex information in memory
// * changes to flags and destination will be saved
// * changes to other data will persist until the game is restarted

00BB: show_text_lowpriority GXT 'FELD_WR' time 3000 flag 1  // Loading data, please wait...
wait 1000

// Early: Determine beginning of enex data in dynamic memory
0A8D: 0@ = read_memory 0x0096a7d8 size 4 virtual_protect  0 // pointer to pointer to enex data
0A8D: 1@ = read_memory 0@ size 4 virtual_protect 0          // start of enex data
wait 0

// Enex for the Unused SmashTV Warehouse, index 302
// becomes entrance to Unused Ammunation, index 340
// located in Montgomery, "Locals Only"
// IPL: 1356.9, 307.5, 18.74, 0, 2, 2, 8, 1356.9, 305.5, 18.74, 153.6, 0, 4, "AMMUN4", 0, 2, 0, 24
0006: 2@ = 302                   // source index            // Unused SmashTV Warehouse "SMASHTV"
0006: 3@ = 340                   // destination index       // Unused Ammu-nation "AMMUN4"
0006: 650@ = 0x554D4D41  //UMMA  // Enex string part 1      // required for clerk to appear
0006: 651@ = 0x0000344E  //  4N  // Enex string part 2      // include null terminator
0007: 652@ = 1355.9              // XinMin (X - X width/2)
0007: 653@ = 308.5               // YinMax (Y + Y width/2)
0007: 654@ = 1357.9              // XinMax (X + X width/2)
0007: 655@ = 306.5               // YinMin (Y - Y width/2)
0007: 656@ = 19.74               // Z in Coord + 1.0
0006: 657@ = 0x00000000          // (unknown)
0007: 658@ = 1356.9              // X out Coord
0007: 659@ = 305.5               // Y out Coord
0007: 660@ = 19.74               // Z out Coord + 1.0
0007: 661@ = 153.6               // Out Angle
0006: 662@ = 0x4004              // door flags              // unlocked, exterior
0006: 663@ = 0                   // Interior number
0006: 664@ = 0                   // Sky
0006: 665@ = 0                   // Time On
0006: 666@ = 24                  // Time Off
0006: 667@ = 2                   // I2 (unknown)
0006: 668@ = 0x00                // (unknown)
//0006: 669@ = 0x00000000        // destination address     // calculated based on index 3@
0050: gosub @sub_CG_Enex_Rewrite

:CG_Enexing_End
07FB: set_interior 'AMMUN4' access 1  // unused Ammu-Nation // unlock interior for testing
00BB: show_text_lowpriority GXT 'FESZ_LS' time 2000 flag 1  // Load Successful.
004E: end_thread


:sub_CG_Enex_Rewrite
// Change all information of an enex.       // Uses:
// 0@ = pointer to pointer to enex data     // read once early in mission
// 1@ = start of enex data                  // read once early in mission

// 2@ = source index                        // set before gosub
// 3@ = destination index                   // set before gosub
// 650@ through 668@                        // set enex data to be written

// 4@ = source address                      // calculated from 2@
// 669@ = destination address               // calculated from 3@
// 250@ through 269@                        // field addresses, calculated

// source address
0085: 4@ = 2@       // source address = source index
0012: 4@ *= 60      // *= record size // 0x3C
005A: 4@ += 1@      // += start of enex data
// destination address
0085: 669@ = 3@     // destination address = destination index
0012: 669@ *= 60    // *= record size // 0x3C
005A: 669@ += 1@    // += start of enex data

// field offsets
0006: 250@ = 0x00   // Enex string part 1         // hex encoded characters
0006: 251@ = 0x04   // Enex string part 2, +null  // because my string writes never work
0006: 252@ = 0x08   // XinMin (X - X width/2)     // float
0006: 253@ = 0x0C   // YinMax (Y + Y width/2)     // float
0006: 254@ = 0x10   // XinMax (X + X width/2)     // float
0006: 255@ = 0x14   // YinMin (Y - Y width/2)     // float
0006: 256@ = 0x18   // Z in Coord + 1.0           // float
0006: 257@ = 0x1C   // (unknown)                  // byte[4]
0006: 258@ = 0x20   // X out Coord                // float
0006: 259@ = 0x24   // Y out Coord                // float
0006: 260@ = 0x28   // Z out Coord + 1.0          // float
0006: 261@ = 0x2C   // Out Angle                  // float
0006: 262@ = 0x30   // door flags                 // word
0006: 263@ = 0x32   // Interior number            // byte
0006: 264@ = 0x33   // Sky                        // byte
0006: 265@ = 0x34   // Time On                    // byte
0006: 266@ = 0x35   // Time Off                   // byte
0006: 267@ = 0x36   // I2 (unknown)               // byte
0006: 268@ = 0x37   // (unknown)                  // byte
0006: 269@ = 0x38   // destination address        // dword

// field address = field offset += source address
005A: 250@ += 4@    
005A: 251@ += 4@
005A: 252@ += 4@  
005A: 253@ += 4@  
005A: 254@ += 4@  
005A: 255@ += 4@  
005A: 256@ += 4@  
005A: 257@ += 4@  
005A: 258@ += 4@  
005A: 259@ += 4@  
005A: 260@ += 4@  
005A: 261@ += 4@
005A: 262@ += 4@  
005A: 263@ += 4@  
005A: 264@ += 4@  
005A: 265@ += 4@  
005A: 266@ += 4@  
005A: 267@ += 4@  
005A: 268@ += 4@  
005A: 269@ += 4@  

// write data to memory
0A8C: write_memory 250@ size 4 value 650@ virtual_protect 0  
0A8C: write_memory 251@ size 4 value 651@ virtual_protect 0  
0A8C: write_memory 252@ size 4 value 652@ virtual_protect 0
0A8C: write_memory 253@ size 4 value 653@ virtual_protect 0
0A8C: write_memory 254@ size 4 value 654@ virtual_protect 0
0A8C: write_memory 255@ size 4 value 655@ virtual_protect 0
0A8C: write_memory 256@ size 4 value 656@ virtual_protect 0
0A8C: write_memory 257@ size 4 value 657@ virtual_protect 0
0A8C: write_memory 258@ size 4 value 658@ virtual_protect 0
0A8C: write_memory 259@ size 4 value 659@ virtual_protect 0  
0A8C: write_memory 260@ size 4 value 660@ virtual_protect 0  
0A8C: write_memory 261@ size 4 value 661@ virtual_protect 0
0A8C: write_memory 262@ size 2 value 662@ virtual_protect 0  
0A8C: write_memory 263@ size 1 value 663@ virtual_protect 0  
0A8C: write_memory 264@ size 1 value 664@ virtual_protect 0  
0A8C: write_memory 265@ size 1 value 665@ virtual_protect 0  
0A8C: write_memory 266@ size 1 value 666@ virtual_protect 0
0A8C: write_memory 267@ size 1 value 667@ virtual_protect 0
0A8C: write_memory 268@ size 1 value 668@ virtual_protect 0
0A8C: write_memory 269@ size 4 value 669@ virtual_protect 0

0051: return  


Notes on: Z in Coord + 1.0 and Z out Coord + 1.0

The Z value in memory is equal to the Z value in the IPL line +1.0. A Z reading from a coordinate manager utility will match the Z coordinate used in memory. Subtract 1.0 from a coord reading when encoding to IPL.

richardcheckim
  • richardcheckim

    Player Hater

  • Members
  • Joined: 09 Apr 2009

#38

Posted 03 January 2010 - 06:54 PM

Hi, I am doing new enex (I have create a new room behind Zero´s shop) I would create nex enex to that interior and the exit interior in zero´s backyard. I write this: Enter location: unknown, I simply write some numbers... Exit location: X,Y,Z position from Program Place Manager (Coordinates are from doors in that room), Interior: 6 (zero rc is 6, i think...)
Sky: fading...and OFF time 24. When I loaded the game, And I go to Zero´s shop, I appeared on the driving school, and when I go out from school, then I appeared in my interior, but I can´t go out...What I do wrong, please? Can anyone know? bored.gif

Sorry for my english colgate.gif

OrionSR
  • OrionSR

    Chain Game Development Team

  • Feroci Racing
  • Joined: 23 May 2007
  • None
  • Helpfulness Award [GTA & Modding]

#39

Posted 04 January 2010 - 11:41 PM

This is not the appropriate topic for asking questions about your modification. Please start a new topic. Include more information: post you lines of code (use the CODE tags). Are you trying to enter an interior that was added to the game, or a standard interior?

Notes on creating new Enexes

Avoid altering the sequence of the standard enex connections or your links will be scrambled. Make a backup copy of the original Maps folder; reinstall if necessary. Unless you are working on a full mod, do not add or remove enex lines in the standard ipl files. Adding comments to the end of the lines won't hurt anything.

I suggest creating a new ipl file in a new folder for additional enex connections: DATA\ipl\enex.ipl
CODE
enex
end

Make a backup copy of GTA.DAT. Add a link to your new IPL file at the end of GTA.DAT. Scroll down to the end of the list of ipl files, duplicate the format of the last line, and alter the path to point to your file.

Put any new enex lines between the "enex" and "end" lines and as long as you've saved inside (you can't be near burglary doors), and haven't added more than 24 enexes, your new connections should be active when you restart the game.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users