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

 find my error

 
HeresOtis  
Posted: Tuesday, Jul 31 2012, 23:42
Quote Post


Mark Chump
Group Icon
Group: Members
Joined: Apr 29, 2011

XXXXX



Can someone find why this loop isn't working properly at the while Player.Defined($PLAYER_CHAR) loop? I use the formatted text for trial & error purposes. Instead of looping that loop, I guess the game thinks the player isn't defined and ends the loop and goes to back to the beginning of the script. I know for sure that my player is defined.

CODE
{$CLEO}

const
   ATTACH_CAR_KEY      = 0x59   // default Y; key that puts car on dft30
   RELEASE_CAR_KEY     = 0x59  // default Y; releases the car on dft30
   RADIUS              = 15.0   // max radius to search for dft30
   PLAYER_VEHICLE      = 0@
   RANDOM_CAR          = 1@
   RANDOM_CAR_DRIVER   = 2@
//    OLD_PLAYER_VEHICLE  = 6@
end // const

0000:

:Start
while true
   wait 0
   if
       Player.Defined($PLAYER_CHAR)
   then
       if and
           $Active_Interior == 0
           Actor.Driving($PLAYER_ACTOR)
           not Actor.DrivingVehicleType($PLAYER_ACTOR, #DFT30)
           0AB0:  key_pressed ATTACH_CAR_KEY
       then
           0811: PLAYER_VEHICLE = actor $PLAYER_ACTOR car_nosave
           33@ = 0
           
           while 2000 > 33@
               wait 0
               Actor.StorePos($PLAYER_ACTOR, 3@, 4@, 5@)
               if
                   0AE2: RANDOM_CAR = random_vehicle_near_point 3@ 4@ 5@ in_radius RADIUS find_next 0 pass_wrecked 1
               then
                   repeat
                       RANDOM_CAR_DRIVER = -1
                       046C: RANDOM_CAR_DRIVER = car RANDOM_CAR driver
                       if and
                           0137:   car RANDOM_CAR model == #DFT30
                           RANDOM_CAR_DRIVER == -1
                       then
                           0792: disembark_instantly_actor $PLAYER_ACTOR
                           0407: store_coords_to 3@ 4@ 5@ from_car RANDOM_CAR with_offset -2.5 -1.5 0.0
                           00A1: put_actor $PLAYER_ACTOR at 3@ 4@ 5@
                           0683: attach_car PLAYER_VEHICLE to_car RANDOM_CAR with_offset 0.0 -1.6 0.65 rotation 0.0 0.0 180.0
                           02D4: car PLAYER_VEHICLE turn_off_engine
//                            0085: OLD_PLAYER_VEHICLE = PLAYER_VEHICLE // (int)
                           Car.RemoveReferences(RANDOM_CAR)
                           wait 1000
                           
                           while Player.Defined($PLAYER_CHAR)
                               0AD0: show_formatted_text_lowpriority "loop" time 1
                               wait 0
                               if or
                                   $Active_Interior == 0
                                   Car.Wrecked(PLAYER_VEHICLE)
                                   020D:   car PLAYER_VEHICLE flipped        
                               then
                                   break
                               else
                                   if
                                       0AB0:  key_pressed RELEASE_CAR_KEY
                                   then
                                       0AD0: show_formatted_text_lowpriority "back ground" time 2000
                                       0407: store_coords_to 3@ 4@ 5@ from_car RANDOM_CAR with_offset 0.0 -5.0 0.0
                                       00AB: put_car RANDOM_CAR at 3@ 4@ 5@
                                       break
                                   end        
                               end
                           end
                           
                           Car.RemoveReferences(PLAYER_VEHICLE)
                           0AD0: show_formatted_text_lowpriority "ended" time 2000
                           wait 250
                           jump @Start
                           
                       else
                           Car.RemoveReferences(RANDOM_CAR)
                           Actor.RemoveReferences(RANDOM_CAR_DRIVER)
                       end
                   until 8AE2: not RANDOM_CAR = random_vehicle_near_point 3@ 4@ 5@ in_radius RADIUS find_next 1 pass_wrecked 1
               end  
           end
           03E6: remove_text_box
           0ACA: show_text_box "~r~[ERROR]~w~Couldn't find a flatbed truck to put car on."
           wait 250
           
       end
   end
end
PM
  Top
 

 
Deji  
Posted: Wednesday, Aug 1 2012, 00:22
Quote Post


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

ja.gif

XXXXX



Player.Defined($PLAYER_CHAR) is named wrong. Don't bother with classes, they're awful.

0256 actually checks if the player is playing and isn't wasted or busted. Your code is probably exitting the loop because of your break.
CODE
                              if or
                                  $Active_Interior == 0
                                  Car.Wrecked(PLAYER_VEHICLE)
                                  020D:   car PLAYER_VEHICLE flipped        
                              then
                                  break


One of those conditions is probably returning true.
Users WebsitePM
  Top
 

 
HeresOtis  
Posted: Wednesday, Aug 1 2012, 00:35
Quote Post


Mark Chump
Group Icon
Group: Members
Joined: Apr 29, 2011

XXXXX



Okay, I fixed it. I messed up with the Active Interior part. Here's the fixed version:
CODE
while 0256:   player $PLAYER_CHAR defined
   wait 0
   if
       0AB0:  key_pressed RELEASE_CAR_KEY
   then
       0811: PLAYER_VEHICLE = actor $PLAYER_ACTOR car_nosave
       0407: store_coords_to 3@ 4@ 5@ from_car PLAYER_VEHICLE with_offset 0.0 -5.0 0.0
       00AB: put_car OLD_PLAYER_VEHICLE at 3@ 4@ 5@
       break
   else
       if and
           $Active_Interior == 0
           8119:   not car OLD_PLAYER_VEHICLE wrecked
           81F4:   not car OLD_PLAYER_VEHICLE flipped
       then
       else
           break
       end      
   end
end
PM
  Top
 

 
Link2012  
Posted: Wednesday, Aug 1 2012, 02:47
Quote Post


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

ba.gif

XXXXX



I must say to you that this is completely undefined:
CODE
$Active_Interior == 0


This variable is not update by the game, It was named like that because almost all the time that Rockstar used 077E to get the current interior, they used this variable.
So, you must use 077E to get the current interior and then check it (of course use a local variable to get the result).
PMMSN
  Top
 

 
HeresOtis  
Posted: Wednesday, Aug 1 2012, 05:13
Quote Post


Mark Chump
Group Icon
Group: Members
Joined: Apr 29, 2011

XXXXX



QUOTE (Link2012 @ Wednesday, Aug 1 2012, 02:47)
I must say to you that this is completely undefined:
CODE
$Active_Interior == 0


This variable is not update by the game, It was named like that because almost all the time that Rockstar used 077E to get the current interior, they used this variable.
So, you must use 077E to get the current interior and then check it (of course use a local variable to get the result).

Indeed.

I can't seem to find a way to make an actor in a passenger seat stay in the car when another actor enters as the driver and drives off. The passenger seat actor just gets out and starts running. Any solutions?
PM
  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