Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

Pointing to an object base rather than a reference


TripleSixes
 Share

Recommended Posts

Trying to get it to work...OnHit, the object gets disabled. That works, but only on a single reference, i want to apply it to the base object so every instance of that object carries out the script.

Scriptname TISOnHitLootDrop extends ObjectReference  

{Player strikes object, object disappears, sound and visual fx play, loot drops}


ObjectReference Property SmashCont Auto ;Smashable Object


Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, \

bool abBashAttack, bool abHitBlocked) ;Player hits object with virtually anything...

SmashCont.Disable() ;BOOM! Object Is Destroyed/Disabled


EndEvent

I'm thinking i need to replace the objectreference property, but with what? Container doesnt work as the script doesnt compile

Link to comment
Share on other sites

It is attached to a duplicate of a barrel container. If i attach the script to each reference, i cannot point the script at the object it is attached to, as it wont let me choose it as an obj reference. The only way i've gotten it to work correctly is by attaching the script to the base object, and pointing it to a reference, then that single objref works perfect, but wont work on any other references i have<

Sorry. did that make sense? i read it after i typed it and was like "what did i just read" lol

Link to comment
Share on other sites

If the script is on the base object, you do not need to provide a reference.

Normally you preference what you want the function to act on, like this:

myBarrelREF.Disable()

But if the script is ON the barrel already, you only need to code:

Disable()

And it will run on every individual reference of that barrel individually of each other, since the script is on the base object of the barrel.

Edited by WillieSea
Link to comment
Share on other sites

If the script is on the base object, you do not need to provide a reference.

Normally you preference what you want the function to act on, like this:

myBarrelREF.Disable()

But if the script is ON the barrel already, you only need to code:

Disable()

And it will run on every individual reference of that barrel individually of each other, since the script is on the base object of the barrel.

Such a simple change, yet, such a large difference!!! You are the best Willie! Thank you!

im working on getting some sound and effects to play after the object disables. here is how things are looking:

Scriptname TISOnHitLootDrop extends ObjectReference

{Player strikes object, object disappears, sound and visual fx play, loot drops}

Static Property Debris Auto

Sound Property Smash Auto

VisualEffect Property Dust Auto

Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, \

bool abBashAttack, bool abHitBlocked) ;Player hits object with virtually anything...

Disable() ;Object Is Destroyed/Disabled

int instanceID = Smash.play(Self) ; BOOM!

Dust.Play(Self, afTime = 3.0); Airborn Dust

PlaceAtMe(Debris) ;Place debris

EndEvent

The debris that remains after the fact works fine. Im having trouble getting the audio and visual effects to work... Any ideas?

Link to comment
Share on other sites

I have not tested this in Skyrim, but when you 'disable' an object with a script on it, the script stops at the disable.

Try moving the disable to just before the EndEvent.

I have not played with the 'play' command yet, so really could not help there.

If they are used in the game already, check to see how they are used.

Link to comment
Share on other sites

I've used play quite a few times (12+ times), If I'm not mistaken, all you need is:

Smash.play(Self) ; BOOM!
I've never used the "int instanceID =" part before so I'm not sure what effects it can cause. This is from one of my scripts:
aaDSoSEeriePianoBang.play(GetPlayer())

I do "Import Game" at the top of the script, so I'm not required to do Game.GetPlayer()

For the Disable():

Even though the script may finish, its not guaranteed to work 100% of the time. So I agree with Willie on this, (I always) place "Disable()" very last, just for the insurance that everything will fire like it should.

Link to comment
Share on other sites

I've used play quite a few times (12+ times), If I'm not mistaken, all you need is:

Smash.play(Self) ; BOOM!
I've never used the "int instanceID =" part before so I'm not sure what effects it can cause. This is from one of my scripts:
aaDSoSEeriePianoBang.play(GetPlayer())

I do "Import Game" at the top of the script, so I'm not required to do Game.GetPlayer()

For the Disable():

Even though the script may finish, its not guaranteed to work 100% of the time. So I agree with Willie on this, (I always) place "Disable()" very last, just for the insurance that everything will fire like it should.

Very interesting!

I'm currently away from the lab(home) and will test this when I return

Link to comment
Share on other sites

Scriptname TISOnHitLootDrop extends ObjectReference

{Player strikes object, object disappears, sound and visual fx play, loot drops}

Import Game

Import Sound

Static Property Debris Auto

Sound Property Smash Auto

VisualEffect Property Dust Auto

LeveledItem Property Loot Auto

Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, \

bool abBashAttack, bool abHitBlocked) ;Player hits object with virtually anything...

Smash.play(Self) ; BOOM!

Dust.Play(Self, afTime = 3.0); Airborn Dust

PlaceAtMe(Debris) ;Place debris

Self.DropObject(Loot)

Disable() ;Object Is Destroyed/Disabled

EndEvent

Link to comment
Share on other sites


Dust.Play(Self, 3.0); Airborn Dust


PlaceAtMe(Debris) ;Place debris

What objects are you using for these?

Reason I'm asking is that I used some ashes, and they were nearly 100% invisible when on the ground :shrug:

I used "firewoodsmall" for the debris, its not perfect, but will suffice while i model an alternative or find a new one. For the FX, im using dustdrop, but obviously i'm still looking for a replacement for this too. I've also noticed that the placed object fades in, i wish I could get it to "pop" in, if you know what I mean..

Link to comment
Share on other sites

so i gave the script a try, and the sound shot off as planned, but only once, all other references didn't execute the sound. I thought maybe it was due to the sound not ending, thus not allowing it to reoccur. So i tried play and used Utility.Wait(custom wait time). It works near perfect, but still, the object doesnt disable until the sound is done executing, and it wont execute the sound if the disable is infront of it(like you said, it complicates things), i really need to get the object to disable at the same time or before the sound line, this could help with a destroyable object mod later. Is there a way to achieve such a thing?


Scriptname TISOnHitLootDrop extends ObjectReference  

{Player strikes object, object disappears, sound and visual fx play, loot drops}


Import Game

Import Sound

Static Property Debris Auto

Sound Property Smash Auto

VisualEffect Property Dust Auto

LeveledItem Property Loot Auto


Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, \

bool abBashAttack, bool abHitBlocked) ;Player hits object with virtually anything...


Smash.Play(Self) ; BOOM!


Utility.Wait(0.875)


Dust.Play(Self, afTime = 3.0); Airborn Dust


PlaceAtMe(Debris) ;Place debris


Self.DropObject(Loot)


Disable() ;Object Is Destroyed/Disabled


EndEvent

And the VFX line "dust" isnt working, as well as drop item. We cant blame this on the disable line as it's last

EDIT: Substituted the Self.DropObject(Loot) with Game.GetPlayer().AddItem(Loot, 1), that command worked, but it isnt the same feel....

Edited by TripleSixes
Link to comment
Share on other sites

I used "firewoodsmall" for the debris, its not perfect, but will suffice while i model an alternative or find a new one. For the FX, im using dustdrop, but obviously i'm still looking for a replacement for this too. I've also noticed that the placed object fades in, i wish I could get it to "pop" in, if you know what I mean..

I couldn't find "FireWoodSmall" in the CK anywhere.

Do you want it to look just like a smashed barrel, or something else?

Link to comment
Share on other sites

I'm working on the script right now and have it to its basics, but I've ran into an odd issue...

I have 3 barrels with the script on it, I can hit one and it does its thing, but the other 2 does nothing.

When you were testing, could you hit multiple barrels and they each do their own thing??

Link to comment
Share on other sites

I have made barrels destructable. I pretty much figured it out myself.

Click the add destruction button and take a look at the window. You can add explosions, wreckage, all sorts of stuff.

Its pretty easy stuff.

Take a look at the >MovableStatic object, StockadeBarricade01DONOTUSE

Or the >Activator object, StockadeBarricade01Activator

And click the 'Edit Destruction Data' button.

Then in the list, double-click on each line to see what they are doing.

Edited by WillieSea
Link to comment
Share on other sites

I have made barrels destructable. I pretty much figured it out myself.

Click the add destruction button and take a look at the window. You can add explosions, wreckage, all sorts of stuff.

Its pretty easy stuff.

Take a look at the >MovableStatic object, StockadeBarricade01DONOTUSE

Or the >Activator object, StockadeBarricade01Activator

And click the 'Edit Destruction Data' button.

Then in the list, double-click on each line to see what they are doing.

Are you saying that the effects that i have been trying to get could have been added in the CK????? Great! :D Less work for me then!

@Dsos

Can I take a look your script? i ran into the same problem but fixed it when I redid the entire thing lol :P

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...