Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. Red Dead Redemption 2

      1. Gameplay
      2. Missions
      3. Help & Support
    2. Red Dead Online

      1. Gameplay
      2. Find Lobbies & Outlaws
      3. Help & Support
    1. Crews & Posses

      1. Recruitment
    2. Events

    1. GTA Online

      1. Arena War
      2. After Hours
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Grand Theft Auto Series

    3. GTA Next

    4. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    5. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA Mods
    6. GTA Chinatown Wars

    7. GTA Vice City Stories

    8. GTA Liberty City Stories

    9. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    10. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    11. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    12. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    13. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    3. Featured Mods

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption

    2. Rockstar Games

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Programming
      5. Movies & TV
      6. Music
      7. Sports
      8. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. News

    2. Forum Support

    3. Site Suggestions

Sign in to follow this  
Prometheusmo

[GTA 3] [HELP] Duplicated cars on custom mission

Recommended Posts

Prometheusmo

Hello. I'm creating new missions to GTA 3, but when i create a vehicle then if i put a while loop after the vehicle creation, the vehicle will duplicate no matter what i do.

Same happens with blips, markers, peds, object, etc.. They will duplicates and i don't know why..

 

Please someone help me!

 

MISSION_START
// *****************************************************************************************
// *****************************************************************************************
// *****************************************************************************************
// *************************************Progloue MISS01************************************* 
// *************************************Tarack thingyl**************************************
// *****************************************************************************************
// *****************************************************************************************

// Start stuff
GOSUB mission_start_prologue1

IF HAS_DEATHARREST_BEEN_EXECUTED
	GOSUB mission_failed_prologue1
ENDIF
										  
GOSUB mission_cleanup_prologue1

MISSION_END

// Variables
VAR_INT prologue1_borgnine
VAR_INT prologue1_borgnine2
VAR_INT prol_vv

mission_start_prologue1:

REGISTER_MISSION_GIVEN
flag_player_on_mission = 1
SCRIPT_NAME prolog1
WAIT 0

{

REQUEST_MODEL CAR_BORGNINE

WHILE NOT HAS_MODEL_LOADED CAR_BORGNINE
    WAIT 0

ENDWHILE

WAIT 5000

CREATE_CAR CAR_BORGNINE 818.3382 -242.3263 2.6729 prol_vv
SET_CAR_HEADING prol_vv 180.0

TIMERB = 0

// THIS CAUSES THE PROBLEM, IF I REMOVE IT EVERYTHING IS WINE (ALSO DUPLICATES IF I PUT MORE WAIT BEFORE THE VEHICLE OR MARKER SPAWN...
WHILE NOT IS_CHAR_IN_CAR char prol_vv 
    WAIT 0
ENDWHILE

SET_CAR_CRUISE_SPEED prol_vv 1.0

}


mission_success_prologue1:
PLAY_MISSION_PASSED_TUNE 1
PRINT_WITH_NUMBER_BIG ( M_PASS ) 10000 5000 1
CLEAR_WANTED_LEVEL player
ADD_SCORE player 10000
RETURN

mission_failed_prologue1:
PRINT_BIG ( M_FAIL ) 5000 1
RETURN

mission_cleanup_prologue1:
flag_player_on_mission = 0
MISSION_HAS_FINISHED
RETURN

 

Share this post


Link to post
Share on other sites
guard3

Kudos for using gta3script 😛

 

In the script you provided, there’s no declaration of ‘char’, and I don’t see any ped objective related to it. What is it doing there?

Share this post


Link to post
Share on other sites
Prometheusmo

char and player is definied in the main.sc the script i sent is the prologue1.sc

 

main.sc

[SCRIPT]

 
// ########################
// ########################
// ######## MAIN ##########
// ########################
// ########################
 
SCRIPT_NAME MAIN
 
VAR_INT player
VAR_INT char
VAR_INT flag_player_on_mission
 
SET_MAX_WANTED_LEVEL 0
SET_DEATHARREST_STATE 0
LOAD_COLLISION 0
SET_TIME_OF_DAY 12 0
 
CREATE_PLAYER 0 832.6630 -318.5700 7.2974 player
GET_PLAYER_CHAR player char
 
WAIT 0
 
LOAD_SPLASH_SCREEN ( SPLASH1 )
DECLARE_MISSION_FLAG flag_player_on_mission
 
IF NOT IS_PLAYER_DEAD player
    UNDRESS_CHAR char ( PLAYER )
    LOAD_ALL_MODELS_NOW
    DRESS_CHAR char
ENDIF
 
DO_FADE 0 1
 
WHILE NOT IS_PLAYER_PLAYING player
 
    WAIT 0
ENDWHILE
 
SET_PLAYER_CONTROL player TRUE
 
WHILE NOT IS_PLAYER_IN_AREA_3D player 824.7621 -312.0690 7.2972 826.7691 -314.7622 5.6972 1
    WAIT 0
ENDWHILE
 
IF flag_player_on_mission = 0
    PRINT ( S1_TMFN ) 4000 2
    WAIT 0
    LOAD_AND_LAUNCH_MISSION prolog1.sc
ENDIF

[/SCRIPT]

Everything is working fine, but the code after the while true (when i waiting the model load or when i wait the player to get in the car) gets executed twice no matter what i do...

Share this post


Link to post
Share on other sites
ZAZ
IF flag_player_on_mission = 0

i think it should have double equal signe if it should be a condition

 

IF flag_player_on_mission == 0

 

Share this post


Link to post
Share on other sites
Prometheusmo

gta3script requires '=' if you want to compare something. if '==' used, the compiler give an error

Share this post


Link to post
Share on other sites
ZAZ

yes, i think, i'm wrong, i was looking here and found this:

WAIT 250    IF flag_mistery2_passed = 1        TERMINATE_THIS_SCRIPT    ENDIF

Share this post


Link to post
Share on other sites
guard3

Ok, the reason you have multiple borgines spawning is because the variable flag_player_on_mission takes some time to update. Within that timeframe where flag_player_on_mission isn't set to 1, main.sc launches the mission again. So, I guess you have to add the following:

...
VAR_INT flag_prologue_mission_launched
VAR_INT flag_prologue_mission_passed
...
flag_prologue_mission_launched = 0
flag_prologue_mission_passed = 0
...
mainloop:
{
	WAIT 0
	IF flag_prologue_mission_passed = 0
		IF flag_prologue_mission_launched = 0 // If that's set to 1, mission won't launch again
			IF flag_player_on_mission = 0
				WHILE NOT IS_PLAYER_IN_AREA_3D player 824.7621 -312.0690 7.2972 826.7691 -314.7622 5.6972 1
					WAIT 0
				ENDWHILE
				PRINT ( S1_TMFN ) 4000 2
				WAIT 0
				LOAD_AND_LAUNCH_MISSION prolog1.sc //At the end of the mission set flag_prologue_mission_passed to 1
				flag_prologue_mission_launched = 1 //This is the important part
			ENDIF
		ENDIF
	ENDIF
	GOTO mainloop
}

EDIT: Did a correction
 

Edited by guard3

Share this post


Link to post
Share on other sites
Prometheusmo

Thank you i added this check to make sure the bug won't occur anymore.

 

Interestinlgy, i fixed the bug with putting the main mission started to a new mission controller thread somehow..

:)

Share this post


Link to post
Share on other sites
guard3

Nice! And a little advice, keep flags for each mission launched and completed.

A separate internal script is best for handling missions, like the original game does

Spoiler
eightball_mission_loop:
{
    WAIT 0
    IF flag_industrial_passed = 1
    AND flag_eightball_mission_passed = 0
        TERMINATE_THIS_SCRIPT
    ENDIF
    IF flag_eightball_mission_passed = 1
        TERMINATE_THIS_SCRIPT
    ENDIF
    IF IS_PLAYER_PLAYING player
    AND flag_eightball_mission_launched = 0
    AND flag_player_on_mission = 0
        IF flag_reached_hideout = 0
            IF LOCATE_PLAYER_ON_FOOT_2D player 811.875 -939.9375 3.5 3.5 0
                IF CAN_PLAYER_START_MISSION player
                    LOAD_AND_LAUNCH_MISSION 8ball.sc // (19) Give Me Liberty and Luigi's Girls
                    flag_eightball_mission_launched = 1
                ENDIF
            ENDIF
        ELSE
            IF LOCATE_PLAYER_ON_FOOT_2D player 883.5 -308.1875 3.5 3.5 0
                IF CAN_PLAYER_START_MISSION player
                    LOAD_AND_LAUNCH_MISSION 8ball.sc // (19) Give Me Liberty and Luigi's Girls
                    flag_eightball_mission_launched = 1
                ENDIF
            ENDIF
        ENDIF
    ENDIF
    GOTO eightball_mission_loop
}

 

Also, for your mission, make sure to put HAS_DEATHARREST_BEEN_EXECUTED check in every WHILE loop in your mission_start label, and not after the GOSUB, otherwise the check won't be performed.
And if you're interested, I rewrote the above scripts for fun, check them out if you want

Spoiler

main.sc

Spoiler

// ########################
// ########################
// ######## MAIN ##########
// ########################
// ########################

SCRIPT_NAME MAIN

VAR_INT player
VAR_INT flag_player_on_mission
VAR_INT flag_prologue_mission_launched
VAR_INT flag_prologue_mission_passed
 
SET_TOTAL_NUMBER_OF_MISSIONS 0
SET_MAX_WANTED_LEVEL 4
LOAD_COLLISION LEVEL_INDUSTRIAL
SET_TIME_OF_DAY 12 0

DECLARE_MISSION_FLAG flag_player_on_mission
flag_player_on_mission = 0
flag_prologue_mission_launched = 0
flag_prologue_mission_passed = 0
 
CREATE_PLAYER 0 832.6630 -318.5700 8.0 player

WHILE NOT IS_PLAYER_PLAYING player
    WAIT 0
ENDWHILE
 
SET_PLAYER_CONTROL player TRUE
SET_CAMERA_BEHIND_PLAYER

LOAD_SCENE 832.6630 -318.5700 8.5
WAIT 0
DO_FADE 2000 FADE_IN

mainloop:
{
    WAIT 0
    IF flag_prologue_mission_passed = 0
        IF flag_prologue_mission_launched = 0
            IF flag_player_on_mission = 0
                WHILE NOT IS_PLAYER_IN_AREA_3D player 824.7621 -312.0690 7.2972 826.7691 -314.7622 5.6972 1
                    WAIT 0
                ENDWHILE
                SET_PLAYER_CONTROL player OFF
                DO_FADE 1500 FADE_OUT
                WHILE GET_FADING_STATUS
                    WAIT 0
                ENDWHILE
                
                
                LOAD_AND_LAUNCH_MISSION prolog1.sc
                flag_prologue_mission_launched = 1
            ENDIF
        ENDIF
    ENDIF

    GOTO mainloop
}

TERMINATE_THIS_SCRIPT

 

 

prolog1.sc

Spoiler

MISSION_START
// *****************************************************************************************
// *****************************************************************************************
// *****************************************************************************************
// *************************************Progloue MISS01************************************* 
// *************************************Tarack thingyl**************************************
// *****************************************************************************************
// *****************************************************************************************

// Start stuff
GOSUB mission_start_prologue1
										  
GOSUB mission_cleanup_prologue1

MISSION_END

// Variables
VAR_INT prologue1_borgnine
//VAR_INT prologue1_borgnine2
VAR_INT prol_vv

mission_start_prologue1:

SCRIPT_NAME prolog1

DO_FADE 0 FADE_OUT
SET_DEATHARREST_STATE OFF
SET_PLAYER_CONTROL player OFF
REGISTER_MISSION_GIVEN
flag_player_on_mission = 1

REQUEST_MODEL CAR_BORGNINE
WHILE NOT HAS_MODEL_LOADED CAR_BORGNINE
    WAIT 0
ENDWHILE

CREATE_CAR CAR_BORGNINE 818.3382 -242.3263 2.6729 prol_vv
SET_CAR_HEADING prol_vv 180.0

MARK_MODEL_AS_NO_LONGER_NEEDED CAR_BORGNINE

SET_DEATHARREST_STATE ON
SET_PLAYER_CONTROL player ON
WAIT 0
DO_FADE 1500 FADE_IN

PRINT ( S1_TMFN ) 4000 2

WHILE NOT IS_PLAYER_IN_CAR player prol_vv
    WAIT 0
    IF HAS_DEATHARREST_BEEN_EXECUTED
        GOTO mission_failed_prologue1
    ENDIF
ENDWHILE

SET_CAR_CRUISE_SPEED prol_vv 1.0

mission_success_prologue1:
PLAY_MISSION_PASSED_TUNE 1
PRINT_WITH_NUMBER_BIG ( M_PASS ) 10000 5000 1
CLEAR_WANTED_LEVEL player
ADD_SCORE player 10000
PLAYER_MADE_PROGRESS 1
flag_prologue_mission_passed = 1
RETURN

mission_failed_prologue1:
PRINT_BIG ( M_FAIL ) 5000 1
RETURN

mission_cleanup_prologue1:
MARK_CAR_AS_NO_LONGER_NEEDED prol_vv
flag_player_on_mission = 0
flag_prologue_mission_launched = 0
MISSION_HAS_FINISHED
RETURN

 

 

Looking forward to more missions 😛

Share this post


Link to post
Share on other sites
Prometheusmo

Thank you

Interestingly, in Rockstar scripts, they put the death/arrest stuffs after the mission start gosub...

 

Share this post


Link to post
Share on other sites
guard3

Hmm, apparently they did. I have spent some time in sidemissions where the checks are done differently.

In that case, I take it back, go R* style 😛

Share this post


Link to post
Share on other sites
Prometheusmo

Thank you!

Do you know if is there any way to load the savefiles with custom scm? (Like i do)

I think i can do it somehow, because save file saves script, onmission value, etc..

 

I created a working save-system, it displays the last custom mission name at the saves list but when i want to load it, the game just freezes.

There isn't any error or something. Just freeze.

 

Thank you!

Share this post


Link to post
Share on other sites
guard3

Normally, if you use the internal script for save from the original source, it should work with no issues. What have you done?

Share this post


Link to post
Share on other sites
Prometheusmo

I wanted to recreate everything, i created a stripped main.sc then i compiled it to scm

Do you know how to fix save if i want to make whole new missions with a stripped scm? I'm sure it is possible somehow, i don't care if its hard.

Share this post


Link to post
Share on other sites
guard3

You don't have to do anything special though.
The main commands that are responsible for saving your game are

ACTIVATE_SAVE_MENU
WAIT 0
WHILE NOT HAS_SAVE_GAME_FINISHED
	WAIT 0
ENDWHILE

The whole code for handling that is in the script source. You just have to remove some checks that aren't related to your game and it should work with no extra hassle.

Share this post


Link to post
Share on other sites
Prometheusmo

I created my saving script, i have save. Save is working very well, the last mission name (custom mission) displayed at the save list good.

The problem is with the loading. When i load it, the game freezes....

Share this post


Link to post
Share on other sites
guard3

Then I personally don't know what's wrong with freezing on loading.

Share this post


Link to post
Share on other sites
Prometheusmo

I think i know the problem. When i enter the save marker created by me the game immediatelly renders save screen.

WHen i save it then exit and load it will load myself INTO that marker so it will be an endless save-thing because the save is load!! :D but into that marker xD

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.