zone problems

Anything to do with GTA1/GTA2 modding (tools, scripts and more).
Post Reply
CarThief
Hitman
Hitman
Posts: 108
Joined: 19 May 2012, 18:12
GH nick: CarThief
Location: Holland, AKA The Netherlands

zone problems

Post by CarThief »

Well im stumped on this one... For some reason IS_CHAR_IN_ZONE(char, zonename) almost NEVER works, all it does is if called during an IF statement succesfully crashes the freaking game.
Its a redicuously weird or specific command, it gone and did the following stuff:
Only desired to function in a NOT statement after a non-NOT statement;
^ Failed to work once either of them where alone without eachother...
Was still uncooperative after putting in a intentional never-reached IF statement with this AND having both IF() and IF(NOT()) statements.

From what i gather that was all script specific. Below here's the zone-specific stuff:
It seems to HATE being in another zone and utterly refused to work as a local navigation zone instead of a regular navigation zone.

The only time it actually worked on me was calling IF(NOT(IS_CHAR_IN_ZONE(Player1, Slums))) while the actual zone Slums was navigagion, not sharing any space with other zones and bordering to some other zones.
Anyone care to figure out how the hell this command can be used to actually if people are INSIDE the zones instead of outside of them? Checking for characters by LOCATE is VERY shoddy and unreliable in larger zones...
So yeah, only thing that ever worked script-wise was this, if it helps:

[mis]IF ( ( As2_Pursuit = 0 ) AND ( As2_Progress = 1 ) )
IF(NOT(IS_CHAR_IN_ZONE (Player1 , Slums)))
As2_PursuitCar1 = CREATE_CAR (148.5, 239.5, 2.0) 21 90 STRATOS END
As2_PursuitGuy1 = CREATE_CHAR_INSIDE_CAR (As2_PursuitCar1) 22 FBI END//FBI likes to agressively pull its victim out of car and shoot
As2_PursuitCar2 = CREATE_CAR (156.5, 125.5, 2.0) 17 0 STRIPETB END
As2_PursuitGuy2 = CREATE_CHAR_INSIDE_CAR (As2_PursuitCar2) 22 FBI END//its victim while stunned. Ideal for a bulletproof car.
SET_FAVOURITE_MODEL(As2_PursuitGuy1, STRATOS)
SET_FAVOURITE_MODEL(As2_PursuitGuy2, STRIPETB)
GIVE_WEAPON(As2_PursuitGuy1, SHOTGUN)
GIVE_WEAPON(As2_PursuitGuy2, MACHINE_GUN)
SET_CHAR_THREAT_SEARCH (As2_PursuitGuy1, AREA_PLAYER_ONLY)
SET_CHAR_THREAT_REACTION (As2_PursuitGuy1, REACT_AS_NORMAL)
SET_CHAR_THREAT_SEARCH (As2_PursuitGuy2, AREA_PLAYER_ONLY)
SET_CHAR_THREAT_REACTION (As2_PursuitGuy2, REACT_AS_NORMAL)
SET_CHAR_DRIVE_AGGRESSION (As2_PursuitGuy1, ON)
SET_CHAR_DRIVE_AGGRESSION (As2_PursuitGuy2, ON)
SET_CHAR_OBJECTIVE (As2_PursuitGuy1, KILL_CHAR_ANY_MEANS, Player1)
DO_NOWT
SET_CHAR_OBJECTIVE (As2_PursuitGuy2, KILL_CHAR_ANY_MEANS, Player1)
SET As2_Pursuit = 1
DISPLAY_BRIEF_NOW (1020)//l!You've got two blokes on your tail trying to kill you, watch out!
ENDIF
ENDIF[/mis]
User avatar
Sektor
Boss
Boss
Posts: 1423
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: Collection of gta scripting and map weirdness

Post by Sektor »

IF ( IS_CHAR_IN_ZONE ( p1 , B22 ) )
DISPLAY_BRIEF_NOW ( 3124 )
ENDIF

That works without crashing on bil.gmp but maybe there is something weird with your zones or the zone doesn't exist.
User avatar
elypter
Immortal
Posts: 1120
Joined: 26 Dec 2009, 23:53
GH nick: elypter

Re: Collection of gta scripting and map weirdness

Post by elypter »

zone names can be tricky. they sometimes need a specific lengthj
yur sa'nok ngeyä
CarThief
Hitman
Hitman
Posts: 108
Joined: 19 May 2012, 18:12
GH nick: CarThief
Location: Holland, AKA The Netherlands

Re: Collection of gta scripting and map weirdness

Post by CarThief »

Well i've tried using B01 while setting B01 to the name "Cargo Area" but even then it just refused to work, and crashed whenever loaded.
Used both Navigation Zones and Local Navigation Zones, with and without Information zones cooperaring with them, both covered and uncovered by bigger Navigation zones. It just flat out seems to refuse to work! Meh, maybe im missing something special the official maps use as zone structure...

Oh well i'll throw in the checking script if it helps any bit. Already checked potential causes of crashing but it only did when zone checking was involved.
[mis]IF(Rn3_SpottedCircle = 5)

CLEAR_ALL_BRIEFS()
//In the circle: Surround intruder.
IF(IS_CHAR_IN_ZONE (Player1, B01))
//IF((LOCATE_CHARACTER_ANY_MEANS(Player1, 227.5, 243.5, 4.0, 4.0, 3.0)) OR (LOCATE_CHARACTER_ANY_MEANS(Player1, 227.5, 243.5, 5.0, 4.0, 3.0)) )
//IF(LOCATE_CHARACTER_ANY_MEANS(Player1, 227.2, 243.2, 4.0, 4.0, 3.0))
SET Rn3_SpottedCircle = 1
DISPLAY_BRIEF_NOW(1081)//n!Intruder at the cargo area! Get into positions and send reinforcements!
SET Rn3_Countdown = 600//20 sec.
SET Rn3_CounterSetting = 1
SET_CHAR_OBJECTIVE(Rn3_Guard5, GOTO_AREA_ON_FOOT, 226.5, 242.5, 4.0)//Top-left
SET_CHAR_OBJECTIVE(Rn3_Guard6, GOTO_AREA_ON_FOOT, 231.5, 243.5, 4.0)//Top-Right
SET_CHAR_OBJECTIVE(Rn3_Guard7, GOTO_AREA_ON_FOOT, 228.5, 246.5, 4.0)//Bottom-Left
SET_CHAR_OBJECTIVE(Rn3_Guard8, GOTO_AREA_ON_FOOT, 231.5, 245.5, 4.0)//Bottom-Right
//ENDIF
ENDIF
//At circle entrance: Block entry.
IF(NOT(Rn3_SpottedCircle = 1))
IF((LOCATE_CHARACTER_ANY_MEANS(Player1, 233.5, 244.5, 3.0, 3.0, 3.0)) OR (LOCATE_CHARACTER_ANY_MEANS(Player1, 233.5, 244.5, 4.0, 3.0, 3.0)))
SET Rn3_SpottedCircle = 2
DISPLAY_BRIEF_NOW(1082)//n!Intruder spotted! Dont let him through!
MAKE_CHAR_DO_NOTHING(Rn3_Guard5)
MAKE_CHAR_DO_NOTHING(Rn3_Guard6)
MAKE_CHAR_DO_NOTHING(Rn3_Guard7)
MAKE_CHAR_DO_NOTHING(Rn3_Guard8)
SET_CHAR_OBJECTIVE(Rn3_Guard5, GOTO_AREA_ON_FOOT, 231.5, 244.5, 4.0)//Entrance
SET_CHAR_OBJECTIVE(Rn3_Guard6, GOTO_AREA_ON_FOOT, 231.5, 245.5, 4.0)//Same
SET_CHAR_OBJECTIVE(Rn3_Guard7, GOTO_AREA_ON_FOOT, 231.5, 246.5, 4.0)//Also
SET_CHAR_OBJECTIVE(Rn3_Guard8, GOTO_AREA_ON_FOOT, 228.5, 242.5, 4.0)//Guarding upper-exit path.
ENDIF
ENDIF
//If at neither location.
IF(NOT(Rn3_SpottedCircle = 1))
IF(NOT(Rn3_SpottedCircle = 2))
IF(NOT(LOCATE_CHARACTER_ANY_MEANS(Player1, 233.5, 244.5, 3.0, 3.0, 3.0)))
IF(NOT(LOCATE_CHARACTER_ANY_MEANS(Player1, 233.5, 244.5, 4.0, 3.0, 3.0)))
IF(NOT(LOCATE_CHARACTER_ANY_MEANS(Player1, 227.5, 243.5, 4.0, 4.0, 3.0)))
IF(NOT(LOCATE_CHARACTER_ANY_MEANS(Player1, 227.5, 243.5, 5.0, 4.0, 3.0)))
SET Rn3_SpottedCircle = 3
DISPLAY_BRIEF_NOW(1083)//n!Intruder in the area! Get him!
SET_CHAR_OBJECTIVE(Rn3_Guard5, KILL_CHAR_ON_FOOT, Player1)
SET_CHAR_OBJECTIVE(Rn3_Guard6, KILL_CHAR_ON_FOOT, Player1)
SET_CHAR_OBJECTIVE(Rn3_Guard7, KILL_CHAR_ON_FOOT, Player1)
SET_CHAR_OBJECTIVE(Rn3_Guard8, KILL_CHAR_ON_FOOT, Player1)
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
//---------------
//ENDIF
ENDIF[/mis]
If that doesnt work i wonder whats the secret to more accurate large-scale LOCATE_CHARACTER checking... Might as well mess with that some more in the meanwhile.

Edit: I've tried various names, Cargo_Area, cargoarea, Cargo. And Cargo uses the same amount of letters as Slums, the only working zone check i have in the whole damn map! Though that zone doesnt use a gtx file for name referencing.
User avatar
Pyro
Immortal
Posts: 414
Joined: 17 Mar 2010, 04:07
GH nick: Pyro
Location: Wales, UK

Re: Collection of gta scripting and map weirdness

Post by Pyro »

When using MAP_ZONE names you can't have a space in the name of it, and I don't think it will even compile. As you've probably seen, the script needs to have the same name as what is used in map editor zone itself.
CarThief
Hitman
Hitman
Posts: 108
Joined: 19 May 2012, 18:12
GH nick: CarThief
Location: Holland, AKA The Netherlands

Re: Collection of gta scripting and map weirdness

Post by CarThief »

Well i know spaces in zone names dont work out too well, not if they're needed by script atleast. Stuff like bus stops or stoplights dont seem to care.
Speaking of the subject i think i found a way for it to work: I named it Cargobay using Elypter's suggestion of 8 characters (though less seems to work as well), messed around a bit and made it a normal Navigation Zone, gave it its own personal equally-sized Information zone with the exact same name and at the very least it takes it on IF(NOT()) statements. I have my doubts if it still works within a larger Navigation Zone, though.

Now just to fix a few (hopefully) non-zone-based scripting errors and the mission is compete...

Edit: Still works! This may be usefull to note on this list after some extensive testing, as its otherwise very tedious to find out on your own.
As far as i can gather, it needs a reasonable name without spaces, no idea if it cares about underscores (_'s) and needs an information zone with the exact same name as it covering it or being the exact same size. It worked for me as a Navigation Zone though it may also work as a Local Navigation Zone.

Hm, too bad the AI runs right through the middle section of the supposed 'circle' area instead of staying and waiting outside to flank around the corners while bad guys enter the area from a door below. Ah well GTA2's AI isnt perfect...
BenMillard
Immortal
Posts: 889
Joined: 16 May 2009, 06:14
GH nick: BenMillard
Location: London, UK
Contact:

Re: Collection of gta scripting and map weirdness

Post by BenMillard »

Please split support requests and general "WTF?" moments to a separate thread. This one is specifically for short, well-proven, definite cases of GTA2 doing something wrong or extremely weird.

A command not working the way you expect the first time you use it is totally normal. We'd have to get all your map files to analyse the situation in detail before this could even be considered GTA2 scripting weirdness.
Post Reply