SET affects the COUNTER used by parent IF?

Anything to do with GTA1/GTA2 modding (tools, scripts and more).
Post Reply
BenMillard
Immortal
Posts: 889
Joined: 16 May 2009, 06:14
GH nick: BenMillard
Location: London, UK
Contact:

SET affects the COUNTER used by parent IF?

Post by BenMillard » 12 Apr 2012, 00:05

Entire level, ready for testing, is here. Or just skip to the solution.
tron-broken.zip
Door works but no sound is played. Uncomment lines in the "// Enter CLU's Command Ship:" section to try making the sounds work.
(213.02 KiB) Downloaded 312 times
Symptoms
A door opens when you approach it, after the long stairs. This works correctly, with the big code sample below.

However, I want it to play a sound when it opens and another when it closes. But if I uncomment this line, the door opens once and immediately closes forever:

Code: Select all

//SET open_closed = 1 // opening sound is now playing
The effect is like the COUNTER for command_entry is being reset or broken? Why would changing the value of the COUNTER for open_closed do that, though?

So maybe there's a logic error in my code, or a tiny syntax problem? I was looking at it late at night and posted this quite frustrated; sorry I forgot to describe it properly!

Desired Behaviour
The door opens when you approach it. The door closes if you move away from it or pass through it. That works fine, until the line is uncommented.

Big Code Sample
Relevant parts of the code, to help focus bug-hunting.

[mis]// Objectives
COUNTER command_entry // door to CLU's Command Ship
COUNTER open_closed // 1 = opening, 2 = closing
SOUND door_sound // plays the sound

// Players
PLAYER_PED p1 = (30.2,28.6,255.0) 05 080 // Blue Redneck (Sam)

// Counters
COUNTER stage = 1

LEVELSTART

// Loop until JOB COMPLETE:
WHILE_EXEC (stage = 1)

// Player 1:
IF (CHECK_CHARACTER_HEALTH(p1, 0))
// Enter CLU's Command Ship:
IF (LOCATE_CHARACTER_ANY_MEANS(p1, 41.5,20.5,5.0, 1.0,1.0))
SET command_entry = 1 // central controller for door
ENDIF
ENDIF

// [all other players]

// Enter CLU's Command Ship:
// Central controller for door
IF (command_entry = 1)
// Open door to let player(s) in:
CHANGE_BLOCK SIDE (41,20,5) TOP
NOT_WALL NOT_BULLET NOT_FLAT NOT_FLIP
000 935
CHANGE_BLOCK SIDE (41,20,5) BOTTOM
NOT_WALL NOT_BULLET FLAT NOT_FLIP
000 935
// Stop the door closing sound:
/*
IF (open_closed = 2) // closing door sound is playing
DELETE_ITEM (door_sound)
SET open_closed = 0 // opening sound is now playing
ENDIF
*/
// Play the door opening sound:
IF (open_closed = 0) // no sounds are playing
DELETE_ITEM (door_sound)
door_sound = CREATE_SOUND (41.5,21.0,5.0) GARAGE_OPEN PLAY_INSTANT END
//SET open_closed = 1 // opening sound is now playing
ENDIF
ELSE
// Close door because no players are near it:
CHANGE_BLOCK SIDE (41,20,5) TOP
NOT_WALL NOT_BULLET NOT_FLAT NOT_FLIP
000 928
CHANGE_BLOCK SIDE (41,20,5) BOTTOM
WALL BULLET FLAT NOT_FLIP
000 928
// Play the door closing sound once:
/*
IF (open_closed = 1) // opening door sound is playing
DELETE_ITEM (door_sound)
door_sound = CREATE_SOUND (41.5,21.0,5.0) GARAGE_OPEN PLAY_INSTANT END
SET open_closed = 2 // closing sound is now playing
ENDIF
*/
ENDIF
SET command_entry = 0 // reset

ENDWHILE[/mis]
Some sort of tiny syntax error I've made, which the compiler doesn't mind? Or a logic problem?

(EDIT) Provide a link straight to the solution, for future coder convenience.
Last edited by BenMillard on 12 Apr 2012, 20:15, edited 3 times in total.

User avatar
T.M.
Immortal
Posts: 957
Joined: 29 Jan 2010, 15:00
Location: F21B3EED

Re: SET affects the COUNTER used by parent IF?

Post by T.M. » 12 Apr 2012, 11:20

Few questions:
1) Where is the syntax error?
2) What should the code do, and what does it do instead?

PS. ELSE's are broken, try to replace with IF's.

User avatar
elypter
Immortal
Posts: 1119
Joined: 26 Dec 2009, 23:53
GH nick: elypter

Re: SET affects the COUNTER used by parent IF?

Post by elypter » 12 Apr 2012, 11:23

what is the problem? is the door sound not playing?

i can't really see a problem with that code but i have a working garage sound for a powerup pickup in tiny face off army

warning: long code (search for garage)
[mis]<%@ Template Language="C#" TargetLanguage="gta2mis" Description="Generates Tiny Face Off Army." %>
<%@ Property Name="PlayerCount" Type="System.Int32" Default="6" Category="Options" Description="This is the amount of players that this script should support." %>
<%@ Property Name="Author" Type="System.String" Default="anybody" Category="Options" Description="Author" %>
<%@ Property Name="Mapname" Type="System.String" Default="anymap" Category="Options" Description="Map name" %>
<%@ Property Name="Base" Type="System.String" Default="any" Category="Options" Description="base file name without extension" %>
<%@ Property Name="train" Type="System.Boolean" Default="true" Category="Options" Description="will the train be on the map" %>
<%@ Property Name="lite" Type="System.Boolean" Default="true" Category="Options" Description="will it be the lite version" %>
<% System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); %>
<script runat="template">
const int PU_NONE = -1;
const int PU_OBJECT = 0;
const int PU_INSTANT = 1;
const int PU_EVER = 2;

public struct pos{
public pos(double x,double y,double z){
this.x = x;
this.y = y;
this.z = z;
}
public double x;
public double y;
public double z;
public override string ToString(){
return(string.Format(" {0:0.00}, {1:0.00} , {2:0.00} ", x, y, z));
}
}
public struct powerup{
public powerup( string name, pos pos, int respawn, string obj, int soundtype, string sound){
this.name = name;
this.pos = pos;
this.respawn =respawn;
this.obj = obj;
this.soundtype = soundtype;
this.sound = sound;
}
public string name;
public pos pos;
public int respawn;
public string obj;
public int soundtype;
public string sound;
}
</script>

//{ //Header
// <%=Mapname%>
// script and map by <%=Author%>
// for details look at <%=Base%>_readme.txt
// <%=Base%>.mis Compiled by <%=Author%> on <%= DateTime.Now.ToLongDateString() %> with codesmith

// addons:
//#region header
//#endregion
//}

//{ //Declares

//{ //PlayerDefines <%int p=1;%>
<% if (PlayerCount>=p) { %>PLAYER_PED p<%=p++%> = (53.5, 198.8, 255.0) 5 135 <% } %>
<% if (PlayerCount>=p) { %>PLAYER_PED p<%=p++%> = (55.5, 198.8, 255.0) 7 225 <% } %>
<% if (PlayerCount>=p) { %>PLAYER_PED p<%=p++%> = (53.5, 197.2, 255.0) 8 45 <% } %>
<% if (PlayerCount>=p) { %>PLAYER_PED p<%=p++%> = (55.5, 197.2, 255.0) 11 315<% } %>
<% if (PlayerCount>=p) { %>PLAYER_PED p<%=p++%> = (53.2, 198.0, 255.0) 13 90 <% } %>
<% if (PlayerCount>=p) { %>PLAYER_PED p<%=p++%> = (55.8, 198.0, 255.0) 10 270<% } %>
//}

//{ //PlayerDeclares
<% for(int i=1;i<=PlayerCount;i++){%>
//{ //Player<%=i%>
//#region player_declare
//#endregion

COUNTER p<%=i%>_wantedlevel = 0
COUNTER p<%=i%>_trg_ic=1
CAR_DATA p<%=i%>_v
COUNTER p<%=i%>_tmr_swat = 150
COUNTER p<%=i%>_tmp_wantedlevel = 0
COUNTER p<%=i%>_expunch = 0
COUNTER p<%=i%>_trg_punched = 0
CHAR_DATA p<%=i%>_punched
COUNTER p<%=i%>_armor = 0
CAR_DATA p<%=i%>_armor_v
CAR_DATA p<%=i%>_ffield1
COUNTER p<%=i%>_nocol = 0
CAR_DATA p<%=i%>_nocol_v
CAR_DATA p<%=i%>_ffield2
COUNTER p<%=i%>_blackbox = 0
COUNTER p<%=i%>_trg_horn = 0
COUNTER p<%=i%>_carinvis = 0
CHAR_DATA p<%=i%>_blackbox_bot
COUNTER p<%=i%>_incar = 0
CAR_DATA p<%=i%>_nocon_v = (1.0, 1.0, 0.0) 27 90 BUG
COUNTER p<%=i%>_doorlock = 0
COUNTER p<%=i%>_tmr_invulv = 0
COUNTER p<%=i%>_deathplosion = 0
COUNTER p<%=i%>_remote=0
COUNTER p<%=i%>_tmr_remote=0
COUNTER p<%=i%>_electro_protection=0
//}

<% } %>
//}

//#region declare
//#endregion

//{ //Collectibles
// Weapons
GENERATOR shotgun1 = (54.5, 198.0) 0 COLLECT_06 0 0 99
GENERATOR shotgun2 = (35.5, 227.5) 0 COLLECT_06 0 0 99
GENERATOR molotov1 = (75.5, 198.5) 0 COLLECT_04 0 0 99
GENERATOR molotov2 = (26.5, 198.5, 2.0) 0 COLLECT_04 0 0 99
GENERATOR molotov3 = (87.0, 229.0) 0 COLLECT_04 0 0 99
GENERATOR molotov4 = (28.5, 229.5) 0 COLLECT_04 0 0 99
GENERATOR molotov5 = (66.5, 224.5) 0 COLLECT_04 0 0 99
GENERATOR molotov6 = (101.5, 217.5) 0 COLLECT_04 0 0 99
GENERATOR electro1 = (94.5, 216.5) 0 COLLECT_03 2000 2000 5
GENERATOR electro2 = (25.0, 196.5, 3.0) 0 COLLECT_03 2000 2000 5
GENERATOR electro3 = (67.5, 197.5) 0 COLLECT_03 2000 2000 5
GENERATOR rocket1 = (66.0, 193.5) 0 COLLECT_02 2000 2000 10
GENERATOR rocket2 = (91.5, 226.5) 0 COLLECT_02 2000 2000 10
GENERATOR rocket3 = (26.5, 214.5) 0 COLLECT_02 2000 2000 10

GENERATOR smg1 = (49.5, 199.5) 0 COLLECT_09 99999 99999 99
GENERATOR smg2 = (33.0, 222.5) 0 COLLECT_09 0 0 99
GENERATOR pistol1 = (28.5, 221.5) 0 COLLECT_00 0 0 99
GENERATOR dualpistol1 = (29.5, 231.5) 0 COLLECT_10 0 0 99
GENERATOR grenades1 = (34.0, 224.9) 0 COLLECT_05 0 0 99

GENERATOR armor = (57.5, 196.5) 0 COLLECT_31 99999 99999 -1
GENERATOR ddamage1 = (41.5, 209.5) 0 COLLECT_35 250 250 -1
GENERATOR ddamage2 = (100.5, 199.5) 0 COLLECT_35 250 250 -1
GENERATOR ddamage3 = (52.5, 196.5) 0 COLLECT_35 99999 99999 -1
GENERATOR ddamage4 = (31.0, 190.5) 0 COLLECT_35 250 250 -1
GENERATOR ddamage5 = (26.5, 224.5) 0 COLLECT_35 250 250 -1
GENERATOR fastr1 = (26.5, 213.5) 0 COLLECT_36 250 250 -1
GENERATOR fastr2 = (74.5, 202.5) 0 COLLECT_36 250 250 -1
GENERATOR fastr3 = (57.5, 199.5) 0 COLLECT_36 250 250 -1
GENERATOR fastr4 = (32.0, 190.5) 0 COLLECT_36 250 250 -1
GENERATOR fastr5 = (26.5, 225.5) 0 COLLECT_36 250 250 -1
GENERATOR health1 = (90.5, 207.5) 0 COLLECT_30 250 250 -1
GENERATOR health2 = (33.5, 221.0) 0 COLLECT_30 250 250 -1
GENERATOR health3 = (47.5, 209.5) 0 COLLECT_30 250 250 -1
GENERATOR fingers1 = (54.5, 214.5) 0 COLLECT_37 250 250 -1
GENERATOR fingers2 = (52.5, 199.5) 0 COLLECT_37 250 250 -1
GENERATOR bribe1 = (26.5, 226.5) 0 COLLECT_33 250 250 -1 // doesnt work in bankvan
GENERATOR igang1 = (64.0, 229.0) 0 COLLECT_40 250 250 -1
GENERATOR igang2 = (54.0, 229.0) 0 COLLECT_40 250 250 -1
GENERATOR igang3 = (68.0, 202.5, 2.0) 0 COLLECT_40 250 250 -1
GENERATOR igang4 = (78.5, 202.5) 0 COLLECT_40 250 250 -1

GENERATOR vmg2 = (70.5, 231.5) 0 COLLECT_18 800 800 10
GENERATOR vmg3 = (73.5, 202.5) 0 COLLECT_18 800 800 10
GENERATOR vbomb1 = (65.5, 213.5) 0 COLLECT_15 250 250 1
GENERATOR vbomb2 = (87.0, 226.5) 0 COLLECT_15 250 250 1
GENERATOR vbomb3 = (34.5, 196.5) 0 COLLECT_15 250 250 1
GENERATOR ibomb1 = (63.0, 220.5) 0 COLLECT_23 250 250 1
GENERATOR vmines1 = (63.5, 199.5) 0 COLLECT_17 800 800 10
GENERATOR vmines2 = (46.5, 224.5) 0 COLLECT_17 800 800 10
GENERATOR voil1 = (87.5, 193.5) 0 COLLECT_16 800 800 10
GENERATOR voil2 = (31.5, 229.5, 2.0) 0 COLLECT_16 800 800 10


GENERATOR flamer01 = (49.5, 190.5, 2.0) 0 COLLECT_08 800 800 20
GENERATOR flamer02 = (90.5, 199.5) 0 COLLECT_08 800 800 20
GENERATOR flamer03 = (52.5, 209.5) 0 COLLECT_08 800 800 20
GENERATOR flamer04 = (75.0, 225.0) 0 COLLECT_08 800 800 20
GENERATOR flamer05 = (51.5, 224.5) 0 COLLECT_08 800 800 20
GENERATOR flamer06 = (83.5, 207.5) 0 COLLECT_08 800 800 20
GENERATOR flamer07 = (65.0, 208.0) 0 COLLECT_08 800 800 20
GENERATOR flamer08 = (40.5, 203.0) 0 COLLECT_08 800 800 20
GENERATOR flamer09 = (94.0, 235.0) 0 COLLECT_08 800 800 20
GENERATOR flamer10 = (94.0, 226.0) 0 COLLECT_08 800 800 20

GENERATOR xmg01 = (41.5, 194.5) 0 COLLECT_01 0 0 99
GENERATOR xam01 = (41.5, 193.5) 0 COLLECT_31 0 0 -1
GENERATOR xmg02 = (26.5, 231.5) 0 COLLECT_01 0 0 99
GENERATOR xam02 = (26.5, 230.5) 0 COLLECT_31 0 0 -1
GENERATOR xmg03 = (59.5, 225.5) 0 COLLECT_01 0 0 99
GENERATOR xam03 = (59.5, 224.5) 0 COLLECT_31 0 0 -1
GENERATOR xmg04 = (96.5, 231.5) 0 COLLECT_01 0 0 99
GENERATOR xam04 = (96.5, 230.5) 0 COLLECT_31 0 0 -1
GENERATOR xmg05 = (85.5, 226.5, 2.0) 0 COLLECT_01 0 0 99
GENERATOR xam05 = (85.5, 225.5) 0 COLLECT_31 0 0 -1
GENERATOR xmg06 = (75.5, 208.5, 2.0) 0 COLLECT_01 0 0 99
GENERATOR xam06 = (75.5, 207.5) 0 COLLECT_31 0 0 -1
GENERATOR xmg07 = (58.5, 208.5) 0 COLLECT_01 0 0 99
GENERATOR xam07 = (58.5, 207.5) 0 COLLECT_31 0 0 -1
GENERATOR xmg08 = (41.5, 229.5) 0 COLLECT_01 0 0 99
GENERATOR xam08 = (41.5, 228.5) 0 COLLECT_31 0 0 -1
GENERATOR xmg09 = (68.5, 229.5) 0 COLLECT_01 0 0 99
GENERATOR xam09 = (68.5, 228.5) 0 COLLECT_31 0 0 -1
GENERATOR xmg10 = (90.4, 206.5) 0 COLLECT_01 0 0 99
GENERATOR xam10 = (90.5, 205.5) 0 COLLECT_31 0 0 -1
GENERATOR xmg11 = (80.5, 197.5) 0 COLLECT_01 0 0 99
GENERATOR xam11 = (80.5, 196.5) 0 COLLECT_31 0 0 -1
GENERATOR xmg12 = (58.5, 190.5, 2.0) 0 COLLECT_01 0 0 99
GENERATOR xam12 = (58.5, 189.6) 0 COLLECT_31 0 0 -1
GENERATOR xmg13 = (26.5, 191.5) 0 COLLECT_01 0 0 99
GENERATOR xam13 = (26.5, 190.5) 0 COLLECT_31 0 0 -1
GENERATOR xmg14 = (44.5, 208.5) 0 COLLECT_01 0 0 99
GENERATOR xam14 = (44.5, 207.5) 0 COLLECT_31 0 0 -1
GENERATOR xmg15 = (69.4, 199.6) 0 COLLECT_01 0 0 99
GENERATOR xam15 = (69.5, 198.5) 0 COLLECT_31 0 0 -1
GENERATOR xmg16 = (30.5, 208.5) 0 COLLECT_01 0 0 99
GENERATOR xam16 = (30.5, 207.5) 0 COLLECT_31 0 0 -1
GENERATOR xmg17 = (97.5, 200.5) 0 COLLECT_01 0 0 99
GENERATOR xam17 = (97.5, 199.5) 0 COLLECT_31 0 0 -1
GENERATOR xmg18 = (91.5, 212.5, 2.0) 0 COLLECT_01 0 0 99
GENERATOR xam18 = (91.5, 211.5, 2.0) 0 COLLECT_31 0 0 -1

//}

//{ //Staic Cars

//CAR_DATA static_car

PARKED_CAR_DATA car1 = (31.6, 239.4) 27 85 PICKUP
PARKED_CAR_DATA car2 = (30.8, 222.3, 2.0) -1 75 TOWTRUCK
PARKED_CAR_DATA car3 = (48.8, 210.5) 37 295 BANKVAN
PARKED_CAR_DATA car4 = (23.6, 224.6, 2.0) 18 100 ALFA

PARKED_CAR_DATA car5 = (64.9, 220.6) 10 90 GTRUCK
PARKED_CAR_DATA car6 = (89.0, 235.0) -1 90 TANK
PARKED_CAR_DATA car7 = (29.0, 236.5, 3.5) 27 120 SWATVAN
PARKED_CAR_DATA car8 = (93.0, 199.5, 2.0) 27 265 FIRETRUK
PARKED_CAR_DATA car9 = (79.5, 172.5) -1 270 APC
PARKED_CAR_DATA car10 = (62.0, 200.5) -1 90 JEEP

PARKED_CAR_DATA car11 = (52.0, 233.0) -1 90 GUNJEEP
PARKED_CAR_DATA car12 = (23.6, 190.5) -1 100 COPCAR
PARKED_CAR_DATA car13 = (83.0, 200.5) -1 90 EDSELFBI
PARKED_CAR_DATA car14 = (28.7, 210.6) -1 30 MEDICAR

PARKED_CAR_DATA trailer = (57.5, 231.5) 2 275 TRUKTRNS
PARKED_CAR_DATA cab = (55.9, 231.4) 2 255 TRUKCAB1

//OBJ_DATA train_obj

//}

//{ //Towers
OBJ_DATA tower01 = (55.2, 195.2, 6.0) 0 TOWER
OBJ_DATA tower02 = (64.8, 195.2, 5.0) 0 TOWER
OBJ_DATA tower03 = (64.2, 195.2, 5.0) 0 TOWER
OBJ_DATA tower04 = (79.5, 218.5, 5.0) 90 TOWER
OBJ_DATA tower05 = (74.5, 218.5, 5.0) 270 TOWER
OBJ_DATA tower06 = (53.8, 195.2, 6.0) 0 TOWER
OBJ_DATA tower07 = (64.8, 194.8, 5.0) 0 TOWER
OBJ_DATA tower08 = (64.2, 194.8, 5.0) 0 TOWER
OBJ_DATA tower09 = (64.5, 194.8, 5.0) 0 TOWER
OBJ_DATA tower10 = (52.2, 231.2, 3.0) 0 TOWER

OBJ_DATA tower11 = (52.5, 231.2, 3.0) 0 TOWER
OBJ_DATA tower12 = (52.8, 231.2, 3.0) 0 TOWER
OBJ_DATA tower13 = (53.1, 231.2, 3.0) 0 TOWER
OBJ_DATA tower14 = (53.4, 231.2, 3.0) 0 TOWER
OBJ_DATA tower15 = (53.7, 231.2, 3.0) 0 TOWER
OBJ_DATA tower16 = (64.5, 195.2, 5.0) 0 TOWER

OBJ_DATA tower17 = (43.2, 197.2, 3.1) 0 TOWER

OBJ_DATA tower20 = (71.2, 186.8, 7.1) 0 TOWER
OBJ_DATA tower21 = (73.9, 186.8, 7.1) 0 TOWER
OBJ_DATA tower22 = (73.6, 186.8, 7.1) 0 TOWER
OBJ_DATA tower23 = (73.3, 186.8, 7.1) 0 TOWER
OBJ_DATA tower24 = (73.0, 186.8, 7.1) 0 TOWER
OBJ_DATA tower25 = (72.7, 186.8, 7.1) 0 TOWER
OBJ_DATA tower26 = (72.4, 186.8, 7.1) 0 TOWER
OBJ_DATA tower27 = (72.1, 186.8, 7.1) 0 TOWER
OBJ_DATA tower28 = (71.8, 186.8, 7.1) 0 TOWER
OBJ_DATA tower29 = (71.5, 186.8, 7.1) 0 TOWER

OBJ_DATA tower30 = (74.2, 185.8, 7.1) 0 TOWER
OBJ_DATA tower31 = (76.9, 185.8, 7.1) 0 TOWER
OBJ_DATA tower32 = (76.6, 185.8, 7.1) 0 TOWER
OBJ_DATA tower33 = (76.3, 185.8, 7.1) 0 TOWER
OBJ_DATA tower34 = (76.0, 185.8, 7.1) 0 TOWER
OBJ_DATA tower35 = (75.7, 185.8, 7.1) 0 TOWER
OBJ_DATA tower36 = (75.4, 185.8, 7.1) 0 TOWER
OBJ_DATA tower37 = (75.1, 185.8, 7.1) 0 TOWER
OBJ_DATA tower38 = (74.8, 185.8, 7.1) 0 TOWER
OBJ_DATA tower39 = (74.5, 185.8, 7.1) 0 TOWER

OBJ_DATA tower40 = (68.2, 185.8, 7.1) 0 TOWER
OBJ_DATA tower41 = (70.9, 185.8, 7.1) 0 TOWER
OBJ_DATA tower42 = (70.6, 185.8, 7.1) 0 TOWER
OBJ_DATA tower43 = (70.3, 185.8, 7.1) 0 TOWER
OBJ_DATA tower44 = (70.0, 185.8, 7.1) 0 TOWER
OBJ_DATA tower45 = (69.7, 185.8, 7.1) 0 TOWER
OBJ_DATA tower46 = (69.4, 185.8, 7.1) 0 TOWER
OBJ_DATA tower47 = (69.1, 185.8, 7.1) 0 TOWER
OBJ_DATA tower48 = (68.8, 185.8, 7.1) 0 TOWER
OBJ_DATA tower49 = (68.5, 185.8, 7.1) 0 TOWER

OBJ_DATA tower50 = (77.2, 188.8, 7.1) 0 TOWER
OBJ_DATA tower51 = (79.9, 188.8, 7.1) 0 TOWER
OBJ_DATA tower52 = (79.6, 188.8, 7.1) 0 TOWER
OBJ_DATA tower53 = (79.3, 188.8, 7.1) 0 TOWER
OBJ_DATA tower54 = (79.0, 188.8, 7.1) 0 TOWER
OBJ_DATA tower55 = (78.7, 188.8, 7.1) 0 TOWER
OBJ_DATA tower56 = (78.4, 188.8, 7.1) 0 TOWER
OBJ_DATA tower57 = (78.1, 188.8, 7.1) 0 TOWER
OBJ_DATA tower58 = (77.8, 188.8, 7.1) 0 TOWER
OBJ_DATA tower59 = (77.5, 188.8, 7.1) 0 TOWER

OBJ_DATA tower60 = (81.2, 188.8, 7.1) 0 TOWER
OBJ_DATA tower61 = (83.9, 188.8, 7.1) 0 TOWER
OBJ_DATA tower62 = (83.6, 188.8, 7.1) 0 TOWER
OBJ_DATA tower63 = (83.3, 188.8, 7.1) 0 TOWER
OBJ_DATA tower64 = (83.0, 188.8, 7.1) 0 TOWER
OBJ_DATA tower65 = (82.7, 188.8, 7.1) 0 TOWER
OBJ_DATA tower66 = (82.4, 188.8, 7.1) 0 TOWER
OBJ_DATA tower67 = (82.1, 188.8, 7.1) 0 TOWER
OBJ_DATA tower68 = (81.8, 188.8, 7.1) 0 TOWER
OBJ_DATA tower69 = (81.5, 188.8, 7.1) 0 TOWER

//}

//{ //Static Objects

// Radio Stations
RADIO_STATION rockstar = STATION_RESIDENTIAL (212.5, 22.5)
RADIO_STATION futuro = STATION_ZAIBATSU (54.5, 195.0)
RADIO_STATION rebel = STATION_REDNECK (29.5, 226.5)
RADIO_STATION osmosis = STATION_SCIENTIST (93.5, 210.5)

//SW Corner
OBJ_DATA sw00 = (26.2, 227.5) 0 BUSH
OBJ_DATA sw01 = (31.3, 226.8) 0 CONE
OBJ_DATA sw02 = (34.0, 222.2) 5 CRATE
OBJ_DATA sw03 = (28.8, 224.7) 340 RUBBISH
OBJ_DATA sw04 = (37.6, 240.7) 0 OILDRUM
OBJ_DATA sw051 = (33.8, 224.4) 290 BOXES
OBJ_DATA sw05 = (31.4, 225.7) 0 HARDBOX
OBJ_DATA sw06 = (33.7, 222.0) 0 OIL
OBJ_DATA sw07 = (31.7, 226.6) 0 MOVING_CONE
OBJ_DATA sw08 = (32.0, 222.1) 0 MOVING_BIN_LID
OBJ_DATA sw09 = (27.3, 221.2) 0 TYRE

OBJ_DATA sw10 = (26.8, 227.8) 90 BUSH
OBJ_DATA sw11 = (31.9, 228.6, 2.0) 0 CONE
OBJ_DATA sw12 = (25.3, 231.4) 355 CRATE
OBJ_DATA sw13 = (28.3, 227.7, 2.0) 335 RUBBISH
OBJ_DATA sw14 = (26.2, 227.2) 0 OILDRUM
OBJ_DATA sw15 = (25.6, 231.7) 0 BOXES
OBJ_DATA sw151 = (25.7, 231.0) 0 HARDBOX
OBJ_DATA sw16 = (28.7, 221.3) 0 OIL
OBJ_DATA sw17 = (31.6, 226.8) 305 MOVING_CONE
OBJ_DATA sw18 = (30.4, 221.5, 2.1) 0 MOVING_BIN_LID
OBJ_DATA sw19 = (27.2, 221.8) 0 TYRE

OBJ_DATA sw20 = (26.5, 227.8) 0 BUSH
OBJ_DATA sw21 = (31.6, 228.3, 2.0) 0 CONE
OBJ_DATA sw22 = (29.6, 221.3) 0 CRATE
OBJ_DATA sw23 = (33.1, 229.6) 315 RUBBISH
OBJ_DATA sw24 = (27.8, 221.3) 0 OILDRUM
OBJ_DATA sw25 = (29.0, 240.7) 0 BOXES
OBJ_DATA sw251 = (33.4, 236.1) 70 HARDBOX
OBJ_DATA sw26 = (29.7, 222.3) 0 OIL
OBJ_DATA sw27 = (31.8, 226.1) 155 MOVING_CONE
OBJ_DATA sw28 = (33.8, 229.2, 2.0) 0 MOVING_BIN_LID
OBJ_DATA sw29 = (27.5, 221.3) 0 TYRE

OBJ_DATA sw30 = (26.2, 227.8) 270 BUSH
OBJ_DATA sw31 = (31.2, 228.2, 2.0) 0 CONE
OBJ_DATA sw32 = (33.4, 234.9) 345 CRATE
OBJ_DATA sw33 = (27.8, 222.3) 50 RUBBISH
OBJ_DATA sw34 = (31.2, 225.2) 0 OILDRUM
OBJ_DATA sw35 = (34.5, 222.6) 345 BOXES
OBJ_DATA sw351 = (33.4, 234.0) 0 HARDBOX
OBJ_DATA sw36 = (29.0, 225.2, 2.0) 0 OIL
OBJ_DATA sw37 = (31.4, 226.3) 70 MOVING_CONE
OBJ_DATA sw38 = (28.3, 239.5) 0 MOVING_BIN_LID
OBJ_DATA sw39 = (27.2, 221.5) 0 TYRE

OBJ_DATA swx01 = (23.1, 227.2, 3.0) 0 BUSH
OBJ_DATA swx02 = (21.8, 228.5) 0 BUSH
OBJ_DATA swx03 = (21.8, 227.9) 180 BUSH
OBJ_DATA swx04 = (21.8, 227.3) 0 BUSH
OBJ_DATA swx05 = (23.5, 228.7) 0 BUSH
OBJ_DATA swx06 = (23.5, 228.2) 270 BUSH
OBJ_DATA swx07 = (23.5, 227.7, 3.0) 0 BUSH
OBJ_DATA swx08 = (23.5, 227.2, 3.0) 90 BUSH

OBJ_DATA bnc01 = (69.9, 197.1, 3.0) 90 BUSH
OBJ_DATA bnc02 = (70.7, 197.9, 3.0) 0 BUSH
OBJ_DATA bnc03 = (69.9, 197.9, 3.0) 180 BUSH
OBJ_DATA bnc04 = (69.2, 197.1, 3.0) 90 BUSH
OBJ_DATA bnc05 = (71.6, 196.01, 3.0) 0 BUSH
OBJ_DATA bnc06 = (71.2, 196.01, 3.0) 270 BUSH
OBJ_DATA bnc07 = (70.7, 197.1, 3.0) 90 BUSH
OBJ_DATA bnc08 = (69.2, 197.9, 3.0) 0 BUSH

//Cones
OBJ_DATA cwc01 = (36.1, 213.0) 0 CONE
OBJ_DATA cwc03 = (36.1, 214.0) 0 CONE
OBJ_DATA cwc042 = (36.1, 215.0) 0 CONE
OBJ_DATA cwc06 = (77.9, 217.0) 0 CONE
OBJ_DATA cwc08 = (77.9, 216.0) 0 CONE
OBJ_DATA cwc11 = (77.9, 215.0) 0 CONE
OBJ_DATA cwc14 = (76.1, 217.0) 0 CONE
OBJ_DATA cwc16 = (76.1, 216.0) 0 CONE
OBJ_DATA cwc18 = (76.1, 215.0) 0 CONE

OBJ_DATA cec01 = (37.9, 217.0, 2.0) 0 CONE
OBJ_DATA cec03 = (37.9, 216.0) 0 CONE
OBJ_DATA cec05 = (37.9, 215.0) 0 CONE
OBJ_DATA cec07 = (37.9, 214.0) 0 CONE
OBJ_DATA cec09 = (37.9, 213.0) 0 CONE
OBJ_DATA cec11 = (36.1, 217.0, 2.0) 0 CONE
OBJ_DATA cec13 = (36.1, 216.0) 0 CONE

OBJ_DATA css02 = (82.5, 212.0, 2.0) 0 CONE
OBJ_DATA css03 = (80.5, 212.0, 2.0) 0 CONE
OBJ_DATA css04 = (78.5, 212.0) 0 CONE
OBJ_DATA css05 = (79.5, 211.0) 0 CONE
OBJ_DATA css07 = (83.5, 211.0) 0 CONE
OBJ_DATA css08 = (80.0, 212.0, 2.0) 0 CONE
OBJ_DATA css10 = (79.0, 211.0) 0 CONE
OBJ_DATA css11 = (83.5, 212.0, 2.0) 0 CONE
OBJ_DATA css12 = (83.0, 211.0) 0 CONE
OBJ_DATA css13 = (79.5, 212.0) 0 CONE
OBJ_DATA css14 = (80.5, 211.0) 0 CONE
OBJ_DATA css15 = (78.5, 211.0) 0 CONE
OBJ_DATA css16 = (83.0, 212.0, 2.0) 0 CONE
OBJ_DATA css17 = (82.5, 211.0) 0 CONE
OBJ_DATA css18 = (79.0, 212.0) 0 CONE
OBJ_DATA css19 = (80.0, 211.0) 0 CONE



OBJ_DATA bench01 = (61.5, 190.2, 2.0) 0 BENCH
OBJ_DATA bench02 = (60.4, 190.2, 2.0) 0 BENCH
OBJ_DATA bench03 = (90.7, 204.1) 270 BENCH
OBJ_DATA bench04 = (74.0, 207.7) 180 BENCH
OBJ_DATA bench05 = (46.5, 207.7) 180 BENCH
OBJ_DATA bench06 = (29.1, 190.3) 0 BENCH
OBJ_DATA bench07 = (28.3, 190.3) 0 BENCH
OBJ_DATA bench08 = (44.0, 193.7) 180 BENCH
OBJ_DATA bench09 = (29.5, 207.7) 180 BENCH
OBJ_DATA bench10 = (101.7, 201.4) 270 BENCH
OBJ_DATA bench11 = (100.5, 198.4, 2.0) 0 BENCH
OBJ_DATA bench12 = (101.7, 199.6) 270 BENCH
OBJ_DATA bench13 = (101.7, 200.5) 270 BENCH
OBJ_DATA bench14 = (88.5, 212.3, 2.0) 0 BENCH
OBJ_DATA bench15 = (89.3, 212.3, 2.0) 0 BENCH
OBJ_DATA bench16 = (97.7, 203.5) 270 BENCH
OBJ_DATA bench17 = (88.7, 225.7) 180 BENCH
OBJ_DATA bench18 = (43.3, 228.8) 180 BENCH

OBJ_DATA bin01 = (31.7, 222.3) 0 BIN

//}

//{ //Conveyor,Crusher,Destructor,Cranes,Trains,Gangs

CONVEYOR belt_north4 = (72.5, 196.5, 4.0) (1.0, 51.0) 0 -1
CONVEYOR belt_south0 = (65.5, 221.5, 4.0) (13.0, 1.0) 1 0
CONVEYOR belt_south1 = (59.0, 221.5, 3.0) (6.0, 1.0) 1 0
CONVEYOR belt_rocket1 = (79.5, 223.5, 3.0) (1.0, 3.0) 0 1
CONVEYOR belt_rocket2 = (84.5, 226.5, 4.0) (3.0, 1.0) 1 0
CONVEYOR belt_rocket3 = (90.5, 231.5) (1.0, 3.0) 0 1

//CONVEYOR belt_north5 = (72.5, 178.0) (1.0, 20.0) 0 -1

CONVEYOR belt_jump1 = (74.5, 232.0, 4.5) (8.0, 1.5) 0 -3
CONVEYOR belt_jump12 = (74.5, 229.0, 4.5) (8.0, 4.0) 0 -1
CONVEYOR belt_jump2 = (74.5, 232.0, 5.0) (8.0, 1.5) 0 -3
CONVEYOR belt_jump22 = (74.5, 229.0, 5.0) (8.0, 4.0) 0 0
CONVEYOR belt_jump3 = (74.5, 232.0, 5.5) (8.0, 1.5) 0 -3
CONVEYOR belt_jump32 = (74.5, 229.0, 5.5) (8.0, 4.0) 0 -1
CONVEYOR belt_jump4 = (74.5, 232.0, 6.0) (8.0, 1.5) 0 -3
CONVEYOR belt_jump42 = (74.5, 229.0, 6.0) (8.0, 4.0) 0 -1

CRUSHER crush1 = (63.0, 221.5)
CRUSHER crush2 = (72.5, 188.5)
CRANE_DATA crane1 = (58.5, 224.5) 40 NO_HOMECRANE FIRST (58.5, 221.5) 270
CRANE_DATA crane2 = (26.5, 242.5) 350 NO_HOMECRANE FIRST (30.5, 245.7) 270
CRANE_DATA crane3 = (59.5, 230.5) 200 NO_HOMECRANE
CRANE_DATA crane4 = (30.5, 241.5) 200 NO_HOMECRANE FIRST (35.4, 241.5) 270
DESTRUCTOR destr1 = (72.5, 221.5, 4.0) (1.0, 1.0)
//DESTRUCTOR destr2 = (72.5, 189.5, 4.0) (1.0, 1.0)
DESTRUCTOR destr3 = (72.5, 186.5, 4.0) (1.0, 1.0)
DESTRUCTOR destr4 = (72.5, 187.5, 4.0) (1.0, 1.0)

OBJ_DATA bollard = (72.5, 186.5, 3.0) 0 BOLLARD

//does not work probly because wrecks are not transported by type 2 crane
GENERATOR generator_crusher_crane_powerup1 = (72.5, 220.5, 4.0) 0 TYRE 80 80 5
DECLARE_POWERUP_CARLIST ( apc , apc , apc , apc , apc , apc , apc , apc , apc , apc
, apc , apc , apc , apc , apc , apc , apc , apc , apc )
DECLARE_CRANE_POWERUP (crane1, generator_crusher_crane_powerup1, 124, 115, 3)

SET_STATION_INFO (trak01, 1, 2, 1)
//SET_STATION_INFO (trak00, 1, 1, 0)
//SET_STATION_INFO (trak02, 1, 0, 2)

OBJ_DATA tun01 = (93.5, 190.5, 3.5) 270 TUNNEL_BLOCKER
//DELETED// OBJ_DATA tun02 = (37.5, 196.5, 2.2) 270 TUNNEL_BLOCKER
OBJ_DATA tun03 = (67.5, 233.5, 3.5) 270 TUNNEL_BLOCKER
OBJ_DATA tun04 = (92.5, 206.5, 3.6) 180 TUNNEL_BLOCKER
OBJ_DATA tun05 = (92.5, 190.5, 3.6) 0 TUNNEL_BLOCKER
OBJ_DATA tun06 = (54.5, 189.5, 2.6) 0 TUNNEL_BLOCKER
OBJ_DATA tun07 = (31.5, 196.5, 2.0) 90 TUNNEL_BLOCKER
OBJ_DATA tun08 = (23.5, 196.5, 1.5) 90 TUNNEL_BLOCKER
OBJ_DATA tun09 = (23.5, 209.5, 4.6) 90 TUNNEL_BLOCKER
OBJ_DATA tun10 = (29.0, 233.5, 5.0) 90 TUNNEL_BLOCKER
OBJ_DATA tun11 = (29.0, 234.5, 5.0) 90 TUNNEL_BLOCKER
OBJ_DATA tun12 = (29.0, 232.5, 5.0) 90 TUNNEL_BLOCKER

OBJ_DATA tun13 = (76.5, 188.5, 3.6) 90 TUNNEL_BLOCKER
OBJ_DATA tun14 = (76.5, 187.5, 3.6) 90 TUNNEL_BLOCKER
OBJ_DATA tun15 = (90.5, 188.4, 3.6) 270 TUNNEL_BLOCKER
OBJ_DATA tun16 = (90.5, 187.5, 3.6) 270 TUNNEL_BLOCKER



//}

//{ //Sounds
//}

//{ //Scripting
COUNTER firstrun=1
COUNTER mainloop = 1
COUNTER tmploop=0
COUNTER temp = 0
COUNTER temp2 =0
COUNTER rand = 0
COUNTER tmr = 0

OBJ_DATA del_mine
OBJ_DATA del_oil
COUNTER mineoil_tmr =0

ONSCREEN_COUNTER dummy_osc

COUNTER wantedlevel =0
COUNTER max_wantedlevel = 5
COUNTER tmr_wantedlevel =0

//Scripted Collectibles
COUNTER color = 0
SOUND snd_item
COUNTER armor_ani = 0 //animation runs faster when 2 players have it
COUNTER nocol_ani = 0 //animation runs faster when 2 players have it
COUNTER armor_duration = 150
COUNTER nocol_duration = 1000000
COUNTER wantedlevel_duration = 10000

COUNTER msg_sunday = 0

//}

//{ //Scripted Powerups
<%
string[] powerups = { "armor", "nocol", "repair", "abribe", "expunch", "carflamer", "tankgun", "jeepgun",
"blackbox", "carinvis", "doorlock", "deathplosion", "remote", "electro_protection"};

powerup[] pus = {
new powerup( "armor", new pos( 68.0, 199.5, 7.5 ), 800, "COLLECT_28", PU_OBJECT, "BONUS_TOKEN" ),
new powerup( "nocol", new pos( 38.5, 222.5, 2.5 ), 250, "COLLECT_38", PU_NONE, "NONE" ),
new powerup( "repair", new pos( 81.5, 211.5, 2.0 ), 250, "TYRE", PU_NONE, "NONE" ),
new powerup( "abribe", new pos( 45.0, 224.0 , 255.0 ), 250, "KILL_FRENZY", PU_INSTANT, "SCREAM" ),
new powerup( "expunch", new pos( 46.5, 209.5, 4.0 ), 250, "BRIEFCASE", PU_OBJECT, "RUBBISH" ),
new powerup( "carflamer", new pos( 58.5, 232.0, 255.0 ), 800, "FIREJET", PU_OBJECT, "BONUS_TOKEN" ),
new powerup( "tankgun", new pos( 85.1, 200.9, 255 ), 800, "TANKTOP", PU_OBJECT, "BONUS_TOKEN" ),
new powerup( "jeepgun", new pos( 60.5, 232.0, 255.0 ), 800, "TRAFFIC_LIGHT", PU_OBJECT, "BONUS_TOKEN" ),
new powerup( "blackbox", new pos( 99.0, 207.0, 6.5 ), 800, "COLLECT_29", PU_OBJECT, "BONUS_TOKEN" ),
new powerup( "carinvis", new pos( 29.5, 240.0, 255.0 ), 250, "COLLECT_39", PU_NONE, "NONE" ),
new powerup( "doorlock", new pos( 75.0, 193.5, 3.5 ), 250, "COLLECT_32", PU_INSTANT, "GARAGE_CLOSE" ),
new powerup( "deathplosion", new pos( 72.5, 221.5, 255.0 ), 250, "BOMB", PU_INSTANT, "YEEHA_BOMB" ),
new powerup( "remote", new pos( 33.5, 209.5, 255.0 ), 800, "REMOTE", PU_OBJECT, "BONUS_TOKEN" ),
new powerup( "electro_protection", new pos( 52.5, 190.5, 255.0 ), 250, "PHONE", PU_OBJECT, "BLASTER" )
};
%>

<% foreach(powerup pu in pus){ %>
COUNTER tmr_<%=pu.name%> = 1
COUNTER col_<%=pu.name%> = 1
COUNTER res_<%=pu.name%> = 250
OBJ_DATA obj_<%=pu.name%>

<% } %>
//}

//}

LEVELSTART

WHILE_EXEC(mainloop=1)
IF (firstrun=1)
//#region init
//#endregion

//ADD_ONSCREEN_COUNTER ( dummy_osc , p1_trg_ic )
//train_obj = CREATE_CAR (88.5, 210.5, 3.0) 0 270 TRUKCAB1 END

// Environment
SET_SHADING_LEVEL (27)
SET_AMBIENT_LEVEL (1.0, 0)
DECLARE_POLICELEVEL (6)
SET_GANG_INFO (nocol, 1, MACHINE_GUN, ROCKET_LAUNCHER, ROCKET_LAUNCHER, 5, 0.0, 0.0, 0.0, 0, APC, 30)

LAUNCH_MISSION (load.mis)
SET firstrun=0

ENDIF

++tmr
++rand

//{ // Player Checks
<% for(int i=1;i<=PlayerCount;i++){%>
IF (CHECK_CHARACTER_HEALTH(p<%=i%>, 0))
//#region player_loop
//#endregion

STORE_CAR_CHARACTER_IS_IN ( p<%=i%> , p<%=i%>_v )

IF (((IS_CHARACTER_IN_ANY_CAR(p<%=i%>))AND(CHECK_WEAPON_TYPE_HIT_CAR ( p<%=i%>_v , BY_WATER_CANNON ) )) AND (NOT (CHECK_WEAPON_TYPE_HIT_CAR ( p<%=i%>_nocon_v , BY_WATER_CANNON ))))
ORDER_CHAR_TO_BACKDOOR(p<%=i%>,p<%=i%>_v)
SET_ENTER_CONTROL_STATUS ( p<%=i%> , OFF )
p<%=i%>_nocon_v = CREATE_CAR (1.0, 1.0, 0.0) 27 90 BUG END
STORE_CAR_CHARACTER_IS_IN ( p<%=i%> , p<%=i%>_nocon_v )
ENDIF

IF(( LOCATE_CHARACTER_ANY_MEANS ( p<%=i%>, 83.5 , 106.5, 2.0, 0.8, 0.8 )) OR ( LOCATE_CHARACTER_ANY_MEANS ( p<%=i%>, 33.5 , 221.0, 4.5, 0.8, 0.8 )))
SET_CHAR_INVINCIBLE( p<%=i%> , OFF )
IF (IS_CHAR_ON_FIRE ( p<%=i%> ) )
SET_CHAR_INVINCIBLE( p<%=i%> , ON )
ENDIF
ENDIF
IF(LOCATE_CHARACTER_ANY_MEANS (p<%=i%>, 47.5, 209.5, 4.0, 0.8, 0.8))
SET_CHAR_INVINCIBLE( p<%=i%> , OFF )
IF (IS_CHAR_ON_FIRE ( p<%=i%> ) )
SET_CHAR_INVINCIBLE( p<%=i%> , ON )
ENDIF
ENDIF

IF ( HAS_CHARACTER_DIED ( p<%=i%> ))
//#region player_died
//#endregion
SET_ENTER_CONTROL_STATUS ( p<%=i%> , ON )

SET p<%=i%>_tmr_swat = 150
ALTER_WANTED_LEVEL (p<%=i%>, 0)
//SET max_wantedlevel = 5
IF (p<%=i%>_deathplosion = 1)
EXPLODE_LARGE (p<%=i%>)
ENDIF

SET p<%=i%>_expunch = 0
SET p<%=i%>_blackbox = 0
SET p<%=i%>_deathplosion = 0
SET p<%=i%>_remote = 0
SET p<%=i%>_electro_protection=0

//SUNDAY DRIVER
IF (IS_CHARACTER_IN_ANY_CAR ( p<%=i%> ))
SET msg_sunday=3
ENDIF

SET temp = ( rand / 3 )
SET temp = ( temp * 3 )
SET rand= ( rand - temp )
ENDIF

//{ // WANTED_LEVEL READ
IF (NOT((p<%=i%>_trg_ic=0) AND (CHECK_CAR_MODEL ( p<%=i%>_v , BANKVAN ))))

IF(CHECK_HEADS_GREATER ( p<%=i%> , 0 ))
SET p<%=i%>_wantedlevel = 1
IF(CHECK_HEADS_GREATER ( p<%=i%> , 1 ))
SET p<%=i%>_wantedlevel = 2
IF(CHECK_HEADS_GREATER ( p<%=i%> , 2 ))
SET p<%=i%>_wantedlevel = 3
IF(CHECK_HEADS_GREATER ( p<%=i%> , 3 ))
SET p<%=i%>_wantedlevel = 4
IF(CHECK_HEADS_GREATER ( p<%=i%> , 4 ))
SET p<%=i%>_wantedlevel = 5
IF(CHECK_HEADS_GREATER ( p<%=i%> , 5 ))
SET p<%=i%>_wantedlevel = 6
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF

IF( p<%=i%>_wantedlevel > max_wantedlevel )
SET p<%=i%>_wantedlevel = (max_wantedlevel + 0)
ALTER_WANTED_LEVEL (p<%=i%>, 5) //should be ALTER_WANTED_LEVEL (p<%=i%>, max_wantedlevel) but works for this map that way too
ENDIF
IF( p<%=i%>_wantedlevel > wantedlevel )
SET wantedlevel = (p<%=i%>_wantedlevel + 0)
ENDIF

//}

//SWAT
IF (p<%=i%>_tmr_swat > 1)
SET p<%=i%>_tmr_swat = ( p<%=i%>_tmr_swat - 1)
ENDIF
IF (p<%=i%>_tmr_swat = 1)
SET p<%=i%>_tmr_swat = 0
ALTER_WANTED_LEVEL (p<%=i%>, 4) //SWAT
ENDIF

//{ //Powerups
IF ((LOCATE_CHARACTER_BY_CAR ( p<%=i%> , 68.0, 199.5, 7.0 , 0.8 , 0.8 ))AND(col_armor = 0))
IF (p<%=i%>_armor > 1)
SET_CAR_NUMBER_GRAPHIC ( p<%=i%>_ffield1 , 8 )
SET_CAR_BULLETPROOF ( p<%=i%>_armor_v, OFF )
SET_CAR_ROCKETPROOF ( p<%=i%>_armor_v, OFF )
SET_CAR_FLAMEPROOF ( p<%=i%>_armor_v, OFF )
ENDIF
SET tmr_armor = 0
SET armor_ani = -3
SET p<%=i%>_armor = (armor_duration+0)
STORE_CAR_CHARACTER_IS_IN ( p<%=i%> , p<%=i%>_armor_v )
p<%=i%>_ffield1 = CREATE_CAR (1.0, 1.0, 0.0) 27 90 AMDB4 END
PUT_CAR_ON_TRAILER ( p<%=i%>_ffield1 , p<%=i%>_armor_v )
ENDIF

IF ((LOCATE_CHARACTER_BY_CAR ( p<%=i%> , 38.5, 222.5, 2.0 , 0.8 , 0.8 ))AND(col_nocol = 0))
IF (p<%=i%>_nocol > 1)
SET_CAR_NUMBER_GRAPHIC ( p<%=i%>_ffield2 , 8 )
CLEAR_CAR_NO_COLLIDE ( p<%=i%>_nocol_v )
ENDIF
SET tmr_nocol = 0
SET nocol_ani = -3
SET p<%=i%>_nocol = (nocol_duration + 0)
STORE_CAR_CHARACTER_IS_IN ( p<%=i%> , p<%=i%>_nocol_v )
p<%=i%>_ffield2 = CREATE_CAR (1.0, 1.0, 0.0) 27 90 AMDB4 END
PUT_CAR_ON_TRAILER ( p<%=i%>_ffield2 , p<%=i%>_nocol_v )
CHANGE_GANG_CHAR_RESPECT ( nocol , p<%=i%> , -1 )
ENDIF

IF ((LOCATE_CHARACTER_BY_CAR ( p<%=i%> , 81.5, 211.5, 2.0 , 0.8 , 0.8 ))AND(col_repair = 0))
SET tmr_nocol = 0
SET p<%=i%>_tmp_wantedlevel=(p<%=i%>_wantedlevel+0)
ADD_SCORE (p<%=i%>,5000)
LAUNCH_MISSION(repair.mis)
LAUNCH_MISSION(p<%=i%>_rwl.mis)
ENDIF

IF ((LOCATE_CHARACTER_ANY_MEANS ( p<%=i%> , 45.0, 224.0, 5.0 , 0.8 , 0.8 ))AND(col_abribe = 0))
SET tmr_abribe = 0
SET p<%=i%>_wantedlevel = 6
SET p<%=i%>_tmp_wantedlevel=6
SET max_wantedlevel = 6
SET tmr_wantedlevel = (wantedlevel_duration + 0)
ALTER_WANTED_LEVEL (p<%=i%>, 6)
ENDIF

IF ((LOCATE_CHARACTER_ANY_MEANS ( p<%=i%> , 46.5, 209.5, 4.0 , 0.8 , 0.8 ))AND(col_expunch = 0))
SET tmr_expunch = 0
SET p<%=i%>_expunch = 1
ENDIF

IF ((LOCATE_CHARACTER_BY_CAR ( p<%=i%> , 58.5, 232.0, 3.0 , 0.8 , 0.8 ))AND(col_carflamer = 0))
IF ((CHECK_CAR_MODEL ( p<%=i%>_v , FIRETRUK )) OR (CHECK_CAR_MODEL ( p<%=i%>_v , GUNJEEP )))
SET tmr_carflamer = 0
GIVE_WEAPON (p<%=i%>_v, CAR_FLAMETHROWER, 99)
GIVE_WEAPON (p<%=i%>_v, CAR_FLAMETHROWER, 99)
ENDIF
ENDIF

IF (((LOCATE_CHARACTER_BY_CAR ( p<%=i%> , 85.1, 200.9, 2.0 , 0.8 , 0.8 ))AND(col_tankgun = 0)) AND (CHECK_CAR_MODEL ( p<%=i%>_v , TANK ) ))
SET tmr_tankgun = 0
GIVE_WEAPON (p<%=i%>_v, TANK_GUN, 99)
GIVE_WEAPON (p<%=i%>_v, TANK_GUN, 99)
ENDIF

IF (((LOCATE_CHARACTER_BY_CAR ( p<%=i%> , 60.5, 232.0, 3.0 , 0.8 , 0.8 ))AND(col_jeepgun = 0)) AND (CHECK_CAR_MODEL ( p<%=i%>_v , GUNJEEP )) )
SET tmr_jeepgun = 0
GIVE_WEAPON (p<%=i%>_v, JEEP_GUN, 99)
GIVE_WEAPON (p<%=i%>_v, JEEP_GUN, 99)
ENDIF

IF ((LOCATE_CHARACTER_BY_CAR ( p<%=i%> , 99.0, 207.0, 6.0 , 0.8 , 0.8 ))AND(col_blackbox = 0))
SET tmr_blackbox = 0
SET p<%=i%>_blackbox = 1
ENDIF

IF ((LOCATE_CHARACTER_BY_CAR ( p<%=i%> , 29.5, 240.0, 2.0 , 0.8 , 0.8 ))AND(col_carinvis = 0))
SET tmr_carinvis = 0
SET_CAR_NUMBER_GRAPHIC ( p<%=i%>_v , 8 )
ENDIF
IF ((LOCATE_CHARACTER_ON_FOOT ( p<%=i%> , 29.5, 240.0, 2.0 , 0.8 , 0.8 ))AND(col_carinvis = 0))
SET tmr_carinvis = 0
ENDIF

IF ((LOCATE_CHARACTER_BY_CAR ( p<%=i%> , 75.0, 193.5, 3.0 , 0.8 , 0.8 ))AND(col_doorlock = 0))
SET tmr_doorlock = 0
SET p<%=i%>_doorlock = 1
ENDIF

IF ((LOCATE_CHARACTER_ANY_MEANS ( p<%=i%> , 72.5, 221.5, 5.0 , 0.8 , 0.8 ))AND(col_deathplosion = 0))
SET tmr_deathplosion = 0
SET p<%=i%>_deathplosion = 1
ENDIF

IF (((LOCATE_CHARACTER_BY_CAR ( p<%=i%> , 33.5, 209.5, 5.0 , 0.8 , 0.8 ))AND(col_remote = 0)) AND (p<%=i%>_remote=0))
SET tmr_remote = 0
SET p<%=i%>_tmr_remote = 30
ORDER_DRIVER_OUT_CAR (p<%=i%>)
ENDIF

IF ((LOCATE_CHARACTER_ANY_MEANS ( p<%=i%> , 52.5, 190.5, 4.0 , 0.8 , 0.8 ))AND(col_electro_protection = 0))
SET tmr_electro_protection = 0
SET p<%=i%>_electro_protection=1
ENDIF

//}

//{ //Armor
IF ( p<%=i%>_armor > 1 )
SET_CAR_BULLETPROOF ( p<%=i%>_armor_v, ON )
SET_CAR_ROCKETPROOF ( p<%=i%>_armor_v, ON )
SET_CAR_FLAMEPROOF ( p<%=i%>_armor_v, ON )
++armor_ani
IF ( armor_ani = 3 )
SET_CAR_NUMBER_GRAPHIC ( p<%=i%>_ffield1 , 0 )
ENDIF
IF ( armor_ani = 6 )
SET_CAR_NUMBER_GRAPHIC ( p<%=i%>_ffield1 , 1 )
ENDIF
IF ( armor_ani = 9 )
SET_CAR_NUMBER_GRAPHIC ( p<%=i%>_ffield1 , 2 )
ENDIF
IF ( armor_ani = 12 )
SET_CAR_NUMBER_GRAPHIC ( p<%=i%>_ffield1 , 3 )
SET armor_ani = 0
--p<%=i%>_armor
ENDIF
ENDIF
IF ( p<%=i%>_armor = 1 )
SET_CAR_NUMBER_GRAPHIC ( p<%=i%>_ffield1 , 8 )
SET_CAR_BULLETPROOF ( p<%=i%>_armor_v, OFF )
SET_CAR_ROCKETPROOF ( p<%=i%>_armor_v, OFF )
SET_CAR_FLAMEPROOF ( p<%=i%>_armor_v, OFF )
ENDIF

//}

//{ //Nocol
IF ( p<%=i%>_nocol > 1 )
SET_CAR_NO_COLLIDE ( p<%=i%>_nocol_v )
++nocol_ani
IF ( nocol_ani = 3 )
SET_CAR_NUMBER_GRAPHIC ( p<%=i%>_ffield2 , 4 )
ENDIF
IF ( nocol_ani = 6 )
SET_CAR_NUMBER_GRAPHIC ( p<%=i%>_ffield2 , 5 )
ENDIF
IF ( nocol_ani = 9 )
SET_CAR_NUMBER_GRAPHIC ( p<%=i%>_ffield2 , 6 )
ENDIF
IF ( nocol_ani = 12 )
SET_CAR_NUMBER_GRAPHIC ( p<%=i%>_ffield2 , 7 )
SET nocol_ani = 0
--p<%=i%>_nocol
ENDIF
ENDIF
IF ( p<%=i%>_nocol = 1 )
SET_CAR_NUMBER_GRAPHIC ( p<%=i%>_ffield2 , 8 )
CLEAR_CAR_NO_COLLIDE ( p<%=i%>_nocol_v )
ENDIF
//}

IF ((( HAS_CHAR_PUNCHED_SOMEONE ( p<%=i%> ) ) AND ( p<%=i%>_trg_punched = 0 ) ) AND ( p<%=i%>_expunch = 1))
STORE_LAST_CHAR_PUNCHED ( p<%=i%> , p<%=i%>_punched )
SET p<%=i%>_trg_punched = 1
ENDIF
IF (( p<%=i%>_trg_punched = 1 ) AND ( p<%=i%>_expunch = 1))
IF ( NOT ( DELAY ( 60 ) ) )
EXPLODE_SMALL (p<%=i%>_punched)
SET p<%=i%>_trg_punched = 0
ENDIF
ENDIF

IF ( p<%=i%>_blackbox=1 )
IF (IS_CHAR_PRESSING_HORN ( p<%=i%> ) ) //Player pressing HORN
IF (p<%=i%>_trg_horn=0)
SET p<%=i%>_trg_horn=1
ENDIF
ENDIF
IF (NOT(IS_CHAR_PRESSING_HORN ( p<%=i%> ) ))
IF (p<%=i%>_trg_horn=1)
ORDER_CHAR_TO_BACKDOOR(p<%=i%>,p<%=i%>_v)
p<%=i%>_blackbox_bot = CREATE_CHAR_INSIDE_CAR ( p<%=i%>_v ) 0 DRIVER END
SET p<%=i%>_blackbox=0
ENDIF
SET p<%=i%>_trg_horn=0
ENDIF
ENDIF

// Teleport
IF((NOT(IS_CHARACTER_IN_ANY_CAR( p<%=i%> )))OR(NOT(CHECK_CAR_MODEL(p<%=i%>_v , TRAIN ))))
IF (( LOCATE_CHARACTER_ANY_MEANS ( p<%=i%>, 56.0, 188.0, 1.0, 88.0, 40.0 )) OR ( LOCATE_CHARACTER_ANY_MEANS ( p<%=i%>, 90.5 , 203.5, 1.0, 31.0, 23.0 )) )
//CONVEYOR belt_north4 = (55.5, 186.0, 1.0) (87.0, 44.0) 0 -1
//CONVEYOR belt_north4 = (82.0, 203.0, 1.0) (48.0, 22.0) 0 -1
WARP_FROM_CAR_TO_POINT (p<%=i%>, 54.5, 197.5, 5.0, 0)
SET_CHAR_INVINCIBLE( p<%=i%> , ON )
SET p<%=i%>_tmr_invulv = 100
ENDIF
IF ( LOCATE_CHARACTER_ANY_MEANS ( p<%=i%>, 54.5 , 229.5, 1.0, 85.0, 13.0 ))
//CONVEYOR belt_north4 = (54.5, 229.5, 1.0) (85.0, 13.0) 0 -1
WARP_FROM_CAR_TO_POINT (p<%=i%>, 54.5, 197.5, 5.0, 0)
SET_CHAR_INVINCIBLE( p<%=i%> , ON )
SET p<%=i%>_tmr_invulv = 100
ENDIF
ENDIF
IF (p<%=i%>_tmr_invulv > 1)
SET p<%=i%>_tmr_invulv = ( p<%=i%>_tmr_invulv - 1)
ENDIF
IF (p<%=i%>_tmr_invulv = 1)
SET p<%=i%>_tmr_invulv = 0
SET_CHAR_INVINCIBLE( p<%=i%> , OFF )
ENDIF


// remote
IF (p<%=i%>_tmr_remote > 1)
SET p<%=i%>_tmr_remote = ( p<%=i%>_tmr_remote - 1)
ENDIF
IF (p<%=i%>_tmr_remote = 1)
SET p<%=i%>_tmr_remote = 0
SET p<%=i%>_remote = 1
TAKE_REMOTE_CONTROL_OF_CAR (p<%=i%>, p<%=i%>_v)
ENDIF

// electro protection
IF((CHECK_WEAPON_TYPE_HIT_CHAR (p<%=i%>, BY_ELECTRO_WEAPON)) AND (p<%=i%>_electro_protection = 1))
SET_CHAR_INVINCIBLE( p<%=i%> , ON )
SET p<%=i%>_tmr_invulv = 100
EXPLODE_SMALL(p<%=i%>)
ENDIF

//{ // CARMODEL CHECK

IF ((IS_CHARACTER_IN_ANY_CAR ( p<%=i%> ) ) AND (p<%=i%>_remote=0) )
IF (p<%=i%>_trg_ic=1)
SET p<%=i%>_trg_ic=0
LAUNCH_MISSION(p<%=i%>_cmc.mis)
ENDIF
ENDIF
IF ((NOT(IS_CHARACTER_IN_ANY_CAR ( p<%=i%> ) )) AND (p<%=i%>_remote=0) )
IF (p<%=i%>_trg_ic=0)

IF (CHECK_CAR_MODEL ( p<%=i%>_v , BANKVAN ) )
LAUNCH_MISSION (p<%=i%>_rwl.mis) //Restore wanted level
ENDIF
CHANGE_CAR_LOCK ( p<%=i%>_v , UNLOCKED )
ENDIF
SET p<%=i%>_trg_ic=1
SET p<%=i%>_incar = 0
ENDIF
IF (p<%=i%>_trg_ic=0)
IF (CHECK_CAR_MODEL ( p<%=i%>_v , BANKVAN ) )
ADD_SCORE ( p<%=i%>, 10 )
ALTER_WANTED_LEVEL (p<%=i%>, 0)
ENDIF
IF(p<%=i%>_doorlock=1)
CHANGE_CAR_LOCK ( p<%=i%>_v , LOCKED )
ENDIF
ENDIF
//}

ENDIF

<% } %>
//}

//#region loop
//#endregion

//{ // Powerups

<% foreach(powerup pu in pus){ %>
IF (tmr_<%=pu.name%>=0)
SET tmr_<%=pu.name%> = (res_<%=pu.name%> + 0)
SET col_<%=pu.name%> = 1
DELETE_ITEM ( obj_<%=pu.name%> )
<% if(pu.soundtype==PU_OBJECT){ %>
obj_<%=pu.name%> = CREATE_OBJ (<%=pu.pos%>) 0 <%=pu.sound%> END
DELETE_ITEM ( obj_<%=pu.name%> )
<% }else if(pu.soundtype==PU_INSTANT){ %>
snd_item = CREATE_SOUND (<%=pu.pos%>) <%=pu.sound%> PLAY_INSTANT END
<% }else if(pu.soundtype==PU_EVER){ %>
snd_item = CREATE_SOUND (<%=pu.pos%>) <%=pu.sound%> PLAY_FOREVER END
<% } %>
ENDIF
IF (tmr_<%=pu.name%>>1)
SET tmr_<%=pu.name%> = ( tmr_<%=pu.name%> - 1 )
ENDIF
IF (tmr_<%=pu.name%>=1)
SET col_<%=pu.name%> = 0
SET tmr_<%=pu.name%> = -1
obj_<%=pu.name%> = CREATE_OBJ (<%=pu.pos%>) 0 <%=pu.obj%> END
ENDIF

<% } %>

//}

//{ // cleanup
IF (mineoil_tmr > 0)
SET mineoil_tmr = ( mineoil_tmr - 1)
ENDIF
IF (mineoil_tmr = 0)
SET mineoil_tmr = 50
del_mine = CREATE_OBJ (1.0, 1.0, 1.0) 0 MINE END
del_oil = CREATE_OBJ (1.0, 1.0, 1.0) 0 OIL END
ENDIF
//}

//{ //SUNDAY DRIVER Message
IF (msg_sunday>1)
SET msg_sunday = ( msg_sunday - 1 )
ENDIF
IF (msg_sunday=1)
DISPLAY_MESSAGE (5061) //DAMN SUNDAY DRIVERS!
SET msg_sunday = 0
ENDIF
//}

//{ //Army Reset
IF (tmr_wantedlevel>1)
SET tmr_wantedlevel = ( tmr_wantedlevel - 1 )
ENDIF
IF (tmr_wantedlevel=1)
SET tmr_wantedlevel = 0
SET max_wantedlevel = 5
ENDIF
//}

ENDWHILE

LEVELEND
[/mis]
yur sa'nok ngeyä

BenMillard
Immortal
Posts: 889
Joined: 16 May 2009, 06:14
GH nick: BenMillard
Location: London, UK
Contact:

Re: SET affects the COUNTER used by parent IF?

Post by BenMillard » 12 Apr 2012, 14:52

I've updated the first post. It was typed when tired and annoyed and didn't tell you half of what you would need to know.

Thanks for looking.

User avatar
T.M.
Immortal
Posts: 957
Joined: 29 Jan 2010, 15:00
Location: F21B3EED

Re: SET affects the COUNTER used by parent IF?

Post by T.M. » 12 Apr 2012, 15:25

Why dont you just use the DOOR_DATA thing... it opens door when you approach and closes when you get out. Rather hacky way to do the same thing as basic doors does...

User avatar
Pyro
Immortal
Posts: 414
Joined: 17 Mar 2010, 04:07
GH nick: Pyro
Location: Wales, UK

Re: SET affects the COUNTER used by parent IF?

Post by Pyro » 12 Apr 2012, 16:45

T.M. wrote:Why dont you just use the DOOR_DATA thing... it opens door when you approach and closes when you get out. Rather hacky way to do the same thing as basic doors does...
If I remember with proper DOOR_DATA, if you fire a gun in the trigger zone (for the door to open/close) you won't see any bullets/rockets. Pretty trivial really, but if you really wanted to fight near a door then it'd affect you, hence making a 'fake' door (check if player/car/object destroyed then change the physical block the door tile is on and, if needs be, use sound on the door to fake it).

Also, by the looks of your COUNTERS in your declarations, you haven't given them an initial value but I doubt that'd affect it. You probably want to use a NOT along with a LOCATE_CHARACTER_ANY_MEANS for door control. Or just use a real door :P

User avatar
elypter
Immortal
Posts: 1119
Joined: 26 Dec 2009, 23:53
GH nick: elypter

Re: SET affects the COUNTER used by parent IF?

Post by elypter » 12 Apr 2012, 18:08

not sure if that has anything to do with it but play instant sounds do not have to be deleted to stop them
and i can confirm that the garage close sound is working. maybe the open sound is not
yur sa'nok ngeyä

User avatar
T.M.
Immortal
Posts: 957
Joined: 29 Jan 2010, 15:00
Location: F21B3EED

Re: SET affects the COUNTER used by parent IF?

Post by T.M. » 12 Apr 2012, 18:25

Pyro wrote:Also, by the looks of your COUNTERS in your declarations, you haven't given them an initial value but I doubt that'd affect it.
While making the SCR decompiler, i noticed all uninitialized variables gets initialized to zero automatically, in fact, some commands are stored with "COUNTER some = 0" fashion instead of "COUNTER some", so decompiling them will reveal their initial values that way.

BenMillard
Immortal
Posts: 889
Joined: 16 May 2009, 06:14
GH nick: BenMillard
Location: London, UK
Contact:

Re: SET affects the COUNTER used by parent IF?

Post by BenMillard » 12 Apr 2012, 20:10

DOOR_DATA blocks all weapons. So if you are standing 'inside' it and shoot a rocket, it instantly hits an invisible forcefield and kills you. Same with throwing molotovs, etc. A key part of this level is that you shoot through the doorway when the two teams first encounter one another.

(It's also super weird to see this blocking effect at any time in a multiplayer level. Unless you're parking a stolen Pacifier in your own base.)

Elypter, the sound was repeating every cycle over itself in most versions of the code I tried. That was either with or without the DELETE_ITEM, as it turns out. Maybe we can test some versions tomorrow in 2-player? Forgot my power lead tonight, so not on for long.

Thanks for the help so far, dudes. I've attached the broken version to first message.

User avatar
elypter
Immortal
Posts: 1119
Joined: 26 Dec 2009, 23:53
GH nick: elypter

Re: SET affects the COUNTER used by parent IF?

Post by elypter » 12 Apr 2012, 20:35

there are 2 types of sounds. the ones that only play if you execute a command each cycle, repeat automatically and stop immediately if you dont + the ones that play once instantly and cannot be stopped. those are hardcoded. it makes sense to only use the respective type in the script but it there might be exceptions. i didnt figure those out or forgot.

yours looks like the horn on bc_ac. the garage close sound on tyfo army plays once and has to be executed only once like you would expect.
yur sa'nok ngeyä

User avatar
Pyro
Immortal
Posts: 414
Joined: 17 Mar 2010, 04:07
GH nick: Pyro
Location: Wales, UK

Re: SET affects the COUNTER used by parent IF?

Post by Pyro » 12 Apr 2012, 23:48

BenMillard wrote:It's also super weird to see this blocking effect at any time in a multiplayer level. Unless you're parking a stolen Pacifier in your own base.
Not sure if that was a dig at Bootcamp or just coincidence :P

BenMillard
Immortal
Posts: 889
Joined: 16 May 2009, 06:14
GH nick: BenMillard
Location: London, UK
Contact:

Re: SET affects the COUNTER used by parent IF?

Post by BenMillard » 13 Apr 2012, 21:00

Not a dig but yes about Bootcamp. ;)

Gustavob shared a code he wrote to do this. Below is a full working .mis which I quickly adapted to work on pza.gmp with a custom .mmp. The door appears in the far South West corner of the arena.

Looks like the GOSUB he was using isn't actually necessary, so I inlined that code. Might re-use the GOSUB so it can be shared between players, though.

CHANGE_BLOCK SIDE only works when that block already has a side, either from the GMP or (presumably) from ADD_NEW_BLOCK.

[mis]// GTA2 Test Script
// by Pyro & BenMillard, April 2011
// Features Gustavob's doors in SW corner.
// http://gtamp.com/forum/viewtopic.php?f=4&t=505
//
// http://projectcerbera.com/gta/2/tutorials/multiplayer

// Weapons
// Note: This respawns instantly and gives maximum ammo.
GENERATOR rocket1 = (118.0,133.0,1.0) 0 COLLECT_02 0 0 99

// Player Cars:
PARKED_CAR_DATA p1car = (116.5,131.5,1.0) 35 225 VTYPE // Yellow
PARKED_CAR_DATA p2car = (116.5,134.5,1.0) 20 315 VTYPE // Green
PARKED_CAR_DATA p3car = (119.5,134.5,1.0) 28 045 VTYPE // Red
PARKED_CAR_DATA p4car = (119.5,131.5,1.0) 15 135 VTYPE // Orange
PARKED_CAR_DATA p5car = (118.0,135.2,1.0) 24 000 VTYPE // Blue
PARKED_CAR_DATA p6car = (115.8,133.0,1.0) 14 270 VTYPE // Dark Blue
// PARKED_CAR_DATA p7car = (111.8,133.0,1.0) 21 270 VTYPE // Grey

// Players
/*
p1 p4
p6 RL = (118.0,133.0)
p2 p5 p3
*/
PLAYER_PED p1 = (117.0,132.0,1.0) 07 045 // Yellow Scientist
PLAYER_PED p2 = (117.0,134.0,1.0) 11 135 // Green Loonie
PLAYER_PED p3 = (119.0,134.0,1.0) 10 225 // Red Russian
PLAYER_PED p4 = (119.0,132.0,1.0) 09 315 // Orange Krishna
PLAYER_PED p5 = (118.0,134.5,1.0) 05 180 // Blue Redneck
PLAYER_PED p6 = (116.5,133.5,1.0) 13 090 // Dark Blue Yakuza
// PLAYER_PED p7 = (116.5,128.5,1.0) 08 090 // Grey Zaibatsu

// Counters
COUNTER stage = 1

// Gustavob Door Code
COUNTER doorsoundplayed = 0
COUNTER doorsoundplayed2 = 0
SOUND doorsound
playsound1:
doorsound = CREATE_SOUND (112.0,139.0,1.0) GARAGE_OPEN PLAY_INSTANT END //Obviously you'll change the coordinates here...
SET doorsoundplayed = 1
RETURN
playsound2:
doorsound = CREATE_SOUND (112.0,139.0,1.0) GARAGE_CLOSE PLAY_INSTANT END //...and here
SET doorsoundplayed = 0
RETURN




// End of objects...
LEVELSTART
// ...start of commands.



// Environment
SET_AMBIENT_LEVEL (0.75, 0) // reduce the value after you add lights
DECLARE_POLICELEVEL (4) // 4 = SWAT; 5 = FBI; 6 = Army
// Note: Army in multiplayer needs Vike's GTA2 v11.3 or newer.

// Weapons
SWITCH_GENERATOR (rocket1, ON)

// Vehicle Weapons
GIVE_WEAPON (p1car, CAR_MACHINE_GUN, 1)
GIVE_WEAPON (p1car, CAR_MACHINE_GUN, 1) // gives 99
GIVE_WEAPON (p2car, CAR_MACHINE_GUN, 1)
GIVE_WEAPON (p2car, CAR_MACHINE_GUN, 1) // gives 99
GIVE_WEAPON (p3car, CAR_MACHINE_GUN, 1)
GIVE_WEAPON (p3car, CAR_MACHINE_GUN, 1) // gives 99
GIVE_WEAPON (p4car, CAR_MACHINE_GUN, 1)
GIVE_WEAPON (p4car, CAR_MACHINE_GUN, 1) // gives 99
GIVE_WEAPON (p5car, CAR_MACHINE_GUN, 1)
GIVE_WEAPON (p5car, CAR_MACHINE_GUN, 1) // gives 99
GIVE_WEAPON (p6car, CAR_MACHINE_GUN, 1)
GIVE_WEAPON (p6car, CAR_MACHINE_GUN, 1) // gives 99


// Main Loop
// Note: Only needed for missions, game modes and gimmicks.
WHILE_EXEC (stage = 1)
// DO_NOWT

// Gustavob Door Code
IF ( LOCATE_CHARACTER_ANY_MEANS(p1, 113.0,139.0,1.0, 2.0,2.0) ) //In front of door
CHANGE_BLOCK SIDE (113,139,1) TOP NOT_WALL NOT_BULLET FLAT NOT_FLIP 270 935 //Make it look open
CHANGE_BLOCK SIDE (112,139,1) TOP NOT_WALL NOT_BULLET FLAT NOT_FLIP 090 935
CHANGE_BLOCK SIDE (113,139,1) BOTTOM NOT_WALL NOT_BULLET NOT_FLAT NOT_FLIP 090 935
CHANGE_BLOCK SIDE (112,139,1) BOTTOM NOT_WALL NOT_BULLET NOT_FLAT NOT_FLIP 270 935
WHILE ( doorsoundplayed = 0 )
//GOSUB playsound1: //Here is where the sound is played
doorsound = CREATE_SOUND (112.0,139.0,1.0) GARAGE_OPEN PLAY_INSTANT END //Obviously you'll change the coordinates here...
SET doorsoundplayed = 1
ENDWHILE
ENDIF
IF ( NOT ( LOCATE_CHARACTER_ANY_MEANS(p1, 113.0,139.0,1.0, 2.0,2.0) ) )
CHANGE_BLOCK SIDE (113,139,1) TOP WALL BULLET FLAT NOT_FLIP 270 928 //Close it again when player leaves range
CHANGE_BLOCK SIDE (112,139,1) TOP WALL BULLET FLAT NOT_FLIP 090 928
CHANGE_BLOCK SIDE (113,139,1) BOTTOM WALL NOT_BULLET NOT_FLAT NOT_FLIP 090 928
CHANGE_BLOCK SIDE (112,139,1) BOTTOM WALL NOT_BULLET NOT_FLAT NOT_FLIP 270 928
WHILE ( doorsoundplayed = 1 )
//GOSUB playsound2: //Here is where the closing sound (which is actually just the same) plays
doorsound = CREATE_SOUND (112.0,139.0,1.0) GARAGE_CLOSE PLAY_INSTANT END //...and here
SET doorsoundplayed = 0
ENDWHILE
ENDIF
ENDWHILE


LEVELEND[/mis]
Last edited by BenMillard on 13 Apr 2012, 21:48, edited 1 time in total.

User avatar
elypter
Immortal
Posts: 1119
Joined: 26 Dec 2009, 23:53
GH nick: elypter

Re: SET affects the COUNTER used by parent IF?

Post by elypter » 13 Apr 2012, 21:10

you can set a counter if any of the players is at the position and then execute if the counter is set after those 6 checks.

ive done something like that on rocha hd.
yur sa'nok ngeyä

BenMillard
Immortal
Posts: 889
Joined: 16 May 2009, 06:14
GH nick: BenMillard
Location: London, UK
Contact:

Re: SET affects the COUNTER used by parent IF?

Post by BenMillard » 13 Apr 2012, 21:49

Oh yeah, that's actually much closer to the current logic in TRON: Light Jets.

(EDIT) It works! I've updated the TRON: Light Jets download.

Post Reply