Jump to content

Disable Trigger Box on Destruction of an Object


Laerithryn

Recommended Posts

If your object is "Destructible", then the way to is what dylbill posted.

If by "on the destruction of a specific object?" you mean that the objects gets disabled, then it should be handled by the same script that 'Disables' that object.

Link to comment
Share on other sites

Really appreciate the responses both Dylbill & Maxarturo, the thing is, I'm batting zero for scripting and have no clue how to add that event "OnDestructionStageChanged".

 

On my object ActivatorScript I looked and found the following entry:

Event OnDestructionStageChanged(int aiOldStage, int aiCurrentStage)
int DamageID = OBJCWBarricadeDamage.Play(self)
if (aiOldStage == OldStage) && (aiCurrentStage == NewStage)
;Trace("DARYL - " + self + " destroyed, disabling navmesh cut.")
int DestroyedID = OBJCWBarricadeDestroyed.Play(self)
CollisionLink.Disable()
endif
EndEvent
But my Trigger Box is using a separate script to provide damage upon entering the box. So do I add the OnDestructionStageChange to that script or somehow link the Trigger Box to the Object's script?
Any help will greatly appreciated.
Link to comment
Share on other sites

You can still do it with the default script, but you will have to choose to either have a 'Collision' or your 'Trigger Box' disabled.


Create a "NEW ID" / a new object of the destructible, remove its script and create a new script with the one given below.


This will only work if the object is "Destructible".



ObjectReference Property CollisionLink Auto
Sound Property OBJCWBarricadeDamage Auto
Sound Property OBJCWBarricadeDestroyed Auto

ObjectReference Property MyTriggerBox Auto
{Link Ref your Damaging Trigger Box}

Int Property OldStage = 1 Auto
{The destruction stage that is before the stage you want to trigger at - Default = 1}

Int Property NewStage = 2 Auto
{The destruction stage that you want the trigger to happen at - Default = 2}

int DamageID
int DestroyedID

EVENT OnDestructionStageChanged(int aiOldStage, int aiCurrentStage)
int DamageID = OBJCWBarricadeDamage.Play(self)
If (aiOldStage == OldStage) && (aiCurrentStage == NewStage)
int DestroyedID = OBJCWBarricadeDestroyed.Play(self)
CollisionLink.Disable()
MyTriggerBox.Disable()
Endif
ENDEVENT



Remember to fill in correctly the script's properties, otherwise nothing will happen !.


* This is just tip to make things easier for the one trying to provide help, in the future post the whole script.



EDIT: Another way you can do this using the default vanilla stuff is to.

- Go to the trigger box properties in the tab "Enable Parent" and link it to the collision, so when the object gets destroyed the collision will be disable and with the collision so the trigger box will also be disable.



Have a pleasant day.

Link to comment
Share on other sites

Thank you Maxarturo, thank you very much indeed.

 

Ok, your script would not compile at in CK at first until I removed both "int DamageID" and "int DestroyedID" after that it compiled ok.

I did a quick run through and it didn't work even after adding your additions to the old script and still nothing.

It is more than likely me doing something wrong, so I'll try again prolly tomorrow as I have real word issues I have to tend to first. I'm including the Object's script though in case you see the problem.

 

Scriptname StockadeBarricade01ActivatorScript extends ObjectReference  

import debug

ObjectReference Property MyDmgTrigger Auto

Int Property OldStage = 3 Auto

Int Property NewStage = 4 Auto

Sound Property OBJCWBarricadeDamage Auto
Sound Property OBJCWBarricadeDestroyed Auto

ObjectReference CollisionLink 

Event OnLoad()

if GetCurrentDestructionStage() < NewStage
CollisionLink = GetLinkedRef()
CollisionLink.Enable()
EndIf
EndEvent

Event OnUnload()

if (CollisionLink != None)
CollisionLink.Disable()
CollisionLink = None
EndIf
EndEvent

Event OnDestructionStageChanged(int aiOldStage, int aiCurrentStage)

int DamageID = OBJCWBarricadeDamage.Play(self)

if (aiOldStage == OldStage) && (aiCurrentStage == NewStage)
int DestroyedID = OBJCWBarricadeDestroyed.Play(self)
CollisionLink.Disable()
MyDmgTrigger.Disable()
endif
EndEvent
Link to comment
Share on other sites

It wouldn't compile because of force of habit, some things are subconsciously automatically done.

Removing the "Int" would compile the script since it's already define inside the event.


First of all DON'T EVER MODIFY A VANILLA SCRIPT !!!!!. If you need to change something on a vanilla script to serve your purpose, then MAKE YOUR OWN SCRIPT !, create a new script.


I hope that you won't get offended, but i can see that you are at the very beginning of your moding experience, so i would suggest the following:

1) In CK search for a cell that has a "Stockable Barricade" all setted up, and study how it is all made / place in the world.

2) Once you have understanded the above, then do not trouble yourself with making a new script, instead use the alternative option i offered you.

- Go to the trigger box properties (double klick the trigger box) in the tab "Enable Parent" and link it to the collision box, so when the object gets destroyed the collision will be disable and with the collision so the trigger box will also be disable.


If you have any question don't hesitate to ask.

Just an advice: Don't go from A to Z, but take one step at the time, there is much to learn ahead.


Have a happy modding.

Link to comment
Share on other sites

 

It wouldn't compile because of force of habit, some things are subconsciously automatically done.
Removing the "Int" would compile the script since it's already define inside the event.
First of all DON'T EVER MODIFY A VANILLA SCRIPT !!!!!. If you need to change something on a vanilla script to serve your purpose, then MAKE YOUR OWN SCRIPT !, create a new script.
I hope that you won't get offended, but i can see that you are at the very beginning of your moding experience, so i would suggest the following:
1) In CK search for a cell that has a "Stockable Barricade" all setted up, and study how it is all made / place in the world.
2) Once you have understanded the above, then do not trouble yourself with making a new script, instead use the alternative option i offered you.
- Go to the trigger box properties (double klick the trigger box) in the tab "Enable Parent" and link it to the collision box, so when the object gets destroyed the collision will be disable and with the collision so the trigger box will also be disable.
If you have any question don't hesitate to ask.
Just an advice: Don't go from A to Z, but take one step at the time, there is much to learn ahead.
Have a happy modding.

 

 

No offense taken my friend, at 58 I've learned by now that constructive criticism is a welcome thing. And your right this is my first Skyrim mod and first time with CK, despite working on this mod on and off for the past 6 months or so. Started off as a plain Race Mod, turned into that plus followers. Now I'm trying to put together a quest to go along with the theme. Lots of learning curves for teaching an old dog like me some new tricks. The only modding experience I have other than this was back in 2006 with "Neverwinter Nights 2" cutting my teeth on Python scripting language and than prior to that was back in 1995 modding the hell out of the original "Doom" FPS by id Software. I'll eventually get this mod the way I want it even if it takes another 6 months (hoping not).

 

I'll give CK a good gander this weekend to search for an example like you mentioned when I'm not pressed for time. Again, my sincere gratitude Maxarturo!!!

 

If your curious what I'm making:

 

 

 

 

Ok, this is an older generation thing perhaps so here's a couple more hints.

 

Sammy Hagar - Heavy Metal [720P] 3:55
Don Felder - Heavy Metal (Takin' a Ride) [1080P] 4:55

Link to comment
Share on other sites

I'm an 'Old Dog' like you that has been into pcs since the first Spectrum was release back in the early 80, and i've been modding since the early 90, and even earlier than that if i do remember correctly.

What i can tell you is that 'Old Dogs' with this much experience and knowledge in their backs learn 100x faster than any young fellow.


Small tip: To make things easier for you construct a 'Test Cell' in you mod which you will 'COC' and do all your experiments in there which you can delete when you finish with your project, and above all do not hesitate to ask for assistance when you are stuck or not 100% sure about something !, there are quite a few experienced modders that are more than willing to share knowledge and provide assistance.


Have a happy modding.

Link to comment
Share on other sites

Thanks for the quick response Max, I've been using a small esp I made with the test cell in that, but I suppose it wouldn't hurt to put it into my mod as it would save having to recreate it again later. You've been extremely helpful Max! Again, appreciate the feedback man. Cheers!!!

Link to comment
Share on other sites

  • Recently Browsing   0 members

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