NPC Suicide

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

NPC Suicide

Post by Devastator »

So I've been working on a script in the GTA1 San Andreas map that is going to involve many different Assassins hunting after the player, as well as several assassination targets throughout the map. Near the giant Bridge is a building complex I zoned to be free from any dummy ped spawns, only scripted characters. The Gang Leader is located atop a rooftop. I have him scripted to run away as soon the player crosses a roof bridge. & I wanted to make it so that he jumped off the building to his death once the player jumped to the roof he was on, but it doesn't seem possible with scripting commands.

So I set his objective to kill himself, causing him to punch himself to death. It doesn't work if he has a gun though, He'll just fire off into the distance.

Is there anyway to get scripted characters to jump off of roofs like in GTA1? I imagine you could script an invisible block & then delete it as soon as he steps onto it to make him fall but that's a bit more complex than just commanding him to jump off a building.

It'd be cool if there was an NPC only scripted gun that created the bullet inside the character & instantly killed them, so you could
GIVE_WEAPON (GangBoss, Suicide_Gun)
SET_CHAR_OBJECTIVE, (GangBoss, KILL_CHAR_ON_FOOT, GangBoss)
& script some pretty cool missions involving people honor killing themselves.

Anyway, it's funny to watch someone punch themselves to death.
Attachments
HeDead.png
User avatar
elypter
Immortal
Posts: 1120
Joined: 26 Dec 2009, 23:53
GH nick: elypter

Re: NPC Suicide

Post by elypter »

Devastator wrote: I imagine you could script an invisible block & then delete it as soon as he steps onto it to make him fall but that's a bit more complex than just commanding him to jump off a building.
that was my first idea as well. conveyor belts cannot be turned off and explosions wouldnt make sense except if invisble explosions worked which i dont remember. maybe you could create an invisble object on top of him so he jumps but i dont know if he would jump to death. you could create an invisible char with flamethrower that sets him on fire like if hes burning himself or you simply explode the char.
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: NPC Suicide

Post by Sektor »

KILL_CHAR (GangBoss) will instantly kill any character. Making a ped jump to their death is more interesting but until someone figures out how to force a jump, you could teleport them off the edge using a memory write command (warp command only works on players, not bots).
Devastator
Hitman
Hitman
Posts: 120
Joined: 06 Dec 2011, 16:54

Re: NPC Suicide

Post by Devastator »

I have an idea.
I could command the character to go to the edge of X block, do a check to See if he completed his objective, create a water cannon bullet aimed at him to blow him off, & then do a Is Character Falling check to kill him. Can you command someone who is falling to be killed? I think this idea would be a good substitute.
User avatar
elypter
Immortal
Posts: 1120
Joined: 26 Dec 2009, 23:53
GH nick: elypter

Re: NPC Suicide

Post by elypter »

i think to remember that the water bullet didnt work. killing a falling char works. i did that on high land
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: NPC Suicide

Post by Sektor »

I forgot that the WARP command only works on players, that really should be changed. You can still teleport peds by changing their x, y, z values with poke commands.
Devastator
Hitman
Hitman
Posts: 120
Joined: 06 Dec 2011, 16:54

Re: NPC Suicide

Post by Devastator »

I was going to see about using the PISTOL_BULLET object to create a suicide effect, after testing out water bullet & it crashing the game. I had it set up to continuously create the bullet however when checking Player health, creating what could be perfect as a laser trap in certain maps,


EDIT: If you run straight through it with full armor it's guaranteed to take 5 points of armor away. If you aren't wearing armor it'll kill you instantly.

EDIT2: If you use TASER_BULLET you can create a nonlethal stream that you could use to visually represent laser trip triggers (alarms, guards swarming you, etc)
Attachments
Laser.png
Devastator
Hitman
Hitman
Posts: 120
Joined: 06 Dec 2011, 16:54

Re: NPC Suicide

Post by Devastator »

That whole laser thing inspired me to make TRACER ROUNDS.
It may not look like much in a still shot but in motion it's pretty awesome. Just edit the bullet sprites to be 15 pixels tall instead of three, & shade them in the same way.
Attachments
TRACERS.png
User avatar
Sektor
Boss
Boss
Posts: 1423
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: NPC Suicide

Post by Sektor »

I wonder if you removed the reload delay if it would just look like a laser.
Devastator
Hitman
Hitman
Posts: 120
Joined: 06 Dec 2011, 16:54

Re: NPC Suicide

Post by Devastator »

The machine gun still has a distinct projectile differentiation too. I'll have to try it out with fast reload. But that was actually the inspiration, I'm sure if I set it up in that scripted bullet stream it would look like a laser for sure.

EDIT:
Almost, but I think the game knows to space out the projectiles a certain distance. I counted & both these & default bullets only have 8 on a screen at a time if firing continuously, I don't know that increasing the height of the sprite would affect it or not.

EDIT2: Laser works for continuous object creation stream
Attachments
lasertrip.png
laserattempt.png
TRACERS2.png
User avatar
elypter
Immortal
Posts: 1120
Joined: 26 Dec 2009, 23:53
GH nick: elypter

Re: NPC Suicide

Post by elypter »

to make a laser waepon you would need the address of the bullet speed
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: NPC Suicide

Post by Sektor »

I don't know bullet speed address, I would try just changing the reload speed first since you can make that faster than fast reload.

[mis]
//remove reload delay
SET in=(p+368) //player + 368 is a pointer to the player ammo (only for first weapon slot)
CHANGE_GANG_CHAR_RESPECT (in,out,104) //read those 4 bytes
IF (out>0)
SET reload=(out+2) //we don't care about ammo, reload countdown is located at ammo location + 2
SET out=0 //constantly set reload countdown to 0 so we can always fire
CHANGE_GANG_CHAR_RESPECT (reload,out,111) //write 1 byte
ENDIF
[/mis]
User avatar
elypter
Immortal
Posts: 1120
Joined: 26 Dec 2009, 23:53
GH nick: elypter

Re: NPC Suicide

Post by elypter »

if bullet objects can be deleted you could make a light saber with it. that would be sespicially cool if you could deflect projectiles with it and use it as a secondary weapon powerup
yur sa'nok ngeyä
Devastator
Hitman
Hitman
Posts: 120
Joined: 06 Dec 2011, 16:54

Re: NPC Suicide

Post by Devastator »

Bahahahaha.

Also that code doesn't just work for weapon slot one. If I have more than one weapon they all fire without delay.

EDIT: OH MY GOD IT WORKS ON NPCS TOO

- if you use the same code on an NPC but set the reload counter to 1 they'll never be able to fire their gun. This could be useful for making guys who are aiming at you but never attack, or someone shooting at an invisible target but you're creating bullets inside them, to create a suicide effect.
Attachments
LASERGUN.png
LASERGUNnpc.png
Devastator
Hitman
Hitman
Posts: 120
Joined: 06 Dec 2011, 16:54

Re: NPC Suicide

Post by Devastator »

With Dual pistols it'll create an impregnable death wall surrounding the player. Imagine setting two or three of these guy to the Army occupation (to fire from far away), & then creating a few guys set to punch the player to death. It'd create an enclosed fighting arena the player has to fight the melee attackers in without being able to retreat without dying.
Attachments
DualLaser.png
Devastator
Hitman
Hitman
Posts: 120
Joined: 06 Dec 2011, 16:54

Re: NPC Suicide

Post by Devastator »

Here's a short vid of the script I'm working on. I forgot to set the audio to record though. It ends with a guy jumping to his death using the invisible block trick, but in the video he doesn't just go straight to do it like he's supposed to I think because his threat search was set to LINE_OF_SIGHT_PLAYER_ONLY & threat reaction was REACT_AS_NORMAL.

I'm surprised how well everything played out here though, it's pretty great. I just wish I got the audio.

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

Re: NPC Suicide

Post by elypter »

nice, there is a lot that can be done with this. a nice zombie coop mode like the ones in call of duty could work really nice
yur sa'nok ngeyä
Devastator
Hitman
Hitman
Posts: 120
Joined: 06 Dec 2011, 16:54

Re: NPC Suicide

Post by Devastator »

Which aspect would be good for a zombie coop?

I noticed one weird effect though, & this is may be why peds don't fall to their death: The corpse if floating. Peds & Cars go under it.
User avatar
elypter
Immortal
Posts: 1120
Joined: 26 Dec 2009, 23:53
GH nick: elypter

Re: NPC Suicide

Post by elypter »

the naked zone if those are converted normal peds and the usage of special weapons.

maybe hes floating because he has fallen too deep and the game killed him in flight just above the ground
yur sa'nok ngeyä
Devastator
Hitman
Hitman
Posts: 120
Joined: 06 Dec 2011, 16:54

Re: NPC Suicide

Post by Devastator »

Oh! Actually that's one of my "Hit Targets," it's a karma bus filled with four groups of hostile nudists, 31 people total. If the bus is at all stopped when you're near it the passengers get out by default to attack due to their respective gang respect being at -5.

& if the jumper hits the ground to where he falls over & dies his corpse is normal. It's when he's killed by the game just before hitting the ground that he floats, that's what I assume anyway.
Post Reply