Doors

Anything to do with GTA1/GTA2 modding (tools, scripts and more).
Post Reply
kim00000
Ped
Ped
Posts: 4
Joined: 23 May 2012, 12:43
GH nick: Kimo

Doors

Post by kim00000 »

Hello Guys...
I want to make a door in a multi-player map that opens only for players who have 10,000 points or more, but I have some problems...

Here's what I tried:

Code: Select all

// Door Data
DOOR_DATA sg_door = SINGLE (11, 5, 2) (11.0, 6.0, 2.0, 1.0, 1.0)
BOTTOM 0 ANY_PLAYER CLOSE_WHEN_OPEN_RULE_FAILS 0 NOT_FLIPPED NOT_REVERSED
MAKE_DOOR_MANUAL(sg_door)

// Subroutines For The Door
sg_opendoor_Pa:
     IF(CHECK_SCORE_GREATER(Pa, 9999))
          ADD_SCORE(Pa, -10000)
          UPDATE_DOOR_TARGET(sg_door, Pa)
          MAKE_DOOR_AUTOMATIC(sg_door)
     ENDIF
RETURN

sg_opendoor_Pb:
     IF(CHECK_SCORE_GREATER(Pb, 9999))
          ADD_SCORE(Pb, -10000)
          UPDATE_DOOR_TARGET(sg_door, Pb)
          MAKE_DOOR_AUTOMATIC
     ENDIF
RETURN

sg_closedoorbehind:
     CLOSE_DOOR(sg_door)
RETURN

// Thread Triggers For The Door
THREAD_TRIGGER sg_waitdooropen_Pa = THREAD_WAIT_FOR_CHAR_IN_BLOCK
(Pa, 11, 6, 2, sg_opendoor_Pa:)
THREAD_TRIGGER sg_waitdooropen_Pb = THREAD_WAIT_FOR_CHAR_IN_BLOCK
(Pb, 11, 6, 2, sg_opendoor_Pb:)
THREAD_TRIGGER sg_waitdoorclose_Pa = THREAD_WAIT_FOR_CHAR_IN_BLOCK
(Pa, 11, 4, 2, sg_closedoorbehind:)
THREAD_TRIGGER sg_waitdoorclose_Pb = THREAD_WAIT_FOR_CHAR_IN_BLOCK
(Pb, 11, 4, 2, sg_closedoorbehind:)

ENABLE_THREAD_TRIGGER(sg_waitdooropen_Pa)
ENABLE_THREAD_TRIGGER(sg_waitdooropen_Pb)
ENABLE_THREAD_TRIGGER(sg_waitdoorclose_Pa)
ENABLE_THREAD_TRIGGER(sg_waitdoorclose_Pb)
The door opens for the first time, and then it doesn't open again? Any ideas?
User avatar
Pyro
Immortal
Posts: 414
Joined: 17 Mar 2010, 04:07
GH nick: Pyro
Location: Wales, UK

Re: Doors

Post by Pyro »

A few things that come to mind:

1 - If your score was high enough and were in the area by the door, it would constantly deduct $10,000.
2 - If two (or more) people went to the door at the same time, they'd both lose $10,000.
3 - The 'THREAD_WAIT_FOR_CHAR_IN_BLOCK' only applies if they are on foot.
4 - You don't really need thread triggers for this, you can use IF statements instead and generally more flexible. You can use things like LOCATE_CHARACTER_ANY_MEANS for both people in vehicles or on foot or LOCATE_CHARACTER_ON_FOOT for just foot only. You'll need to add some counters too to check who has paid so it doesn't constantly deduct money and if the door(s) is open etc.

I have a garage tutorial here and a more expanded, working tutorial here if you want to look at them.
CarThief
Hitman
Hitman
Posts: 108
Joined: 19 May 2012, 18:12
GH nick: CarThief
Location: Holland, AKA The Netherlands

Re: Doors

Post by CarThief »

I'm still not entirely sure how Thread Triggers work entirely but i assume they disable themselves after one use? I suggest running ENABLE_THREAD_TRIGGER(TT_Name) somewhere in the script after the thread trigger did its thing assuming they work like that. Perhaps using counters to check if its in use and recently activated and run the command after its activated for more uses.

If the Thread Triggers are not to blame somehow i suggest trying keeping the door manual and manually script-wise opening and closing it without updating the target whenever a target gets close enough. As doors can be weird like that to stop functioning correctly after target updates. And probaly one to check if no player is stuck in the door when its trying to close.

Doors are tricky bastards though... Try anything you can think of, GTA2 scripting was always a bit about that, getting around the limits with something inventive, heh.
User avatar
T.M.
Immortal
Posts: 960
Joined: 29 Jan 2010, 15:00
Location: F21B3EED

Re: Doors

Post by T.M. »

Do you want the door to stay open? that would be easier to script.
BenMillard
Immortal
Posts: 889
Joined: 16 May 2009, 06:14
GH nick: BenMillard
Location: London, UK
Contact:

Re: Doors

Post by BenMillard »

Dafe's Death Valley has something like this. You can go into a barn near the West coast and steal a Coach. But only if you have $5,000 or more, I think.

DOOR objects are too weird for multiplayer. Weapons are blocked when inside the door, to avoid cars being shot while they are parking.
Post Reply