SET command/Scriptable instant gang

Anything to do with GTA1/GTA2 modding (tools, scripts and more).
Jones
Psycho
Psycho
Posts: 51
Joined: 08 Aug 2012, 21:25

SET command/Scriptable instant gang

Post by Jones »

Hi,
tried some map editing today, but run quickly into problems :D
I want to have an automatic instant gang which is always active and is constantly refilled. I got it working and it is quite stable, but sometimes it still crashes. Maybe you know how to do it better.
Here is my current version:
[syntax=mis]PLAYER_PED p1 = (120.1, 120.5, 255.0) 19 0
MAP_ZONE copgang = ( 1000 , 0 , 0 , 0 , 1000 , 0 , 0 , 0 , 1000 , 0 , 1000 )
MAP_ZONE redgang = ( 1000 , 0 , 0 , 0 , 1000 , 0 , 0 , 0 , 1000 , 0 , 1000 )

CHAR_DATA char

ONSCREEN_COUNTER onscreen

counter stage=1
counter bots = 1
counter died = 0
counter wait=9

CHAR_DATA botgroup

wait_short:
DELAY_HERE ( 100 )
RETURN

LEVELSTART

ADD_ONSCREEN_COUNTER (onscreen, died)
ADD_ONSCREEN_COUNTER (onscreen, bots)

SET_AMBIENT_LEVEL ( 0.3, 3 )
SET_GANG_INFO (copgang,23,ELECTRO_GUN,ELECTRO_GUN,ELECTRO_GUN,
3, 0.0,0.0,0.0,
10,TANK,24)
SET_GANG_INFO (redgang, 14,ELECTRO_GUN,ELECTRO_GUN,ELECTRO_GUN,
1, 0.0,0.0,0.0,
10,FIRETRUK,-1)
SET_GANG_KILL_REACTION (redgang, copgang, 10)
SET_GANG_KILL_REACTION (copgang, redgang, 10)

ADD_GROUP_TO_CHARACTER(p1, 0)


WHILE(stage=1)

IF ( CHECK_CHARACTER_HEALTH ( p1 , 0 ))

IF(HAS_CHARACTER_DIED(p1))

IF(died=0)
SET died=1
SET bots=0
SET wait=1
ENDIF

ELSE

IF(died=1)
//DESTROY_GROUP(p1)
SET_ALL_CONTROLS_STATUS (p1, OFF )
ADD_GROUP_TO_CHARACTER(p1, 0)
SET died=0
//GOSUB wait_short:
ENDIF


ENDIF

IF(bots=1)
IF((NOT(CHECK_NUMBER_ALIVE_IN_GROUP (p1,9)))AND(NOT(IS_CHARACTER_STOPPED(p1))) )
botgroup = CREATE_CHAR ( 125.1, 120.5, 255.0 ) 12 90 PSYCHO END
GIVE_WEAPON(botgroup,PISTOL)
//ADD_GROUP_TO_CHARACTER (botgroup,0)
ADD_EXISTING_CHAR_TO_GROUP (p1, botgroup)
ENDIF
ENDIF
ENDIF

IF(wait>0)
++wait
ENDIF

IF(wait>=10)
SET_ALL_CONTROLS_STATUS ( p1 , ON )
SET bots=1
SET wait=0
ENDIF


ENDWHILE

LEVELEND[/syntax]
It still sometimes crashes if the player is shocked (hit by electrogun and laying on ground) or is hit by explosion and tries to move in the same moment. Thats why I deactive the controls status and check if the player is moving in first place. Is there no way to check if the player is lying on ground or flying after explosion? HAS_CHARACTER_DIED is triggering too late here.
Of course it also crashes if player is near bot spawning or seldom without appearent cause.
Sry for bad code formatting and thx in advance :)
User avatar
elypter
Immortal
Posts: 1120
Joined: 26 Dec 2009, 23:53
GH nick: elypter

Re: Scripted instant gang

Post by elypter »

first of all: unfortunately there might be some crashes that are unavoidable. (maybe some of them will be fixed in vikes next exe)

second: using while instead of while_exec is problematic. this can cause unexpected behavior because checks can be missed and the timing is depending on the code, maybe even on runtime events. so i suggest to use while_exec, although thats a bit difficult with bots because the game crashes if some bot related commands are executed too early after each other. you can have a look at tiny tiny town army to see how i did that. while_exec aprox has 30 fps and the whole loop is executed once each frame

third: you're right. there is no way to detect if a player is flying, lying or jumping

chaning that is a bit of work but i hope that helps. i cant tell you if thats safe because my map crashes occasionally too and i don't know the exact casue (might be traffic as well)
yur sa'nok ngeyä
Jones
Psycho
Psycho
Posts: 51
Joined: 08 Aug 2012, 21:25

Re: Scripted instant gang

Post by Jones »

yeah you are right, while_exec helped a lot. you don't even have to check if the palyer is in a car. strange :?
[syntax=mis]PLAYER_PED p1 = (120.1, 120.5, 255.0) 19 0
MAP_ZONE copgang = ( 1000 , 0 , 0 , 0 , 1000 , 0 , 0 , 0 , 1000 , 0 , 1000 )
MAP_ZONE redgang = ( 1000 , 0 , 0 , 0 , 1000 , 0 , 0 , 0 , 1000 , 0 , 1000 )

CHAR_DATA char

ONSCREEN_COUNTER onscreen

counter stage=1
counter bots = 1
counter died = 0
counter wait=9
counter botwait=0

CHAR_DATA botgroup

wait_short:
DELAY_HERE ( 100 )
RETURN

LEVELSTART

ADD_ONSCREEN_COUNTER (onscreen, botwait)
ADD_ONSCREEN_COUNTER (onscreen, bots)

SET_AMBIENT_LEVEL ( 0.3, 3 )
SET_CHAR_MAX_RUNSPEED(p1, -0.06)
SET_GANG_INFO (copgang,-2,ELECTRO_GUN,ELECTRO_GUN,ELECTRO_GUN,
3, 0.0,0.0,0.0,
10,TANK,24)
SET_GANG_INFO (redgang, -1,ROCKET_LAUNCHER,ROCKET_LAUNCHER,ROCKET_LAUNCHER,
1, 0.0,0.0,0.0,
10,FIRETRUK,-1)
SET_GANG_KILL_REACTION (redgang, copgang, 10)
SET_GANG_KILL_REACTION (copgang, redgang, 10)

ADD_GROUP_TO_CHARACTER(p1, 0)
SET_GROUP_TYPE(p1,CHAIN)


WHILE_EXEC(stage=1)

IF ( CHECK_CHARACTER_HEALTH ( p1 , 0 ))

//IF( ( (HAS_CHARACTER_DIED(p1)) OR (CHECK_WEAPON_TYPE_HIT_CHAR(p1,BY_ELECTRO_WEAPON)) )
// OR ( (IS_CHARACTER_IN_ANY_CAR(p1)) OR (CHECK_WEAPON_TYPE_HIT_CHAR(p1,BY_ROCKET_LAUNCHER)))
// )

IF(HAS_CHARACTER_DIED(p1))

//IF(died=0)
SET died=1
SET bots=0
SET botwait=0
//ENDIF

ELSE

IF(died=1)
// DESTROY_GROUP(p1)
ADD_GROUP_TO_CHARACTER(p1, 0)
SET died=0
SET bots=1
//GOSUB wait_short:
ENDIF


ENDIF

IF(bots=1)
++botwait
ENDIF

IF(botwait>=30)
IF(NOT(CHECK_NUMBER_ALIVE_IN_GROUP (p1,10)) )
botgroup = CREATE_CHAR ( 125.1, 120.5, 255.0 ) 12 90 PSYCHO END
GIVE_WEAPON(botgroup,PISTOL)
//ADD_GROUP_TO_CHARACTER (botgroup,0)
ADD_EXISTING_CHAR_TO_GROUP (p1, botgroup)
ENDIF
SET botwait=0
ENDIF


ENDIF


ENDWHILE

LEVELEND[/syntax]
now some multiplayer testing :D

edit:
here is the updated (final) version. tested with two players, seems to work well so far.
[syntax=mis]PLAYER_PED p1 = (119.5, 116.5, 2.0) 0 0
PLAYER_PED p2 = (119.5, 117.5, 2.0) 1 0
PLAYER_PED p3 = (119.5, 118.5, 2.0) 2 0
PLAYER_PED p4 = (119.5, 119.5, 2.0) 3 0
PLAYER_PED p5 = (119.5, 120.5, 2.0) 4 0
PLAYER_PED p6 = (119.5, 121.5, 2.0) 5 0
MAP_ZONE copgang = ( 1000 , 0 , 0 , 0 , 1000 , 0 , 0 , 0 , 1000 , 0 , 1000 )
MAP_ZONE redgang = ( 1000 , 0 , 0 , 0 , 1000 , 0 , 0 , 0 , 1000 , 0 , 1000 )

CHAR_DATA p
CHAR_DATA char

counter stage=1

counter current_player =1
counter p_died = 0
counter p_botSpawnTime=0

counter p1_died = 0
counter p1_botSpawnTime=0

counter p2_died = 0
counter p2_botSpawnTime=0

counter p3_died = 0
counter p3_botSpawnTime=0

counter p4_died = 0
counter p4_botSpawnTime=0

counter p5_died = 0
counter p5_botSpawnTime=0

counter p6_died = 0
counter p6_botSpawnTime=0

CHAR_DATA botgroup

LEVELSTART
SET_AMBIENT_LEVEL (0.25,0)
SET_SHADING_LEVEL (20)

SET_GANG_INFO (copgang,1,ELECTRO_GUN,ELECTRO_GUN,ELECTRO_GUN,
3, 0.0,0.0,0.0,
10,TANK,20)
SET_GANG_INFO (redgang, 26,ROCKET_LAUNCHER,ROCKET_LAUNCHER,ROCKET_LAUNCHER,
1, 0.0,0.0,0.0,
10,FIRETRUK,11)
SET_GANG_KILL_REACTION (redgang, copgang, 10)
SET_GANG_KILL_REACTION (copgang, redgang, 10)


IF ( CHECK_CHARACTER_HEALTH ( p1 , 0 ))
ADD_GROUP_TO_CHARACTER(p1, 0)
ENDIF
IF ( CHECK_CHARACTER_HEALTH ( p2 , 0 ))
ADD_GROUP_TO_CHARACTER(p2, 0)
ENDIF
IF ( CHECK_CHARACTER_HEALTH ( p3 , 0 ))
ADD_GROUP_TO_CHARACTER(p3, 0)
ENDIF
IF ( CHECK_CHARACTER_HEALTH ( p4 , 0 ))
ADD_GROUP_TO_CHARACTER(p4, 0)
ENDIF
IF ( CHECK_CHARACTER_HEALTH ( p5 , 0 ))
ADD_GROUP_TO_CHARACTER(p5, 0)
ENDIF
IF ( CHECK_CHARACTER_HEALTH ( p6 , 0 ))
ADD_GROUP_TO_CHARACTER(p6, 0)
ENDIF

WHILE_EXEC(stage=1)
SET current_player=1

WHILE(current_player<7)

IF(current_player=1)
SET p=(p1+0)
SET p_died=(p1_died+0)
SET p_botSpawnTime=(p1_botSpawnTime+0)
ENDIF
IF(current_player=2)
SET p=(p2+0)
SET p_died=(p2_died+0)
SET p_botSpawnTime=(p2_botSpawnTime+0)
ENDIF
IF(current_player=3)
SET p=(p3+0)
SET p_died=(p3_died+0)
SET p_botSpawnTime=(p3_botSpawnTime+0)
ENDIF
IF(current_player=4)
SET p=(p4+0)
SET p_died=(p4_died+0)
SET p_botSpawnTime=(p4_botSpawnTime+0)
ENDIF
IF(current_player=5)
SET p=(p5+0)
SET p_died=(p5_died+0)
SET p_botSpawnTime=(p5_botSpawnTime+0)
ENDIF
IF(current_player=6)
SET p=(p6+0)
SET p_died=(p6_died+0)
SET p_botSpawnTime=(p6_botSpawnTime+0)
ENDIF

IF ( CHECK_CHARACTER_HEALTH ( p , 0 ))

IF(HAS_CHARACTER_DIED(p))
SET p_died=1
SET p_botSpawnTime=0
ELSE



IF(p_died=1)
ADD_GROUP_TO_CHARACTER(p, 0)
SET p_died=0
ENDIF

IF(p_died=0)
++p_botSpawnTime
ENDIF

IF(p_botSpawnTime>=30)
IF(NOT(CHECK_NUMBER_ALIVE_IN_GROUP (p,10)) )

IF(current_player=1)
botgroup = CREATE_CHAR ( 122.5, 114.5, 2.0 ) 0 90 PSYCHO END
ENDIF
IF(current_player=2)
botgroup = CREATE_CHAR ( 123.5, 114.5, 2.0 ) 1 90 PSYCHO END
ENDIF
IF(current_player=3)
botgroup = CREATE_CHAR ( 124.5, 114.5, 2.0 ) 2 90 PSYCHO END
ENDIF
IF(current_player=4)
botgroup = CREATE_CHAR ( 125.5, 114.5, 2.0 ) 3 90 PSYCHO END
ENDIF
IF(current_player=5)
botgroup = CREATE_CHAR ( 126.5, 114.5, 2.0 ) 4 90 PSYCHO END
ENDIF
IF(current_player=6)
botgroup = CREATE_CHAR ( 127.1, 114.5, 2.0 ) 5 90 PSYCHO END
ENDIF

GIVE_WEAPON(botgroup,PISTOL)
ADD_EXISTING_CHAR_TO_GROUP (p, botgroup)
ENDIF
SET p_botSpawnTime=0
ENDIF
ENDIF

ENDIF

IF(current_player=1)
SET p1_died=(p_died+0)
SET p1_botSpawnTime=(p_botSpawnTime+0)
ENDIF
IF(current_player=2)
SET p2_died=(p_died+0)
SET p2_botSpawnTime=(p_botSpawnTime+0)
ENDIF
IF(current_player=3)
SET p3_died=(p_died+0)
SET p3_botSpawnTime=(p_botSpawnTime+0)
ENDIF
IF(current_player=4)
SET p4_died=(p_died+0)
SET p4_botSpawnTime=(p_botSpawnTime+0)
ENDIF
IF(current_player=5)
SET p5_died=(p_died+0)
SET p5_botSpawnTime=(p_botSpawnTime+0)
ENDIF
IF(current_player=6)
SET p6_died=(p_died+0)
SET p6_botSpawnTime=(p_botSpawnTime+0)
ENDIF

++current_player
ENDWHILE


ENDWHILE

LEVELEND[/syntax]
BenMillard
Immortal
Posts: 889
Joined: 16 May 2009, 06:14
GH nick: BenMillard
Location: London, UK
Contact:

Re: Scripted instant gang

Post by BenMillard »

Your code formatting and structure looks neat. You use a central COUNTER to control the logic, same way I do. Strange to have WHILE inside WHILE_EXEC though. Some rare things work better in WHILE.

Never seen it used to simulate a FOR ... EACH approach to spread the load of player-specific commands. That might be doing more harm than good as you get 0 to 5 frames between each player-specific check. Might be best to process everything every frame in one big WHILE_EXEC?

GTA2 can get a bit weird with 60 or 70 scripted characters, IIRC. Groups seem to use a different system and someone tested ~100 successfully. They linked 10 groups or 10 to each other, so maybe 60 scripted characters created from 6 groups will be OK.

Try testing your code by making a .mmp which uses the Pure Zooka Arena map (pza.gmp). You might need to change a lot of coordinates but it rules out all traffic and pedestrians.

If your code is stable there, the crashes are most likely from your traffic network. Long emergency vehicles spawning in impossible locations, roadblocks of infinite length and similar crashes happen when GTA2 doesn't like your road layout and traffic arrows.
Jones
Psycho
Psycho
Posts: 51
Joined: 08 Aug 2012, 21:25

Re: Scripted instant gang

Post by Jones »

Actually I only used this FOR..EACH approach not to spread the load, but to keep coding more simple and avoid redundancy. I don't want to change the code 6 times if I make a small change to the player logic. I thought a WHILE loop in a WHILE_EXEC loop will also executed in the same frame, am I wrong? Should I only use WHILE_EXEC if possible?
I like it how many maps have included their sources (.mis) files. Btw Ben thanks for your tutorials, they are very helpful and nice ;)

edit: is this a known bug? a gang remapped as army with JEEP gangcar try to chase you like police/army and makes the game crash?
User avatar
elypter
Immortal
Posts: 1120
Joined: 26 Dec 2009, 23:53
GH nick: elypter

Re: Scripted instant gang

Post by elypter »

I never tried that but I don't see a reason why not
but it will only work for exactly the same lines of code
if you want flexibility you need codesmith
yur sa'nok ngeyä
BenMillard
Immortal
Posts: 889
Joined: 16 May 2009, 06:14
GH nick: BenMillard
Location: London, UK
Contact:

Re: Scripted instant gang

Post by BenMillard »

ZOMG, I just realised the pure evil which is going on in your code:
  1. Central p variable is a CHAR_DATA.
  2. SET with an arithmetic hack to makes p refer to that PLAYER_PED rather than copying that player!
  3. The player referred to by p can be changed without destroying the PLAYER_PED it previously referred to.
  4. Doing this for values from 1 to 6 creates a type of FOR EACH PLAYER ... NEXT PLAYER loop!!!
THAT IS SO AWESOME! Although maybe it's why stuff is crashing randomly?

This is the essence of Jones's code:
[mis]PLAYER_PED p1 = (119.5, 116.5, 2.0) 0 0
PLAYER_PED p2 = (119.5, 117.5, 2.0) 1 0

// [...]

CHAR_DATA p // this character stores the player...then the next player...then the next!
COIUNTER current_player=1


LEVELSTART


SET current_player=1 // just a COUNTER storing a number

WHILE(current_player<7)
// Are we processing player 1?
IF(current_player=1)
SET p=(p1+0) // this turns p into a reference to p1!
ENDIF
[... repeated for each player ...]

// The actual code happens here and is shared by every player in the game:
// First thing is to make sure p refers to a player who exists:
IF ( CHECK_CHARACTER_HEALTH ( p , 0 ))
// do stuff for the player currently referred to by p!
ENDIF

++current_player // do stuff for the NEXT PLAYER
ENDWHILE[/mis]
Suggestions
These are just based on guesswork and past experience. Probably won't get a chance to test your code and experiment with it for quite a while.

Remove the WHILE level of the loop
In theory this should indeed process every player within one cycle of the outer WHILE_EXEC. But in practice, GTA2 has weird "buffering" effects with some commands and not others. So you can get subtle timing differences using WHILE instead of using WHILE_EXEC even when nested.

Respawning vehicles works better using WHILE than WHILE_EXEC, so could even try that.

CHECK_CHARACTER_HEALTH just after the game starts
This lets you set the maximum number of players your shared loop should process, before the loop start. Something like this:
[mis]COUNTER current_player = 0 // shared commands act on player in this position
COUNTER player_count = 0 // number of players in the game

LEVELSTART

// Environment stuff

// Count how many players are in the game:
IF ( CHECK_CHARACTER_HEALTH ( p1 , 0 ))
++player_count
ENDIF
IF ( CHECK_CHARACTER_HEALTH ( p2 , 0 ))
++player_count
ENDIF
// [... repeated for each player ...]

WHILE_EXEC (stage=1)
++current_player // next player
IF (current_player >= player_count)
current_player=1 // return to first player
ENDIF
// For a 3-player game, current_player follows this sequence:
// p0 becomes p1 immediately before first shared commands begin
// p1 becomes p2
// p2 becomes p3
// p3 becomes p4 and is immediately reset to p1 before shared commands begin
// loop continues...

ENDWHILE

LEVELEND[/mis]
If a player leaves, CHECK_CHARACTER_HEALTH still says that player is alive. Someone suggested using a CHECK_SCORE command as the score is always 0 for a player who quit or crashed out?

Sometimes death takes a while...
The delay I use in MultiSlayer Cops & Robbers is 150, just incrementing a COUNTER with an IF check.

That's because the "BUSTED!" sequence is really long.
User avatar
elypter
Immortal
Posts: 1120
Joined: 26 Dec 2009, 23:53
GH nick: elypter

Re: Scripted instant gang

Post by elypter »

Image

SET mind = blown


Edit:
btw, if you don't already understand the implications of this:
I'm pretty sure this allows to address random peds, objects and cars which adds almost infinite new possibilities.
thinking of things like:
making all fbi cars bullet proof (not only if youre sitting in)
choose a random ped to run at you and explode
make all drivers on the street leave their cars at once
give all characters in an area rocket launchers
give all characters with machine gun (eg army) flame throwers
check for grenade objects and let them explode large
....

i also wonder what happens if you SET p1 = ...
it might be useful as spectator mode

default arrows might be adressable and deletable
Last edited by elypter on 12 Aug 2012, 21:44, edited 6 times in total.
yur sa'nok ngeyä
User avatar
Sektor
Boss
Boss
Posts: 1423
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: Scripted instant gang

Post by Sektor »

Nice. I never knew you could use SET that way.
BenMillard
Immortal
Posts: 889
Joined: 16 May 2009, 06:14
GH nick: BenMillard
Location: London, UK
Contact:

Re: Scripted instant gang

Post by BenMillard »

I guess using SET on a CHAR_DATA is processed a bit like STORE_LAST_CHAR_PUNCHED but only between mission characters? Jones uses it to re-use code for each player. Same technique should allow sharing code for each mission character, I would think.

Using it on a CAR_DATA would presumably work like STORE_CAR_CHARACTER_IS_IN but only between mission cars?

Looking forwards to playing with this. It could revolutionise the way we repeat code for multiple similar mission objects.
Jones
Psycho
Psycho
Posts: 51
Joined: 08 Aug 2012, 21:25

Re: Scripted instant gang

Post by Jones »

Haven't expected no one did this before :) Ben seems to be right, I couldn't get the trick working with gang zones so far, maybe only those values with a STORE_.. function will work, because gta handle those as simple integer id's/references.
I have made a little map Tiny Town Gang which use my posted code. It doesn't seem more unstable than other maps :D
User avatar
Sektor
Boss
Boss
Posts: 1423
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: SET command (used to be Scripted instant gang)

Post by Sektor »

SET is awesome. You can use it to add new script commands.

PLAYER_PED p1 = ( 150.4 , 189.5 , 255.0 ) 22 0

COUNTER k = 8 // change this number

CHAR_DATA special
LEVELSTART
DECLARE_POLICELEVEL ( 6 )
SET special = ( p1 + k )
SET_CHAR_INVINCIBLE ( special , ON )
LEVELEND

8/9 electrocute the player
13 sets the player health to 39% (2 hearts)
14 sets the player health to 0% with SET_CHAR_INVINCIBLE ( special , OFF )
19 makes the player BUSTED!
22/23 gives character electrofingers but also makes them burn (without flames) to death (unless you also have them invul). If done on a player, it will say TOASTED and they will respawn with a partially transparent remap.

I still want an INVIS command, I'm sure there is way.
CarThief
Hitman
Hitman
Posts: 108
Joined: 19 May 2012, 18:12
GH nick: CarThief
Location: Holland, AKA The Netherlands

Re: SET command (used to be Scripted instant gang)

Post by CarThief »

Sounds quite handy to be able to manipulate the player in these kinds of ways, wonder if there's any method of healing a character without using a health pickup by doing something like this.
I'd give this code a spin as well with various numbers but i'm not quite sure what would need to be changed then, the number in 'SET special = (p1 + 8)' or 'counter k = 8'? Or both?

Edit: Heh, invisible peds would be awesome, especially if you can de-invis them, as if they where 'cloaking'. Oh the mission ideas if half of these things work reliably...
User avatar
Sektor
Boss
Boss
Posts: 1423
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: SET command (used to be Scripted instant gang)

Post by Sektor »

Just change the counter value (I edited the script and changed my 8 to a k, that was an error). I tried 100s of values but all the useful ones seem to be early on.

We will need a new EXE for better control.
User avatar
Sektor
Boss
Boss
Posts: 1423
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: SET command (used to be Scripted instant gang)

Post by Sektor »

Over 9000% <3

SET special = ( p1 + 14 )
SET_CHAR_INVINCIBLE (special, ON)
SET special = ( p1 + 13 )
SET_CHAR_INVINCIBLE (special, OFF)

It will take a while for the cops to drain that but it still drains instantly if you fall too far.
CarThief
Hitman
Hitman
Posts: 108
Joined: 19 May 2012, 18:12
GH nick: CarThief
Location: Holland, AKA The Netherlands

Re: SET command (used to be Scripted instant gang)

Post by CarThief »

That's pretty nice, i've tested that on a ped and it works very well, though they still die instantly from rockets, and probaly electro guns too, i suppose. The poor guy survived roughly 43 full Silenced Machinegun Rounds, and took ages to burn to death in another test as well.

Hope you find some other interesting bits too, especially the invis one, that would be awesome to be able to use as either a controlled powerup (probaly quite handy for sneaking, heh) and for stealthed enemies. :P
User avatar
Sektor
Boss
Boss
Posts: 1423
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: SET command (used to be Scripted instant gang)

Post by Sektor »

If an invis player quits a multiplayer game then they turn into a visible but transparent ped (pedator? cloaked ped), so if you make 5 players invis and then quit, you can have a transparent gang. Not at all practical, so yes hoping it can be done with just script. Probably have to use a third party tool (Vike) to find the memory location.
Jones
Psycho
Psycho
Posts: 51
Joined: 08 Aug 2012, 21:25

Re: SET command/Scriptable instant gang

Post by Jones »

Yeah, nice work Sektor you did it ;) How did you find about the 660, via ADD_SCORE and some wild testing?

edit: strange that SET_CHAR_INVINCIBLE did it in the end, I think I had chosen it just because it was a simple (flag/bit changing) command.
Last edited by Jones on 05 Apr 2013, 22:30, edited 1 time in total.
User avatar
Sektor
Boss
Boss
Posts: 1423
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: SET command/Scriptable instant gang

Post by Sektor »

Yes just ADD_SCORE with known chars and cars (I enabled show ped/car IDs in gta2manager, so I could see the order). At first I displayed the CHAR_DATA address with ADD_SCORE but then I realised, I didn't have to write down the addresses and type them in calc since I could just subtract them in game and display the difference with ADD_SCORE :)

Vike found the invisibility location but I don't know how to write the correct value yet.

[1:25:12 PM] vikethehube: the powerups bitmask is a dword 540 bytes from the start of the struct
[1:25:44 PM] vikethehube: invisibility is 2000000h
[1:29:26 PM] vikethehube: so if you can somehow write 2 or 4 to +543 then you'll trigger invis or the other one or OR it somehow
CarThief
Hitman
Hitman
Posts: 108
Joined: 19 May 2012, 18:12
GH nick: CarThief
Location: Holland, AKA The Netherlands

Re: SET command/Scriptable instant gang

Post by CarThief »

Had any luck with that invisibility thing by any chance? Seems a bit too fancy to try it myself from the looks of it.
Did have a thought, its pretty likely the SWAT, FBI and Cops use something like the health changing things to get increased and lowered health, not to mention the dummy peds which die in one pistol shot/2 MG bullets while regular gang/mission peds take 2 pistol/4 MG bullets to kill.

So any chance you bumped into whatever part of the memory which controls in a more accurate sense what health a character gets? Would be a usefull feature to give players/peds the SWAT/FBI bullet soaking abilities, if anything.
Also hope there's a command that could basically 'heal' the player somewhat more then the one listed earlier, such as between 50 to 100 health.
Hm... Also makes me wonder if one could replicate the effects of the delete debug key which restores the current car (both visually and in actual health) or player's health back to 100.
Post Reply