Quantcast

Jump to content

» «
Photo

assets

23 replies to this topic
cst1992
  • cst1992

    Spam Hater

  • Members
  • Joined: 27 Dec 2012

#1

Posted 24 August 2013 - 09:42 AM Edited by cst1992, 28 August 2013 - 05:31 PM.

how do assets work? I didn't find anything related to that on the forums.
Is there any way to modify the money they generate, or create more?

gta3masta5000
  • gta3masta5000

    'Sup?

  • Members
  • Joined: 28 Apr 2012
  • United-States

#2

Posted 24 August 2013 - 12:03 PM

Here's a thing about changing property prices. Should work the same (more or less) for the money pickups (like the one outside CJ's house). Here Hope it helps!

Here's a list of pickup ID's for you. ID 1274 is what to look for when changing how much money it generates. smile.gif Good luck!

OrionSR
  • OrionSR

    Chain Game Development Team

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

#3

Posted 24 August 2013 - 12:08 PM Edited by OrionSR, 24 August 2013 - 10:02 PM.

An asset is just a special kind of pickup with it's own opcode. This one spawns an asset on the bar in the Four Dragons casino.

CODE
04A6: 0@ = create_asset_money_pickup_at 1946.968 1017.776 993.0 money 25000 25000  // Four Dragons Asset


The first 25000 is the max asset value, the second is the asset rate. Normal would be something like 2000 2000, or 10000 10000. This one was set a bit high. The code below is pushing the limits. I think the max that can display properly is a bit more than $300000, and 65535 is the max possible rate. The other bit of this code shows a method to seed a value into an asset. Usually they start at 0 and work their way to the max value based on the asset rate.

CODE
04A6: 0@ = create_asset_money_pickup_at -602.25 842.25 -45.0 money 250000 65535 // Pirate Booty
0085: 6@ = 0@
000E: 6@ -= 0x020000    // extract just the index from the local
0012: 6@ *= 0x20        // pickup record size
000A: 6@ += 0           // offset to asset value field
000A: 6@ += 0x009788c0  // start of pickup structure
0A8C: write_memory 6@ size 4 value 250000.0 virtual_protect 0


It's been a while, but I believe it is possible to make an asset with models other than the BIGDOLLAR by creating it as a weapon pickup with type 16 and ammo value for the max value, and adjusting the rate with opcode 094A. If it works as expected, the code below will make an asset using the Green Goo model.

CODE
032B: 0@ = create_weapon_pickup 2976 group 16 ammo 10000 at 2222.8101 -1179.2964 1028.8 // Jefferson Hotel Room 6
094A: set_money_pickup @0 cash_to 10000


BTW, that Pirate Booty asset doesn't work right and I'm not sure why. It doesn't generate more value unless CJ is in fairly close. Usually the assets update if CJ's been away for a while. This one doesn't, perhaps because it's underwater and away from normal zones.

cst1992
  • cst1992

    Spam Hater

  • Members
  • Joined: 27 Dec 2012

#4

Posted 24 August 2013 - 03:12 PM Edited by cst1992, 24 August 2013 - 03:22 PM.

Actually I'm trying to make a mod to have asset money updated directly in the player's money (say every 5 minutes).
But when I tried to test what I'd written on the Verdant Meadows asset, I found that the money that was displayed on the asset was stored in hex address 97869c (using Cheat Engine). When I read that address using SB opcode 0A8D, it worked. But when I tried to write 0 to that address, it didn't work(causing the amount to get added to the player's money repeatedly). Then I found that when CJ moved a little further from the asset, the value at 97869c reset to 0, and vice versa.
Is there any other way I can achieve what I said above? (Sadly, unlike C++, there is no VM.Cash = 0 or something here).

OrionSR, I disagree with you on the money,rate thing(No offence) but when I set it to money 10000 5000 I found that there was a jumble of two numbers above the pickup, and when I set it to 10000 10000, I got a single number. But the funny thing is that when I collected the money in the asset and the value was 30, the player's money increased by 60, When I set it to 10000 0 then it worked correctly.(I also tried to create an asset outside CJ's safe house in Calton Heights, about which I am talking in this paragraph.)

gta3masta5000
  • gta3masta5000

    'Sup?

  • Members
  • Joined: 28 Apr 2012
  • United-States

#5

Posted 24 August 2013 - 03:35 PM

QUOTE (cst1992 @ Saturday, Aug 24 2013, 15:12)
Actually I'm trying to make a mod to have asset money updated directly in the player's money (say every 5 minutes).

That I'm not so sure. Unless you made it so you had to press a button, I don't find it possible. And either way, you'd have to make it possible only when you have assets available. I guess you could try to make something where you press a button and it gives you all your generated asset money so far. I suppose if you want it to be like you say, automatic (aka not pressing a button), you could make it be for just one asset. I guess something like this: 5 minutes passes in real life (in-game 5 minutes would be real life... a few seconds...) and you get $5000 from your generated assets directly into your money. That would be possible I suppose. For 5 minutes passing you would have to use 300000 ms as I'm sure CLEO scripts (and main.scm) use milliseconds. IDK about having it know the time passed, though. You can look it up. tounge.gif For giving the money, use something like this.
CODE
0109: player $PLAYER_CHAR money += 5000
Hope this helped!

cst1992
  • cst1992

    Spam Hater

  • Members
  • Joined: 27 Dec 2012

#6

Posted 24 August 2013 - 04:03 PM

My original hope was that there could be some opcode to say copy the asset cash to variable by supplying name(none, sadly)
Then I tried using global variables(CRASH!)
Finally a ray of hope was there, directly accessing addresses. But in there happened what I said earlier.
I originally believed that the address 0097869c stored the money generated in the Verdant Meadows asset, and modifying the address will make my life simple. But then I found out it was updated hundreds of times a second from somewhere else (what the..?)

I'm beginning to think that it's impossible.
If you could provide code for doing it by pressing a button, then I don't think converting it to automatic would be much of an issue.

5 minutes is a practical figure, for testing I used 10 seconds.
Rest of the things I know.

gta3masta5000
  • gta3masta5000

    'Sup?

  • Members
  • Joined: 28 Apr 2012
  • United-States

#7

Posted 24 August 2013 - 04:09 PM Edited by gta3masta5000, 24 August 2013 - 04:18 PM.

Code for button use smile.gif
CODE
if
00E1:   player 0 pressed_key 19
0109: player $PLAYER_CHAR money += 5000
That may work... Not sure.
F*ck that... If you wanna know what number to set the
CODE
player 0 pressed_key number
to, look it up because I really have no idea. Sorry. Anyway, I'm gonna test it now, so if you're willing to wait a minute... Done testing. Didn't work. Not enough... stuff. Work off of this or this or even this. That is the best I can give you. The first you press a button combo to get 50k or lose 50k. The others... IDK. Anyway, have fun!

cst1992
  • cst1992

    Spam Hater

  • Members
  • Joined: 27 Dec 2012

#8

Posted 24 August 2013 - 05:38 PM

Sorry to disappoint you man, but you are missing the point.
Thanks for the input anyway.

gta3masta5000
  • gta3masta5000

    'Sup?

  • Members
  • Joined: 28 Apr 2012
  • United-States

#9

Posted 24 August 2013 - 05:40 PM

Whatevs. I'm not really the 'helper' type of person anyway. Meh. I have better things to do than try to help others. I should be helping myself in my mission making.

OrionSR
  • OrionSR

    Chain Game Development Team

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

#10

Posted 24 August 2013 - 10:05 PM

QUOTE (cst1992 @ Saturday, Aug 24 2013, 08:12)
OrionSR, I disagree with you on the money,rate thing(No offence) but when I set it to money 10000 5000 I found that there was a jumble of two numbers above the pickup, and when I set it to 10000 10000, I got a single number. But the funny thing is that when I collected the money in the asset and the value was 30, the player's money increased by 60, When I set it to 10000 0 then it worked correctly.

It sounds to me like you've created two assets instead of one. The max value and asset rate can be different. Below is the standard code used to create the grove asset. The rate is different depending on the percentage of turfs under control.

CODE
04A6: $GS_GANG_MONEY_PICKUP = create_asset_money_pickup_at 2508.359 -1676.538 12.579 money 10000 $GS_GANG_CASH


The easiest way to reset the asset would be to destroy it and create it again.

I suspect you will continue to have problems with your goal. It's been a while since I've run my tests on these, but IIRC, assets don't update their value when they aren't active because CJ isn't near. When CJ approaches and the pickup becomes active and the value is updated based on the current time and time stamp of when the pickup was last active. The asset value will continue to get updated by the engine unless CJ is very close. There's a fine line where CJ is close enough to see the asset value but far enough that it will build value. (These are very old observations. My memory is a bit fuzzy on this and I don't have notes on these details. This is a working hypothesis that could definitely use refinement based on new observations.)

It isn't too surprising if the game crashes when you try to update the asset value while the engine is trying to crunch away on the increasing value. In fact, that sounds somewhat familiar. Destroying and recreating the pickup should work if it's active or not. Each standard asset is associated with a particular global variable. You can check if the asset exists yet, destroy and create, and calculate it's location in memory using the index stored in these variable.

The example of seeding a value to an asset that I posted previously can be adapted to read the value instead. Pickups generally aren't in the same location on different saves. I added a line for a field offset even though the asset value is at offset 0x00 because you might also want to check the timer (0x0C) and adjust the asset value to what should be earned if CJ was close enough for the asset to be active.

CODE
Block 6: Pickups

0x0000   Pickup[620]     Pickups  --Size 0x20
0x4D80   word            Number of pickups being picked up (up to 20)
0x4D82   byte            Weapon pickup message counter (see note 1 below)
0x4D83   dword[20]       Pickups being picked up (they don't exist, but could be checked by opcode 0214
0x4DD3                   end

Pickup structure:
 0x00    float          current asset value
 0x04    dword          pointer to CObject
 0x08    dword          ammo (or max asset value)
 0x0C    dword          timer
 0x10    word[3]        x,y,z, all multiplied by 8
 0x16    word           asset rate
 0x18    word           model
 0x1A    word           index
 0x1C    byte           type
 0x1D    byte           flags
 0x1E    byte[2]        (Align?)
Reference: http://www.gtamoddin...lock_6:_Pickups[/CODE]

Note that the current asset value is stored as a float, and player money is stored as an integer, so you'll need to convert the asset value to an integer before giving it to the player.

cst1992
  • cst1992

    Spam Hater

  • Members
  • Joined: 27 Dec 2012

#11

Posted 25 August 2013 - 05:10 PM Edited by cst1992, 25 August 2013 - 05:41 PM.

Thank you OrionSR, for your information.
The current asset value is indeed a float, and the 4 byte value at 0097869c must be updated with this value, probably for displaying above the asset icon.
I tried externally modifying the value and it was reflected promptly in the asset.
The only thing left now is the thing of it not updating when cj is far away.
What if we use a simulation, rather than the real asset?
Just creating a variable which has the same value and increases at the same rate as the real asset?
One thing I didn't get is that what does this rate = 10000 mean?
I set the asset to 0 and at rate 10000 I found that when the timer increased by 14388(subject to error) the value is increased to 68.33334351.

OrionSR
  • OrionSR

    Chain Game Development Team

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

#12

Posted 25 August 2013 - 07:45 PM

I'm fairly sure the asset value will increase faster with a higher asset rate. I think the max value simply caps the asset value and doesn't effect the rate of increase, but I'm not sure.

I got really inconsistent results when I experimented with the update process for the asset values. In particular, that Pirate Booty asset I posted previously never updates. If CJ isn't near the value never increases. This is a mystery I'd like to solve. From what I remember, the standard assets didn't update consistently either. I would expect all of the courier assets to increase at the same rate, but IIRC, the assets in remote cities didn't increase as quickly as an asset in the current city, even if the local asset was far enough away that it shouldn't be active. These results don't make any sense. I can't see how zones or cities can possibly effect pickups which have no record of their zones or cities. I would expect the time stamp field to be the only information used when updating the asset value.

Again, please take these observations with a grain of salt. I'm trying to highlight some of the riddles involved rather than provide accurate answers. My primary goal was to document how assets and other pickups were recorded in the save file/pickup pool. I eventually grew frustrated with the inconsistent results from the assets and moved on to documenting other structures in the save.

cst1992
  • cst1992

    Spam Hater

  • Members
  • Joined: 27 Dec 2012

#13

Posted 26 August 2013 - 06:40 AM Edited by cst1992, 26 August 2013 - 08:29 AM.

So this is what I came up with:
CODE

{$CLEO .cs}

thread 'ASSETS'

0@ = 0x0097CF00         //Verdant Meadows Asset
0@ += 0x00              //current asset value
:ASSETS_1
wait 5000 ms
0A8D: 1@ = read_memory 0@ size 4 virtual_protect 0
008E: 2@ = float 1@ to_integer
Player.Money($PLAYER_CHAR) += 2@
2@ = 0
008F: 1@ = integer 2@ to_float
0A8C: write_memory 0x0097CF00 size 4 value 1@ virtual_protect 0 // reset asset to 0 after transferring money to player
jump @ASSETS_1


Works, but with my own savegame.
Using the global variable $7512 from main.scm(verdant meadows asset) is out of the question, as that causes the game to crash.
Other savegames are not agreeing with this mod.
The address for verdant meadows asset in another savegame was different.(0x0097cee0)
Any workaround for this?

OrionSR
  • OrionSR

    Chain Game Development Team

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

#14

Posted 26 August 2013 - 08:57 AM Edited by OrionSR, 26 August 2013 - 09:01 AM.

Use the global variable used to create the asset to find the correct address. The code below is adapted (and untested) from the seeding example I posted previously. The global will contain the index of the asset, but also an extra 0x00020000. I'm not sure what this extra info is for but it's easy enough to subtract to get just the index. Multiply the index by the record size for the pickups (0x20). Add an offset to the correct field if necessary (the current value is at offset 0x00 but this line is helpful for reading the timer or other fields). Add the address for the start of the pickup pool and you should have the correct address for your asset. It would be a good idea to confirm that the asset exists before performing these calculations.

The "index" as I'm using the term, is the slot number for the pickup. Pickup indexes can range from 0 through 619.

CODE
0085: 6@ = $7512        // Airstrip Asset
000E: 6@ -= 0x020000    // extract just the index from the local
0012: 6@ *= 0x20        // pickup record size
000A: 6@ += 0x00        // offset to asset value field
000A: 6@ += 0x009788c0  // start of pickup structure
0A8D: 1@ = read_memory 6@ size 4 virtual_protect 0


I went ahead and snagged all the asset lines from my v1 scripts (search for "04A6:"). Note that the Grove Asset is created in a couple of different spots.

CODE
04A6: $GS_GANG_MONEY_PICKUP = create_asset_money_pickup_at 2508.359 -1676.538 12.579 money 10000 $GS_GANG_CASH //Grove Asset
04A6: $1938 = create_asset_money_pickup_at -1969.463 289.5335 34.6719 money $1937 $1937 //Wang Asset
04A6: $1908 = create_asset_money_pickup_at -2243.007 136.9601 34.8203 money $1907 $1907 //Zero Asset
04A6: $7512 = create_asset_money_pickup_at 420.5204 2532.687 16.0869 money $7511 $7511 //Airstrip Asset
04A6: $1933 = create_asset_money_pickup_at -82.2693 -1135.526 0.5847 money $1934 $1934 //Trucking Asset
04A6: $1931 = create_asset_money_pickup_at 818.2578 853.8873 10.8059 money $1932 $1932 //Quarry Asset
04A6: $2000 = create_asset_money_pickup_at 1887.997 2073.008 10.5547 money $1999 $1999 //Burgershot Asset
04A6: $1996 = create_asset_money_pickup_at 1345.859 -1757.432 13.0078 money $1995 $1995 //Roboi Asset
04A6: $1998 = create_asset_money_pickup_at -2593.882 59.2467 3.8359 money $1997 $1997 //Hippy Shopper Asset
04A6: $5271 = create_asset_money_pickup_at -1757.668 961.7819 24.3828 money 2000 2000 //Valet Asset


Pickups are seldom located in the same memory location. Even the location of pickups introduced at the beginning of the game can vary depending on whether or not the save was started "fresh" after starting the game. "Restart" saves created after first loading another save will be missing 4 pickups that are placed by the IPL files (3 extinguishers and a sniper rifle). The location of any pickups created after playing will depend on the collection of oysters, horseshoes and snapshots, and even the dropped money and weapons from peds, cops, gangs, and dealers.

cst1992
  • cst1992

    Spam Hater

  • Members
  • Joined: 27 Dec 2012

#15

Posted 26 August 2013 - 09:55 AM

Crashes sad.gif
Need to find another way
Have already tried that.

OrionSR
  • OrionSR

    Chain Game Development Team

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

#16

Posted 26 August 2013 - 11:31 AM

Well... the process works for seeding cash into the pirate booty in my custom Chain Game scripts. Below is the code exactly as it's used. It's part of a custom mission so 60@ is a valid local variable. I've also been using the same process (with a different start to the pickup block) to make cheat device codes that alter pickups on PS2. There shouldn't be a problem with the math.

CODE
// Create and Seed Pirate Booty
//04A6: 0@ = create_asset_money_pickup_at 2244.6328 -1245.8905 28.7431 money 250000 65535 // Jefferson Booty
04A6: 0@ = create_asset_money_pickup_at -602.25 842.25 -45.0 money 250000 65535 // Pirate Booty
0085: 60@ = 0@
000E: 60@ -= 0x020000    // extract just the index from the local
0012: 60@ *= 0x20        // pickup record size
000A: 60@ += 0x009788c0  // start of pickup block
//000A: 60@ += 0         // offset to asset value field
0A8C: write_memory 60@ size 4 value 250000.0 virtual_protect 0


I'm confused about why your game is crashing, especially since you are only reading the value and not writing anything. The only explanation I can think of is that perhaps the extra info contained in the global, the "upper" word in the dword, isn't always 0x0002xxxx (where xxxx should be the index). If the extra info was 0001xxxx or 0000xxxx then subtracting 0x00020000 would put the index way out of range. I've only modified newly created assets. I'm not sure what the extra info is or if it changes over time.

GTA:SA Save Game Editor v1.0 by Ryosuke: http://gtasamod.web....sase/index.html

The save game editor linked above can tell you the values of the global variables (Script tab) and the index (ID) of the pickups. Due to the extra info you'll need to view the values of the globals in hex format and convert the index to decimal to compare with the pickup ID. You may also want to use this information to manually calculate the address and verify the location in memory using your cheat engine (if it works the way I think it does -- haven't tried it myself).

Note: upper word and lower word are terms I just made up to describe parts of the dword. I seriously doubt these are the proper terms, but I hope they provided a reasonable description.

cst1992
  • cst1992

    Spam Hater

  • Members
  • Joined: 27 Dec 2012

#17

Posted 26 August 2013 - 04:15 PM

Don't worry, I'm doing a undergraduate level computer course myself, the terms aren't too new to me wink.gif
The main difference here is that you have created the pirate booty asset yourself, as opposed to the airstrip asset being in the main.scm.

OrionSR
  • OrionSR

    Chain Game Development Team

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

#18

Posted 26 August 2013 - 07:21 PM Edited by OrionSR, 26 August 2013 - 08:22 PM.

I took a look at an old End of the Line save I've got on hand and my suspicions were confirmed. The extra info recorded in the global isn't always the same. I worked out a new method for extracting just the index and the code is working as expected. (I also cleaned up the opcode for assigning a local to a global.)

CODE
//Change the max value and current value of the Airstrip Asset
008B: 6@ = $7512        // Airstrip Asset
//000E: 6@ -= 0x020000    // extract just the index from the local (inconsistent)
0012: 6@ *= 0x010000    // extract just the index from the local (part 1/2)
0016: 6@ /= 0x010000    // extract just the index from the local (part 2/2)
0012: 6@ *= 0x20        // pickup record size
000A: 6@ += 0x009788c0  // start of pickup structure
0085: 7@ = 6@           // copy start address for this pickup
000A: 6@ += 0x00        // offset to asset value field
000A: 7@ += 0x08        // offset to max value field (ammo)
0A8C: write_memory 7@ size 4 value 250000 virtual_protect 0
0A8C: write_memory 6@ size 4 value 250000.0 virtual_protect 0
//0A8D: 1@ = read_memory 6@ size 4 virtual_protect 0


Same thing as above but this method doesn't rely on rolling over the dword. It seems more elegant but uses an additional local.
CODE
008B: 6@ = $7512        // Airstrip Asset
0085: 5@ = 6@
0016: 5@ /= 0x010000  
0012: 5@ *= 0x010000  
0062: 6@ -= 5@
0012: 6@ *= 0x20        // pickup record size
000A: 6@ += 0x009788c0  // start of pickup structure
0085: 7@ = 6@           // copy start address for this pickup
000A: 6@ += 0x00        // offset to asset value field
000A: 7@ += 0x08        // offset to max value field (ammo)
0A8C: write_memory 7@ size 4 value 150000 virtual_protect 0
0A8C: write_memory 6@ size 4 value 100000.0 virtual_protect 0


Notes: The extra info contained in the upper word of the global variables associated with pickups appears to vary widely between different saves, but appears to remain consistent as a save is progressed. I still have no idea what this information is or how/if it is used by the game.

cst1992
  • cst1992

    Spam Hater

  • Members
  • Joined: 27 Dec 2012

#19

Posted 27 August 2013 - 03:31 PM

Finally I get it!
I'm sorry OrionSR, the cause of my game crashing is that I have been trying to use CLEO to have the mod work.
But CLEO does not support using the variables of the main.scm, causes crashes.
Do you know of some way I could add the code that I have written in the main.scm, and still use my old savegames?
Having people start a new game for such a small utility is kind of a letdown.

OrionSR
  • OrionSR

    Chain Game Development Team

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

#20

Posted 27 August 2013 - 07:37 PM

You could use a Darkpact script to modify a main.scm and maintain compatibility with existing saves, but this is not necessary. You may even have difficulties finding a good reference for a Darkpact script because CLEO works so much better.

CLEO has no problem using the global variables; they will not crash the game if used properly. The examples I posted in my previous message were implemented with CLEO. My custom Chain Game scripts are written in CLEO and make extensive use of global variables for a variety of purposes. However, I'm very careful about how I use the globals in order to maintain compatibility with the standard scripts.

Using global variables with CLEO is highly discouraged in most documentation. The main problem is that programmers want to invent new custom global variables like $MyCar without defining the variable in CustomVariables.ini. When CLEO encounters an unknown custom variable it will use the next available undefined global variable, $4. $4 is used by the gymbike script, so players are likely to encounter problems with the gymbike when this custom variable is used. Even if a programmer carefully searches for unused globals to use in their scripts they are likely to run into problems with scripts from other programmers who have done the same thing.

I could post plenty of examples of how I safely use global variables in CLEO scripts, but this would clutter the post unnecessarily. I suspect the problem lies elsewhere in the script, but you have reached the incorrect but somewhat logical conclusion that the globals are causing the crash based on the available documentation and frequent reports of problems.

Wesser
  • Wesser

    The complexity simplifier, the efficiency optimizer.

  • Feroci Racing
  • Joined: 19 Aug 2006
  • Unknown

#21

Posted 28 August 2013 - 01:20 PM

There is a critical dark side to consider when using new global variables in CLEO, even though they have been declared into CustomVariables.ini. If the offset exceeds the amount of allocated bytes for globals written in the first section of the SCM file, the data subsequent to the block will be filled with the new variable value. Nevertheless, it is safe to use as many variables as you want till the first active script IP.

Anyway, Sanny Builder allows the usage of the alloc directive to assign a particular global index to a specific name, without modifying the file mentioned above each time.

cst1992
  • cst1992

    Spam Hater

  • Members
  • Joined: 27 Dec 2012

#22

Posted 28 August 2013 - 02:06 PM

But how do I use a global variable used in main.scm in my CLEO script? The moment I write the line 0@ = $7512, it crashes the game.
I read on another forum that there is an address 0x00a49960, which is the start of the global variables scm block, and reading the memory location a49960 + 4*7512 should read the same location as the global variable $7512.

fastman92
  • fastman92

    фастман92 | ف

  • Members
  • Joined: 28 Jul 2009

#23

Posted 28 August 2013 - 02:44 PM

QUOTE (cst1992 @ Wednesday, Aug 28 2013, 16:06)
But how do I use a global variable used in main.scm in my CLEO script? The moment I write the line 0@ = $7512, it crashes the game.
I read on another forum that there is an address 0x00a49960, which is the start of the global variables scm block, and reading the memory location a49960 + 4*7512 should read the same location as the global variable $7512.

Strange issue.
You probably use a wrong opcode to assign value from global variable to local variable.

Use this opcode:
CODE
008B: 3@ = $CURRENT_TIME_IN_MS2 // (int)

cst1992
  • cst1992

    Spam Hater

  • Members
  • Joined: 27 Dec 2012

#24

Posted 28 August 2013 - 04:36 PM

Thanks. This new opcode doesn't crash the game.
I'll try to rewrite the code, I deleted the old file and the decompiled file is harder to read.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users