[CLEO] EnhancedPickup
Enviado: 18 Ago 2020, 23:20
Note: This version is very outdated. Here is the latest version:
f302-utilities/t6254-cleo-enhancedpickupplus
Updated (overhauled, actually) my previous mod with numerous bugs.
I rewrote the script about 4 times. I don't know if I have OCD, but it sucks. :(
But the script did turn out better each time. So there is a silver lining, I guess.
Description:
This is a custom script that creates and manages pickups in such a way that they are not saved with the game.
Download:
1.0
1.1
1.2
1.3
1.4
1.5
Note:
CLEO+ is required.
Features:
Pickup limit is taken care of in a unique way by hiding each pickup when:
Usage:
Put the EnhancedPickup.s file along with your CLEO script, and launch as a custom script, passing your desired values:
Example Script:
Compile and put in the same folder as the EnhancedPickup.s file:
Source:
Bugs:
All previous bugs have been resolved! If you find any, please report!
f302-utilities/t6254-cleo-enhancedpickupplus
Updated (overhauled, actually) my previous mod with numerous bugs.
I rewrote the script about 4 times. I don't know if I have OCD, but it sucks. :(
But the script did turn out better each time. So there is a silver lining, I guess.
Description:
This is a custom script that creates and manages pickups in such a way that they are not saved with the game.
Download:
1.0
1.1
1.2
1.3
1.4
1.5
Note:
CLEO+ is required.
Features:
Pickup limit is taken care of in a unique way by hiding each pickup when:
- Camera is not looking at its position.
- Camera is far away from its position based on pickups' draw distance.
Usage:
Put the EnhancedPickup.s file along with your CLEO script, and launch as a custom script, passing your desired values:
Código: Selecionar tudo
0A92: create_custom_thread "EnhancedPickup.s" _pMemory 0 _iModelID 1212 _iAmmo 100 _fXYZ 2498.1343 -1670.9431 13.3354 _iRespawnTimeMs 1000 _fRespawnDistance 2.0 _iPickupType 1 _iBlipColor -1 _bHideOnMission false _bCollectedUntilRespawn falseExample Script:
Compile and put in the same folder as the EnhancedPickup.s file:
SpoilerAbrir
EnhancedPickup - Test.cs
Código: Selecionar tudo
{$CLEO .cs}
//adds a save, a tec9 and a bat pickup near CJ's house in Ganton, Grove Street
//also a cash pickup that stacks on every script reload
// save pickup controls:
// 1 - toggle blip
// 2 - hide*
// 3 - delete
// 4 - release memory (no longer manageable)
// collect it to show save menu
// type 'RSEPT' to reload this script
// * key must be held
//only required if you need to manage pickup later, otherwise use 0
//take a variable pointer, e.g. 10@
//you can also use allocated memory of 4 bytes
0AC7: 20@ = var 10@ offset
//start custom script, passing arguments
// _iRespawnTimeMs:
// -1: respawn never
// -2: respawn after short time (default 30000, type 2, used in missions)
// -3: respawn after long time (default 360000, type 15, used outside missions)
// any other value will use that value
// compatible with memory addresses
// _fRespawnDistance:
// -1: (default 10.0)
// any other value will use that value
// _iPickupType:
// any other value = default pickup
// 1/true = Money *
// 2 = Available asset *
// 3 = Unavailable asset *
// 4 = Asset money * (does not seem to work, not tested)
// * _iModelID does not work as it has its own model ID.
// _iBlipColor
// -1: (default green)
// any other value will use that value
0A92: create_custom_thread "EnhancedPickup.s" _pMemory 20@ _iModelID 1277 _iAmmo 0 _fXYZ 2492.1343 -1670.9431 13.3354 _iRespawnTimeMs 0 _fRespawnDistance 0 _iPickupType 0 _iBlipColor -1 _bHideOnMission true _bCollectedUntilRespawn false
0AC7: 21@ = var 11@ offset
0A92: create_custom_thread "EnhancedPickup.s" _pMemory 21@ _iModelID 372 _iAmmo 0 _fXYZ 2494.1343 -1670.9431 13.3354 _iRespawnTimeMs -3 _fRespawnDistance -1 _iPickupType 0 _iBlipColor -1 _bHideOnMission false _bCollectedUntilRespawn false
0A92: create_custom_thread "EnhancedPickup.s" _pMemory 21@ _iModelID 336 _iAmmo 0 _fXYZ 2496.1343 -1670.9431 13.3354 _iRespawnTimeMs -3 _fRespawnDistance -1 _iPickupType 0 _iBlipColor -1 _bHideOnMission false _bCollectedUntilRespawn false
0A92: create_custom_thread "EnhancedPickup.s" _pMemory 0 _iModelID 1212 _iAmmo 100 _fXYZ 2498.1343 -1670.9431 13.3354 _iRespawnTimeMs 1000 _fRespawnDistance 2.0 _iPickupType 1 _iBlipColor -1 _bHideOnMission false _bCollectedUntilRespawn false
//only required if you need to manage pickup later
wait 0
//managing the pickup:
// bits of 10@ will be set and cleared based on the condition of the pickup
// if bit 0 is set (for one frame), then pickup has been collected
// set bit 1 to delete
// set bit 2 to toggle blip
// set bit 3 to hide for one frame
// if bit 3 is set (for one frame), then pickup has been hidden
// set bit 4 to release variable (pickup will no longer be manageable)
01F5: 0@ = get_player_actor 0
while true
if 08B7: test 10@ bit 0
then
00A1: put_actor 0@ at 2492.1343 -1665.9431 12.3354
0173: set_actor 0@ Z_angle_to 0
03D8: show_save_screen
end
if 0AB0: key_pressed 49
then
08BD: set 10@ bit 2
wait 250
end
if or
0AB0: key_pressed 50
0E1D: is_on_mission
then
08BD: set 10@ bit 3
end
if 08B7: test 10@ bit 3
then
0AD1: show_formatted_text_highpriority "HIDDEN" time 0
end
if 0AB0: key_pressed 51
then
08BD: set 10@ bit 1
end
if 0AB0: key_pressed 52
then
08BD: set 10@ bit 4
end
wait 0
if 0ADC: test_cheat "RSEPT"
then
08BD: set 10@ bit 1
08BD: set 11@ bit 1
0ACE: show_formatted_text_box "EnhancedPickup - Test Script Reloaded."
0A92: create_custom_thread "EnhancedPickup - Test.cs"
0A93: end_custom_thread
end
endSource:
SpoilerAbrir
Código: Selecionar tudo
{$CLEO .s}
//1.4
//0A92: create_custom_thread "EnhancedPickup.s" _pMemory 20@ _iModelID 1277 _iAmmo 0 _fXYZ 2492.1343 -1670.9431 13.3354 _iRespawnTimeMs -2 _fRespawnDistance 0 _iPickupType false _iBlipColor -1 _bHideOnMission true _bCollectedUntilRespawn false
const
pMemory = 0@
iModelID = 1@
iAmmo = 2@
fX = 3@
fY = 4@
fZ = 5@
iRespawnTimeMs = 6@
fRespawnDistance = 7@
iPickupType = 8@
iBlipColor = 9@
bHideOnMission = 10@
bCollectedUntilRespawn = 11@
//11, 12, 13
end
const
bCollected = 14@ = false
bBlip = 15@ = false
iCollectionTimeMs = 16@ = 0
hPlayerPed = 17@
iCurrentTimeMs = 18@
hBlip = 19@
hPickup = 20@ = 0
pPickup = 21@
bHidden = 22@
//23, 24, 25
end
01F5: hPlayerPed = get_player_actor 0
while true
if bCollectedUntilRespawn == false
then
bCollected = false
end
01BD: iCurrentTimeMs = current_time_in_ms
if and
bBlip == false
075C: marker hBlip enabled
then
0164: disable_marker hBlip
end
if and
bBlip == true
875C: not marker hBlip enabled
hPickup <> 0
then
03DC: hBlip = create_marker_above_pickup hPickup
if iBlipColor <> -1
then
0165: set_marker hBlip color_to iBlipColor
end
end
if iCollectionTimeMs <> 0
then
if fRespawnDistance == -1
then
26@ = 10.0 //need memory address
else
0087: 26@ = fRespawnDistance
end
if 80FE: not actor hPlayerPed sphere 0 in_sphere fX fY fZ radius 26@ 26@ 26@
then
if iRespawnTimeMs == -1
then
break
else
if iRespawnTimeMs == -2
then
0A8D: 26@ = read_memory 0x457F66 size 4 virtual_protect 0 //regen time for pickup type 2
else
if iRespawnTimeMs == -3
then
0A8D: 26@ = read_memory 0x457F5E size 4 virtual_protect 0 //regen time for pickup type 15
else
0085: 26@ = iRespawnTimeMs
end
end
005A: 26@ += iCollectionTimeMs
if 001D: iCurrentTimeMs > 26@
then
iCollectionTimeMs = 0
if bCollectedUntilRespawn == true
then
bCollected = false
end
end
end
end
else
if gosub @hide
then
gosub @destroy
else
gosub @create
0A8C: write_memory pPickup size 4 value iCurrentTimeMs virtual_protect 0
if 0214: pickup hPickup picked_up
then
gosub @destroy
0085: iCollectionTimeMs = iCurrentTimeMs
bCollected = true
end
end
end
if pMemory <> 0
then
26@ = 0
if bCollected == true
then
08BD: set 26@ bit 0
end
0A8C: write_memory pMemory size 4 value 26@ virtual_protect 0
end
bHidden = false
wait 0
if pMemory <> 0
then
0A8D: 26@ = read_memory pMemory size 4 virtual_protect 0
if 08B7: test 26@ bit 1
then
gosub @destroy
break
end
if 08B7: test 26@ bit 2
then
if bBlip == false
then
bBlip = true
else
bBlip = false
end
end
if 08B7: test 26@ bit 3
then
bHidden = true
end
if 08B7: test 26@ bit 4
then
pMemory = 0
end
end
end
0A93: end_custom_thread
:hide
26@ = false
if and
bHideOnMission == true
0E1D: is_on_mission
then
26@ = true
else
if bHidden == true
then
26@ = true
else
if bBlip == false
then
if 80C2: not sphere_onscreen fX fY fZ radius 1.0
then
26@ = true
else
0A8D: 27@ = read_memory 0x454CC9 size 4 virtual_protect 0
0A8D: 27@ = read_memory 27@ size 4 virtual_protect 0 //pickups draw distance
068D: get_camera_position_to 28@ 29@ 30@
050A: 31@ = distance_between_XYZ fX fY fZ and_XYZ 28@ 29@ 30@
if 0025: 31@ > 27@
then
26@ = true
end
end
end
end
end
if 26@ == true
then
0485: return_true
end
return
:destroy
if hPickup <> 0
then
0215: destroy_pickup hPickup
hPickup = 0
end
return
:create
if hPickup == 0
then
if iPickupType == true
then
if iModelID == 0
then
02E1: hPickup = create_cash_pickup iAmmo at fX fY fZ permanence_flag 0
else
032B: hPickup = create_weapon_pickup iModelID group 8 ammo iAmmo at fX fY fZ
end
else
if iPickupType == 2
then
if iModelID == 0
then
0518: hPickup = create_available_asset_pickup 'DUMMY' at fX fY fZ price iAmmo
else
032B: hPickup = create_weapon_pickup iModelID group 18 ammo iAmmo at fX fY fZ
end
else
if iPickupType == 3
then
if iModelID == 0
then
0517: hPickup = create_unavailable_asset_pickup 'DUMMY' at fX fY fZ
else
032B: hPickup = create_weapon_pickup iModelID group 17 ammo iAmmo at fX fY fZ
end
else
if iPickupType == 4
then
if iModelID == 0
then
04A6: hPickup = create_asset_money_pickup_at fX fY fZ money iAmmo 100
else
032B: hPickup = create_weapon_pickup iModelID group 16 ammo iAmmo at fX fY fZ
end
else
032B: hPickup = create_weapon_pickup iModelID group 4 ammo iAmmo at fX fY fZ
end
end
end
end
0E38: get_pickup_pointer hPickup store_to pPickup
0A8E: 26@ = pPickup + 0x1C
0A8C: write_memory 26@ size 1 value 4 virtual_protect 0
pPickup += 0xC
end
returnBugs:
All previous bugs have been resolved! If you find any, please report!