Matrix Respawn Snatch?

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
User avatar
Sky_216
Droid Pilot Assassin
Droid Pilot Assassin
Posts: 2086
Joined: Mon Feb 13, 2006 3:28 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

Matrix Respawn Snatch?

Post by Sky_216 »

Quick question for the scripting gurus - is this possible/feasible:

Use GetEntityMatrix to get the position of a unit (only 1, players) when using a certain weapon.
Force respawn player without dying.
Teleport player to exact location of Matrix.

And do it quickly.

Idea is to have a "snatch" weapon that lets you "grab" a weapon from an enemy (use LastHit, check for enemy class) and then get teleported back near instantly to where you were when you snatched.
RepSharpshooter
Gametoast Staff
Gametoast Staff
Posts: 1351
Joined: Tue Jul 10, 2007 4:10 pm

Re: Matrix Respawn Snatch?

Post by RepSharpshooter »

Skyhammer_216 wrote:Force respawn player without dying.
That's the tricky part. You're basically asking if you can remove the player from the battlefield without killing him. There is only one instance of this ever happening in the game, and that is with unlocking heroes. I'm pretty sure unlocking heroes is more of a hard coded thing, so you'd probably have to work something out as is.
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: Matrix Respawn Snatch?

Post by Maveritchell »

I'll go ahead and say "no." You might be able to mitigate the effects of the player dying, but they'll have to be killed if you want to respawn them.
User avatar
Sky_216
Droid Pilot Assassin
Droid Pilot Assassin
Posts: 2086
Joined: Mon Feb 13, 2006 3:28 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

Re: Matrix Respawn Snatch?

Post by Sky_216 »

OK...what if you can kill the player to do it?
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: Matrix Respawn Snatch?

Post by Maveritchell »

Skyhammer_216 wrote:OK...what if you can kill the player to do it?
Then... yes you can? I'm not sure what you're asking - we both had acknowledged that it's possible to do if you can kill the player. Are you asking how?
User avatar
Sky_216
Droid Pilot Assassin
Droid Pilot Assassin
Posts: 2086
Joined: Mon Feb 13, 2006 3:28 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

Re: Matrix Respawn Snatch?

Post by Sky_216 »

Maveritchell wrote:
Skyhammer_216 wrote:OK...what if you can kill the player to do it?
Then... yes you can? I'm not sure what you're asking - we both had acknowledged that it's possible to do if you can kill the player. Are you asking how?
Yes.
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: Matrix Respawn Snatch?

Post by Maveritchell »

You'll want to:
a) Grab a player's location: variable = GetEntityMatrix(GetCharacterUnit())
b) Kill the player: ScriptCB_PlayerSuicide()
c) Select their character class: SelectCharacterClass()
d) Spawn them at the saved location location: SpawnCharacter()
User avatar
[RDH]Zerted
Gametoast Staff
Gametoast Staff
Posts: 2982
Joined: Sun Feb 26, 2006 7:36 am
Projects :: Bos Wars AI - a RTS game
Games I'm Playing :: SWBF2 and Bos Wars
xbox live or psn: No gamertag set
Location: USA
Contact:

Re: Matrix Respawn Snatch?

Post by [RDH]Zerted »

There are other issues you have to deal with. First, if you mess with the weapons in MP the game will crash. The stealing weapon would only be usable in singleplayer. Second, we can only change weapons for a unit class, not a single unit itself. That means anyone else spawned as that unit class will also get the new weapon. To get around this, you have to make sure no AI play as the stealing unit class.

Sometimes you don't need to respawn for some weapon changes. Mess around with the weapon changing code before you test the respawning. Try setting the weapon to different slots and see if you can get it instantly working.

Leave out step b from Maveritchell and see if it works.

Remember, those steps are just the respawn sequence. You'll have to update the weapon before a or after b. Test to see which works better.
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: Matrix Respawn Snatch?

Post by Maveritchell »

[RDH]Zerted wrote:There are other issues you have to deal with. First, if you mess with the weapons in MP the game will crash. The stealing weapon would only be usable in singleplayer. Second, we can only change weapons for a unit class, not a single unit itself. That means anyone else spawned as that unit class will also get the new weapon. To get around this, you have to make sure no AI play as the stealing unit class.

Sometimes you don't need to respawn for some weapon changes. Mess around with the weapon changing code before you test the respawning. Try setting the weapon to different slots and see if you can get it instantly working.

Leave out step b from Maveritchell and see if it works.

Remember, those steps are just the respawn sequence. You'll have to update the weapon before a or after b. Test to see which works better.
If you want to check to see whether a weapon change (like ammo, for instance) will go into effect, you might as well leave out all of the above steps - like Zerted said, those are only for respawning a character.

It's worth mentioning that any time you try and change the first primary weapon, you'll get a crash. The character can't not have a first weapon (first primary), and even if you're just swapping it the game will give you a "cannot build without primary weapon" error.
Post Reply