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

 Object detection

 conditional check
 
JACK JONES  
Posted: Wednesday, Apr 25 2012, 11:31
Quote Post


Booom!!!
Group Icon
Group: Members
Joined: Dec 6, 2011

sr.gif

XXXXX



How to check is there is some building or other structure somewhere around the player (or vehicle). I need the conditional check opcode which could tell is there any (not specific) object around the player, car, helicopter... In other words I need to detect immovable objects (I mean buildings, trees, houses...) - everything that stands still forever. The problem is when I create coordinates from player and force some vehicle to go to those coordinates - the vehicle is not capable to predict the impact and therefore it smashes into the building (without even knowing what the hell just happened):
CODE
04C4: create_coordinate 0@ 1@ 2@ from_actor $PLAYER_ACTOR offset 10.0 0.0 0.0
02C2: car 3@ drive_to_point 0@ 1@ 2@
04C4: create_coordinate 4@ 5@ 6@ from_actor $PLAYER_ACTOR offset -10.0 5.0 30.0
04A2: heli 7@ fly_to 4@ 5@ 6@ speed 100

You see what's the problem - the drivers and pilots are blind and stupid. So how to make them to become smart?

This post has been edited by JACK JONES on Wednesday, Apr 25 2012, 11:58
PM
  Top
 

 
Ashwin the new boy  
Posted: Wednesday, Apr 25 2012, 12:44
Quote Post


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

ia.gif

XXXXX



::Solution::
create a small object,
disable its collision
put it to Z = -100.0
& read its Z coord then,
if it is more than Ground Level then there is a building, tree, or a Collision Object,

I hope you got me,
tell if not
Users WebsitePM
  Top
 

 
JACK JONES  
Posted: Wednesday, Apr 25 2012, 19:07
Quote Post


Booom!!!
Group Icon
Group: Members
Joined: Dec 6, 2011

sr.gif

XXXXX



I'm not sure what exactly do you mean? Maybe something like this?
CODE
{$CLEO .cs}
thread 'TEST'

:Create
04C4: create_coordinate 4@ 5@ 6@ from_actor $PLAYER_ACTOR offset 0.0 0.0 -100.0
0107: 0@ = create_object #COLT45 at 4@ 5@ 6@

:Move
wait 0
04C4: create_coordinate 1@ 2@ 3@ from_actor $PLAYER_ACTOR offset 0.0 40.0 -100.0
01BC: put_object 0@ at 1@ 2@ 3@
0382: set_object 0@ collision_detection 0
04C4: create_coordinate 7@ 8@ 9@ from_actor $PLAYER_ACTOR offset 0.0 0.0 0.0
if
0025:   3@ > 9@  // (float)
else_jump @Move

:Move1
wait 0
010D: set_player $PLAYER_CHAR wanted_level_to 6 (test - if checking is working 6 stars will flash)
jump @Move
05DC: end_custom_thread

But it's not working (players wanted level is 0 starts).
I don't understand - why would some object change its Z coordinate if it's in a building area? Tell me more. Also I'm guessing that the code can't reach 010D because 04C4 was defined twice so 0025 can't recognize the value of 3@ variable (but I just don't know how to force some object to be attached to player AND to check players ground position AT THE SAME TIME without using 04C4 command).

This post has been edited by JACK JONES on Wednesday, Apr 25 2012, 19:40
PM
  Top
 

 
Link2012  
Posted: Thursday, Apr 26 2012, 03:12
Quote Post


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

ba.gif

XXXXX



The Z coordinate must be <= -100.0 to create object at ground, not relative to player location. If for example player is at Z 400.0, get coords with offset -100.0 will return Z 300.0, Z now is not <= -100.0, failure in create object at ground.

CODE
00A0: store_actor $PLAYER_ACTOR position_to 0@ 1@ 2@
0107: 0@ = create_object #FAKETARGET at 0@ 1@ -100.0


use 00A0 instead of 04C4 if you doesn't need offset in coordinates.
PMMSN
  Top
 

 
Ashwin the new boy  
Posted: Thursday, Apr 26 2012, 13:18
Quote Post


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

ia.gif

XXXXX



QUOTE
the drivers and pilots are blind and stupid. So how to make them to become smart?

It is very difficult,
when you give them instruction to go somewhere
they calculate & follow smallest path rote
so, Add more paths to make them smart wink.gif

the thing i am telling you is
QUOTE
How to check is there is some building or other structure somewhere around the player


CODE

{$CLEO}
thread 'Ashwin'
wait 5000
model.Load(#COLT45)
038B: load_requested_models

:0
04C4: create_coordinate 1@ 2@ 3@ from_actor $3 offset 0.0 10.0 0.0
object.Create(0@, #COLT45, 1@, 2@, -100.0)
object.CollisionDetection(0@, 0)

:1
04C4: create_coordinate 1@ 2@ 3@ from_actor $3 offset 0.0 10.0 0.0
01BC: put_object 0@ at 1@ 2@ -100.0
wait 0
01BB: store_object 0@ position_to 4@ 5@ 6@
if
0035:   6@ >= 3@      //<--- checking if object Z height is more than player Actor
jf @1
// <--- If condition true then There is a building, tree, car, or any collision object at this place (1@ 2@ 3@) ---> //
//<--- Give them instruction what to do now --->//

using this script,
you will get that there is a object in front of it,
i am interested to know what instruction you will give them now lol.gif
Users WebsitePM
  Top
 

 
JACK JONES  
Posted: Thursday, Apr 26 2012, 14:16
Quote Post


Booom!!!
Group Icon
Group: Members
Joined: Dec 6, 2011

sr.gif

XXXXX



Hey Ashwin you are a genius. I spend almost whole day trying to activate objects Z checking but your code solves everything. In case you're still interested what I was trying to do:
My ultimate plan is to create 4 objects at player offset. These 4 objects will have the same movements as helicopter following player - the only diference is they will be around the helicopter and their job will be to alert the vehicle about the dangerous places. Helicopters movements (which is following player with a 04C4) are -x, +x, -y and +y so these 4 objects will be some kind of a helicopter radars - if any of these 4 protectors feal a building or a tree - helicopters speed will become 0 so it won't smash into the structure. And if all 4 objects don't feal anything the helis speed will be 100 again.
All thie wouldn't be possible without your code. Thanks man.
PM
  Top
 

 
SilentPL  
Posted: Thursday, Apr 26 2012, 14:38
Quote Post


Senior File Manager
Group Icon
Group: Members
Joined: Feb 1, 2010

pl.gif

Member Award




Isn't it easier to just use 02CE to retrieve the Z coord?
Users WebsitePMMSNXbox Live
  Top
 

 
DK22Pac  
Posted: Thursday, Apr 26 2012, 15:29
Quote Post


Assembly!
Group Icon
Group: Members
Joined: Apr 12, 2009

un.gif

XXXXX



Yes but the easiest way is using isLineOfSightClear wink.gif
Users WebsitePM
  Top
 

 
JACK JONES  
Posted: Thursday, Apr 26 2012, 16:00
Quote Post


Booom!!!
Group Icon
Group: Members
Joined: Dec 6, 2011

sr.gif

XXXXX



Hey guys I'm having some hard time finding the opcode that can make an object invisible - I searched SB opcodes, gtagaming and MB opcode DB - I couldn't find anything. Is there an opcode that can do this?
PM
  Top
 

 
Ashwin the new boy  
Posted: Thursday, Apr 26 2012, 16:06
Quote Post


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

ia.gif

XXXXX



i don't think VC have such a Opcode,
you may make a Object Invisible by changing its Texture(using alpha)
Users WebsitePM
  Top
 

 
DK22Pac  
Posted: Thursday, Apr 26 2012, 18:51
Quote Post


Assembly!
Group Icon
Group: Members
Joined: Apr 12, 2009

un.gif

XXXXX



CODE
// store needed coords
04C4: create_coordinate 0@ 1@ 2@ from_actor $3 offset 0.0 0.0 10.0
04C4: create_coordinate 4@ 5@ 6@ from_actor $3 offset 0.0 0.0 2.0
// get pointers to these coords
05F8: 3@ = var 0@ offset
05F8: 7@ = var 4@ offset
// check if there any collision between these points
05E2: call_function 0x4DA560 num_params 9 pop 9 0 0 0 1 1 1 1 7@ 3@ 8@
if
   8@ == 0
then
   // there's some collision
else
   // this space is free
end


This post has been edited by DK22Pac on Thursday, Apr 26 2012, 19:07
Users WebsitePM
  Top
 

 
JACK JONES  
Posted: Friday, Apr 27 2012, 18:20
Quote Post


Booom!!!
Group Icon
Group: Members
Joined: Dec 6, 2011

sr.gif

XXXXX



Thanks DK22Pac but I already started scrypting with the Ashwins idea and instead of creating 4 objects - my new plan is to create 1 object and force him to change its position around a vehicle (with 01BC) at every 250 ms (timers 16@ and 17@ could help me with that) - that way I don't have to use so meny local variables.
And Ashwin thanks for the tip about the making an object invisible - I know how to do that. By the way I did find some opcode in SB that checks if some object is invisible:
CODE
82CC:   not object $3502 bounding_sphere_visible
so that makes me wonder - why would exist conditional check opcode for objects visibility if there's no opcode for seting an objects visibility?

PM
  Top
 

 
DK22Pac  
Posted: Friday, Apr 27 2012, 19:13
Quote Post


Assembly!
Group Icon
Group: Members
Joined: Apr 12, 2009

un.gif

XXXXX



You had some problems with code which I've posted?
Users WebsitePM
  Top
 

 
JACK JONES  
Posted: Saturday, Apr 28 2012, 10:04
Quote Post


Booom!!!
Group Icon
Group: Members
Joined: Dec 6, 2011

sr.gif

XXXXX



Well I have to admit that I didn't work with this CLEO method before - I mean I never used opcodes then, else, end. Here's what I don't understand here:
Why should I check if a float value of 8@ variable is equal to 0 integer - why not 0.0 float and why did you choose exactly number 0? Also I have some example of this high level coding of CLEO and I didn't noticed jump or else_jump commands in it - if there are no loops then how the code works all the time? And yes I've tested your code but wanted level stars were 0 which means that the code didn't reach 010D even when I rotated player in all directions between some buildings:
CODE
{$CLEO}

04C4: create_coordinate 0@ 1@ 2@ from_actor $PLAYER_ACTOR offset 10.0 10.0 10.0
04C4: create_coordinate 4@ 5@ 6@ from_actor $PLAYER_ACTOR offset 10.0 10.0 2.0
05F8: 3@ = var 0@ offset
05F8: 7@ = var 4@ offset
05E2: call_function 0x4DA560 num_params 9 pop 9 0 0 0 1 1 1 1 7@ 3@ 8@
if
0039:   8@ == 0
then
010D: set_player $PLAYER_CHAR wanted_level_to 6
else
05DC: end_custom_thread
end


This post has been edited by JACK JONES on Saturday, Apr 28 2012, 11:13
PM
  Top
 

 
DK22Pac  
Posted: Saturday, Apr 28 2012, 11:33
Quote Post


Assembly!
Group Icon
Group: Members
Joined: Apr 12, 2009

un.gif

XXXXX



Yes, ut must be in a loop.
Low-level code cool.gif
CODE
{$CLEO}

wait 0
:loop
wait 0
if player.Defined(0)
jf @loop
04C4: create_coordinate 0@ 1@ 2@ from_actor $3 offset 0.0 0.0 10.0
04C4: create_coordinate 4@ 5@ 6@ from_actor $3 offset 0.0 0.0 2.0
05F8: 3@ = var 0@ offset // lineStart
05F8: 7@ = var 4@ offset // lineEnd
// check if there any collision on this line
05E2: call_function 0x4DA560 num_params 9 pop 9 0 0 0 checkObjects 1 checkPeds 1 checkVehicles 1 checkBuildings 1 lineEnd 7@ lineStart 3@ get_result_to 8@
if 8@ == 1 // if 0 - some collision there, if 1 - there no collisions
jf @loop
// there no collisions
jump @loop
Users WebsitePM
  Top
 

 
Ashwin the new boy  
Posted: Saturday, Apr 28 2012, 11:44
Quote Post


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

ia.gif

XXXXX



do you know what
reading "Low level" sounds bad to me,
it should be easy & hard

Easy
CODE

if
 8@ == 0 // integer values
else_jump @NONAME_20
Player.WantedLevel($7) = 6
jump @NONAME_22

:NONAME_20
05DC: end_custom_thread

:NONAME_22


Hard
CODE

if
0039:   8@ == 0
then
010D: set_player $PLAYER_CHAR wanted_level_to 6
else
05DC: end_custom_thread
end


we all are compiling same thing then why Low & High level ?
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