Quantcast

Jump to content

» «
Photo

Laser sight ?

20 replies to this topic
xana
  • xana

    xanthis

  • Members
  • Joined: 25 Jun 2008

#1

Posted 19 October 2010 - 03:46 PM

Can we replace the aim cross, by a laser ? Like Resident evil 4 & 5 game ?

Not just a red, green, or any colour point, a real laser ^^
Something like this :

user posted image

Without aim cross, of course wink.gif

Thanks !

BnB
  • BnB

    Better days

  • The Yardies
  • Joined: 28 Jun 2010
  • Jamaica

#2

Posted 19 October 2010 - 04:50 PM

Yeah, If you make a script for the laser and make aim texture transparent!

yair1221
  • yair1221

    Homie

  • Members
  • Joined: 18 Feb 2010

#3

Posted 19 October 2010 - 04:55 PM

the laser can be done with the model
i downloaded an M4 with a laser once....
i think it was on gtainside
as well as another 100000000 models...wish you good luck finding it tounge.gif

xana
  • xana

    xanthis

  • Members
  • Joined: 25 Jun 2008

#4

Posted 19 October 2010 - 05:59 PM

I had it, long time ago...
But it's not really what I want, because the laser don't " touch " the target, it pass trought confused.gif

coin-god
  • coin-god

    High Roller

  • $outh $ide Hoodz
  • Joined: 18 Mar 2007

#5

Posted 19 October 2010 - 06:04 PM

Weeser was working on a laser mod RE4 style. You did not see the laser trail, but the dot did collide with objects, and was interesting.

Not sure if he finished it.

Here is an old video:
http://www.xfire.com/video/1be6c8/

The aiming is kinda off, but Wesser fixed it.

yair1221
  • yair1221

    Homie

  • Members
  • Joined: 18 Feb 2010

#6

Posted 19 October 2010 - 06:35 PM

guess you can also create it as a particle
you can start from the base of the searchlight...

xana
  • xana

    xanthis

  • Members
  • Joined: 25 Jun 2008

#7

Posted 20 October 2010 - 12:46 PM

I will see with wesser wink.gif
It's just what I want ^^

Wesser
  • Wesser

    The complexity simplifier, the efficiency optimizer.

  • Feroci Racing
  • Joined: 19 Aug 2006
  • Unknown

#8

Posted 03 November 2010 - 07:12 PM

After playing a bit with IDA, I figured out a quick way to avoid some iterations by using game routines. Here is the code:
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.

-   getIntPoint
     Type: GET
       Description: Get the intersection between 2 points.

-   getActorBonePos
     Type: GET
       Description: Get the XYZ coords of a ped's bone.

-   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: 10@ = current_thread_pointer
0AB1: call_scm_func @getLocalVarOffset 2 thread 10@ var 4 store_to 11@
0AB1: call_scm_func @getLocalVarOffset 2 thread 10@ var 7 store_to 12@
0AA6: call_method 0x514970 struct 0xB6F028 num_params 6 pop 0 pPoint 12@ pCamera 11@ fZ 3@ fY 2@ fX 1@ fRange 0@
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: 10@ = actor $PLAYER_ACTOR struct
0AB1: call_scm_func @getIntPoint 12 from 0@ 1@ 2@ to 3@ 4@ 5@ solid 1 car 1 actor 1 object 1 particle 0 ignore_entity 10@ store_to 6@ 7@ 8@ distance_to 9@
0AB1: call_scm_func @getActorBonePos 2 actor $PLAYER_ACTOR bone 25 store_to 0@ 1@ 2@
if
06BD:  no_obstacles_between 0@ 1@ 2@ and 3@ 4@ 5@ solid 1 car 1 actor 1 object 1 particle 0
then
 0087: 6@ = 3@
 0087: 7@ = 4@
 0087: 8@ = 5@
end
0AB2: ret 3 6@ 7@ 8@

:getIntPoint
{
 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@ - entity to ignore (offset)
   Result:
     6@ - middle point X
     7@ - middle point Y
     8@ - middle point Z
     9@ - distance

 Example:
   0AB1: call_scm_func @getIntPoint 12 from 0.0 0.0 0.0 to 1.0 0.0 0.0 solid 1 car 0 actor 0 object 0 particle 0 ignore_entity 0x0 store_to 1@ 2@ 3@ distance_to 4@
}
if
 11@ <> 0x0
then
 0A8C: write_memory 0xB7CD68 size 4 value 11@ virtual_protect 0
end
0A9F: 26@ = current_thread_pointer
0AB1: call_scm_func @getLocalVarOffset 2 thread 26@ var 0 store_to 16@ // from => 0@-2@
0AB1: call_scm_func @getLocalVarOffset 2 thread 26@ var 3 store_to 17@ // to => 3@-5@
0AB1: call_scm_func @getLocalVarOffset 2 thread 26@ var 12 store_to 18@ // out => 12@-14@
0AB1: call_scm_func @getLocalVarOffset 2 thread 26@ var 15 store_to 19@ // out => 15@
0AA7: call_function 0x56BA00 num_params 12 pop 12 bIgnoreShootThroughStuff 0 bIgnoreSomeObjectsForCamera 0 bIgnoreSeeThroughStuff 0 bDummies 10@ bObject 9@ bActor 8@ bCar 7@ bBuilding 6@ fDistance 19@ pPoint 18@ pTarget 17@ pOrigin 16@ bReturn 20@
if
 11@ <> 0x0
then
 0A8C: write_memory 0xB7CD68 size 4 value 0 virtual_protect 0
end
0AB1: call_scm_func @getLocalVarOffset 2 thread 26@ var 21 store_to 24@ // out => 21@-23@
if
 20@ <> 0
then
 if and
   12@ <> 0.0
   13@ <> 0.0
   14@ <> 0.0
 then
   050A: 15@ = distance_between_XYZ 0@ 1@ 2@ and_XYZ 12@ 13@ 14@
 end
else
 15@ = 0.0
end
0AB2: ret 4 12@ 13@ 14@ 15@

:getActorBonePos
{
 Parameters:
   Passed:
     0@ - actor
     1@ - bone number
   Result:
     2@ - bone point X
     3@ - bone point Y
     4@ - bone point Z

 Example:
   0AB1: call_scm_func @getActorBonePos 2 actor 0@ bone 0 store_to 1@ 2@ 3@

 Values:
   http://www.google.com/codesearch/p?hl=it#KdIewVX4zdg/trunk/MTA10/sdk/game/CPed.h&q=eBone%20package:http://mtasa-blue%5C.googlecode%5C.com&sa=N&cd=1&ct=rc&l=43
}
0A96: 0@ = actor 0@ struct
0A9F: 6@ = current_thread_pointer
0AB1: call_scm_func @getLocalVarOffset 2 thread 6@ var 2 store_to 5@
0AA6: call_method 0x5E4280 struct 0@ num_params 3 pop 0 bUnk 1 nBone 1@ pPoint 5@
0AB2: ret 3 2@ 3@ 4@

: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@

I guess it works as your preferences.

coin-god
  • coin-god

    High Roller

  • $outh $ide Hoodz
  • Joined: 18 Mar 2007

#9

Posted 03 November 2010 - 07:30 PM

Wesser, you are awesome. icon14.gif

TheSiggi
  • TheSiggi

    Surgeon

  • Members
  • Joined: 05 Jul 2009

#10

Posted 03 November 2010 - 07:47 PM

Let me see.... monocle.gif ... wow.gif .... mercie_blink.gif .... cry.gif ... facedesk.gif < thats my exact reaction :lol

Agreeing with goin-god icon14.gif

coin-god
  • coin-god

    High Roller

  • $outh $ide Hoodz
  • Joined: 18 Mar 2007

#11

Posted 03 November 2010 - 08:03 PM

Actually my reaction was like

user posted image

He wrote a Cleo using real programming structure. Someone new to Programming could think thats written in C#
And just the other day I was wondering how to work like this in coding, using Functions or Procedures and Calling them.

Its a beautiful script.

TheSiggi
  • TheSiggi

    Surgeon

  • Members
  • Joined: 05 Jul 2009

#12

Posted 03 November 2010 - 08:41 PM

Well the script itself is indeed a beauty and like his walkstyle changer and the snippet for writting coords into a file I realy appreciate the structure and also the way the functions are used.

In game the script looks just realy cool (beside the dot is there always) and owning peope with a aser sight almost doubles the fun biggrin.gif

QUOTE
Someone new to Programming could think thats written in C#


ehh? dontgetit.gif

QUOTE
Its a beautiful script.


Indeed icon14.gif

btw, Wesser: hows your progress on your SDK? monocle.gif

Wesser
  • Wesser

    The complexity simplifier, the efficiency optimizer.

  • Feroci Racing
  • Joined: 19 Aug 2006
  • Unknown

#13

Posted 17 November 2010 - 08:35 AM

coin-god, you've propably exceded a bit. At present, none of the known programming languages has this pre-defined structure. You'd rather say it's similar but nobody will be confused after learning it. tounge2.gif

The_Siggi, I'm still working to put my website online so I've just stopped working on those SDK. smile.gif

ZAZ
  • ZAZ

    Kernlochbohrer

  • Members
  • Joined: 10 Jan 2005
  • European-Union

#14

Posted 17 November 2010 - 04:34 PM

Excellent script, Wesser. I wanna use your methods for future scripts, if you confirm (please reply),
for scripts of Project Fantsia to get the aiming target point and throw objects as well as the script in the current version and add a Lasersight effect

Wesser
  • Wesser

    The complexity simplifier, the efficiency optimizer.

  • Feroci Racing
  • Joined: 19 Aug 2006
  • Unknown

#15

Posted 17 November 2010 - 05:39 PM

Sure, I love those new effects since I can't realize the way they could be done.

Deji
  • Deji

    Coding like a Rockstar!

  • Feroci Racing
  • Joined: 24 Dec 2007
  • None

#16

Posted 17 November 2010 - 09:58 PM

Nice find on that bone position function. Much easier than calling all those other functions manually.

I'm wondering if you know of any similar methods for vehicles? Knowing the exact position of vehicle components seems very useful. I've been doing some research into components recently (amongst other things).

Anyway.. this page is annoyingly wide, so I'll come back to check out the script later tounge.gif

ZAZ
  • ZAZ

    Kernlochbohrer

  • Members
  • Joined: 10 Jan 2005
  • European-Union

#17

Posted 17 November 2010 - 10:08 PM Edited by ZAZ, 17 November 2010 - 10:24 PM.

QUOTE (Wesser @ Nov 17 2010, 17:39)
Sure, I love those new effects since I can't realize the way they could be done.

thanks smile.gif
the effects.fxp is data to define effects and allocate settings, mostly to show alpha textures of effectPC.txd and move them, rotate, grow or decrease them, can have time steps
the result must be executed from exe or maybe allocated to a directx enviroment?
i can only modify a little bit, change size and colors, making textures is difficult because you mostly see the border of the picture
Function-X- is an expert, i'm wondering how he can do it

lolleroz
  • lolleroz

    Homeboy

  • Members
  • Joined: 29 Jul 2010
  • None

#18

Posted 17 November 2010 - 10:23 PM

Just a heads up, I didn't read the topic clearly so dunno if you guys got it working or not, but Ryosuke's weapons' accesory mods includes lasers, aim sights, and alot more:
http://hotmist.ddo.j...stom/index.html
look for 'Weapon Accesory'

xhero2503
  • xhero2503

    Player Hater

  • Members
  • Joined: 17 Aug 2010

#19

Posted 12 March 2011 - 05:30 AM

O.o how you get that code work lol i want it too :[

EUX adamant4
  • EUX adamant4

    Square Civilian

  • Members
  • Joined: 12 May 2009

#20

Posted 12 March 2011 - 03:26 PM

I have made a script based off Wesser's that does add a beam (just for educational purposes). Unfortunately the only thing that works properly is using searchlights, as Adler mentioned above tounge.gif

It works pretty well, and has taught me how to make my own functions lol- It still has a few rough edges to be smoothed out, like the beam not coming from the gun, but other than that its perfect (apart from the beam being white sad.gif )

12jango
  • 12jango

    "This is not revenge! This is entertainment!"

  • Members
  • Joined: 08 Mar 2008

#21

Posted 25 August 2011 - 05:57 AM

Excuse me, how do I manage to adjust the corona's position as I desire? (eg; I want to put the corona at the middle, not at the upper-right of the screen)




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users