Mktavish Posted November 25, 2017 Share Posted November 25, 2017 So I'm having trouble getting a trigger box to detect getting hit by a weapon or projectile. Might be because I am trying to detect both the player and a projectile ? This is the projectile "DLC03TeslaChainProjectile"Which has been made into a unique ID , and had the explosion removed from it , incase that matters. Also on the Ref window / Primitive tab ... of the triggerbox activator.I selected "TRIGGER" in the collision layer drop down box. Thinking it will be able to detect both actors and projectiles.(err maybe projectiles won't work except on "POJECTILEZONE" ? )Also I did manually check the persistent reference flag ... incase that matters because when opening the primitive tab ... it flags it as such ... but will uncheck it when not on that tab ... unless manually checked. Here is the script I have for it. SCN BMCoreArcTrigScriptInt iPlayerInt DoOnceDmgFloat TimerBegin OnTriggerEnter PlayerSet iPlayer to 1EndBegin OnTriggerLeave PlayerSet iPlayer to 0EndBegin OnHitWith BMDLC03WeapTeslaCannon ;BMDLC03TeslaChainProjectileShowMessage BMArcHitMessageSet Timer to Timer + GetSecondsPassedIf Timer > .5Set DoOnceDmg to 0Set Timer to 0If iPlayer == 1 && DoOnceDmg == 0PlayerRef.DamageActorValue Health 20IMOD GetHit;PlaySound ?Set DoOnceDmg to 1endifendifEnd And when inputing the projectile form-ID for the "OnHitWith" block.It will not accept it to save the script , saying it is an invalid reference.But can use the Base-ID of the weapon , and it will save the script. But this wiki article says need to use the ammo hits https://geckwiki.com/index.php/OnHitWith So not sure what to use there , since it doesn't want the projectile ??? Anybody have any Idea's ? Or maybe a different way to do it.Which is that I am trying to have the player get hit by the tesla chain projectile , while they happen to be within the same trigger box. Since the hit box for the player with this projectile seems pretty small ... from shoulders to knees ... And the player is able to crouch behind a railing ... essentially never getting hit when these beams pass by. Link to comment Share on other sites More sharing options...
uhmattbravo Posted November 26, 2017 Share Posted November 26, 2017 I'm pretty sure an OnHit block won't work on a trigger because it doesn't have collision. From what I'd read a while back though, I think you might be able to use the projectile or ammo in an onTriggerEnter block. I've never had a reason to actually try any of it, but it could be worth a try at least. Link to comment Share on other sites More sharing options...
Mktavish Posted November 26, 2017 Author Share Posted November 26, 2017 (edited) Actually I tried the OnTriggerEnter first , Then tried the OnTrigger , because I needed a clock to run. But with any block , when I try to pass the projectile ID ... it says it is an invalid reference and will not save. So you are saying that I should pass the ammo ID ? which in this case would be ... "AmmoElectronChargePack" "Begin OnTriggerEnter AmmoElectronChargePack " ??? Script won't take that one either ... Edited November 26, 2017 by Mktavish Link to comment Share on other sites More sharing options...
uhmattbravo Posted November 26, 2017 Share Posted November 26, 2017 Maybe you could use getself on the action ref to declare a ref and check it for the baseID? Link to comment Share on other sites More sharing options...
Mktavish Posted November 28, 2017 Author Share Posted November 28, 2017 (edited) You mean like ... SCN Myscript Ref rAmmoHit Begin OnTriggerEnter Set rAmmoHit to GetActionRef End Begin GameMode If rAmmoHit == BMDLC03TeslaChainProjectile ; Do some damage ??? Edited November 28, 2017 by Mktavish Link to comment Share on other sites More sharing options...
uhmattbravo Posted November 28, 2017 Share Posted November 28, 2017 Possibly. So long as "If rAmmoHit == BMDLC03TeslaChainProjectile" acknowledges that's the ref's base form. I tried to do a little digging for a function that would definitely check the ref's base object, but so far haven't seen any I'm 100% sure about. Link to comment Share on other sites More sharing options...
uhmattbravo Posted November 29, 2017 Share Posted November 29, 2017 (edited) Leave it to me to forget the obvious: SCN Myscript Ref rAmmoHit Begin OnTriggerEnter Set rAmmoHit to GetActionRef End Begin GameMode If rAmmoHit.getIsId BMDLC03TeslaChainProjectile ; Do some damage ??? So long as it registers the projectile as a ref, that, in theory, should do it. Edited November 29, 2017 by uhmattbravo Link to comment Share on other sites More sharing options...
Mktavish Posted November 30, 2017 Author Share Posted November 30, 2017 Ah ya ... getisID ... without testing that already sounds like it will work ... Thanks :D Link to comment Share on other sites More sharing options...
Mktavish Posted December 29, 2017 Author Share Posted December 29, 2017 (edited) Leave it to me to forget the obvious: Sorry I took so long to get around to test it out ... But reporting back it is working great ! There is one caveat though ... I had to change the projectile from a beam to a missile. Here's the script ... ~~~~~~~~~~~~SCN BMCoreArcTrigScript Int iPlayerInt iArcShort DoOnceDmgFloat TimerRef rAmmoHit Begin OnTriggerEnter Player Set iPlayer to 1 Set iArc to 0End Begin OnTriggerLeave Player Set iPlayer to 0 End Begin OnTriggerEnter Set rAmmoHit to GetActionRef If rAmmoHit.GetIsID BMDLC03TeslaChainProjectile == 1 Set iArc to 1endifEnd Begin GameMode If iPlayer == 1 && iArc == 1 ShowMessage BMArcHitMessage Set Timer to Timer + GetSecondsPassed If Timer > .5 Set DoOnceDmg to 0 Set Timer to 0 else If iPlayer == 1 && DoOnceDmg == 0 && iArc == 1 PlayerRef.DamageActorValue Health 50 IMOD GetHit ;PlaySound ? Set DoOnceDmg to 1 endif endifendif End~~~~~~~~~~~~~~~ Edited December 29, 2017 by Mktavish Link to comment Share on other sites More sharing options...
uhmattbravo Posted December 29, 2017 Share Posted December 29, 2017 Nice. Glad it works. Link to comment Share on other sites More sharing options...
Recommended Posts