I wrote up what I think to be a simple collision test to see if my slice collision works. It looks like so:
Code: Select all
script, checkCollisions, begin
if (SliceCollide (sli:Hitbox1, sli: Bullet1)) then (
DestroyNPC (0)
)
end
Invalid slice handle 261
These slices do exist in my slice collections, so why the error? They have also been exported to an HSI included in my script to clarify things.
EDIT:
I have just updated my script to this. It got rid of the error but still no collision is recognized since the NPC is not being destroyed... Any ideas why? I'm positive these slices are making contact.
Code: Select all
script, checkCollisions, begin
if (slice is valid(sli:Hitbox1) && slice is valid(sli:Bullet1)) then(
if (slice collide (sli:Hitbox1, sli:Bullet1)) then(
free slice (sli:Hitbox1)
free slice (sli:Bullet1)
DestroyNPC (0)
)
)
endAfter further realizing that Gizmog and Urkel were discussing something like this earlier I have further revised my code to use handles rather than slices as I made this similar mistake. Still though I am having trouble with getting the code to work. Here's the latest revision of the code:
Code: Select all
script, checkCollisions, begin
if (slice is valid(sli:Hitbox1) && slice is valid(sli:Bullet1)) then(
if (slice collide (LookUpSlice (sli:Hitbox1), LookUpSlice (sli:Bullet1)) == true) then(
destroy NPC (0)
play sound (4, false, true)
)
)
end
