IMG

 
IMG
IMG   IMG
  Welcome to GTAForums! Be sure to check out the Grand Theft Auto V Forum.

You are not registered! (If you are, click here to login) Registering is fast, free and easy and allows you to instantly reply to any topic on GTAForums.
Why wait? Click here to register your own unique username and become part of the ever-growing community!


( Log In | Register | Revalidate Validation E-mail )
Quick Log-In:
  IMG
       
>
Forum Rules GTA Modification Forums

Please post mod releases in the Mod Showroom

GTAGarage.com
free mod hosting from GTANet, simply login with your GTAForums account details

GTAModding.com
GTANet's modding wiki

GTA Modding Chatroom
provided by irc.gtanet.com (Don't have an IRC client? Click here)


  Reply to this topicStart new topicStart Poll

 Center between two moving objects

 
thrndm  
Posted: Wednesday, Apr 11 2012, 12:21
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Mar 5, 2010

XXXXX



Hello there.

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

Basic code is:
CODE
005A: 0@ += 4@ //0@ - 1 object X coordinate, 4@ - 2 object X coordinate
0014: 0@ /= 2
0084: 7@ = 0@
005A: 1@ += 5@ //1@ - 1 object Y coordinate, 5@ - 2 object Y coordinate
0014: 1@ /= 2
0084: 8@ = 1@


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

Thanks.

This post has been edited by thrndm on Wednesday, Apr 11 2012, 12:25
PM
  Top
 

 
fastman92  
Posted: Wednesday, Apr 11 2012, 12:35
Quote Post


фастман92 | ف
Group Icon
Group: Members
Joined: Jul 28, 2009

pl.gif

XXXXX



CODE
0014: 0@ /= 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
0@ /= 2.0


Full code if XYZ coordinates 1 are in 0@, 1@, 2@ and coordinates 2 are in 3@, 4@, 5@:
CODE
0087: 6@ = 0@ // (float)
0087: 7@ = 1@ // (float)
0087: 8@ = 2@ // (float)
005A: 6@ += 3@  // (int)
005A: 7@ += 4@  // (int)
005A: 8@ += 5@  // (int)
6@ /= 2.0
7@ /= 2.0
8@ /= 2.0
Users WebsitePMMSN
  Top
 

 
Los_Vincent  
Posted: Thursday, Apr 12 2012, 11:52
Quote Post


Liberty City
Group Icon
Group: Members
Joined: Apr 5, 2012

cn.gif

XXXXX



+1 to ^'comment
Users WebsitePM
  Top
 

 

0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)

0 Members:

Topic Options Reply to this topicStart new topicStart Poll
Search topic for posted by (exact match)



 
IMG IMG