EUX adamant4 Posted February 7, 2011 Share Posted February 7, 2011 Hello, I have been wondering how to make a "laser" go from one point to another- I have seen this done with opcode 04D5 (i think?) but im not sure how the parameters work. (really noobish question, i know) Any help will be appreciated Link to comment Share on other sites More sharing options...
Wesser Posted February 7, 2011 Share Posted February 7, 2011 (edited) It has been documented by me last year. The following script is an updated version of this code: { FUNCTIONS INCLUDED:- getAimPoint Type: GET Description: Get the point where player is looking/aiming at.- getLaserPoint Type: GET Description: Get laser point between 2 points.- getCollisionBetweenPoints Type: GET Description: Get the collision point coords between 2 points.- getLocalVarOffset Type: GET Description: Get local var offset from thread pointer.}{$CLEO}0000: NOP0A8C: write_memory 0xC1704C size 1 value 105 virtual_protect 0 // 60fps// Disable crosshair0A8C: write_memory 0x58FBBF size 4 value 0x90909090 virtual_protect 1 0A8C: write_memory 0x58FBC3 size 1 value 0x90 virtual_protect 1 while true wait 0 0470: [email protected] = actor $PLAYER_ACTOR current_weapon [email protected] *= 0x70 [email protected] += 0xC8AAB8 [email protected] += 0x8 0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0 // weapon range 00A0: store_actor $PLAYER_ACTOR position_to [email protected] [email protected] [email protected] 0AB1: call_scm_func @getAimPoint 4 range [email protected] from [email protected] [email protected] [email protected] camera_to [email protected] [email protected] [email protected] point_to [email protected] [email protected] [email protected] 0AB1: call_scm_func @getLaserPoint 6 from [email protected] [email protected] [email protected] to [email protected] [email protected] [email protected] store_to [email protected] [email protected] [email protected] 04D5: create_corona_at [email protected] [email protected] [email protected] radius 0.05 type 0 flare 0 RGB 255 0 0 end:getAimPoint{ Parameters: Passed: [email protected] - aiming range [email protected] - start point X [email protected] - start point Y [email protected] - start point Z Result: [email protected] - camera point X [email protected] - camera point Y [email protected] - camera point Z [email protected] - aim point X [email protected] - aim point Y [email protected] - aim point Z Example: 0AB1: call_scm_func @getAimPoint 4 range 20.0 from 0.0 0.0 0.0 camera_to [email protected] [email protected] [email protected] point_to [email protected] [email protected] [email protected] }0A9F: [email protected] = current_thread_pointer0AB1: call_scm_func @getLocalVarOffset 2 thread [email protected] var 4 store_to [email protected] 0AB1: call_scm_func @getLocalVarOffset 2 thread [email protected] var 7 store_to [email protected] 0AA6: call_method 0x514970 struct 0xB6F028 num_params 6 pop 0 pPoint [email protected] pCamera [email protected] fOriginZ [email protected] fOriginY [email protected] fOriginX [email protected] fRange [email protected] // CCamera__Find3rdPersonCamTargetVector0AB2: ret 6 [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] :getLaserPoint{ Parameters: Passed: [email protected] - start point X [email protected] - start point Y [email protected] - start point Z [email protected] - end point X [email protected] - end point Y [email protected] - end point Z Result: [email protected] - middle point X [email protected] - middle point Y [email protected] - middle point Z Example: 0AB1: call_scm_func @getLaserPoint 6 from 0.0 0.0 0.0 to 1.0 0.0 0.0 store_to [email protected] [email protected] [email protected] }0A96: [email protected] = actor $PLAYER_ACTOR struct0AB1: call_scm_func @getCollisionBetweenPoints 17 from [email protected] [email protected] [email protected] to [email protected] [email protected] [email protected] solid 1 car 1 actor 1 object 1 particle 1 cartyre 1 water 0 ignore_entity [email protected] see_through 0 camera_objects 0 shoot_through 0 store_to [email protected] [email protected] [email protected] distance_to [email protected] entity_to [email protected] 0AB2: ret 3 [email protected] [email protected] [email protected] :getCollisionBetweenPoints{ Parameters: Passed: [email protected] - start point X [email protected] - start point Y [email protected] - start point Z [email protected] - end point X [email protected] - end point Y [email protected] - end point Z [email protected] - is solid [email protected] - is car [email protected] - is actor [email protected] - is object [email protected] - is particle [email protected] - is car tyre [email protected] - is water [email protected] - entity to ignore (offset) [email protected] - no see-through stuff [email protected] - no camera objects [email protected] - no shoot-through stuff Result: [email protected] - collision point X [email protected] - collision point Y [email protected] - collision point Z [email protected] - distance [email protected] - entity Example: 0AB1: call_scm_func @getCollisionBetweenPoints 17 from 0.0 0.0 0.0 to 1.0 0.0 0.0 solid 0 car 1 actor 0 object 0 particle 0 cartyre 1 water 0 ignore_entity 0x0 see_through 0 camera_objects 0 shoot_through 0 store_to [email protected] [email protected] [email protected] distance_to [email protected] entity_to [email protected] }if [email protected] <> 0x0 then 0A8C: write_memory 0xB7CD68 size 4 value [email protected] virtual_protect 0 end0A8C: write_memory 0xB7CD70 size 1 value [email protected] virtual_protect 0 0A9F: [email protected] = current_thread_pointer0AB1: call_scm_func @getLocalVarOffset 2 thread [email protected] var 0 store_to [email protected] 0AB1: call_scm_func @getLocalVarOffset 2 thread [email protected] var 3 store_to [email protected] 0AB1: call_scm_func @getLocalVarOffset 2 thread [email protected] var 17 store_to [email protected] 0AB1: call_scm_func @getLocalVarOffset 2 thread [email protected] var 21 store_to [email protected] 0AA7: call_function 0x56BA00 num_params 12 pop 12 bIgnoreShootThroughStuff [email protected] bIgnoreSomeObjectsForCamera [email protected] bIgnoreSeeThroughStuff [email protected] bDummy [email protected] bObject [email protected] bActor [email protected] bCar [email protected] bBuilding [email protected] pEntity [email protected] pPoint [email protected] pTarget [email protected] pOrigin [email protected] bReturn [email protected] // CWorld__ProcessLineOfSightif [email protected] <> 0x0 then 0A8C: write_memory 0xB7CD68 size 4 value 0x0 virtual_protect 0 endif [email protected] <> 0 then if and [email protected] <> 0.0 [email protected] <> 0.0 [email protected] <> 0.0 then 050A: [email protected] = distance_between_XYZ [email protected] [email protected] [email protected] and_XYZ [email protected] [email protected] [email protected] if [email protected] == 1 then 0A9F: [email protected] = current_thread_pointer 0AB1: call_scm_func @getLocalVarOffset 2 thread [email protected] var 27 store_to [email protected] 0AA7: call_function 0x6E61B0 num_params 7 pop 7 pPoint [email protected] fTargetZ [email protected] fTargetY [email protected] fTargetX [email protected] fOriginZ [email protected] fOriginY [email protected] fOriginX [email protected] bResult [email protected] // CWorld__TestLineAgainstWater if [email protected] <> 0 then 0087: [email protected] = [email protected] 0087: [email protected] = [email protected] 0087: [email protected] = [email protected] 050A: [email protected] = distance_between_XYZ [email protected] [email protected] [email protected] and_XYZ [email protected] [email protected] [email protected] end end 0AB2: ret 5 [email protected] [email protected] [email protected] [email protected] [email protected] endend0AB2: ret 5 [email protected] [email protected] [email protected] 0.0 0x0 :getLocalVarOffset{ Parameters: Passed: [email protected] - thread pointer [email protected] - var number Result: [email protected] - var value Example: 0AB1: call_scm_func @getLocalVarOffset 2 thread [email protected] var 0 store_to [email protected] }if [email protected] <> 0 then [email protected] *= 0x4 0A8E: [email protected] = [email protected] + 0xDC // mission flag if [email protected] == 1 then [email protected] += 0xA48960 // mission locals else 005A: [email protected] += [email protected] [email protected] += 0x3C endelse [email protected] = 0 end0AB2: ret 1 [email protected] Edited June 13, 2011 by Wesser RyanDri3957V 1 012 345 678 9A BCD EFG HIJK LMN OPQR STUV WX YZ Link to comment Share on other sites More sharing options...
EUX adamant4 Posted February 7, 2011 Author Share Posted February 7, 2011 (edited) wow, i think this was one of the scripts i was talking about- thanks ^^ Is there any way to make a beam-like effect without using custom particle effects? Edited February 7, 2011 by EUX adamant4 Link to comment Share on other sites More sharing options...
Adler Posted February 8, 2011 Share Posted February 8, 2011 Try searchlights. I used them in my Tactical Laser System (newer versions will have Function-X's laser as optional). Link to comment Share on other sites More sharing options...
EUX adamant4 Posted February 8, 2011 Author Share Posted February 8, 2011 yes, i saw that youtube video, its pretty cool ill use the spotlight for now, but im not really sure if it will work very well- it doesnt really look right. The ideal beam would be the one in the screenshot in the post that contains wessers script- i may have to learn about memory hacking first though, not sure what it involves. Link to comment Share on other sites More sharing options...
EUX adamant4 Posted February 9, 2011 Author Share Posted February 9, 2011 I think i could i make a beam by creating the a corona and then updating it using a step loop- would save the trouble of installing particle effects, but it will be too slow unless i have several coronas at once. Would that work? Link to comment Share on other sites More sharing options...
TheSiggi Posted February 10, 2011 Share Posted February 10, 2011 06BC: might be an alternative aswell: Link to comment Share on other sites More sharing options...
Deji Posted February 10, 2011 Share Posted February 10, 2011 I'd try to use 08EB, but then again, that requires being daring with memory Link to comment Share on other sites More sharing options...
EUX adamant4 Posted February 11, 2011 Author Share Posted February 11, 2011 heh, i tried out using coronas and it worked ok- but its not really designed for this. Then my computer decided to crash -_-(unrelated to SA btw lol) Atm im stuck using a SLOW pc using the virtual keyboard, so no modding for me for the time being lol. I doubt i'll get my mods back, but i now have a chance to rebuild them using a better knowlege of CLEO Link to comment Share on other sites More sharing options...
ZAZ Posted November 27, 2021 Share Posted November 27, 2021 Wessers script recreated in new forums code block { FUNCTIONS INCLUDED: - getAimPoint Type: GET Description: Get the point where player is looking/aiming at. - getLaserPoint Type: GET Description: Get laser point between 2 points. - getCollisionBetweenPoints Type: GET Description: Get the collision point coords between 2 points. - getLocalVarOffset Type: GET Description: Get local var offset from thread pointer. } {$CLEO} 0000: NOP 0A8C: write_memory 0xC1704C size 1 value 105 virtual_protect 0 // 60fps // Disable crosshair 0A8C: write_memory 0x58FBBF size 4 value 0x90909090 virtual_protect 1 0A8C: write_memory 0x58FBC3 size 1 value 0x90 virtual_protect 1 while true wait 0 0470: 0@ = actor $PLAYER_ACTOR current_weapon 0@ *= 0x70 0@ += 0xC8AAB8 0@ += 0x8 0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0 // weapon range 00A0: store_actor $PLAYER_ACTOR position_to 1@ 2@ 3@ 0AB1: call_scm_func @getAimPoint 4 range 0@ from 1@ 2@ 3@ camera_to 4@ 5@ 6@ point_to 7@ 8@ 9@ 0AB1: call_scm_func @getLaserPoint 6 from 4@ 5@ 6@ to 7@ 8@ 9@ store_to 10@ 11@ 12@ 04D5: create_corona_at 10@ 11@ 12@ radius 0.05 type 0 flare 0 RGB 255 0 0 end :getAimPoint { Parameters: Passed: 0@ - aiming range 1@ - start point X 2@ - start point Y 3@ - start point Z Result: 4@ - camera point X 5@ - camera point Y 6@ - camera point Z 7@ - aim point X 8@ - aim point Y 9@ - aim point Z Example: 0AB1: call_scm_func @getAimPoint 4 range 20.0 from 0.0 0.0 0.0 camera_to 1@ 2@ 3@ point_to 4@ 5@ 6@ } 0A9F: 12@ = current_thread_pointer 0AB1: call_scm_func @getLocalVarOffset 2 thread 12@ var 4 store_to 10@ 0AB1: call_scm_func @getLocalVarOffset 2 thread 12@ var 7 store_to 11@ 0AA6: call_method 0x514970 struct 0xB6F028 num_params 6 pop 0 pPoint 11@ pCamera 10@ fOriginZ 3@ fOriginY 2@ fOriginX 1@ fRange 0@ // CCamera__Find3rdPersonCamTargetVector 0AB2: ret 6 4@ 5@ 6@ 7@ 8@ 9@ :getLaserPoint { Parameters: Passed: 0@ - start point X 1@ - start point Y 2@ - start point Z 3@ - end point X 4@ - end point Y 5@ - end point Z Result: 6@ - middle point X 7@ - middle point Y 8@ - middle point Z Example: 0AB1: call_scm_func @getLaserPoint 6 from 0.0 0.0 0.0 to 1.0 0.0 0.0 store_to 1@ 2@ 3@ } 0A96: 11@ = actor $PLAYER_ACTOR struct 0AB1: call_scm_func @getCollisionBetweenPoints 17 from 0@ 1@ 2@ to 3@ 4@ 5@ solid 1 car 1 actor 1 object 1 particle 1 cartyre 1 water 0 ignore_entity 11@ see_through 0 camera_objects 0 shoot_through 0 store_to 6@ 7@ 8@ distance_to 9@ entity_to 10@ 0AB2: ret 3 6@ 7@ 8@ :getCollisionBetweenPoints { Parameters: Passed: 0@ - start point X 1@ - start point Y 2@ - start point Z 3@ - end point X 4@ - end point Y 5@ - end point Z 6@ - is solid 7@ - is car 8@ - is actor 9@ - is object 10@ - is particle 11@ - is car tyre 12@ - is water 13@ - entity to ignore (offset) 14@ - no see-through stuff 15@ - no camera objects 16@ - no shoot-through stuff Result: 17@ - collision point X 18@ - collision point Y 19@ - collision point Z 20@ - distance 21@ - entity Example: 0AB1: call_scm_func @getCollisionBetweenPoints 17 from 0.0 0.0 0.0 to 1.0 0.0 0.0 solid 0 car 1 actor 0 object 0 particle 0 cartyre 1 water 0 ignore_entity 0x0 see_through 0 camera_objects 0 shoot_through 0 store_to 1@ 2@ 3@ distance_to 4@ entity_to 5@ } if 13@ <> 0x0 then 0A8C: write_memory 0xB7CD68 size 4 value 13@ virtual_protect 0 end 0A8C: write_memory 0xB7CD70 size 1 value 11@ virtual_protect 0 0A9F: 26@ = current_thread_pointer 0AB1: call_scm_func @getLocalVarOffset 2 thread 26@ var 0 store_to 22@ 0AB1: call_scm_func @getLocalVarOffset 2 thread 26@ var 3 store_to 23@ 0AB1: call_scm_func @getLocalVarOffset 2 thread 26@ var 17 store_to 24@ 0AB1: call_scm_func @getLocalVarOffset 2 thread 26@ var 21 store_to 25@ 0AA7: call_function 0x56BA00 num_params 12 pop 12 bIgnoreShootThroughStuff 16@ bIgnoreSomeObjectsForCamera 15@ bIgnoreSeeThroughStuff 14@ bDummy 10@ bObject 9@ bActor 8@ bCar 7@ bBuilding 6@ pEntity 25@ pPoint 24@ pTarget 23@ pOrigin 22@ bReturn 31@ // CWorld__ProcessLineOfSight if 13@ <> 0x0 then 0A8C: write_memory 0xB7CD68 size 4 value 0x0 virtual_protect 0 end if 31@ <> 0 then if and 17@ <> 0.0 18@ <> 0.0 19@ <> 0.0 then 050A: 20@ = distance_between_XYZ 0@ 1@ 2@ and_XYZ 17@ 18@ 19@ if 12@ == 1 then 0A9F: 26@ = current_thread_pointer 0AB1: call_scm_func @getLocalVarOffset 2 thread 26@ var 27 store_to 30@ 0AA7: call_function 0x6E61B0 num_params 7 pop 7 pPoint 30@ fTargetZ 5@ fTargetY 4@ fTargetX 3@ fOriginZ 2@ fOriginY 1@ fOriginX 0@ bResult 31@ // CWorld__TestLineAgainstWater if 31@ <> 0 then 0087: 17@ = 27@ 0087: 18@ = 28@ 0087: 19@ = 29@ 050A: 20@ = distance_between_XYZ 0@ 1@ 2@ and_XYZ 27@ 28@ 29@ end end 0AB2: ret 5 17@ 18@ 19@ 20@ 21@ end end 0AB2: ret 5 3@ 4@ 5@ 0.0 0x0 :getLocalVarOffset { Parameters: Passed: 0@ - thread pointer 1@ - var number Result: 1@ - var value Example: 0AB1: call_scm_func @getLocalVarOffset 2 thread 0@ var 0 store_to 1@ } if 0@ <> 0 then 1@ *= 0x4 0A8E: 2@ = 0@ + 0xDC // mission flag if 2@ == 1 then 1@ += 0xA48960 // mission locals else 005A: 1@ += 0@ 1@ += 0x3C end else 1@ = 0 end 0AB2: ret 1 1@ RyanDri3957V 1 CLEO MODS CLEO Script Tutorial Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now