Jump to content

Trigger Box detect Projectile


Mktavish

Recommended Posts

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 BMCoreArcTrigScript

Int iPlayer
Int DoOnceDmg
Float Timer

Begin OnTriggerEnter Player

Set iPlayer to 1

End

Begin OnTriggerLeave Player

Set iPlayer to 0

End


Begin OnHitWith BMDLC03WeapTeslaCannon ;BMDLC03TeslaChainProjectile

ShowMessage BMArcHitMessage
Set Timer to Timer + GetSecondsPassed
If Timer > .5
Set DoOnceDmg to 0
Set Timer to 0

If iPlayer == 1 && DoOnceDmg == 0

PlayerRef.DamageActorValue Health 20
IMOD GetHit
;PlaySound ?
Set DoOnceDmg to 1

endif
endif

End

 

 

 

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

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

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 by Mktavish
Link to comment
Share on other sites

You mean like ...

 

SCN Myscript

 

Ref rAmmoHit

 

Begin OnTriggerEnter

 

Set rAmmoHit to GetActionRef

 

End

 

Begin GameMode

 

If rAmmoHit == BMDLC03TeslaChainProjectile

 

; Do some damage ???

Edited by Mktavish
Link to comment
Share on other sites

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 by uhmattbravo
Link to comment
Share on other sites

  • 5 weeks later...

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 iPlayer
Int iArc
Short DoOnceDmg
Float Timer
Ref rAmmoHit
Begin OnTriggerEnter Player
Set iPlayer to 1
Set iArc to 0
End
Begin OnTriggerLeave Player
Set iPlayer to 0
End
Begin OnTriggerEnter
Set rAmmoHit to GetActionRef
If rAmmoHit.GetIsID BMDLC03TeslaChainProjectile == 1
Set iArc to 1
endif
End
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
endif
endif
End
~~~~~~~~~~~~~~~
Edited by Mktavish
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...