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

 nearest point

 
2FriedEggz  
Posted: Wednesday, Jun 13 2012, 18:20
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Jun 13, 2012

XXXXX



CODE
:GOSUB9
0AB4: 22@ = var 5
0AB4: 23@ = var 6
0AB4: 24@ = var 7
0AB4: 4@ = var 8
0AB4: 5@ = var 9
0AB4: 6@ = var 10
Actor.StorePos($PLAYER_ACTOR, 7@, 8@, 9@)
if
80EC: not actor $PLAYER_ACTOR sphere 0 near_point 15@ 16@ radius 20.0 20.0
0AA1: return_if_false
050A: 0@ = distance_between_XYZ 4@ 5@ 6@ and_XYZ 15@ 16@ 17@
050A: 1@ = distance_between_XYZ 4@ 5@ 6@ and_XYZ 7@ 8@ 9@
if
0025: 1@ > 0@ // point must be nearer to 4,5,6 than the player.
0AA1: return_if_false
050A: 0@ = distance_between_XYZ 7@ 8@ 9@ and_XYZ 15@ 16@ 17@
050A: 1@ = distance_between_XYZ 7@ 8@ 9@ and_XYZ 22@ 23@ 24@
if
0025: 1@ > 0@ // player <-> best point > player <-> point
0AA1: return_if_false
0AB3: var 5 = 15@  //new best point
0AB3: var 6 = 16@
0AB3: var 7 = 17@
return


I use this multiple times in a row with a different input (15@, 16@, 17@) to calculate the nearest point for the player that fits all the conditions.

However, it keeps outputting 0, 0, 0. Yet I made sure all variables start as 3000 to prevent this from being output. I'm quite happy to clarify anything necessary.
PM
  Top
 

 
Ashwin the new boy  
Posted: Thursday, Jun 14 2012, 04:28
Quote Post


I am The Most Confused Person
Group Icon
Group: Members
Joined: Nov 14, 2010

ia.gif

XXXXX



Do you know what are you doing ???
cuz i get nothing except that You want to get the coords,

pls don't show your script just tell us what you want ?

QUOTE
calculate the nearest point for the player

you can't get more nearest point than this
Actor.StorePos($PLAYER_ACTOR, 7@, 8@, 9@)

QUOTE
that fits all the conditions.

Which Conditions ?
Users WebsitePM
  Top
 

 
2FriedEggz  
Posted: Thursday, Jun 14 2012, 09:15
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Jun 13, 2012

XXXXX



QUOTE
Do you know what are you doing ???

The mod is currently 30kb compiled, and this is the only part that causes issues. So I'm pretty sure I know what I'm doing; even if my methods are a bit unorthodox.

QUOTE
you can't get more nearest point than this
Actor.StorePos($PLAYER_ACTOR, 7@, 8@, 9@)

That made me laugh.

QUOTE
pls don't show your script just tell us what you want ?

I need this gosub to process multiple points to determine which is closest to the player.

QUOTE
Which Conditions ?

1) It must not be too close to the player. (1st return_if_false)
2) The point chosen must be nearer to 4@, 5@, 6@ than the player. (2nd return_if_false)
3) The point must be closer than the closest point found so far. (3rd return_if_false)

I've gone over this a hundred or so times, and I cannot fathom why it is outputting 0, 0, 0.
PM
  Top
 

 
Bad.boy!  
Posted: Thursday, Jun 14 2012, 15:14
Quote Post


SA modder
Group Icon
Group: Members
Joined: Jun 20, 2010

nl.gif

XXXXX



Actor.StorePos is the current location of the player. Would you mind posting your full script that proves that Actor.StorePos isn't the accurate location?
PM
  Top
 

 
2FriedEggz  
Posted: Thursday, Jun 14 2012, 17:20
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Jun 13, 2012

XXXXX



Am I not speaking English? I have no idea what's going on anymore.

I used actor.storepos in the OP. Where did I even suggest that it is inaccurate?

To try again to explain...

My mod will only work in specific places. For example, (and this is JUST an example) a roadblock would be useless in mad doggs swimming pool.

So I have predetermined points/coords that the mod will work in.

The gosub, in the OP, is intended to determine which of these points is suitable for the mod to be executed in... except for some reason it outputs 0, 0, 0 even though multiple valid points were input.

Is there anyone here who has the remotest grasp on what I'm saying?
PM
  Top
 

 
Deji  
Posted: Thursday, Jun 14 2012, 20:40
Quote Post


Coding like a Rockstar!
Group Icon
Group: Members
Joined: Dec 24, 2007

ja.gif

XXXXX



It sounds like you want to check the player is in radius of a point, but that wouldn't make sense, since it only requires using 00FE.

Also, I get a feeling that if your CLEO script is 30kb, you probably need to enable "Skip scm header" in Sanny Builders options (something like that, anyway).
Users WebsitePM
  Top
 

 
Link2012  
Posted: Thursday, Jun 14 2012, 20:45
Quote Post


Wut?
Group Icon
Group: Members
Joined: Jan 30, 2011

ba.gif

XXXXX



QUOTE (Deji @ Thursday, Jun 14 2012, 17:40)
Also, I get a feeling that if your CLEO script is 30kb, you probably need to enable "Skip scm header" in Sanny Builders options (something like that, anyway).

Disable Add Extra Info To SCM
PMMSN
  Top
 

 
2FriedEggz  
Posted: Friday, Jun 15 2012, 12:40
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Jun 13, 2012

XXXXX



QUOTE
Also, I get a feeling that if your CLEO script is 30kb, you probably need to enable "Skip scm header" in Sanny Builders options (something like that, anyway).

Aside from cutting kb off a file, does that actually do anything beneficial? My script's 1800 lines BTW.

Anyway this is a compilable script that demonstrates the problem. Can anyone help?

CODE
{$CLEO .cs}

0000:

:START0
wait 0
if
  Player.Defined($PLAYER_CHAR)
jf @START0
select_interior 0
0860: link_actor $PLAYER_ACTOR to_interior 0
00A1: put_actor $PLAYER_ACTOR at 1178.093 -166.0749 40.58875

:START1
wait 0
if and
  Player.Defined($PLAYER_CHAR)
00E1:   key_pressed 0 4 // Action
00E1:   key_pressed 0 16 // Sprint
jf @START1

22@ = 3000 // Should prevent 0, 0, 0
23@ = 3000
24@ = 3000
4@ = -98.40488
5@ = -938.9159
6@ = 20.60678
gosub @PLACE_1
gosub @POINTCHECK
gosub @PLACE_2
gosub @POINTCHECK
gosub @PLACE_3
gosub @POINTCHECK
Jump @TELEPORT

:PLACE_1
15@ = 908.501
16@ = -175.6631
17@ = 10.80305
return

:PLACE_2
15@ = 620.4529
16@ = 308.6574
17@ = 19.87542
return

:PLACE_3
15@ = -98.40488
16@ = -938.9159
17@ = 20.60678
return

:POINTCHECK
Actor.StorePos($PLAYER_ACTOR, 7@, 8@, 9@)
if
80EC: not actor $PLAYER_ACTOR sphere 0 near_point 15@ 16@ radius 20.0 20.0
0AA1: return_if_false
050A: 0@ = distance_between_XYZ 4@ 5@ 6@ and_XYZ 15@ 16@ 17@
050A: 1@ = distance_between_XYZ 4@ 5@ 6@ and_XYZ 7@ 8@ 9@
if
0025: 1@ > 0@
0AA1: return_if_false
050A: 0@ = distance_between_XYZ 7@ 8@ 9@ and_XYZ 15@ 16@ 17@
050A: 1@ = distance_between_XYZ 7@ 8@ 9@ and_XYZ 22@ 23@ 24@
if
0025: 1@ > 0@
0AA1: return_if_false
0087: 22@ = 15@
0087: 23@ = 16@
0087: 24@ = 17@
return

:TELEPORT
00A1: put_actor $PLAYER_ACTOR at 22@ 23@ 24@
Jump @START1


It should teleport the player to 908.501, -175.6631, 10.80305, but it teleports him to 0, 0, 0.

Does anyone know why?
PM
  Top
 

 
juarez  
Posted: Friday, Jun 15 2012, 13:46
Quote Post


Rat
Group Icon
Group: Members
Joined: Jun 11, 2011

pl.gif

XXXXX



CODE
22@ = 3000 // Should prevent 0, 0, 0
23@ = 3000
24@ = 3000


but...
CODE

22@ = 3000.0 // Should prevent 0, 0, 0
23@ = 3000.0
24@ = 3000.0
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