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.
Detect shots
Moderator: Moderators
- bobfinkl
- Rebel Colonel

- Posts: 593
- Joined: Sun Jul 13, 2008 9:01 am
- Projects :: Lots of unreleased stuff
- xbox live or psn: No gamertag set
- Location: The quaint little city gametoast.
-
Master_Ben
- Lieutenant General

- Posts: 675
- Joined: Wed Nov 12, 2008 9:50 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
- Location: Watching your PC over your shoulder. No, the other sholder....
Re: Detect shots
Had a look through Lua functions in the FAQ and didn't find anything. Looks like a no go.
- Fiodis
- Master of the Force

- Posts: 4145
- Joined: Wed Nov 12, 2008 9:27 pm
- Projects :: Rannoch + Tientia + Tools Programming
Re: Detect shots
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
)- bobfinkl
- Rebel Colonel

- Posts: 593
- Joined: Sun Jul 13, 2008 9:01 am
- Projects :: Lots of unreleased stuff
- xbox live or psn: No gamertag set
- Location: The quaint little city gametoast.
Re: Detect shots
Alright well I've found an acceptable workaround, thanks anyway. Admins this topic can be locked now.
