Yonke Ming
Fat Laughing Hyena
Join date: 18 Jun 2005
Posts: 16
|
06-29-2005 12:45
Oh, sorry about the double post. I forgot to mention that I would also like to have variables manipulated between two or more objects.
Let's say that there is a Cat(Object 1) and a Dog(Object 2). ---------------------------------------------------- The Cat is the enemy with Health 30. The Health is stored in Object 1, the cat.
The Dog is the hero with Attack 10. For simplicity, the dog will have the Attack variable.
The dog collides (Or attacks) the cat. The cat loses 10 health BECAUSE the Attack variable on object 2 is 10. If Attack were to be 11, then the cat will lose 11 health. -----------------------------------------------------
Please help if you can.
_____________________
I like Hyenas...
...Especially the soft, fat, squishy, and silly ones!
|
Keknehv Psaltery
Hacker
Join date: 11 Apr 2005
Posts: 1,185
|
06-29-2005 12:50
You can't truly share variables between scripts. What you really need is some sort of communication between the two, probably on a non-zero channel. For example, when the dog attacks, it figures out if it has hit the cat, and then it might say something like "CAT:HP:-10". This would be in the format "[name]:[variable]:[change]". To parse that, you should look into llParseString2List.
|
Johnny Noir
Registered User
Join date: 5 Jan 2004
Posts: 28
|
06-30-2005 07:02
Expanding on the communication point: depending on your situation, you can communicate this stuff in different ways.
For example, if you had a bunch of objects that were going to interact, but their "attack" values, etc. weren't going to change over time, you could have them all exchange info quickly during start-up. Then, when the cat was attacked by the dog, it could look up that dog's info 'locally' and act accordingly.
|