user826 Posted May 14, 2015 Share Posted May 14, 2015 Hey, all. I tried Googling this first but I couldn't find anything (maybe I'm just not using the right keywords) so I'm hoping someone here can help me. Anyway, is there a function that can detect if any NPC is using an object? For instance, is there some way for a chair to detect if anyone is sitting on it, not just a single actor ID reference? I know of the IsCurrentFurnitureRef and IsCurrentFurnitureObj functions, but these only detect a single actor. How can I, for example, make a booby-trapped chair that explodes as soon as anyone sits in it? Thanks for any help you can give me! Link to comment Share on other sites More sharing options...
Fallout2AM Posted May 14, 2015 Share Posted May 14, 2015 Did you try to use an OnActivate block on a script attached to the chair? Begin OnActivate ; Boom End Link to comment Share on other sites More sharing options...
user826 Posted May 14, 2015 Author Share Posted May 14, 2015 (edited) That's one way, but if I want the chair to use the Pants Exploded method and deposit a live grenade into the inventory of the NPC, is there a way to do so, like: begin OnActivate if [**AnyNPC**].IsCurrentFurnitureRef TotallyNormalChairREF == 1 ;Add a live grenade to [**AnyNPC**]'s inventory endif endOr, if I want to attach the script on a couch, and only run it if two or more NPCs are sitting on the couch? Edited May 14, 2015 by user826 Link to comment Share on other sites More sharing options...
Fallout2AM Posted May 14, 2015 Share Posted May 14, 2015 If you are attaching the script to the chair, you could get who's activating it, which is the reference you need. At that point you don't need to check anything else, even forgetting the IsCurrentFurnitureRef. Link to comment Share on other sites More sharing options...
user826 Posted May 14, 2015 Author Share Posted May 14, 2015 Okay, awesome! So, the script would look something like this, then? begin OnActivate if (GetActionRef != Player) set bOccupied to bOccupied + 1 Return elseif (bOccupied > 1) activate endif end Link to comment Share on other sites More sharing options...
Fallout2AM Posted May 14, 2015 Share Posted May 14, 2015 (edited) mmmh... Why that last "Activate"? didn't you want to make them explode? (A couple of things, which are more for your curiosity: the b in front of the Occupied variable should be an i, you are admitting at least 3 values so it's not a boolean-it's just to make things easier when you need to read a script you wrote the month before and you're not remembering parts; the Return in that spot is unuseful - in bigger scripts, using too many Returns could lead me to not see issues when something doesn't work as intended, so I personally tend to not use them if they are not necessary) Edited May 14, 2015 by Fallout2AM Link to comment Share on other sites More sharing options...
user826 Posted May 15, 2015 Author Share Posted May 15, 2015 Heh, you can probably tell I'm not much of a scripter and that I mostly just copy/paste from pre-existing code. Most of the stuff you pointed out is just me imitating what worked in other scripts I found. As for the "Activate", I'd replace that with the exploding code, once I've found/written it. Link to comment Share on other sites More sharing options...
Recommended Posts