StealthDick Posted March 26, 2018 Share Posted March 26, 2018 I want an objective to be completed when a player places a few mines in a trigger area, I just dont know how to do it ex: (fake script I didn't actually write this) short bminesplaced begin gamemodeif player.placed NVWeaponFragmine 3 set bminesplaced to 1endifEND if there's a way to get a sequence like that to work that would be awesome. Link to comment Share on other sites More sharing options...
kingbeast88 Posted March 26, 2018 Share Posted March 26, 2018 (edited) I imagine you can have a script check for a custom named mine in the PC's inventory, have a trigger box that runs once the player enters it and then does a count of the custom named mine and detects when a player places it as the inventory count of the mine goes down. Likely an easier way exist to do it though. Edited March 26, 2018 by kingbeast88 Link to comment Share on other sites More sharing options...
EPDGaffney Posted March 26, 2018 Share Posted March 26, 2018 Are these mines specific mines or do you want the script to account for all types of mine in the game? I can think of a few approaches, but they're all rather different depending on what you want. What a lot of developers would do, if this is for a quest, is these wouldn't even be weapons, but Misc Items that are non-droppable Quest Items, and then they'd make a bunch of Activators instead of that trigger box, so the player walks over to each one and if they have one of the Quest Item mines, it removes one from the player's inventory and enables one that looks like it and is placed at the spot you want (and had been previously disabled and probably isn't a live mine, if this is like most game situations that sound like this). Then, when each one is placed, you update a variable and if the count is 3, you update the quest. 1. Does that make sense?2. Does that actually sound like what you're trying to do? Link to comment Share on other sites More sharing options...
uhmattbravo Posted March 26, 2018 Share Posted March 26, 2018 (edited) Ref MineRef Begin OnTrigger Set MineRef to GetActionRef If MineRef.GetIsId (mine's formId) == 1 ;do stuffEndif End The thing is with mines, you'll want to use the formId of the projectile object, not the item so that it'll be counted when they actually set the mine, not just drop an inactive one. Also, you should be able to use a formlist instead of the direct formId if you want to allow different types of mine's instead of just a specific one. Edited March 26, 2018 by uhmattbravo Link to comment Share on other sites More sharing options...
EPDGaffney Posted March 26, 2018 Share Posted March 26, 2018 That could get complicated making sure the same mine doesn't trigger the variable more than once, as OnTrigger is called every frame. OnTriggerEnter is not as reliable for something like this, in my experience. I haven't tried this function, but if it works with trigger boxes, it could be great here:https://geckwiki.com/index.php/GetHasContact Then we could use either OnFire if it's a custom mine, or this event handler with an array variable:https://geckwiki.com/index.php/SetOnFireWeaponEventHandler Suppose that's no less complex than what it would take to make sure the same mine doesn't trigger the box twice, though. Oh, well. Link to comment Share on other sites More sharing options...
uhmattbravo Posted March 26, 2018 Share Posted March 26, 2018 (edited) Ideally, with any one use trigger, it's best to end it with DisableMarkfordelete Which will make sure the mine only gets counted once anyway. If multiple mine's need to be placed, you could amend it with more declared refs Ref MineRefRef MineRefARef MineRefBShort MinesPlaced If MinesPlaced == 0 If MineRef.GetIsId (mine's formId) == 1 Set MineRefA to MineRef.getself Set MinesPlaced to 1 Elseif MinesPlaced == 1 If MineRef != mineRefA && If MineRef.GetIsId (mine's formId) == 1 Set MineRefB to MineRef.getself Set MinesPlaced to 2 ...etc.... Edited March 26, 2018 by uhmattbravo Link to comment Share on other sites More sharing options...
EPDGaffney Posted March 26, 2018 Share Posted March 26, 2018 Yeah, OP wants to do more than one mine. Also, I find that at least according to a console check with GetDisabled, my triggers never disable, and I disable and MarkForDelete everything after it's done what it needs to do. I always use a DoOnce check anyway, so I haven't tested whether they're non-functional despite what the console says. Any thoughts on that? Link to comment Share on other sites More sharing options...
uhmattbravo Posted March 26, 2018 Share Posted March 26, 2018 According to the wiki article, refs that were placed by a plugin (i'm assuming as opposed to placed during gameplay) never actually get deleted (I didn't know that), but the script should stop running. Might be worth trying it on a repeatable trigger just to see what happens though, the GECK certainly doesn't have a shortage of quirks like that. Link to comment Share on other sites More sharing options...
EPDGaffney Posted March 26, 2018 Share Posted March 26, 2018 Hahaha of course they don't get deleted when you script them to do so. Why would Gamebryo ever do what it's supposed to do? References that are in the ESM or an ESP file can be marked for deletion, but are not truly deleted. However, the script on such objects is removed and no longer runs.Ah, that makes sense. So they stop running their scripts. That seems to agree with my memory of things, and would be why your OnTrigger blocks get stopped when you 'delete' the trigger running them. I'll do some tests eventually, though, just to get a bit more clarification. Link to comment Share on other sites More sharing options...
StealthDick Posted March 27, 2018 Author Share Posted March 27, 2018 thank you guys for the replies gonna try these out now/ Link to comment Share on other sites More sharing options...
Recommended Posts