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

    1. GTANet.com

    2. GTANet 20th Anniversary

    1. GTA Online

      1. The Cayo Perico Heist
      2. Find Lobbies & Players
      3. Guides & Strategies
      4. Vehicles
      5. Content Creator
      6. Help & Support
    2. Red Dead Online

      1. Frontier Pursuits
      2. Find Lobbies & Outlaws
      3. Help & Support
    3. Crews

    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. Grand Theft Auto Series

      1. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
    6. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
    7. GTA III

      1. Guides & Strategies
      2. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

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

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

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

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

    2. Support

      1. Court House
    3. Suggestions

Problems with Script Pad!


QuentinVance

Recommended Posts

Hi there guys!

I'm trying to build a map for GTA2, and I'm using Script Pad to code it. Anyway, it seems like the programm skips every line inside an "IF" or "WHILE", so I can't actually create a fully working map.

Is anybody having this kind of issue? How could I solve it?

Link to post
Share on other sites

There's probably an error in your script. I can take a look or you can do the process of elimination and keep commenting out code until it works.

 

Scriptpad and mispad definitely support IF and WHILE. The Epic Map Editor decompiler doesn't support decompiling those commands, are you trying to use an official decompiled script?

Link to post
Share on other sites

I'm writing the script myself, I didn't decompile another (I don't even know how to do that).

Anyway, that's the script:

PLAYER_PED TESTER = ( 10.5, 8.5, 2.0) 18 180CAR_DATA sciencevan = ( 12.5, 8.5, 2.0) 10 180 VANCHAR_DATA scientist = (14.5 , 8.5 , 2.0) 7 0 DUMMYLEVELSTARTIF (IS_CHARACTER_IN_CAR(TESTER, sciencevan))   SET_CHAR_OBJECTIVE (scientist, ENTER_CAR_AS_PASSENGER, sciencevan)ENDIFLEVELEND

If I remove the IF and ENDIF, the guy enters the van with no problems. If I leave it as it is now, it stands there without moving, no matter if the character is in the car or not. Then, if I scare him, he runs away and then returns back as he should normally do. I can't solve this. It may be something stupid, but I really can't make it work.

Link to post
Share on other sites

I'm on my phone, so I haven't tested it yet but try this:

 

PLAYER_PED TESTER = ( 10.5, 8.5, 2.0) 18 180

CAR_DATA sciencevan = ( 12.5, 8.5, 2.0) 10 180 VAN

CHAR_DATA scientist = (14.5 , 8.5 , 2.0) 7 0 DUMMY

 

COUNTER main = 1

LEVELSTART

 

WHILE_EXEC ( main = 1 )

IF (IS_CHARACTER_IN_CAR(TESTER, sciencevan))

SET_CHAR_OBJECTIVE (scientist, ENTER_CAR_AS_PASSENGER, sciencevan)

ENDIF

ENDWHILE

LEVELEND

Link to post
Share on other sites

It works now, thanks.

What was the problem? Should I put any of my code inside that "WHILE_EXEC" part to have it always working?

 

EDIT: Now I have a similiar situation, with a more complex code. I can't make it work. Again.

//Other code up heremission1:COUNTER objective = 0missionbulwark = CREATE_CAR ( 121.5 , 163.5 , 2.0) 6 135 BUICK ENDru_rookie = CREATE_CHAR ( 124.5 , 163.5 , 2.0 ) 10 0 NO_OCCUPATION ENDSET_CHAR_THREAT_SEARCH (ru_rookie, AREA)SET_CHAR_THREAT_REACTION (ru_rookie, NO_REACTION)ADD_NEW_BLOCK (123, 163 , 2)IF (IS_CHARACTER_IN_CAR(QUENTIN, missionbulwark))ORDER_CHAR_TO_BACKDOOR (ru_rookie, missionbulwark)ENDIFRETURNLEVELSTARTWHILE_EXEC (main = 1)THREAD_TRIGGER triggername = THREAD_WAIT_FOR_ANSWER_PHONE                              (QUENTIN , russian_phone , mission1:)ENDWHILELEVELEND

The code seems to work, but when I enter the car the dude stays still. It's the same situation, but this time I'm using a label and I don't know if this has something to do with the code not working.

The "WHILE_EXEC" should still work now, since the label is inside it...

Edited by QuentinVance
Link to post
Share on other sites

What was the problem? Should I put any of my code inside that "WHILE_EXEC" part to have it always working?

The problem was without the WHILE_EXEC loop, the script was only running for 1 frame, getting to LEVELEND and then your script was done. The infinite WHILE_EXEC loop prevents the game getting to LEVELEND and runs your script every frame.

 

Threads shutdown and don't run again after they RETURN, so you need an additional WHILE_EXEC inside the thread.

Edited by Sektor
Link to post
Share on other sites

I wrote it like this, but it still doesn't work.

 

mission1:WHILE_EXEC (main = 1)COUNTER objective = 0missionbulwark = CREATE_CAR ( 121.5 , 163.5 , 2.0) 6 135 BUICK ENDru_rookie = CREATE_CHAR ( 124.5 , 163.5 , 2.0 ) 10 0 NO_OCCUPATION ENDSET_CHAR_THREAT_SEARCH (ru_rookie, AREA)SET_CHAR_THREAT_REACTION (ru_rookie, NO_REACTION)ADD_NEW_BLOCK (123, 163 , 2)IF (IS_CHARACTER_IN_CAR(QUENTIN, missionbulwark))  SET_CHAR_OBJECTIVE (ru_rookie, ENTER_CAR_AS_PASSENGER, missionbulwark)ENDIFRETURNENDWHILE
I thought "Maybe the ENDWHILE should be before the RETURN", but in that case the game freezes a second after the trigger. So... I really don't know. I'm sorry for my stupidity. Edited by Sektor
Link to post
Share on other sites

Try this:

 

 

mission1:COUNTER objective = 0missionbulwark = CREATE_CAR ( 121.5 , 163.5 , 2.0) 6 135 BUICK ENDru_rookie = CREATE_CHAR ( 124.5 , 163.5 , 2.0 ) 10 0 NO_OCCUPATION ENDSET_CHAR_THREAT_SEARCH (ru_rookie, AREA)SET_CHAR_THREAT_REACTION (ru_rookie, NO_REACTION)ADD_NEW_BLOCK (123, 163 , 2)WHILE_EXEC (main = 1)  IF (IS_CHARACTER_IN_CAR(QUENTIN, missionbulwark))    SET_CHAR_OBJECTIVE (ru_rookie, ENTER_CAR_AS_PASSENGER, missionbulwark)  ENDIFENDWHILERETURN
It would freeze/crash before since it was in an endless loop creating cars, chars and blocks. If you really need to create new objects with the same name as old ones, you should delete the old objects first.
Link to post
Share on other sites

It works now, and I understood how to make it work. I will leave the post open so I can write if I need other help.

Thanks a lot, you're very patient and kind :)

Link to post
Share on other sites

I've noticed that the website I was using (Projectcerbera) by Ben Millard has been suspended. It was the only website I could find that had all the script codes. What now?

Link to post
Share on other sites

That's cool! I'm working again, thanks.
Anyway, I'm having troubles with a door which makes my game crash. I put this code before the LEVELSTART:

DECLARE_DOOR_INFO (928, 935, 2)DOOR_DATA russian_factory_door = DOUBLE (146,153,2)                          (146.0,153.0,2.0,4.0,2.0)                          RIGHT 0 ANY_PLAYER_ONE_CAR CLOSE_WHEN_OPEN_RULE_FAILS 0 FLIP_RIGHT NOT_REVERSED rookiebulwark

When I start the map, the game crashes (it doesn't even load the map).
The door-creating section on the guide isn't clear at all, so I'm not sure how to continue.

Also, I'm trying to make a phone ring again after I fail the mission.
I'm using this code to make it stop ringing when the mission starts:

mission1:COUNTER objective = 0SET russian_phone_active = 0STOP_PHONE (russian_phone)

This should shut the phone off until I turn it ogain. This won't happen until russian_phone_active is set to 1. This happens when I kill one of the characters I need to pick up.

IF ((HAS_CHARACTER_DIED(ru_rookie1)) AND (objective = 0))     DELETE_ITEM(ru_rookie2)     SET russian_phone_active = 1RETURNENDIF

However, the phone doesn't start ringing, so I can't active the mission again. How could I fix this?

Link to post
Share on other sites

That's what I have right now.

mission1:COUNTER objective = 0SET russian_phone_active = 0STOP_PHONE (russian_phone)rookiebulwark = CREATE_CAR ( 121.5 , 163.5 , 2.0) 6 135 BUICK ENDru_rookie1 = CREATE_CHAR ( 124.5 , 161.5 , 2.0 ) 10 270 NO_OCCUPATION ENDSET_CHAR_THREAT_SEARCH (ru_rookie1, AREA)SET_CHAR_THREAT_REACTION (ru_rookie1, NO_REACTION)ru_rookie2 = CREATE_CHAR ( 110.5 , 150.5 , 2.0 ) 10 270 NO_OCCUPATION ENDSET_CHAR_THREAT_SEARCH (ru_rookie2, AREA)SET_CHAR_THREAT_REACTION (ru_rookie2, NO_REACTION)WHILE_EXEC (main = 1)//Get the russians in car  IF ((IS_CAR_IN_BLOCK(rookiebulwark, 123.5 , 161.5 , 2.0 )) AND (IS_CHAR_PRESSING_HORN (QUENTIN)))     SET_CHAR_OBJECTIVE (ru_rookie1, ENTER_CAR_AS_PASSENGER, rookiebulwark)  ENDIF  IF ((IS_CAR_IN_BLOCK(rookiebulwark, 111.5 , 150.5 , 2.0 )) AND (IS_CHAR_PRESSING_HORN (QUENTIN)))     SET_CHAR_OBJECTIVE (ru_rookie2, ENTER_CAR_AS_PASSENGER, rookiebulwark)  ENDIF//Are the russians dead?  IF ((HAS_CHARACTER_DIED(ru_rookie1)) AND (objective = 0))     DELETE_ITEM(ru_rookie2)     SET russian_phone_active = 1  RETURN  ENDIF  IF ((HAS_CHARACTER_DIED(ru_rookie2)) AND (objective = 0))     DELETE_ITEM(ru_rookie1)     SET russian_phone_active = 1  RETURN  ENDIF//Are all the russians in car?  IF ((IS_CHARACTER_IN_CAR(rookiebulwark, ru_rookie1)) AND (IS_CHARACTER_IN_CAR(rookiebulwark, ru_rookie2)))  SET objective = 1  ENDIF

As you can see, I do have a check to see if the guys (which I should pick up with a designed car) are dead or not, and if I kill one of them the other one disappears as he's supposed to do. The phone, however, doesn't start. I used to make it ring before the mission using this code:

LEVELSTARTWHILE_EXEC (main = 1)IF (russian_phone_active = 1)   THREAD_TRIGGER russian_mission1 = THREAD_WAIT_FOR_ANSWER_PHONE                              (QUENTIN , russian_phone , mission1:)ENDIFENDWHILELEVELEND

I know there's something I'm missing, but I can't find what and where. I'm sorry to be so stupid, I'll improve somehow I guess.

Link to post
Share on other sites

Each THREAD_TRIGGER should only be declared once and it should go before LEVELSTART. Trigger is disabled after the RETURN command. You can use ENABLE_THREAD_TRIGGER to enable the trigger again if the player fails the mission.

 

You could use ENABLE_THREAD_TRIGGER (russian_mission1) to make make the phone ring again and restart the trigger. That command can only go after LEVELSTART.

 

For the door, delete rookiebulwark at the end of DOOR_DATA. After you create the car:

 

UPDATE_DOOR_TARGET (russian_factory_door,rookiebulwark)

Edited by Sektor
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 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.