Knuckle Cracker

Creeper World 3 => The Coder's Corner => Topic started by: stewbasic on January 23, 2014, 11:10:41 AM

Title: GetScriptVar(<-unit 0 ...
Post by: stewbasic on January 23, 2014, 11:10:41 AM
The example on this page:

http://knucklecracker.com/wiki/doku.php?id=crpl:docs:getscriptvar

shows that even units which are not CRPL cores have some variables to get and set. Is there a way to find out what variables are available for each unit?
Title: Re: GetScriptVar(<-unit 0 ...
Post by: Clean0nion on January 23, 2014, 11:21:05 AM
eduran kindly added them to the SetScriptVar page.
Title: Re: GetScriptVar(<-unit 0 ...
Post by: stewbasic on January 23, 2014, 10:30:48 PM
Thanks for the pointer, not sure how I didn't see that.

Do we know that this is a definitive list? I was hoping player units (mortars etc) would expose some variables, like amount built (allowing creation of prebuilt units) or targeting control.

Edit: Also being able to set the energy generation of a reactor would let people do a lot of cool economy stuff. I guess this is partly a feature request and partly a question about whether there's already stuff available that I don't know about :P.
Title: Re: GetScriptVar(<-unit 0 ...
Post by: Flabort on January 23, 2014, 10:39:33 PM
Actually, I was trying to figure that stuff out myself earlier, and couldn't find any answers yet.
Title: Re: GetScriptVar(<-unit 0 ...
Post by: Clean0nion on January 24, 2014, 02:58:22 AM
Quote from: stewbasic on January 23, 2014, 10:30:48 PM
Thanks for the pointer, not sure how I didn't see that.

Do we know that this is a definitive list? I was hoping player units (mortars etc) would expose some variables, like amount built (allowing creation of prebuilt units) or targeting control.

Edit: Also being able to set the energy generation of a reactor would let people do a lot of cool economy stuff. I guess this is partly a feature request and partly a question about whether there's already stuff available that I don't know about :P.
For unit health and ammo, use <-unitUID CONST_HEALTH GetUnitAttribute and <-unitUID CONST_AMMO GetUnitAttribute, respectively. I don't know if other internal functions can be changed, such as energy production. As for changing how mortars target, I'm 99.9% sure that's impossible.
Title: Re: GetScriptVar(<-unit 0 ...
Post by: eduran on January 24, 2014, 03:59:15 AM
Quote from: stewbasic on January 23, 2014, 10:30:48 PM
Do we know that this is a definitive list?

Inhibitors are missing. They use the same variables as emitters. There is probably also a way to set the AE field range (both on towers and inhibs). I very much doubt that player units can be accessed in the same way, but virgil is the only one who could give you a definitive answer in that regard.
Also: http://knucklecracker.com/forums/index.php?topic=15295.0 has some answers about what is/isn't possible.
Title: Re: GetScriptVar(<-unit 0 ...
Post by: knucracker on January 24, 2014, 12:00:18 PM
This is what is in the game right now for implicit var's available on non crpl tower units (for tonight's build and for last night's as well).  If someone wouldn't mine syncing this up with the wiki I'd be very grateful.  I've got a few irons in the fire right now and am rushing to get another build done before the day is out.


Emitter
   STARTTIME
   FINISHTIME
   PRODUCTIONINTERVAL
   PRODUCTIONAMT

SporeTower
   STARTTIME
   WAVEINTERVAL
   WAVECOUNT
   SPOREPAYLOAD

AETower
   RANGE

RunnerNest
   SPAWNINTERVAL
   MAXPOPULATION
   MOVESPEED
   RUNNERMAXHEALTH
   CREEPERPAYLOAD

Inhibitor
   STARTTIME
   PRODUCTIONINTERVAL
   PRODUCTIONAMT
   RANGE

ResourcePack
   AMT
   MAXAMT
   RESOURCETYPE {'ENERGY', 'ORE', 'AETHER'}



Title: Re: GetScriptVar(<-unit 0 ...
Post by: pawel345 on January 24, 2014, 12:25:28 PM
Added to the wiki.