Detect shots

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
bobfinkl
Rebel Colonel
Rebel Colonel
Posts: 593
Joined: Sun Jul 13, 2008 9:01 am
Projects :: Lots of unreleased stuff
Games I'm Playing :: Life
xbox live or psn: No gamertag set
Location: The quaint little city gametoast.

Detect shots

Post by bobfinkl »

Alright well I'm making a sniper mission and long story short I need to be able to detect if a player shoots a weapon in the campaign, e.g. if the player shoots this weapon during this objective they lose.

Any help appreciated, if it's not possible then that's fine I'll find a workaround.
Master_Ben
Lieutenant General
Lieutenant General
Posts: 675
Joined: Wed Nov 12, 2008 9:50 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Watching your PC over your shoulder. No, the other sholder....

Re: Detect shots

Post by Master_Ben »

Had a look through Lua functions in the FAQ and didn't find anything. Looks like a no go.
User avatar
Fiodis
Master of the Force
Master of the Force
Posts: 4145
Joined: Wed Nov 12, 2008 9:27 pm
Projects :: Rannoch + Tientia + Tools Programming

Re: Detect shots

Post by Fiodis »

You can only detect dispensers firing. However, you may be able to save your campaign yet - take a look at the Geonosis campaign, specifically the objective in which you must kill some droids with a sniper rifle. They use some sort of GetLastWeaponHitClass or something similar, if the player in your campaign is inside a room, you could edit the room's ODF to be destructable with a very very high health, then use something like

Code: Select all

OnObjectDamage (
function (object, damager)
           if GetLastHitWeaponClass (object) == "whatever weapon you want" and GetEntityClass (object) == "name of room's ODF" then
           "insert code to make them lose here"
           end, 
           end
    )
User avatar
bobfinkl
Rebel Colonel
Rebel Colonel
Posts: 593
Joined: Sun Jul 13, 2008 9:01 am
Projects :: Lots of unreleased stuff
Games I'm Playing :: Life
xbox live or psn: No gamertag set
Location: The quaint little city gametoast.

Re: Detect shots

Post by bobfinkl »

Alright well I've found an acceptable workaround, thanks anyway. Admins this topic can be locked now.
Post Reply