Themabewertung:
  • 0 Bewertung(en) - 0 im Durchschnitt
  • 1
  • 2
  • 3
  • 4
  • 5
Kerzenflamme an/aus
#1
Hallo zusammen,
kennt jemand ein Script womit man
eine Kerzenflamme an und wieder ausschalten
kann (z.B. Advetskranz)?

Lg
Raul
Zitieren
#2
Ich kenne dein Objekt nicht, daher hier mal ein Partikelskript, das eine Flamme durch Anklicken ein- und ausschaltet.
Es gibt allerdings auch die Möglichkeit, Flammen mittels Textur(animation) darzustellen- dazu bräuchte es dann wieder ein anderes Skript, was dann aber auch in Abhängigkeit der Textur eingestellt werden muss (je nachdem aus wievielen Einzelbildern die Textur waagrecht und senkrecht besteht) ...

Code:
float       giHeight    = 2.0;                                              // Change this value to alter height.
integer     giLighted   = TRUE;                                          
Flame()
{
     llParticleSystem([
        PSYS_PART_FLAGS, 0 | PSYS_PART_EMISSIVE_MASK | PSYS_PART_INTERP_COLOR_MASK | PSYS_PART_INTERP_SCALE_MASK |
        PSYS_PART_FOLLOW_VELOCITY_MASK | PSYS_PART_BOUNCE_MASK,
        PSYS_SRC_PATTERN,PSYS_SRC_PATTERN_ANGLE,
        PSYS_PART_START_COLOR, <1.0, 0.5, 0.0>,
        PSYS_PART_END_COLOR, <1.0, 1.0, 0.0>,
        PSYS_PART_START_SCALE, <0.06000, 0.08000, 0.06000> * giHeight,
        PSYS_PART_END_SCALE, <0.04000, 0.08000, 0.06000> * giHeight,
        PSYS_SRC_ACCEL, <0.00000, 0.00000, 0.00000>,
        PSYS_PART_MAX_AGE, 0.30000 * giHeight,
        PSYS_SRC_BURST_RATE, 0.020000,
        PSYS_SRC_BURST_PART_COUNT, 10,
        PSYS_SRC_BURST_RADIUS, 0.001000,
        PSYS_SRC_BURST_SPEED_MIN, 0.100000,
        PSYS_SRC_BURST_SPEED_MAX, 0.500000,
        PSYS_SRC_INNERANGLE, 1.550000,
        PSYS_SRC_OUTERANGLE, 1.540000,
        PSYS_SRC_OMEGA, <0.00000, 0.00000, 5.00000>,
        PSYS_SRC_MAX_AGE, 0.000000,
        PSYS_PART_START_ALPHA, 1.000000,
        PSYS_PART_END_ALPHA, 0.100000
    ]);
}

Smoke()
{
    llParticleSystem([
        PSYS_PART_FLAGS, 0 | PSYS_PART_EMISSIVE_MASK | PSYS_PART_INTERP_COLOR_MASK | PSYS_PART_INTERP_SCALE_MASK |
        PSYS_PART_FOLLOW_VELOCITY_MASK | PSYS_PART_BOUNCE_MASK,
        PSYS_SRC_PATTERN,PSYS_SRC_PATTERN_ANGLE,
        PSYS_PART_START_COLOR, <0.2, 0.2, 0.2>,
        PSYS_PART_END_COLOR, <0.4, 0.4, 0.4>,
        PSYS_PART_START_SCALE, <0.06000, 0.08000, 0.06000> * giHeight,
        PSYS_PART_END_SCALE, <0.04000, 0.08000, 0.06000> * giHeight,
        PSYS_SRC_ACCEL, <0.00000, 0.00000, 0.50000>,
        PSYS_PART_MAX_AGE, 2.0000 * giHeight,
        PSYS_SRC_BURST_RATE, 0.20000,
        PSYS_SRC_BURST_PART_COUNT, 10,
        PSYS_SRC_BURST_RADIUS, 0.001000,
        PSYS_SRC_BURST_SPEED_MIN, 0.100000,
        PSYS_SRC_BURST_SPEED_MAX, 0.500000,
        PSYS_SRC_INNERANGLE, 1.550000,
        PSYS_SRC_OUTERANGLE, 1.540000,
        PSYS_SRC_OMEGA, <0.00000, 0.50000, 5.00000>,
        PSYS_SRC_MAX_AGE, 0.000000,
        PSYS_PART_START_ALPHA, 1.000000,
        PSYS_PART_END_ALPHA, 0.100000
    ]);
    llSleep(1.5);                                                          
    llParticleSystem([]);                                                  
}

default
{
    state_entry()
    {
        Flame();
    }

    on_rez(integer iStartParameter)
    {
        llResetScript();
    }

    touch_start(integer iNumberTouching)
    {
        integer i = 0;
        do {
            if (giLighted)
            {
                Smoke();
                giLighted = FALSE;                                          
            }
            else
            {
                Flame();
                giLighted = TRUE;                                            
            }
            ++i;
        } while (i < iNumberTouching);

    }
}
Man darf nicht alles glauben was im Internet steht, nur weil es eine berühmte Person gesagt haben soll....
Friedrich Schiller
Zitieren
#3
Kerzen- oder Oellampenlicht zum an und aus machen:

// Candle Flame version 3

string szFlameOn = "pfft";

integer OnChannel = 5395;
integer OffChannel = 5396;
integer controlChannel = 5397;

//float reSpawnTime = 0.5; // How often to re-rez candle flames
float reSpawnTime = 0.1; // this is kind of an evil number. 1 more evil number in this script

float randomRange = 16234;
integer lastRandom = 65535; // Unpossible for this to be set initially

string messageHeader = "FC Candle Message: ";
string messageStatus = "Status Request";
string messageFlameRate = "Set Flamerate ";

integer messageHeaderLength;
integer fireOn = 0;

integer fireTextureSet = 0;
integer lastFlameRezzed = 0;


doFlame() {
if ( !fireOn ) {
llSetTouchText("Light");
llParticleSystem([]);
}
else {
llSetTouchText("Blow Out");
llParticleSystem([
PSYS_PART_MAX_AGE, 3.0,
PSYS_PART_FLAGS, PSYS_PART_EMISSIVE_MASK|PSYS_PART_INTERP_SCALE_MASK|
PSYS_PART_INTERP_COLOR_MASK|PSYS_PART_FOLLOW_SRC_MASK,
PSYS_PART_START_COLOR, <1,1,1>,
PSYS_PART_END_COLOR, <1,1,1>,
PSYS_PART_START_SCALE,<0.062,0.062,0.062>,
PSYS_PART_END_SCALE,<0.062,0.100,0.062>,
PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_DROP,
PSYS_SRC_BURST_RATE,reSpawnTime,
PSYS_SRC_ACCEL, <0,0,0.008>,
// PSYS_SRC_BURST_PART_COUNT,1,
PSYS_SRC_BURST_PART_COUNT,3, // evil number.
PSYS_SRC_MAX_AGE, 0.0,
PSYS_SRC_TEXTURE, "candleflame4",
PSYS_PART_START_ALPHA, 0.3,
PSYS_PART_END_ALPHA, 0.25
]);
}
}

toggleFlame() {
fireOn = !fireOn;
doFlame();
llSetColor( <1,1,1>, ALL_SIDES );
llSetTexture( "a56ec37f-5674-aaa3-36b8-be8891d1e271", ALL_SIDES );
}

default {
state_entry() {
messageStatus = messageHeader + messageStatus;
messageFlameRate = messageHeader + messageFlameRate;
messageHeaderLength = llStringLength(messageHeader);
lastRandom = llFloor(llFrand(randomRange));
llListen(0, "", "", "");
llListen(controlChannel, "", "", "");
toggleFlame();
}
on_rez(integer start_param) {
lastRandom = llFloor(llFrand(randomRange));
fireOn = TRUE;
doFlame();
}
touch_start(integer total_number) {
//llWhisper( 0, (string) llGetOwner() );
toggleFlame();
lastRandom = llFloor(llFrand(randomRange));
}
listen(integer channel, string name, key id, string message) {
if ( channel == 0 ) {
if ( message == szFlameOn ){
llParticleSystem([]);
llParticleSystem([ PSYS_PART_MAX_AGE, 2.0,
PSYS_PART_FLAGS, PSYS_PART_EMISSIVE_MASK|
PSYS_PART_INTERP_COLOR_MASK|PSYS_PART_INTERP_SCALE_MASK,
PSYS_PART_START_COLOR, <1,1,0>,
PSYS_PART_END_COLOR, <1,0,0>,
PSYS_SRC_BURST_RATE, 0.001,
PSYS_SRC_BURST_PART_COUNT, 2,
PSYS_SRC_INNERANGLE,3.14,
PSYS_SRC_OUTERANGLE,3.13,
PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_ANGLE,
PSYS_PART_START_ALPHA, 1.0,
PSYS_PART_END_ALPHA, 0.0,
PSYS_SRC_MAX_AGE, 5.0,
PSYS_PART_START_SCALE, <0.01, 0.01, 0.01>,
PSYS_PART_END_SCALE, <0.5, 0.5, 0.5>,
PSYS_SRC_BURST_SPEED_MIN,0.4,
PSYS_SRC_BURST_SPEED_MAX,0.7
] );
llSleep(6);
doFlame();
}
}
else {
if ( llSubStringIndex(message, messageStatus) == 0 ) {
if ( fireOn )
llSay( OnChannel, messageHeader + (string)lastRandom );
else
llSay( OffChannel, messageHeader + (string)lastRandom );
}
if ( llSubStringIndex(message, messageFlameRate) == 0 ) {
integer lastChar = llStringLength(message);
lastChar--;
reSpawnTime = (float)llGetSubString(message, llStringLength(messageFlameRate), lastChar);
//llSay( 0, "Flame rez time set to: " + (string)reSpawnTime );
}
else if ( message == messageHeader + (string)lastRandom ) {
toggleFlame();
}
}
}
}


Du brauchst aber noch eine Flammentextur, wie die z.B.: UUUID 5fb33268-a068-4814-bf60-1a88eb6ef810
Zitieren
#4
Danke für eure Hilfe, :-) werde es ausprobieren.
Zitieren


Gehe zu:


Benutzer, die gerade dieses Thema anschauen: 1 Gast/Gäste