Knuckle Cracker

Creeper World 3 => Custom Map Discussion => Topic started by: wolkiewicz on June 30, 2014, 01:25:36 PM

Title: CRPL problem
Post by: wolkiewicz on June 30, 2014, 01:25:36 PM
Hi
Could someone help me with that script? It is my 2nd script and i dunno what's wrong :/

once Self CONST_REQUESTPACKETS SetUnitAttribute endonce
once Self CONST_ISBUILDING SetUnitAttribute endonce
once Self CONST_BUILDCOST 20 SetUnitAttribute endonce
if "CONST_BUILDCOST" eq0
SetTechLimit("FIRERANGE" 5)
endif

I can connect crpl core to CN but it don't recive packets.
Title: Re: CRPL problem
Post by: planetfall on June 30, 2014, 01:44:29 PM
Try this.


once
   Self CONST_CONNECTABLE true SetUnitAttribute
   Self CONST_REQUESTPACKETS true SetUnitAttribute
   Self CONST_ISBUILDING true SetUnitAttribute
   Self CONST_BUILDCOST 20 SetUnitAttribute
endonce
Self CONST_BUILDCOST GetUnitAttribute eq0 if
   SetTechLimit("FIRERANGE" 5)
endif


edit: whoops, I'm losing my touch :/

If that doesn't work try changing the second CONST_BUILDCOST to CONST_ISBUILDING.
Title: Re: CRPL problem
Post by: Crimson King on June 30, 2014, 02:11:06 PM
First off, you only need one once block to set the attributes. Second, you give no value to the REQUESTPACKETS and ISBUILDING constants. For those constants, 1 is true and 0 is false.

Your if statement doesn't work because the BUILDCOST constant will never equal 0. Try checking against the ISBUILDING constant instead.

Try this:

once
Self CONST_REQUESTPACKETS 1 SetUnitAttribute
Self CONST_ISBUILDING 1 SetUnitAttribute
Self CONST_BUILDCOST 20 SetUnitAttribute
endonce

Self CONST_ISBUILDING ->test
if <-test eq0
SetTechLimit("FIRERANGE" 5)
endif
Title: Re: CRPL problem
Post by: planetfall on June 30, 2014, 02:24:51 PM
Quote from: Crimson King on June 30, 2014, 02:11:06 PM

Self CONST_ISBUILDING ->test
if <-test eq0
SetTechLimit("FIRERANGE" 5)
endif


it should be
<-test eq0 if
OR
if(<-test eq0)

Also you're missing a GetUnitAttribute.
Title: Re: CRPL problem
Post by: Crimson King on June 30, 2014, 03:05:20 PM
Oops about missing the GetUnitAttribute. The syntax is wonky in my code because I used the code provided by the OP and only made the necessary changes to get it to work.
Title: Re: CRPL problem
Post by: wolkiewicz on July 01, 2014, 08:45:48 AM
Thx for help guys! You are the best!