Quantcast

Jump to content

» «
Photo

Center between two moving objects

2 replies to this topic
thrndm
  • thrndm

    Player Hater

  • Members
  • Joined: 05 Mar 2010

#1

Posted 11 April 2012 - 12:21 PM Edited by thrndm, 11 April 2012 - 12:25 PM.

Hello there.

I'm trying to get center between two moving objects and save it's coordinates to variables.

Basic code is:
CODE
005A: [email protected] += [email protected] //[email protected] - 1 object X coordinate, [email protected] - 2 object X coordinate
0014: [email protected] /= 2
0084: [email protected] = [email protected]
005A: [email protected] += [email protected] //[email protected] - 1 object Y coordinate, [email protected] - 2 object Y coordinate
0014: [email protected] /= 2
0084: [email protected] = [email protected]


Game crashes when it meets 0014 opcode, I.. I don't get why. What could be wrong here?

Thanks.

fastman92
  • fastman92

    фастман92 | ف

  • Members
  • Joined: 28 Jul 2009
  • Poland
  • Best Conversion 2016 [GTA: Underground] [Contribution]
    Contribution Award [Mods]

#2

Posted 11 April 2012 - 12:35 PM

CODE
0014: [email protected] /= 2

Will crash.

See the example in opcode search, applies to math opcodes only:
CODE
0014: $HJ_TWOWHEELS_TIME /= 1000


R* Math opcodes require specified input - variable or value depending on command.
It doesn't apply to any other opcodes.

And also i think coordinates will be float values (floating points).
2 integer is saved differently in CLEO script than 2.0.
2 integer will compute floating point 2.802596929E-45

You must do:
CODE
[email protected] /= 2.0


Full code if XYZ coordinates 1 are in [email protected], [email protected], [email protected] and coordinates 2 are in [email protected], [email protected], [email protected]:
CODE
0087: [email protected] = [email protected] // (float)
0087: [email protected] = [email protected] // (float)
0087: [email protected] = [email protected] // (float)
005A: [email protected] += [email protected]  // (int)
005A: [email protected] += [email protected]  // (int)
005A: [email protected] += [email protected]  // (int)
[email protected] /= 2.0
[email protected] /= 2.0
[email protected] /= 2.0

Vincent Johnson
  • Vincent Johnson

    China

  • Members
  • Joined: 05 Apr 2012
  • China

#3

Posted 12 April 2012 - 11:52 AM

+1 to ^'comment




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users