Adding Self-Destruct to Units

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

User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Adding Self-Destruct to Units

Post by Maveritchell »

Is it possible to make a weapon that causes a unit to self destruct, much like the self-destruct works on the remote droid?

I've tried equipping the remote droid's detonator to a unit, which only makes the map crash. I've also tried modifying the neuropoison to do damage to everyone, but not only will it not kill the user unless it hits someone else, but, obviously, it will only hit you if team damage is on. Likewise, that problem seems to apply to a number of solutions (e.g. no-distance grenades that explode automatically)- I'd like to make this be something that works with team damage off.
Last edited by Maveritchell on Sat Sep 09, 2006 7:35 am, edited 2 times in total.
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: Adding Self-Destruct to Units

Post by [RDH]Zerted »

To kill someone with team damage off, you need to crush them, send them into a death or damage region, or code it into the Lua.

In the scripting documentation, there are two events of intrest. CharacterDispensePowerup and CharacterDispenseControllable. For your death weapon, make it one of these (powerup or controllable) and give it to the unit. In the Lua using the 'On' + [event], determine if the powerup/controllable dropped is the death weapon. If so, call ScriptCB_PlayerSuicide([player]) and the player will die. However, this won't kill/damage any units nearby so there really isn't much point.
Rekubot
Jedi
Jedi
Posts: 1080
Joined: Wed Apr 05, 2006 12:34 pm
Projects :: No Mod project currently.
Games I'm Playing :: Shadow Complex
xbox live or psn: Rekubot
Location: UK

RE: Adding Self-Destruct to Units

Post by Rekubot »

I gave the tie mauler a self destruct feature, and it works even with friendly fire turned off. So it is possible. I also used the remote droid ODF, but of course I changed it a bit.
Adreniline
Command Sergeant Major
Command Sergeant Major
Posts: 290
Joined: Fri Oct 28, 2005 8:24 pm
Projects :: No Mod project currently.
xbox live or psn: XTIndie
Location: Coffee Centre of the World
Contact:

Post by Adreniline »

Another way I have done it, is by giving a unit a timebomb, and turning the cook time from 5 to 0

In other words, insta-explosion
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: RE: Adding Self-Destruct to Units

Post by Maveritchell »

[RDH]Zerted wrote:To kill someone with team damage off, you need to crush them, send them into a death or damage region, or code it into the Lua.

In the scripting documentation, there are two events of intrest. CharacterDispensePowerup and CharacterDispenseControllable. For your death weapon, make it one of these (powerup or controllable) and give it to the unit. In the Lua using the 'On' + [event], determine if the powerup/controllable dropped is the death weapon. If so, call ScriptCB_PlayerSuicide([player]) and the player will die. However, this won't kill/damage any units nearby so there really isn't much point.
Thank you, but unless I were somehow able to give that action a region of effect, then I would be stuck with a weapon that, as you quite correctly say, has no point. Ideally, I would be able to modify the remote-droid's self destruct, which leads me to:
Rekubot wrote:I gave the tie mauler a self destruct feature, and it works even with friendly fire turned off. So it is possible. I also used the remote droid ODF, but of course I changed it a bit.
Did you only change values in the .odf but left the function unchanged, i.e. making the weapon slightly customized, or were these changes necessary for the operation of the weapon?

If you did in fact have to make functional changes to let the weapon operate, what in the .odf would be necessary to change to activate it on a spawnable unit?

And as to:
Adreniline wrote:Another way I have done it, is by giving a unit a timebomb, and turning the cook time from 5 to 0

In other words, insta-explosion
As I mentioned, taking any weapon other than the self-destruct from the remote and simply modifying it to detonate automatically with no distance only works if team attack is set on, and I'd like for the self-destruct weapon to kill the user regardless of team attack damage status.

On another vein:

I've seen reference (specifically by you, [RDH]Zerted) as to the feasibility of forcing units to spawn in vehicles. What I'd like to do is force a specific unit to spawn in a vehicle every time it spawns.

I'd really like to just make a vehicle a spawnable class, but everything I've tried - which, to be fair, has been making rather crude unit-vehicle chimera .odfs - has failed, and it seems like if I could force a specific unit - the sniper unit - to spawn in a specific vehicle - a spider walker - every time it spawns, then I could accomplish the same task.
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: Re: RE: Adding Self-Destruct to Units

Post by [RDH]Zerted »

I have never forced a unit into a vehicle, but one of the developers said it was possible. I think the info is in the old forgotten 'Sides' topic created by one of the game developers.
xwingguy

RE: Re: RE: Adding Self-Destruct to Units

Post by xwingguy »

about the explosion thing...

Did we forget about this:

com_weap_inf_remotedroid_destruct

classlabel = "destruct"

not entirely sure whether or not the soldier class can use it or not.
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: RE: Re: RE: Adding Self-Destruct to Units

Post by Maveritchell »

xwingguy wrote:about the explosion thing...

Did we forget about this:

com_weap_inf_remotedroid_destruct

classlabel = "destruct"

not entirely sure whether or not the soldier class can use it or not.
The real problem would be forgetting to use the _ord file, but no, I forgot neither- unless you meant something else.

To be clear, this is the odf to com_weap_droid_incinerator_ord - the ordnance used by com_weap_inf_remotedroid_destruct. Now, I'd checked this out, and continue to, looking for some clue:
com_weap_droid_incinerator_ord wrote: [OrdnanceClass]

ClassLabel = "emitterordnance"

[Properties]
ImpactEffectWater = "com_sfx_watersplash_ord"

Radius = "12"
ConeLength = "0"
ConeAngle = "120"
FirstRadius = "0.0"
MaxTargets = "10" // Max number of targets to hit. Chaining is off so the damage will be split between the number of targets
NoChaining = "1" // No chaining - all bolts coming from the attacker

Explosion = "com_weap_droid_incinerator_exp"

//OrdnanceSound = "com_weap_launcher_energy_dumbfire"

Damage = "10000" // This is the min damage. Even if the initial damage is split between the number of targets, it will never go below this number for each target
MaxDamage = "10000" // This is the max damage
JumpDeduction = "0" // No jump deduction. This is for chaining only
DamageThreshold = "0" // Always do damage (no threshold)
MaxJumpDistance = "0" // No max jump distance because the chaining is off

VehicleScale = "0.0"
ShieldScale = "1.0"
PersonScale = "1.0"
AnimalScale = "1.0"
DroidScale = "1.0"
BuildingScale = "0.0"

//Push = "0.0"
//LightningEffect = "com_sfx_lightning"
//LightningEffectScale = "0.25"
//NoTargetLightningEffectCount = "5" // The number of ligthning effects to display when the ordinance has no targets to hit
//NoTargetLightningEffectRandomSpread = "0.4" // The random rotation spread the ligthning effects does when the ordinance has no targets to hit


PlayEffectOnOwner = "com_sfx_weap_remotedroid_exp"

SmolderEffectTimer = 0.5

//SmolderEffect = "com_sfx_inf_damage_disintergrate"
//SmolderBone = "bone_l_forearm"

SmolderVanishDeath = "1"
In there, I can't even figure out what operation is even doing the damage to/destroying the user. Other than the Smolder... things, there's nothing too different in there from a standard area affect weapon. Any guesses are quite welcome.

And thanks for the point in the right direction, Zerted, any further pointers on that subject, by anyone, are also quite welcome.
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Post by Maveritchell »

Ok, for sake of clarity, here's the answer to my own question:

Here's what PAN-Fnord had to say on the topic:
PAN-Fnord and [RDH]Zerted wrote:
P-F: Well, you can't spawn as a vehicle per-se because it doesn't derive from the same things a soldier does. What you can do is in your mission script, when the player spawns, create a flyer (or grab one from somewhere), put it at his position, and force him into it. We were doing that as a test at one point, but that was scrapped - it works though.

Mike Z

...

R-Z: I've found OnCharacterEnterVehicle(), ForceAIOutOfVehicles(), and a few others, but nothing to force a unit to enter a vehicle. Is it done using SetProperty() or do you force the player to press the enter vehicle key when they are standing close to the vehicle?

...

P-F: It's just EnterVehicle(vehicle, playerNumber)

Where "vehicle" is either a reference to a vehicle or a string that is the name of a vehicle. For vehicle names, vehicles take the name of their vehicle-spawns, so if your vehicle spawn is "snazzy" even if it's spawning X-Wings, they're snazzy1, etc. Otherwise you can actually just create a vehicle using
CreateEntity(ODFname, optionalMatrix, optionalNameForVehicle)

So you can do EnterVehicle(CreateEntity("all_fly_snowspeeder"), 1) hopefully.

Mike Z
Unfortunately, for me, that means I cannot do what I want, as I can't have vehicles just sitting around waiting to have units spawned into them. The unit/vehicle I'm looking for is a four-legged droid, and short of modeling one and creating an entirely new skeleton and animation set - at which I would be woefully inept - I'm not sure that there's really a solution.

To anyone whose interest is truly piqued in helping me solve both these things - and their possible ramifications, I would provide further detail as to why I want these things through a PM.

Of course, I welcome further discussion, especially of the self-destruct problem, in this thread.
Penguin
Jedi Admin
Jedi Admin
Posts: 2541
Joined: Sun Mar 05, 2006 12:00 am
Location: Australia

Post by Penguin »

*cough*PlayEffectOnOwner = "com_sfx_weap_remotedroid_exp" *cough*

EDIT: lol, diddn't see the sfx part, doh, and explosions do damage aswell, most exp files for guns just have the explosion effect but have the damage on 0
Last edited by Penguin on Sat Sep 09, 2006 2:24 am, edited 1 time in total.
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Post by Maveritchell »

Penguin wrote:*cough*PlayEffectOnOwner = "com_sfx_weap_remotedroid_exp" *cough*
That would appear to be just an effect (com_sfx_etc...), and besides, even if it were the _exp, isn't it an _ord that does the actual dealing of damage?
Big_rich

Post by Big_rich »

Have you tried to put it as a secondary weapon in the soldiers odf? Then make the weapon destruct in class label? Just use this as the weapon(edited odf), try it and see if this does it for you. I have a feeling it's crashing cause it doesn't have a .msh/geometry.:

Code: Select all

[u]all_weap_inf_remotedroid_destruct[/u]

[WeaponClass]
ClassLabel          = "destruct"

[Properties]
GeometryName        = "com_weap_inf_grenadethermal"
HighResGeometry     = "com_1st_weap_inf_grenadethermal"

OffhandWeapon       = 1

//***********************************************
//************* TARGET & RANGE VALUES  **********
//***********************************************

TargetEnemy         = "1"
TargetNeutral       = "1"
TargetFriendly      = "1"

TargetPerson        = "1"
TargetAnimal        = "1"
TargetDroid         = "1"
TargetVehicle       = "1"
TargetBuilding      = "1"

MinRange            = "0"
OptimalRange        = "0"
MaxRange            = "0"

LockOnRange         = "30.0"

IconTexture         = "HUD_orbital_strike_icon"

RoundsPerClip           = "1"

MaxPressedTime          = "3.0"

InitialSalvoDelay       = "0.0"

AimAzimuth          = "0.0"
AimElevation            = "70.0"
AimDistance         = "600.0"

SalvoCount          = "4"
SalvoDelay          = "0.75"

ScatterDistance         = "2.5"

ChargeSound             = "com_weap_remote_charge_fire"
SelfDestructSoundPitch  = "0.3"

OrdnanceName            = "com_weap_droid_incinerator_ord"
HUDTag                  = "hud_detpack_plunger"
maybe even add an animation bank if need be.
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Post by Maveritchell »

Big_rich wrote:Have you tried to put it as a secondary weapon in the soldiers odf? Then make the weapon destruct in class label? Just use this as the weapon(edited odf), try it and see if this does it for you. I have a feeling it's crashing cause it doesn't have a .msh/geometry.:

Code: Select all

[u]all_weap_inf_remotedroid_destruct[/u]

[WeaponClass]
ClassLabel          = "destruct"

[Properties]
GeometryName        = "com_weap_inf_grenadethermal"
HighResGeometry     = "com_1st_weap_inf_grenadethermal"

OffhandWeapon       = 1

//***********************************************
//************* TARGET & RANGE VALUES  **********
//***********************************************

TargetEnemy         = "1"
TargetNeutral       = "1"
TargetFriendly      = "1"

TargetPerson        = "1"
TargetAnimal        = "1"
TargetDroid         = "1"
TargetVehicle       = "1"
TargetBuilding      = "1"

MinRange            = "0"
OptimalRange        = "0"
MaxRange            = "0"

LockOnRange         = "30.0"

IconTexture         = "HUD_orbital_strike_icon"

RoundsPerClip           = "1"

MaxPressedTime          = "3.0"

InitialSalvoDelay       = "0.0"

AimAzimuth          = "0.0"
AimElevation            = "70.0"
AimDistance         = "600.0"

SalvoCount          = "4"
SalvoDelay          = "0.75"

ScatterDistance         = "2.5"

ChargeSound             = "com_weap_remote_charge_fire"
SelfDestructSoundPitch  = "0.3"

OrdnanceName            = "com_weap_droid_incinerator_ord"
HUDTag                  = "hud_detpack_plunger"
maybe even add an animation bank if need be.
The thing is, the weapon isn't designed to have a geometry, just like, I believe, any "buff" weapon. It has an area effect (an explosion), but shouldn't need any kind of geometry, just the hud tag, which does go in there as the plunger (default), which it should.

I might try creating an invisible thermal det, or something, that has no effect in and of itself, but allows me to have an _ord that causes the self-destruct without being a ClassLabel destruct. It's never that easy, though, and I've a feeling the game would crash if I used that, as well.
PvtParts
Jedi
Jedi
Posts: 1001
Joined: Mon Apr 03, 2006 9:12 pm
Projects :: No Mod project currently.
xbox live or psn: No gamertag set
Location: plundering yer booty

Post by PvtParts »

Well, in my games, I redid the shockfield weapon. Now, its meant to be a self destruct weapon. I used the ApplyOnOwnerIfOnOthers command to simulate a self destruct sort weapon. Basically, if there is no-one in the immediate area when you fire it you do not die, but when others are affected, it kills you as well.

Have you considered using the SoldierHealth command, and setting it to a negative number, such as -500
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Post by Maveritchell »

PvtParts wrote:Well, in my games, I redid the shockfield weapon. Now, its meant to be a self destruct weapon. I used the ApplyOnOwnerIfOnOthers command to simulate a self destruct sort weapon. Basically, if there is no-one in the immediate area when you fire it you do not die, but when others are affected, it kills you as well.

Have you considered using the SoldierHealth command, and setting it to a negative number, such as -500
I've played around with the ApplyOnOwnerIfOnOthers (it's in the debuff weapon), but have never tried the shockfield, and I've tried using AddHealth (which I'm not even sure is a command), but never SoldierHealth. I'll look over it and give it a try.
PvtParts
Jedi
Jedi
Posts: 1001
Joined: Mon Apr 03, 2006 9:12 pm
Projects :: No Mod project currently.
xbox live or psn: No gamertag set
Location: plundering yer booty

Post by PvtParts »

The shockfield basically electricutes everyone in your immediate vicinity. Adding ApplyOnOwnerIfOnOthers makes it electricute you as well, but only if it contacts anyone else.

Let me know if SoldierHealth works, as if it does I will put it in my shockfield so you no longer have to rely on nearby soldiers to make it work.

But then again..I like my justification of why the shockfield only kills you when it affects others - it requires a complete current for the energy to jump back towards you. When the electricity comes in contact with a conductor (in this case and enemy, or friend), it then jumps inwards, from the point of origin. If it does not come into contact with a conductor, it simply disapates, harming no one.
User avatar
Dohnutt
Hoth Battle Chief
Hoth Battle Chief
Posts: 3248
Joined: Sun Aug 20, 2006 9:25 am
Contact:

Post by Dohnutt »

I know almost nothing about modding, but I figured that maybe this might work. Would you be able to follow the same commands that are used in the Re-Spawn button during pause?
PvtParts
Jedi
Jedi
Posts: 1001
Joined: Mon Apr 03, 2006 9:12 pm
Projects :: No Mod project currently.
xbox live or psn: No gamertag set
Location: plundering yer booty

Post by PvtParts »

Thats a very interesting, and well thought, idea. But as far as plausability, I know not. I have a feeling the Respawn is more of a specific, hard-coded game asset, not so much a file handled with odfs.

This is a job for Zertedddd!!!!!!!
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:

Post by [RDH]Zerted »

When you press the respawn button, it runs: ScriptCB_PlayerSuicide(this.viewpoint)
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Post by Maveritchell »

[RDH]Zerted wrote:When you press the respawn button, it runs: ScriptCB_PlayerSuicide(this.viewpoint)
And you certainly can't have a weapon that triggers an event callback, can you?
Post Reply