Knuckle Cracker

Creeper World 3 => The Coder's Corner => Topic started by: Mexxor on November 15, 2014, 09:32:24 AM

Title: Capture emitter gives digitalis when connected?
Post by: Mexxor on November 15, 2014, 09:32:24 AM

# 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  :-\
Title: Re: Capture emitter gives digitalis when connected?
Post by: J on November 15, 2014, 09:40:05 AM
Use SetUnitAttribute (http://knucklecracker.com/wiki/doku.php?id=crpl:docs:setunitattribute) (CRPL wiki) and change CONST_SUPPORTSDIGITALIS.
Title: Re: Capture emitter gives digitalis when connected?
Post by: Mexxor on November 15, 2014, 09:52:29 AM
Quote from: J on November 15, 2014, 09:40:05 AM
Use SetUnitAttribute (http://knucklecracker.com/wiki/doku.php?id=crpl:docs: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)
Title: Re: Capture emitter gives digitalis when connected?
Post by: J on November 15, 2014, 10:02:09 AM
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