I'm trying to make an if/else statement (in Director MX) and I can't figure out
how to get it working properly. There is a ship in my 3D world that already
exists called "ship3" (imported over to Director as a W3D file named "world").
I want Director to look for the ship. If its there, then I want it to apply a
collision modifier to it (so that if it is hit by the bullet object, it will
recognize a collision).

If it isn't there, then I want it to not apply the modifier (meaning the ship
was destroyed by the bullet and is no longer there). I have it on a exitFrame
statement.

on exitFrame me

if sprite(me.spriteNum).member.model("ship3") = TRUE then
sprite(me.spriteNum).member.model("ship3").addModi fier(#collision)
else
sprite(me.spriteNum).member.model("ship3").removeM odifier(#collision)
end if

end

Ultimately I want to be able to shoot the ship and destroy it (the user fires
at it and it is deleted from the world when the bullet hits the object).

If you need the director file, I've uploaded it to my server (
[url]http://www.taranwilson.com/temporary/game.zip[/url] ). If you can give me any
assistance at all, I would greatly appreciate it.

I'm still rather a novice when it comes to Lingo I know what I want to do, its
just hard for me to get it executed sometimes. Anyways, that kind of sort of
works. It applies the collision modifier like I need it to, however I need it
removed once the ship is destroyed. My problem comes when I shoot the ship, it
disappears. Then Director tries to apply the modifier to the ship again, but it
doesn't exist. So I need to find a way for it to not do that after the ship has
been destroyed.

I have the following statement in a behavior that is applied to the the W3D
file. It is within a exitFrame structure....


if NOT VoidP(sprite(me.spriteNum).member.model("ship3")) then
sprite(me.spriteNum).member.model("ship3").addModi fier(#collision)
else
sprite(me.spriteNum).member.model("ship3").removeM odifier(#collision)
end if


The "removeModifier" part isn't working. It worked for the bullets (for when
they hit something), but it doesn't work in this instance.

A difference between the two is that the bullet objects are created when the
user presses the mouse button down. The ship is built into the W3D file. Maybe
that effects it, I'm not sure. I also have this bit of code in if it helps
any...


on pCollision(me, collisionDataObject)
-- a collision occured between this bullet and something else

case TRUE of
-- if the following collision is met

((collisionDataObject.modelA).name contains "ship3"):
-- the bullet model hit a target

w.deleteModel((collisionDataObject.modelA).name)
-- delete the target

x = w.model(pModelName)
-- make a temporary reference to the bullet model


if NOT voidP(x) then
-- if the bullet has not already been destroyed then

w.model((collisionDataObject.modelB).name).removeM odifier(#collision)
-- remove the collision modifier from the bullet

w.deleteModel((collisionDataObject.modelB).name)
-- delete the bullet model
end if


otherwise:
-- Kill bullets that run into other bullets

x = w.model((collisionDataObject.modelB).name)
-- make a temporary reference to the bullet model

if NOT voidP(x) then
-- if the bullet has not already been destroyed then

w.model((collisionDataObject.modelB).name).removeM odifier(#collision)
-- remove the collision modifier from the bullet

w.deleteModel((collisionDataObject.modelB).name)
-- delete the bullet model
end if

end case

end


That mainly just applies to the bullets. You can view a demo of it here (
[url]http://www.taranwilson.com/mm444/sots4.html[/url] ). You need Shockwave of course.
Its a 10MB file.