Quantcast

Jump to content

» «
Photo

A hard question about Gta 2 scripting :

4 replies to this topic
Andrew_Thiago
  • Andrew_Thiago

    http://dyom.gtagames.nl/profile/12409

  • Members
  • Joined: 15 Feb 2015
  • Brazil

#1

Posted 26 October 2015 - 09:55 PM Edited by Andrew_Thiago, 26 October 2015 - 09:57 PM.

Hi Sector!  how are you? I have another great question to ask you, take a look at this:

 

LEVELSTART
 
 
phone1_mission1:   ///Mission label
 
 // Mission begins here!
 
 
SET mission1_failed = 0  //Doing that,  i could restart the mission again setting the failed mission counter to zero isn't!
 
DELAY_HERE (30)     POINT_ARROW_AT ( ar1, phone01 )
DISPLAY_BRIEF (1019)
ANSWER_PHONE ( boy  , phone01 , 100 )    
 
 /////////////////////////////////////////////////////////////////////////////////////////////   
    WHILE_EXEC (onmission1 = 0)
 
   IF (CHECK_ANSWERED_PHONE(phone01))   
               truck1 = CREATE_CAR ( 84.7,149.8,2.0 )  23 090  TRUKCAB2 TRUKTRNS END
               SET onmission1 = 2            
               STOP_PHONE ( phone01 ) 
               DISPLAY_BRIEF (1020)    
               DELAY_HERE (40)
                                    ++onmission1
   ENDIF
   
     IF (CHECK_FAIL_PHONE_TIMER(phone01))  
    
         DISPLAY_BRIEF ( 1014 ) 
SET mission1_failed = 1
         STOP_PHONE ( phone01 )
         REMOVE_ARROW (ar1)
        
 
RETURN           // I can't make that command work properly! The script did not restart  After not answer the phone. 
 
 
        ENDIF   
        ENDWHILE
 
 
I just copied that script from another correct scripts, and then, i fixed some names etc..  But, even seeing how it works, if i failed to answer the phone, the script are not heading back to the mission label in the start.
 
OBS: And, why we have to write for example:   ++onmission1 in the middle of the script? If i take this out of my codes, the compile just don't compile my script.
 
                                            Thank you so much!,  Andrew Thiago

Sektor
  • Sektor

    GTAMP.com

  • GTA Series Staff
  • Joined: 28 Jan 2003
  • None

#2

Posted 27 October 2015 - 09:41 AM Edited by Sektor, 27 October 2015 - 09:46 AM.

++onmission1 isn't needed and doesn't make any sense in that location.  Not sure why that would stop you compiling, it didn't in my tests.  I use mispad.

 

RETURN won't do anything without GOSUB or a thread trigger.

 

Instead of RETURN, you could try GOSUB phone1_mission1:


Andrew_Thiago
  • Andrew_Thiago

    http://dyom.gtagames.nl/profile/12409

  • Members
  • Joined: 15 Feb 2015
  • Brazil

#3

Posted 27 October 2015 - 10:03 PM

Yeah, but look:  when i write GOSUB ... after the failed brief text, he points the phone again, but it creates a infinite loop that crash the game after 5 seconds. The same problem happens when i check if the vehicle is destroyed too. I created all the necesary counter, and his isn't the problem. Take at  this: 

 

LEVELSTART -------------------------------------------------------------------------------------------------------------------------

 

mission1:  //mission1 Label

 

IF (mission1_failed = 1)   //The the player failed the mission before.
     SET mission1_failed = 0   
     ENDIF
 
     
    ANSWER_PHONE ( boy , phone01 , 2000 )
    POINT_ARROW_AT (  ar1, phone01 )            
     ENDIF
 
 
   WHILE_EXEC (onmission1 = 0)  // He didn't answer the phone yet
 
   IF (CHECK_ANSWERED_PHONE(phone01))     //If he answer the phone
           REMOVE_ARROW (ar1)
           STOP_PHONE ( phone01 )
           CLEAR_ALL_BRIEFS ( )
           DISPLAY_BRIEF (1020)    // Hello .....
           SET onmission1 = 2              //This means he will be now doing that mission
           truck1 = CREATE_CAR ( 84.7,149.8,2.0 )  23 090  TRUKCAB2 TRUKTRNS END  //It's the truck who i must get in
                      
         ENDIF 
         
         IF ( ( CHECK_FAIL_PHONE_TIMER(phone01 ))  //Did not answer the phone on the time
AND (  mission1_failed = 0 )) 
         SET mission1_failed = 1 
         STOP_PHONE ( phone01 )
         REMOVE_ARROW (ar1)
         CLEAR_ALL_BRIEFS ( ) 
         DISPLAY_MESSAGE ( 3730 )//You have failed the mission ... 
           I learned yesterday that we must put the original failed brief text in the script to everything work properly. But now, the GOSUB aren't working right.
 
        GOSUB mission1:  <-----        //Is the " <----   GOSUB.." command on his right place in the end? Or must another problem?
 
     ENDWHILE   <-------------
        
     ENDIF         <-----------
 
///////////////////////////ANOTHER STUFFS....
OBS:
 
If i fail to answer the phone or the mission vehicle is destroyed, the GOSUB really head back to the label in the beginning, but its creates a infinite loop, then crashing the game.
That's the only  problem that don't let me keep writing all the rest of the script that left for me to end

Sektor
  • Sektor

    GTAMP.com

  • GTA Series Staff
  • Joined: 28 Jan 2003
  • None

#4

Posted 28 October 2015 - 02:41 AM

PLAYER_PED boy = (82.10,148.3,2.0) 8 0

/////COUNTERS////

COUNTER onmission1 = 0
COUNTER inside_truck1 = 0
COUNTER mission1_completed = 0
COUNTER mission1_failed = 0

/////Vehicles///
CAR_DATA truck1

/////Phones////
OBJ_DATA phone01 = (82.7,148.25) 090 GREEN_PHONE

///Arrows//
ARROW_DATA ar1
ARROW_DATA ar2
ARROW_DATA ar3
ARROW_DATA ar4

LEVELSTART // -------------------------------------------------------------------------------------------------------------------------

mission1:  //mission1 Label
IF (mission1_failed = 1)   //The player failed the mission before.
     SET mission1_failed = 0  
ENDIF
ANSWER_PHONE ( boy , phone01 , 2000 )
POINT_ARROW_AT ( ar1, phone01 )           
    
WHILE_EXEC (onmission1 = 0)  // He didn't answer the phone yet

IF (CHECK_ANSWERED_PHONE(phone01))     //If he answer the phone
  REMOVE_ARROW (ar1)
  STOP_PHONE ( phone01 )
  CLEAR_ALL_BRIEFS ( )
  DISPLAY_BRIEF (1020)    // Hello .....
  SET onmission1 = 2              //This means he will be now doing that mission
  truck1 = CREATE_CAR ( 84.7,149.8,2.0 )  23 090  TRUKCAB2 TRUKTRNS END  //It's the truck who i must get in
ENDIF
        
IF ( ( CHECK_FAIL_PHONE_TIMER(phone01 ))  //Did not answer the phone on the time
AND (  mission1_failed = 0 ))
  SET mission1_failed = 1
  STOP_PHONE ( phone01 )
  REMOVE_ARROW (ar1)
  CLEAR_ALL_BRIEFS ( )
  DISPLAY_MESSAGE (3730)//You have failed the mission ...
  GOSUB mission1:
ENDIF
ENDWHILE
       
LEVELEND

Andrew_Thiago
  • Andrew_Thiago

    http://dyom.gtagames.nl/profile/12409

  • Members
  • Joined: 15 Feb 2015
  • Brazil

#5

Posted 28 October 2015 - 03:20 AM

For GOD SAKE you're the man!! heh thank you so much!!! Now i guess i can go on!hehehe





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users