Scripting command questions

Anything to do with GTA1/GTA2 modding (tools, scripts and more).
Devastator
Hitman
Hitman
Posts: 120
Joined: 06 Dec 2011, 16:54

Scripting command questions

Post by Devastator »

I've been trying my hand at Scripting for GTA2 again, using one of the earlier renditions of Multislayer (which I played a lot in Single player many years ago).

I've been able to produce some pretty cool effects, like Suicide bombers (on foot) that explode upon reaching the player,
5 different assassins that swarm the player on level start, becoming invincible if the player dies & having a group added to their character, if each particular assassin dies that respawn as a downgraded form with no objective(plus a weaker weapon & standard gangster attire (whereas the Gang assassins have The EMERG_GRAPHIC remap, I'm using this to pretend they're the gang leaders).

I have a zombie gang in the graveyard that attacks the player on site, & a generator in the graveyard that turns all characters into muggers(Psychos) if destroyed (I used to use the buckfast cheat to pretend everyone in the city was zombies & I would play to see how long I could survive for, so this generator acts as a way to optionally turn it on at any point during gameplay).

A funny thing I noticed with this experimentation is some scripting weirdness which is actually pretty cool & you guys may have not known about;
If you have turn all characters into muggers both (ON) & (OFF) simultaneously in a loop, it'll create interesting behavior with dummy peds. The peds who spawn as Psychos don't attack the player or each other on sight, but if the player attacks the peds will rush him & punch him to the ground like a cop (or maybe they were doing that to gangsters but actually killing me). They also won't fight each other in this state so you can have like 10 dummy peds all chasing the player at once.

I also created some Terminator like characters similar to those in Snow Ball City 2; invulnerable Objectiveless guys that wander around & attack when attacked. Killing them turns on the Instant Gang generator they spawn at. I got this to work once but my latest version of the script doesn't seem to be activating the generator when I kill them.

The player starts out with an EMERG_GRAPHIC remap (Green vested Krishna), upon dying he looks like a standard Krishna. If you manage to kill a Terminator though you'll "level up" & become gang leader again by getting your Vest back.
(The Pherson Ghetto is the location of Krishna looking 'Thugs' gang)

I've also learned some cool scripting hacks you guys may or may not have known about involving NPCs with groups created for them.
Any group added to a character will have that character's remap & weapon.
However, if you create the character, create the group, & then remap the character & give the character a weapon (or different weapon) his gang can have completely different weapons & remaps then him. I've been using this to designate the gang leader with an EMERG_GRAPH remap.
One of my assassins is actually armed with an Electrobaton, & his group (following him in a chain) is unarmed, so he shoots the player to slow him down while they gang up on him & beat him up.
What I learned from all this though is when you kill a Group leader, another member of that group becomes that group leader;
Killing the leader of the gang with the electrobaton makes one of the cohorts instantly armed with it,
Similarly with a Flame thrower dude & his group.

It's the same with my Kamikaze guys, if you kill the group leader whose objective is to go to p1 on foot, causing him to explode, his lackey will continue the objective, being the one to explode instead. This is pretty cool because I have a second group comprised of 6 kamikazes who have a car bomb size explosion.

Speaking of my kamikazes, upon reaching their objective the loop caused them to explode indefinitely, which was pretty amusing as they soared through the air leaving a chain of explosions, but not what I had intended. So by setting a check to make the character have no objective upon reaching the player & then exploding, or having no objective upon dying, I was able to break the infinitely exploding corpse glitch.

Here's all the coding so far for anyone curious:
[mis](to make this more legible I removed Cerbera's original lines from the script so that only mine are visible)
OBJ_DATA Psychogen = (055.5,066.5) 0 POWERGEN


OBJ_DATA Pistcrate = (099.18,087.24) 0 Crate
OBJ_DATA Pistcrateproduct

//Gangs

MAP_ZONE Zombies //= (0,0,0,0,10,0,0,0,1000,0,0)
SET_GANG_INFO ( Zombies , 24, NO_WEAPON, NO_WEAPON, NO_WEAPON, 0 ,
0.0, 0.0, 0.0, 00 , BMW , 1)
//
//MAP_ZONE Fire1
//SET_GANG_INFO ( Fire1 , 3, NO_WEAPON, NO_WEAPON, NO_WEAPON, 0 ,
// 0.0, 0.0, 0.0, 00 , FIRETRUK , -1)
//
//MAP_ZONE Fire1
//SET_GANG_INFO ( Fire1 , 3, NO_WEAPON, NO_WEAPON, NO_WEAPON, 0 ,
// 0.0, 0.0, 0.0, 00 , FIRETRUK , -1)
//
//
MAP_ZONE Police1 //= (500,0,0,500,100,0,0,0,500,400,500)
SET_GANG_INFO ( Police1 , 0, PISTOL, NO_WEAPON, NO_WEAPON, 0 ,
0.0, 0.0, 0.0, 00 , COPCAR , -1)
//
MAP_ZONE SubwayRats
SET_GANG_INFO ( SubwayRats , 14, NO_WEAPON, NO_WEAPON, NO_WEAPON, 0 ,
0.0, 0.0, 0.0, 00 , STYPE , 1)
//
MAP_ZONE Thugs
SET_GANG_INFO ( Thugs , 9, PISTOL, NO_WEAPON, NO_WEAPON, 0 ,
0.0, 0.0, 0.0, 00 , STRIPETB , 29)
//
MAP_ZONE Shockers
SET_GANG_INFO ( Shockers , 12, NO_WEAPON, NO_WEAPON, NO_WEAPON, 0 ,
0.0, 0.0, 0.0, 00 , ALLARD , 33)
////
MAP_ZONE Seniors
SET_GANG_INFO ( Seniors , 46, NO_WEAPON, NO_WEAPON, NO_WEAPON, 0 ,
0.0, 0.0, 0.0, 00 , VAN , 16)
////
MAP_ZONE Reds
SET_GANG_INFO ( Reds , 30, NO_WEAPON, NO_WEAPON, NO_WEAPON, 0 ,
0.0, 0.0, 0.0, 00 , ALFA , 28)
////
MAP_ZONE Bruisers
SET_GANG_INFO ( Bruisers , 22, NO_WEAPON, NO_WEAPON, NO_WEAPON, 0 ,
0.0, 0.0, 0.0, 00 , DART , 32)
//
//MAP_ZONE Docks
//SET_GANG_INFO ( Docks , 33, PISTOL, NO_WEAPON, NO_WEAPON, 0 ,
// 0.0, 0.0, 0.0, 00 , PICKUP , 35)
//
//MAP_ZONE A2gang
//SET_GANG_INFO ( A2gang , 42, NO_WEAPON, NO_WEAPON, NO_WEAPON, 0 ,
// 0.0, 0.0, 0.0, 00 , GRAHAM , 11)
//
//MAP_ZONE A4gang
//SET_GANG_INFO ( A4gang , 36, NO_WEAPON, NO_WEAPON, NO_WEAPON, 0 ,
// 0.0, 0.0, 0.0, 00 , ISETTA , 20)
//
MAP_ZONE Pinks
SET_GANG_INFO ( Pinks , 52, PISTOL, NO_WEAPON, NO_WEAPON, 0 ,
0.0, 0.0, 0.0, 00 , MESSER , 26)
//
MAP_ZONE Sharks
SET_GANG_INFO ( Sharks , 17, SHOTGUN, NO_WEAPON, NO_WEAPON, 0 ,
0.0, 0.0, 0.0, 00 , FIAT , 17)

// Players:
PLAYER_PED p1 = (103.5,090.5,255.0) 9 90

// Char Data:
//ASSASSINS
CHAR_DATA A2
CHAR_DATA A3
CHAR_DATA A3b
CHAR_DATA A4
CHAR_DATA A5
CHAR_DATA A6

CHAR_DATA B2
CHAR_DATA B3
CHAR_DATA B4
CHAR_DATA B5
CHAR_DATA B6

CHAR_DATA Term
CHAR_DATA Term2
CHAR_DATA Term3
CHAR_DATA Term4
CHAR_DATA Kazi1
CHAR_DATA KaziSupport
//CHAR_DATA Thug2
CHAR_DATA Carbomber
CHAR_DATA Flamer


// Code Looping:
COUNTER loopage = 1
Counter Crates = 1
//COUNTER playerdead = 1
COUNTER Kazico = 1
COUNTER regenerating_characters = 1
COUNTER Zombiezone = 1
COUNTER Termcount = 1

LEVELSTART

CHANGE_GANG_CHAR_RESPECT (Zombies, p1, -5)
CHANGE_GANG_CHAR_RESPECT (Thugs, p1, 5)


SET_CHAR_GRAPHIC_TYPE (p1, EMERG_GRAPHIC, 9)
GIVE_WEAPON (p1, PISTOL, 20)

// Assassins
// Create the killers:

A2 = CREATE_CHAR (072.5,094.5,255.0) 42 90 CRIMINAL END
SET_CHAR_GRAPHIC_TYPE (A2, EMERG_GRAPHIC, 41)
DO_NOWT
A3 = CREATE_CHAR (193.5,107.5,255.0) 22 0 CRIMINAL END
ADD_GROUP_TO_CHARACTER (A3, 3)
SET_GROUP_TYPE (A3, CHAIN)
SET_CHAR_GRAPHIC_TYPE (A3, EMERG_GRAPHIC, 22)
DO_NOWT
A4 = CREATE_CHAR (081.5,122.5,255.0) 36 90 CRIMINAL END
SET_CHAR_GRAPHIC_TYPE (A4, EMERG_GRAPHIC, 36)
DO_NOWT
A5 = CREATE_CHAR (182.0,162.5,255.0) 30 180 CRIMINAL END
SET_CHAR_GRAPHIC_TYPE (A5, EMERG_GRAPHIC, 30)
DO_NOWT
A6 = CREATE_CHAR (128.5,189.5) 46 90 CRIMINAL END
SET_CHAR_GRAPHIC_TYPE (A6, EMERG_GRAPHIC, 46)

// Arm the killers:
GIVE_WEAPON (A2, SILENCED_MACHINE_GUN)
GIVE_WEAPON (A3, ELECTRO_BATON)
GIVE_WEAPON (A4, MACHINE_GUN)
GIVE_WEAPON (A5, DUAL_PISTOL)
GIVE_WEAPON (A6, SHOTGUN)

// Make the killers attack any nearby player:
SET_CHAR_THREAT_SEARCH (A2, AREA_PLAYER_ONLY)
SET_CHAR_THREAT_SEARCH (A3, AREA_PLAYER_ONLY)
SET_CHAR_THREAT_SEARCH (A4, AREA_PLAYER_ONLY)
SET_CHAR_THREAT_SEARCH (A5, AREA_PLAYER_ONLY)
SET_CHAR_THREAT_SEARCH (A6, AREA_PLAYER_ONLY)

SET_CHAR_THREAT_REACTION (A2, REACT_AS_NORMAL)
SET_CHAR_THREAT_REACTION (A3, REACT_AS_NORMAL)
SET_CHAR_THREAT_REACTION (A4, REACT_AS_NORMAL)
SET_CHAR_THREAT_REACTION (A5, REACT_AS_NORMAL)
SET_CHAR_THREAT_REACTION (A6, REACT_AS_NORMAL)

SET_CHAR_OBJECTIVE (A2, KILL_CHAR_ON_FOOT, p1)
SET_CHAR_OBJECTIVE (A3, KILL_CHAR_ON_FOOT, p1)
SET_CHAR_OBJECTIVE (A4, KILL_CHAR_ON_FOOT, p1)

SET_CHAR_OBJECTIVE (A5, KILL_CHAR_ON_FOOT, p1)
SET_CHAR_OBJECTIVE (A6, KILL_CHAR_ON_FOOT, p1)


//Terminators

Term = CREATE_CHAR (184.0,137.0) 6 0 GUARD END
ADD_GROUP_TO_CHARACTER (Term, 2)
SET_GROUP_TYPE (Term, CHAIN)
SET_CHAR_GRAPHIC_TYPE (Term, EMERG_GRAPHIC, 6)
GIVE_WEAPON (Term, PISTOL)
SET_CHAR_THREAT_SEARCH (Term, NO_THREATS)
SET_CHAR_THREAT_REACTION (Term, REACT_AS_NORMAL)
SET_CHAR_OBJECTIVE (Term, NO_OBJ)
SET_CHAR_INVINCIBLE (Term, ON)

Term2 = CREATE_CHAR (131.5,130.5) 12 0 GUARD END
//ADD_GROUP_TO_CHARACTER (Term2, 8)
//SET_GROUP_TYPE (Term2, MOB)
SET_CHAR_GRAPHIC_TYPE (Term2, EMERG_GRAPHIC, 12)
GIVE_WEAPON (Term2, ELECTRO_GUN)
SET_CHAR_THREAT_SEARCH (Term2, NO_THREATS)
SET_CHAR_THREAT_REACTION (Term2, REACT_AS_NORMAL)
SET_CHAR_OBJECTIVE (Term2, NO_OBJ)
SET_CHAR_INVINCIBLE (Term2, ON)
ADD_CHAR_TO_GANG (Term2, Shockers)

Term3 = CREATE_CHAR (064.5,107.5) 11 0 GUARD END
ADD_GROUP_TO_CHARACTER (Term3, 4)
SET_GROUP_TYPE (Term3, MOB)
SET_CHAR_GRAPHIC_TYPE (Term3, EMERG_GRAPHIC, 11)
GIVE_WEAPON (Term3, SHOTGUN)
SET_CHAR_THREAT_SEARCH (Term3, NO_THREATS)
SET_CHAR_THREAT_REACTION (Term3, REACT_AS_NORMAL)
SET_CHAR_OBJECTIVE (Term3, NO_OBJ)
SET_CHAR_INVINCIBLE (Term3, ON)

Term4 = CREATE_CHAR (129.0,166.0) 13 0 GUARD END
ADD_GROUP_TO_CHARACTER (Term4, 6)
SET_GROUP_TYPE (Term4, MOB)
SET_CHAR_GRAPHIC_TYPE (Term4, EMERG_GRAPHIC, 13)
GIVE_WEAPON (Term4, MACHINE_GUN)
SET_CHAR_THREAT_SEARCH (Term4, NO_THREATS)
SET_CHAR_THREAT_REACTION (Term4, REACT_AS_NORMAL)
SET_CHAR_OBJECTIVE (Term4, NO_OBJ)
SET_CHAR_INVINCIBLE (Term4, ON)

Kazi1 = CREATE_CHAR (138.5,070.0) 7 0 PSYCHO END
ADD_GROUP_TO_CHARACTER (Kazi1, 1)
SET_GROUP_TYPE (Kazi1, MOB)
SET_CHAR_GRAPHIC_TYPE (Kazi1, EMERG_GRAPHIC, 7)
SET_CHAR_BRAVERY_LEVEL (Kazi1, COWARD)
SET_CHAR_THREAT_SEARCH (Kazi1, NO_THREATS)
SET_CHAR_THREAT_REACTION (Kazi1, REACT_AS_NORMAL)
SET_CHAR_OBJECTIVE (Kazi1, GOTO_CHAR_ON_FOOT, p1)

KaziSupport = CREATE_CHAR (055.5,075.5) 7 0 CRIMINAL END
ADD_GROUP_TO_CHARACTER (KaziSupport, 4)
SET_GROUP_TYPE (KaziSupport, MOB)
SET_CHAR_GRAPHIC_TYPE (KaziSupport, EMERG_GRAPHIC, 7)
//SET_CHAR_BRAVERY_LEVEL (KaziSupport, COWARD)
SET_CHAR_THREAT_SEARCH (KaziSupport, NO_THREATS)
SET_CHAR_THREAT_REACTION (KaziSupport, REACT_AS_NORMAL)
SET_CHAR_OBJECTIVE (KaziSupport, GOTO_CHAR_ON_FOOT, p1)

Flamer = CREATE_CHAR (014.5,143.0) 10 0 MUGGER END
ADD_GROUP_TO_CHARACTER (Flamer, 3)
SET_GROUP_TYPE (Flamer, MOB)
GIVE_WEAPON (Flamer, FLAME_THROWER)
SET_CHAR_GRAPHIC_TYPE (Flamer, EMERG_GRAPHIC, 10)
//SET_CHAR_BRAVERY_LEVEL (Kazi1, COWARD)
SET_CHAR_THREAT_SEARCH (Flamer, NO_THREATS)
SET_CHAR_THREAT_REACTION (Flamer, REACT_AS_NORMAL)
SET_CHAR_OBJECTIVE (Flamer, NO_OBJ)


SWITCH_GENERATOR (pupgen_gang_2, OFF)
SWITCH_GENERATOR (pupgen_gang_2, OFF)
SWITCH_GENERATOR (pupgen_gang_3, OFF)
SWITCH_GENERATOR (pupgen_gang_4, OFF)

//WHILE (crates = 1)

//ENDWHILE

// Respawn each killer if they die:
WHILE_EXEC(regenerating_characters = 1)
IF (HAS_CHARACTER_DIED(A2))
A2 = CREATE_CHAR (072.5,094.5,255.0) 42 90 MUGGER END
GIVE_WEAPON (A2, PISTOL)
ADD_GROUP_TO_CHARACTER (A2, 1)
SET_GROUP_TYPE (A2, MOB)
//SET_CHAR_GRAPHIC_TYPE (A2, EMERG_GRAPHIC, 42)
GIVE_WEAPON (A2, PISTOL)
SET_CHAR_THREAT_SEARCH (A2, NO_THREATS)
SET_CHAR_THREAT_REACTION (A2, REACT_AS_NORMAL)
SET_CHAR_OBJECTIVE (A2, NO_OBJ)
ENDIF
IF (IS_CHAR_OBJECTIVE_PASSED (A2))
//REMOVE_WEAPONs (A2)
SET_CHAR_OCCUPATION (A2, MUGGER)
SET_CHAR_OBJECTIVE (A2, NO_OBJ)
ADD_GROUP_TO_CHARACTER (A2, 2)
SET_GROUP_TYPE (A2, CHAIN)
SET_CHAR_THREAT_SEARCH (A2, NO_THREATS)
SET_CHAR_THREAT_REACTION (A2, REACT_AS_NORMAL)
SET_CHAR_INVINCIBLE (A2, ON)
ENDIF
//

IF (HAS_CHARACTER_DIED(A3))
A3 = CREATE_CHAR (193.5,107.5,255.0) 22 0 CRIMINAL END
ADD_GROUP_TO_CHARACTER (A3, 5)
SET_GROUP_TYPE (A3, CHAIN)
SET_CHAR_GRAPHIC_TYPE (A3, EMERG_GRAPHIC, 22)
GIVE_WEAPON (A3, ELECTRO_BATON)
SET_CHAR_THREAT_SEARCH (A3, AREA_PLAYER_ONLY)
SET_CHAR_THREAT_REACTION (A3, REACT_AS_NORMAL)
SET_CHAR_OBJECTIVE (A3, NO_OBJ)
ENDIF
IF (IS_CHAR_OBJECTIVE_PASSED (A3))
//REMOVE_WEAPONs (A3)
SET_CHAR_OCCUPATION (A3, MUGGER)
SET_CHAR_OBJECTIVE (A3, NO_OBJ)
//DESTROY_GROUP (A3)
SET_CHAR_THREAT_SEARCH (A3, NO_THREATS)
SET_CHAR_THREAT_REACTION (A3, REACT_AS_NORMAL)
A3b = CREATE_CHAR (193.5,108.5,255.0) 22 0 CRIMINAL END
ADD_CHAR_TO_GANG (A3b, Bruisers)
ADD_GROUP_TO_CHARACTER (A3b, 7)
SET_GROUP_TYPE (A3b, MOB)
GIVE_WEAPON (A3b, ELECTRO_BATON)
SET_CHAR_GRAPHIC_TYPE (A3b, EMERG_GRAPHIC, 22)
SET_CHAR_THREAT_SEARCH (A3b, NO_THREATS)
SET_CHAR_THREAT_REACTION (A3b, REACT_AS_NORMAL)
SET_CHAR_OBJECTIVE (A3b, NO_OBJ)
SET_CHAR_INVINCIBLE (A3b, ON)
ENDIF
////IF (IS_CHAR_OBJECTIVE_PASSED (B3))
////REMOVE_WEAPONs (B3)
////SET_CHAR_OCCUPATION (B3, MUGGER)
////SET_CHAR_OBJECTIVE (B3, NO_OBJ)
////DESTROY_GROUP (B3)
////SET_CHAR_THREAT_SEARCH (B3, NO_THREATS)
////SET_CHAR_THREAT_REACTION (B3, REACT_AS_NORMAL)
////ENDIF
//
IF (HAS_CHARACTER_DIED(A4))
//SET_CHAR_GRAPHIC_TYPE (p1, EMERG_GRAPHIC, 9)
A4 = CREATE_CHAR (081.5,122.5,255.0) 36 90 MUGGER END
GIVE_WEAPON (A4, ELECTRO_BATON)
ADD_GROUP_TO_CHARACTER (A4, 1)
SET_GROUP_TYPE (A4, MOB)
GIVE_WEAPON (A4, PISTOL)
//SET_CHAR_GRAPHIC_TYPE (A4, EMERG_GRAPHIC, 36)
SET_CHAR_THREAT_SEARCH (A4, NO_THREATS)
SET_CHAR_THREAT_REACTION (A4, REACT_AS_NORMAL)
SET_CHAR_OBJECTIVE (A4, NO_OBJ)
ENDIF
IF (IS_CHAR_OBJECTIVE_PASSED (A4))
//REMOVE_WEAPONs (A4)
SET_CHAR_OCCUPATION (A4, MUGGER)
SET_CHAR_OBJECTIVE (A4, NO_OBJ)
ADD_GROUP_TO_CHARACTER (A4, 2)
SET_GROUP_TYPE (A4, CHAIN)
//MAKE_CHAR_DO_NOTHING (A4)
SET_CHAR_THREAT_SEARCH (A4, NO_THREATS)
SET_CHAR_THREAT_REACTION (A4, REACT_AS_NORMAL)
SET_CHAR_INVINCIBLE (A4, ON)
//GIVE_WEAPON (A4, Pistol)
ENDIF

IF (HAS_CHARACTER_DIED(A5))
A5 = CREATE_CHAR (182.0,162.5,255.0) 30 180 MUGGER END
GIVE_WEAPON (A5, DUAL_PISTOL)
SET_CHAR_THREAT_SEARCH (A5, NO_THREATS)
SET_CHAR_THREAT_REACTION (A5, REACT_AS_NORMAL)
SET_CHAR_OBJECTIVE (A5, NO_OBJ)
ENDIF
IF (IS_CHAR_OBJECTIVE_PASSED (A5))
//REMOVE_WEAPONs (A5)
SET_CHAR_OCCUPATION (A5, MUGGER)
SET_CHAR_OBJECTIVE (A5, NO_OBJ)
ADD_GROUP_TO_CHARACTER (A5, 2)
SET_GROUP_TYPE (A5, CHAIN)
GIVE_WEAPON (A5, MACHINE_GUN)
SET_CHAR_THREAT_SEARCH (A5, NO_THREATS)
SET_CHAR_THREAT_REACTION (A5, REACT_AS_NORMAL)
SET_CHAR_INVINCIBLE (A5, ON)
ENDIF

IF (HAS_CHARACTER_DIED(A6))
A6 = CREATE_CHAR (128.5,189.5) 46 90 MUGGER END
GIVE_WEAPON (A6, SHOTGUN)
SET_CHAR_THREAT_SEARCH (A6, NO_THREATS)
SET_CHAR_THREAT_REACTION (A6, REACT_AS_NORMAL)
SET_CHAR_OBJECTIVE (A6, NO_OBJ)
ENDIF
IF (IS_CHAR_OBJECTIVE_PASSED (A6))
//REMOVE_WEAPONs (A6)
SET_CHAR_OCCUPATION (A6, MUGGER)
SET_CHAR_OBJECTIVE (A6, NO_OBJ)
ADD_GROUP_TO_CHARACTER (A6, 2)
SET_GROUP_TYPE (A6, CHAIN)
SET_CHAR_THREAT_SEARCH (A6, NO_THREATS)
SET_CHAR_THREAT_REACTION (A6, REACT_AS_NORMAL)
SET_CHAR_INVINCIBLE (A6, ON)
ENDIF

IF (IS_CHAR_OBJECTIVE_PASSED (Kazi1))
SET_CHAR_OBJECTIVE (Kazi1, NO_OBJ)

EXPLODE (Kazi1)
DESTROY_GROUP (Kazi1)
ENDIF
IF (HAS_CHARACTER_DIED(p1))
SET_CHAR_OBJECTIVE (Kazi1, NO_OBJ)
ENDIF

IF (IS_CHAR_OBJECTIVE_PASSED (KaziSupport))
SET_CHAR_OBJECTIVE (KaziSupport, NO_OBJ)

EXPLODE_LARGE (KaziSupport)
DESTROY_GROUP (KaziSupport)
ENDIF
IF(HAS_CHARACTER_DIED(p1))
SET_CHAR_OBJECTIVE (Kazisupport, NO_OBJ)
ENDIF

IF (CHECK_OBJ_MODEL (Psychogen, POWERGEN))
DO_NOWT
//CREATE_SOUND(055.5,066.5) GENERATOR_RUMBLE PLAY_INSTANT END
//MAKE_ALL_CHARS_MUGGERS (OFF)
ELSE MAKE_ALL_CHARS_MUGGERS (ON)
ENDIF



IF (HAS_CHARACTER_DIED(Term))
DO_NOWT
SET_CHAR_GRAPHIC_TYPE (p1, EMERG_GRAPHIC, 9)
SWITCH_GENERATOR (pupgen_gang_1, ON)
ENDIF

IF (HAS_CHARACTER_DIED(Term2))
DO_NOWT
CHANGE_GANG_CHAR_RESPECT (Shockers, p1, -5)
SET_CHAR_GRAPHIC_TYPE (p1, EMERG_GRAPHIC, 9)
SWITCH_GENERATOR (pupgen_gang_2, ON)
ENDIF

//IF (HAS_CHARACTER_DIED(Term3))
//DO_NOWT
//SET_CHAR_GRAPHIC_TYPE (p1, EMERG_GRAPHIC, 9)
//CREATE_OBJ (pupgen_gang_3, ON)
//ENDIF

IF (HAS_CHARACTER_DIED(Term4))
DO_NOWT
SET_CHAR_GRAPHIC_TYPE (p1, EMERG_GRAPHIC, 9)
SWITCH_GENERATOR (pupgen_gang_4, ON)
ENDIF
ENDWHILE[/mis]
Any suggestions on why exactly my Instant gangs may not be turning on once the respective Terminator is killed?

I also discovered some interesting things with gang zones, in that you can have multiple small boxes of different shape next to each other all under one gang name but once you've created so many gang zones the game will crash. Reworking the gang zones to all only be perfect squares/rectangles has prevented this.However, looking back at my code, I wonder if it's because I declared the fireman gang twice, when I only would have needed to declare them once despite their respective zones being across the map from each other. I'll test this out.

Currently I'm trying to make crates that produce weapons upon being broke, like in GTA1. However upon being destroyed it continues to produce the weapon indefinitely, which is not what I'm hoping for. I want it to be a one time thing. Do you know how I could go about doing this? This is my code currently,
[mis]IF (CHECK_OBJ_MODEL (Pistcrate, Crate))
DO_NOWT

ELSE Pistcrateproduct = CREATE_OBJ (099.18,087.24,003.09) 0 COLLECT_00 20 END
DELETE_ITEM (pistcrate)
ENDIF[/mis]

I look forward to your input.
(Also with Cerbera's permission I could upload the version of Multislayer I'm using here as well as the .mis script. I haven't tried this particular script yet in the latest version of MS & I know the maps a bit different in size so it may not work with it as intended)

EDIT:
So I'm pretty sure my biggest issue is I'm running all events off of one loop. This makes it impossible to say create for example a new assassin if the old one has died, because the loop keeps seeing the old guy died & then spawns a million Assassin B2s for example, crashing the game. I don't know how to make sequential events happen yet.

Also, I discovered a cool map design exploit you guys may be able to use.
I was redesigning the Mutlislayer map to make the Pherson ghetto a giant scripted survival / tower defense arena.
So, being new to GTA2 map editing, I added a few blocks to wall off the ghetto area.
The stairs to the south east I didn't delete, I just added blocks to bar it off. So, above the slope is a floating block. I was using my same .mis script for the old map, so my assassins were still spawning in the multiplayer locations & making their way towards me.
Naturally you would assume they couldn't get in, because I nor anyone else can get out.
However, due to the block hovering just above the ramp, they can come up the stairs & through the block, but not back out.
If you are ever to design arena based maps that you don't want to spawn scripted characters inside of the main area, you can use this to bring them into the arena from off screen.
Here's a screenshot demonstrating the exact layout needed,
Attachments
One way entrance
One way entrance
Devastator
Hitman
Hitman
Posts: 120
Joined: 06 Dec 2011, 16:54

Re: Scripting command questions

Post by Devastator »

Guys I definitely need some help here. I've been designing my very first multiplayer level & it's almost ready to upload, but there's some scripting info I don't know how to execute yet.

My question is, is it possible to make it so that when a player dies they're given a weapon upon respawn? I've seen weapons after death with things like the GTA1 maps in GTA2, but those have infinite ammo. I want ammo to be finite with each life the player has. If I really have to I'll go the infinite ammo route, but I'd prefer the limited ammo to contribute to the tension I'm hoping this level conveys.
I'll take a look at those GTA1 to 2 maps & see if there's anything in that code I could repurpose.

EDIT: Nevermind, I used a trigger at player starting/respawn point to give the weapon. This area isn't accessible once the main arena has been entered anyway. I'll playtest my map tonight with my brother, & then upload it here if I feel it's satisfactory. It's amazing how much you can accomplish in two days.

Now I'll start on my second map ever, which will be for multiplayer as well.
Devastator
Hitman
Hitman
Posts: 120
Joined: 06 Dec 2011, 16:54

Re: Scripting command questions

Post by Devastator »

Alright so there's a few things I have yet to do before I can launch the first version of my map (there will be four play style versions of it total), but the problem is I want the gameplay of the first three to have stealth elements. I know I can turn off arrow pointers by making the respective graphics in the sty files transparent, but is there anyway to turn off player display names? Or do I have to delete text out of the sty file? If I do so will that affect players ability to type to each other/ or the game to display weapon names?

EDIT:
Here's a teaser from the arena I've been working on (top left corner is warped due to the FN button distorting my screen in GTA2 when held down)
Attachments
Shhhh.png
Devastator
Hitman
Hitman
Posts: 120
Joined: 06 Dec 2011, 16:54

Re: Scripting command questions

Post by Devastator »

I just discovered a way to do super jumps. I was setting up some conveyors & an accidental misplacement revealed this nifty trick to me.
Normal jumps clear a two block area, from the outer edge of the first block to the outer edge of the second, roughly.
If you have a one block slope with a conveyor on it (set to speed 6!) the conveyor will accelerate you up the ramp as you run towards it, & if you time the jump perfectly you'll land on the outer edge of the third block, or if you're really lucky dead center in a third block! It will remove half a heart however.
I'm definitely gonna incorporate this into a jump/platform centric map I intend to design soon.

Correction: You won't lose half a heart.
Devastator
Hitman
Hitman
Posts: 120
Joined: 06 Dec 2011, 16:54

Re: Scripting command questions

Post by Devastator »

I know for a fact I saw someone post code on here that med all dummy peds have the green remap & attack the player on sight. I cannot find it for the life of me now. Does anyone know how I can make all dummies attack the players? Pyschos wouldn't work for what I have in mind.
User avatar
Sektor
Boss
Boss
Posts: 1423
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: Scripting command questions

Post by Sektor »

That was the zombie script http://gtamp.com/forum/viewtopic.php?f=5&t=171&p=1832

I just created a gang zone that covers the whole map, gave them no weapons and set their respect for the player to be -5.

If you change player speed then you will jumper further without having to use a conveyor. http://gtamp.com/forum/viewtopic.php?p=10011#p10011
Devastator wrote:I know I can turn off arrow pointers by making the respective graphics in the sty files transparent, but is there anyway to turn off player display names? Or do I have to delete text out of the sty file? If I do so will that affect players ability to type to each other/ or the game to display weapon names?
You can now turn off all arrows using script instead of editing the STY file: http://gtamp.com/forum/viewtopic.php?p=10212#p10212

I'll see if I can find the hide player names address, it would be good for switching names on/off during gameplay. You can just set your name to blank if you don't want other players to see it or ask everyone to untick show player names but that means it will be hidden the whole game and not dynamic.
Devastator
Hitman
Hitman
Posts: 120
Joined: 06 Dec 2011, 16:54

Re: Scripting command questions

Post by Devastator »

It wasn't that script. The poster actually posted a pic of all the green peds chasing him. He actually used peek & poke to do it. I'll have to keep looking. Currently I also have a giant zombie gang zone, but like Pyro points out in another thread only like four gang members will chase you at once, & the other ones will run away when you fire a gun.

I was surprised to learn that there hasn't been a lot of zombie maps. Currently my map is a huge chunk of Downtown with everything else deleted. There's a huge perimeter wall surrounding the play area with an armygang on the outside of it(that you can never reach). The central hub is that mall that has all the catwalks that go over the streets. I know nothing about mission structure to make the map how I would like to though. I want to implement a timer system where you have to defend the base from different Waves of attack, especially the scripted people who are alive inside of it. I also have a Survivalist gang whose base is the Police Station above the church, but they're going to be located in small fortified pockets around the city, & when you kill each boss (armed with a different heavy weapon) it'll turn on a weapon generator back at the home base, that you can then use for defending against the attacking waves. I'm going to station molotov army guys atop the perimeter wall to create that sense of them trying to keep everything in contained. & took the tedious time to turn every swath of road into pavement so that there is a way higher count of zombie gangmembers walking the streets. Maybe I'll be able to do more with it when I figure out how to do mission triggers.
User avatar
elypter
Immortal
Posts: 1120
Joined: 26 Dec 2009, 23:53
GH nick: elypter

Re: Scripting command questions

Post by elypter »

there is a thread discussing zombie maps. http://gtamp.com/forum/viewtopic.php?f=19&t=596 and a project thread http://gtamp.com/forum/viewtopic.php?f=5&t=171

what made it fail for me was mostly time and the problem with the gang zone method. it wast very challenging and didnt have a zombie feeling to it. but with peek and poke commands this can now be fixed
yur sa'nok ngeyä
Devastator
Hitman
Hitman
Posts: 120
Joined: 06 Dec 2011, 16:54

Re: Scripting command questions

Post by Devastator »

Could you guys create a "KILL_CHAR_IN_CAR" command? A sort of equivalent to KILL_CHAR_ON_FOOT? I'm trying to create a suicide bomber driver & what I was going to do was force the character to be locked in the car, with KILL_CHAR_ANY_MEANS as his objective. This is useful for creating someone who is trying to run you down, however, What I was going to do was make it so that once he accelerates towards you to run you over (which is faster than their default drive speed) I was going to do a speed check to cause the car to explode, that way a flaming mass is hurling towards you. The problem is, as soon as the car teleports, as is common with the KILL_CHAR_ANY_MEANS command, the speed exceeds the speed check, causing it to explode upon warping, crashing the game in this last instance.

Having a kill_char_in_car command would be useful for creating drivers across the city coming to hunt you down. Kill_char_any_means can be a bit broken with it's teleportation, especially because the way some of my scripted characters are set up they'll teleport in front of the hospital you respawn at to effectively spawn kill you, which can be amusing but unbalanced feeling.
User avatar
elypter
Immortal
Posts: 1120
Joined: 26 Dec 2009, 23:53
GH nick: elypter

Re: Scripting command questions

Post by elypter »

i created a scripted wanted level 7 and 8 for tinytinytown army. this included suicide bombing army vehicles. i dont remember how i did it. it didnt hit every time but that was ok since i didnt want to make it too hard
yur sa'nok ngeyä
Devastator
Hitman
Hitman
Posts: 120
Joined: 06 Dec 2011, 16:54

Re: Scripting command questions

Post by Devastator »

I don't know all of the ins & out of scripting yet, so I have a question. For my "Juggernaut" game mode I wanted to make, I wanted to make it so that player one is the juggernaut, & if there's more than three players player four is a second juggernaut. However, due to Juggernaut players being forced to walk incredibly slow, they can be a bit of sitting ducks. Is it possible to make it so that Player one & Player four have arrows on all the other players (except each other) but the other players do not have arrows on the juggernauts? That way the slow players will know which direction to go but can also hide about on the map.

EDIT: Also, is it possible to have an arrow not point at another player but rather the zone the player is in?
User avatar
Sektor
Boss
Boss
Posts: 1423
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: Scripting command questions

Post by Sektor »

Devastator
Hitman
Hitman
Posts: 120
Joined: 06 Dec 2011, 16:54

Re: Scripting command questions

Post by Devastator »

Does anyone know what in the script would cause the game to crash as soon as you enter a car? I don't have any car specific commands.

EDIT:Nevermind I found it
User avatar
Sektor
Boss
Boss
Posts: 1423
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: Scripting command questions

Post by Sektor »

What was it? Code that doesn't work while in a car can be put it inside this IF statement.

IF (NOT(IS_CHARACTER_IN_ANY_CAR(p1)))
DO_NOWT
ENDIF
User avatar
elypter
Immortal
Posts: 1120
Joined: 26 Dec 2009, 23:53
GH nick: elypter

Re: Scripting command questions

Post by elypter »

btw if you use mis tags the code gets syntax highlighting
yur sa'nok ngeyä
Devastator
Hitman
Hitman
Posts: 120
Joined: 06 Dec 2011, 16:54

Re: Scripting command questions

Post by Devastator »

It's my weapon runspeeds. If I used your
IF (NOT(IS_CHAR_IN_ANY_CAR(p1)))
SET *runspeed*

It works fine. But my code is specific to each weapon. So if I get in a car with a weapon equipped it crashes. If I get in with no weapon equipped it won't, but as soon as I equip a weapon while in the car it crashes due to the run speed. The only usable cars on this map were to be Scripted hidden ones. But this seems to break it. Even with remote controlled cars. If I set REMOVE_WEAPONS when in any car it works, but only after you've gotten into the car with no weapon equipped.

This is my code,
[mis]IF (CHECK_CHAR_CURR_WEAPON (p1, PISTOL))
SET RFin=(p1+368) ////player + 368 is a pointer to the player ammo (only for first weapon slot)
CHANGE_GANG_CHAR_RESPECT (RFin,RFout,104)
SET pistpedsprite_ptr = (p1+360)
CHANGE_GANG_CHAR_RESPECT (pistpedsprite_ptr, pistpedsprite_addr, 104) ////read pedsprite address
SET pistspeed_addr = (pistpedsprite_addr+57)
CHANGE_GANG_CHAR_RESPECT (pistspeed_addr, pistspeed, 114) ////write player speed value
ENDIF
IF (CHECK_CHAR_CURR_WEAPON (p1, MACHINE_GUN))
SET pedsprite_ptr = (p1+360)
CHANGE_GANG_CHAR_RESPECT (pedsprite_ptr, pedsprite_addr, 104) ////read pedsprite address
SET speed_addr = (pedsprite_addr+57)
CHANGE_GANG_CHAR_RESPECT (speed_addr, speed, 114) ////write player speed value
ENDIF

IF (CHECK_CHAR_CURR_WEAPON (p1, MOLOTOV))
SET pedsprite_ptr = (p1+360)
CHANGE_GANG_CHAR_RESPECT (pedsprite_ptr, pedsprite_addr, 104) ////read pedsprite address
SET speed_addr = (pedsprite_addr+57)
CHANGE_GANG_CHAR_RESPECT (speed_addr, speed, 114) ////write player speed value
ENDIF

IF (CHECK_CHAR_CURR_WEAPON (p1, GRENADE))
SET pistpedsprite_ptr = (p1+360)
CHANGE_GANG_CHAR_RESPECT (pistpedsprite_ptr, pistpedsprite_addr, 104) ////read pedsprite address
SET pistspeed_addr = (pistpedsprite_addr+57)
CHANGE_GANG_CHAR_RESPECT (pistspeed_addr, pistspeed, 114) ////write player speed value
ENDIF

IF (CHECK_CHAR_CURR_WEAPON (p1, DUAL_PISTOL))
SET RFin=(p1+368) ////player + 368 is a pointer to the player ammo (only for first weapon slot)
CHANGE_GANG_CHAR_RESPECT (RFin,RFout,104)
SET pistpedsprite_ptr = (p1+360)
CHANGE_GANG_CHAR_RESPECT (pistpedsprite_ptr, pistpedsprite_addr, 104) ////read pedsprite address
SET pistspeed_addr = (pistpedsprite_addr+57)
CHANGE_GANG_CHAR_RESPECT (pistspeed_addr, pistspeed, 114) ////write player speed value
ENDIF
IF (CHECK_CHAR_CURR_WEAPON (p1, SHOTGUN))
SET RFin=(p1+368) ////player + 368 is a pointer to the player ammo (only for first weapon slot)
CHANGE_GANG_CHAR_RESPECT (RFin,RFout,104)
SET midweapsprite_ptr = (p1+360)
CHANGE_GANG_CHAR_RESPECT (midweapsprite_ptr, midweapsprite_addr, 104) //read pedsprite address
SET midweapspeed_addr = (midweapsprite_addr+57)
CHANGE_GANG_CHAR_RESPECT (midweapspeed_addr, midweapspeed, 114) ////write player speed value
ENDIF
IF (CHECK_CHAR_CURR_WEAPON (p1, ROCKET_LAUNCHER))
//SET RFin=(p1+368) ///////player + 368 is a pointer to the player ammo (only for first weapon slot)
//CHANGE_GANG_CHAR_RESPECT (RFin,RFout,104)
SET RLsprite_ptr = (p1+360)
CHANGE_GANG_CHAR_RESPECT (RLsprite_ptr, RLsprite_addr, 104) ////read pedsprite address
SET RLspeed_addr = (RLsprite_addr+57)
CHANGE_GANG_CHAR_RESPECT (RLspeed_addr, RLspeed, 114) ////write player speed value
ENDIF
IF (CHECK_CHAR_CURR_WEAPON (p1, SILENCED_MACHINE_GUN))
SET RFin=(p1+368)
CHANGE_GANG_CHAR_RESPECT (RFin,RFout,104)
SET heavyweapsprite_ptr = (p1+360)
CHANGE_GANG_CHAR_RESPECT (heavyweapsprite_ptr, heavyweapsprite_addr, 104)
SET heavyweapspeed_addr = (heavyweapsprite_addr+57)
CHANGE_GANG_CHAR_RESPECT (heavyweapspeed_addr, heavyweapspeed, 114)
ENDIF
IF (CHECK_CHAR_CURR_WEAPON (p1, FLAME_THROWER))
SET RFin=(p1+368) ////player + 368 is a pointer to the player ammo (only for first weapon slot)
CHANGE_GANG_CHAR_RESPECT (RFin,RFout,104)
SET heavyweapsprite_ptr = (p1+360)
CHANGE_GANG_CHAR_RESPECT (heavyweapsprite_ptr, heavyweapsprite_addr, 104) ////read pedsprite address
SET heavyweapspeed_addr = (heavyweapsprite_addr+57)
CHANGE_GANG_CHAR_RESPECT (heavyweapspeed_addr, heavyweapspeed, 114) ////write player speed value
ENDIF
IF (CHECK_CHAR_CURR_WEAPON (p1, ELECTRO_GUN))
SET pistpedsprite_ptr = (p1+360)
CHANGE_GANG_CHAR_RESPECT (pistpedsprite_ptr, pistpedsprite_addr, 104) ////read pedsprite address
SET pistspeed_addr = (pistpedsprite_addr+57)
CHANGE_GANG_CHAR_RESPECT (pistspeed_addr, pistspeed, 114) ////write player speed value
[/mis]

I was trying to use IF (NOT(IS_CHAR_IN_ANY_CAR))) AND Check current weapon--
Or IF (NOT-
THEN

But the compiler wasn't recognizing the tokens. I don't think I was using AND or THEN right. I kept rearranging the paranthesis but it wouldn't process the AND commands, & I don't know any advanced scripting commands outside of basic IF statements. So I guess I may not put any cars in this map unless I can figure it out :(
User avatar
elypter
Immortal
Posts: 1120
Joined: 26 Dec 2009, 23:53
GH nick: elypter

Re: Scripting command questions

Post by elypter »

you cannot use AND and OR in the same IF statement. you have to do nested ifs instead of using and. i hope that was your problem. btw you dont need a "then". the "else" and "elseif" is bugged too sometimes so you may need to use an if not instead in some occasions

http://gtamp.com/forum/viewtopic.php?f=4&t=249

if its as simple as this however it should work. (you messed up the brackets)

[mis]
IF ((NOT(IS_CHAR_IN_ANY_CAR(p1))) AND (CHECK_CHAR_CURR_WEAPON (p1, ELECTRO_GUN)))[/mis]
yur sa'nok ngeyä
Devastator
Hitman
Hitman
Posts: 120
Joined: 06 Dec 2011, 16:54

Re: Scripting command questions

Post by Devastator »

Sorry I meant "Or, "IF (NOT...ELSE.""

Also I just tried the code out & it refuses to work. Says unrecognised token in scriptfile. If I were to remove the AND & make it so it's only either one of the two statements it'd work, but I can't figure out why.

Current code:

[mis]IF ((NOT(IS_CHAR_IN_ANY_CAR(p1))) AND (CHECK_CHAR_CURR_WEAPON (p1, ELECTRO_GUN)))
SET pistpedsprite_ptr = (p1+360)
CHANGE_GANG_CHAR_RESPECT (pistpedsprite_ptr, pistpedsprite_addr, 104) ////read pedsprite address
SET pistspeed_addr = (pistpedsprite_addr+57)
CHANGE_GANG_CHAR_RESPECT (pistspeed_addr, pistspeed, 114) ////write player speed value

ENDIF[/mis]

Also, would you know how I could use more than one CHECK_WEAPON_TYPE_HIT_CHAR?
Currently I have "IF (CHECK_WEAPON_TYPE_HIT_CHAR (p1, by_electro_weapon))
SET_CHAR_GRAPHIC_TYPE (p1, GANG_GRAPHIC, 13)
ENDIF"
to create the flickering effect when you're being zapped,
But If I create a second "IF (CHECK_WEAPON_TYPE_HIT_CHAR (p1, by_gun))
SET_CHAR_GRAPHIC_TYPE (p1, EMERG_GRAPHIC, 2)
ENDIF"
to create a red flicker when you're shot, the loop prioritizes the weapon type hit that comes first, making it so that only one of my visual effects works. This likely also means any status effects I want to make relating to damage types would be overridden.

EDIT: More important question: Can I create Kill Frenzy icons that all players can use? Not necessarily as kill frenzies but rather temporary power ups (I.e. super fast speed with unlimited ammo flamethrower/rocket launcher/ with no reload times)?
User avatar
elypter
Immortal
Posts: 1120
Joined: 26 Dec 2009, 23:53
GH nick: elypter

Re: Scripting command questions

Post by elypter »

its because i copied your code. its actually IS_CHARACTER_IN_ANY_CAR (charname) instead of IS_CHAR_IN_ANY_CAR (charname). you should use syntax highlighting to avoid such problems.

it looks like gta can only handle one hit type per frame. you could check this by some test code like exploding something or whatever signal that cannot be missed

>Can I create Kill Frenzy icons that all players can use?
i think i did that on tyfo army
yur sa'nok ngeyä
Devastator
Hitman
Hitman
Posts: 120
Joined: 06 Dec 2011, 16:54

Re: Scripting command questions

Post by Devastator »

I think I wrote it wrong here, not in the script. Most statements that work get a black bolded text. I just tested it out again with
IF (CHECK_CHAR_CURR_WEAPON (p1, shotgun)) AND (NOT(IS_CHARACTER_IN_ANY_CAR (p1)))
& it doesn't work. If I do
IF (CHECK_CHAR_CURR_WEAPON (p1, shotgun)) ////AND (NOT(IS_CHARACTER_IN_ANY_CAR (p1)))
or IF (NOT(IS_CHARACTER_IN_ANY_CAR (p1))) /////(CHECK_CHAR_CURR_WEAPON (p1, shotgun)) AND
it will compile, but not when the AND is between them. I can only pick between one exprssion. I can't figure out why. I'll have to test out other exprssions with AND to see if I get the same issue.
Post Reply