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

    1. GTANet.com

    1. GTA Online

      1. The Diamond Casino 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. Events
    1. Red Dead Redemption 2

      1. PC
      2. Gameplay
      3. Missions
      4. Help & Support
    2. Red Dead Redemption

    1. Grand Theft Auto Series

    2. GTA 6

    3. GTA V

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

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

    6. GTA Vice City Stories

    7. GTA Liberty City Stories

    8. GTA San Andreas

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

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

      1. Guides & Strategies
      2. Help & Support
    11. 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. DYOM
      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
    3. Gangs

    1. Announcements

    2. Support

    3. Suggestions

QuentinVance

Problems with Script Pad!

Recommended Posts

QuentinVance

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?

Share this post


Link to post
Share on other sites
Sektor

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?

Share this post


Link to post
Share on other sites
QuentinVance

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.

Share this post


Link to post
Share on other sites
Sektor

That would only execute once and then do nothing. You need to wrap it in an endless while.

Share this post


Link to post
Share on other sites
QuentinVance

I've already tried to use "while", but it doesn't work anyway.

Share this post


Link to post
Share on other sites
Sektor

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

Share this post


Link to post
Share on other sites
QuentinVance

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

Share this post


Link to post
Share on other sites
Sektor

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

Share this post


Link to post
Share on other sites
QuentinVance

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

Share this post


Link to post
Share on other sites
Sektor

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.

Share this post


Link to post
Share on other sites
QuentinVance

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 :)

Share this post


Link to post
Share on other sites
QuentinVance

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?

Share this post


Link to post
Share on other sites
QuentinVance

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?

Share this post


Link to post
Share on other sites
Sektor

Post the full script and I'll fix it.

Share this post


Link to post
Share on other sites
QuentinVance

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.

Share this post


Link to post
Share on other sites
QuentinVance

I'm still waiting for some help :cry:

Share this post


Link to post
Share on other sites
Sektor

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

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.


  • 2 Users Currently Viewing
    0 members, 0 Anonymous, 2 Guests

×
×
  • Create New...

Important Information

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