CollisionSet problem....

About advanced scenes, and the Thyme scripting language used in Algodoo.

CollisionSet problem....

Postby War Men » Sun Jun 20, 2010 2:41 pm

hi im working on my AH-64D Apache scene (http://www.algodoo.com/forum/viewtopic.php?f=18&t=2358) and i have a problem...
the missile changes the collideSet of the object that it hits. but if the missile hits the plane, the plane's collideSet also changed.
i only want to change the object's collideSet if it is not immortal, so if the object is immortal its collideSet wont change.

i already tried but it didn't work
Code: Select all
(e.other.immortal == true ? {e.other.collideSet = 8} :{})

i am not very good at scripting...

so can you help?? plz...... whats wrong??
Image <~~ my latest scene (on progress) Click it!
My scene's
User avatar
War Men
 
Posts: 26
Joined: Mon Apr 12, 2010 1:25 pm
Location: Indonesia

Re: CollisionSet problem....

Postby Scorpion » Sun Jun 20, 2010 3:04 pm

I think If structures Don't work with True and False parameters.
a way to fix this is to use a setting that you don't use in the scene.

I'll asume you don't use Controlleracc in your scene, if so, you can do this :

Change the Controlleracc from the object thats got to be hit by the misile (which collideset needs to be changed) to (for example) 5.

Then take the following script :

Code: Select all
e.other.ControllerAcc == 5 ? {e.other.collideSet = 8} :{}


This should solve it
Scorpion
 
Posts: 9
Joined: Wed Apr 21, 2010 8:35 pm

Re: CollisionSet problem....

Postby War Men » Sun Jun 20, 2010 3:35 pm

thank you so much it worked!..
Image <~~ my latest scene (on progress) Click it!
My scene's
User avatar
War Men
 
Posts: 26
Joined: Mon Apr 12, 2010 1:25 pm
Location: Indonesia

Re: CollisionSet problem....

Postby daniels220 » Sun Jun 20, 2010 5:10 pm

I think you could also just do:

Code: Select all
e.other.immortal ? {e.other.collideset = 8} : {}


checking the boolean directly, without an ==.
daniels220
 
Posts: 95
Joined: Mon Aug 31, 2009 11:30 pm

Re: CollisionSet problem....

Postby War Men » Mon Jun 21, 2010 2:44 am

Really? Damn..... Hey it works!! thx anyway...
Image <~~ my latest scene (on progress) Click it!
My scene's
User avatar
War Men
 
Posts: 26
Joined: Mon Apr 12, 2010 1:25 pm
Location: Indonesia

Re: CollisionSet problem....

Postby itsallinyourhead » Thu Jul 01, 2010 5:39 am

I've never posted any of my scenes before, and I'll warn you that most of what I do or have learned is self-taught. With that, take what I say with a grain of salt, and feel free to laugh or point fingers. It doesnt bother me. :)

I would suggest using one single layer as a 'destroy' layer. I use layer e a lot for this, cuz I also use the k-probes alot and they need f and g. I also have done a lot of experimenting with 'labeling' my scenes. For a tank shooting missiles, I actually set the text displayed for each part of each object as what it's a part of. For instance, the barrel, frame, tires, track, and body of my tank all display the text "tank". Making the text dissappear is key, or the scene is worthless. I then use oncollide scripting to ensure the missile does not "attack" it's own tank, by if'ing it to not detonate if it collides with the barrel of the gun. If the oncollide of the missile gets the text "tank" when it collides, the script does not activate.
Not pretty, it does add a bit of coding, but it works for the most part. Also, using a dedicated layer for destroying means that I can set the missile to generate a small invisible circle with collideset:=16, then reset all the collidesets of the missile parts to 16, then set all parts in the collision to kill. The missile hits it's target, changes the collision set to 16, generates a killer circle, changes itself to kill, annihates the whole mess, and wa-laa, self-destroying missile. Encoding the generated circle to actually be the one to change the missile's collision to 16, then it's own collision to 16 gives a momentary pause where the circle actually has a collision setting that allows it to collide with it's target. If you generate that circle with the appropriate texture, it looks like an explosion.
itsallinyourhead
 
Posts: 3
Joined: Thu Jul 01, 2010 5:26 am


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 1 guest