0% found this document useful (0 votes)
7 views1 page

Alloc Function in Game Scripting

The document provides an example of using the Alloc function in a scripting context for a game. It demonstrates how to allocate memory for a player character, set various attributes such as money and clothing, and manage game mechanics like camera positioning and player movement. The script also includes commands for restarting the player if they are wasted or busted in specific locations.

Uploaded by

herdisalfa4
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views1 page

Alloc Function in Game Scripting

The document provides an example of using the Alloc function in a scripting context for a game. It demonstrates how to allocate memory for a player character, set various attributes such as money and clothing, and manage game mechanics like camera positioning and player movement. The script also includes commands for restarting the player if they are wasted or busted in specific locations.

Uploaded by

herdisalfa4
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

// example of using Alloc Function

DEFINE OBJECTS 0
DEFINE MISSIONS 0
DEFINE EXTERNAL_SCRIPTS -1 // Use -1 to not write AAA script
DEFINE UNKNOWN_EMPTY_SEGMENT 0
DEFINE UNKNOWN_THREADS_MEMORY 0

// --------------------
// THE STRIPPED MAIN THREAD
// contains initial info
// --------------------
thread 'MAIN'
var
$PLAYER_CHAR : Player
end
01F0: set_max_wanted_level_to 6
set_wb_check_to 0
00C0: set_current_time 8 0
04E4: unknown_refresh_game_renderer_at 2488.5601 -1666.84
[Link](2488.5601, -1666.84, 13.38)

alloc($PLAYER_CHAR, 10) // the variable $PLAYER_CHAR will be located at memory


address 10

$PLAYER_CHAR = [Link](#NULL, 2488.5601, -1666.84, 13.38)

// we know that player's handle was stored at address 10


// so, use DMA to give money to the player

[Link]($10) += 333

$PLAYER_ACTOR = [Link]($PLAYER_CHAR)
[Link]
set_weather 0
wait 0
$PLAYER_CHAR.SetClothes("PLAYER_FACE", "HEAD", Head)
$PLAYER_CHAR.SetClothes("JEANSDENIM", "JEANS", Legs)
$PLAYER_CHAR.SetClothes("SNEAKERBINCBLK", "SNEAKER", Shoes)
$PLAYER_CHAR.SetClothes("VEST", "VEST", Torso)
$PLAYER_CHAR.Build
$PLAYER_CHAR.CanMove = True
fade 1 (out) 0 ms
select_interior 0
016C: restart_if_wasted at 2027.77 -1420.52 15.99 angle 137.0 unknown 0
016D: restart_if_busted at 1550.68 -1675.49 14.51 angle 90.0 unknown 0
end_thread

You might also like