Capture emitter gives digitalis when connected?

Started by Mexxor, November 15, 2014, 09:32:24 AM

Previous topic - Next topic

Mexxor


# CaptureEmitter.crpl
# Created on: 10/11/2013 6:28:22 PM
# ------------------------------------------

$amount:20
$interval:15
$cost:1

once
Self CONST_AMMO 0 SetUnitAttribute
1 ->state
endonce

Self CONST_AMMO GetUnitAttribute <-cost lt if
CurrentCoords <-amount AddCreeper
CurrentCoords true SetDigitalisGrowth
CurrentCoords 1 SetDigitalis
1 ->state
else
CurrentCoords 0 <-amount sub AddCreeper
Self CONST_AMMO Self CONST_AMMO GetUnitAttribute <-cost sub SetUnitAttribute
-1 ->state
endif

"Amt: " <-amount <-state mul concat
"
Interval: " <-interval 30.0 div 2 round concat concat
SetPopupText <-amt

<-interval Delay


As seeable in the code the emitter still gives digi lfie when connected, how can I change that so it only creates digi when emitting creeper?
Thanks in advance
Mexxor

Edit: accidentally put in the script for flip instead of capture  :-\
"Tell people there's an invisible man in the sky who created the universe, and the vast majority will believe you. Tell them the paint is wet, and they have to touch it to be sure."
― George Carlin

J


Mexxor

Quote from: J on November 15, 2014, 09:40:05 AM
Use SetUnitAttribute (CRPL wiki) and change CONST_SUPPORTSDIGITALIS.

Ehm, should I remove the Setdigitalisgrowth and make it Const_supportsdigitalis then?
(Edited previous post to match what I was saying)
"Tell people there's an invisible man in the sky who created the universe, and the vast majority will believe you. Tell them the paint is wet, and they have to touch it to be sure."
― George Carlin

J

Didn't test, but this should work:

# CaptureEmitter.crpl
# Created on: 10/11/2013 6:28:22 PM
# ------------------------------------------

$amount:20
$interval:15
$cost:1

once
Self CONST_AMMO 0 SetUnitAttribute
1 ->state
endonce

Self CONST_AMMO GetUnitAttribute <-cost lt if
CurrentCoords <-amount AddCreeper
CurrentCoords true SetDigitalisGrowth
        Self CONST_SUPPORTSDIGITALIS True SetUnitAttribute
CurrentCoords 1 SetDigitalis
1 ->state
else
CurrentCoords 0 <-amount sub AddCreeper
        Self CONST_SUPPORTSDIGITALIS False SetUnitAttribute
Self CONST_AMMO Self CONST_AMMO GetUnitAttribute <-cost sub SetUnitAttribute
-1 ->state
endif

"Amt: " <-amount <-state mul concat
"
Interval: " <-interval 30.0 div 2 round concat concat
SetPopupText <-amt

<-interval Delay