Creating a core

Started by BilboGCL, November 28, 2017, 03:48:44 PM

Previous topic - Next topic

BilboGCL

Hi, as a follow up to my :destroyed question:
I try to build a core with a script, the core shouldn't be visible, don't take any map space and don't count for victory:

CreateUnit ("CRPLCore" 1 1) ->rest
<-rest "doe.crpl" AddScriptToUnit
<-rest "main" "none" SetImage
SetScriptVar ("CONST_COUNTSFORVICTORY" 0)
SetScriptVar ("CONST_CELLHEIGHT " 0)
SetScriptVar ("CONST_CELLWIDTH " 0)
SetScriptVar ("CONST_TAKEMAPSPACE " 0)


Right now I know that it is invisible but takes map space, (victory counting test starts right now)...
Any idea what I'm doing wrong?

Greetings from The Shire!
Hey, come to the dark side Discord, we have cookies!

GoodMorning

#1
It's:
<-rest CONST_COUNTSFORVICTORY 0 SetUnitAttribute

You'll be getting "taking from empty stack" errors in the trace.

There's another interpretation, but this looks more likely.

Edit: Corrections to the last line. I'm a poor typist at that time of day.
A narrative is a lightly-marked path to another reality.

BilboGCL

Good Morning, thanks a lot, You are really helpful!

Greetings from The Shire!
Hey, come to the dark side Discord, we have cookies!

GoodMorning

Here's an example of a script for a ghost core - this one exists to take packets, for things which need more than 30eps.

# ChargeGhost.crpl
# Created on: 11/20/2017 8:27:45 PM
# ------------------------------------------
once
@awake
Self CONST_CONNECTABLE 1 SetUnitAttribute
Self CONST_REQUESTPACKETS 1 SetUnitAttribute
Self CONST_CANREQUESTAMMO 1 SetUnitAttribute
Self CONST_CONNECTABLE 1 SetUnitAttribute

Self CONST_NULLIFIERDAMAGES 0 SetUnitAttribute
Self CONST_COUNTSFORVICTORY 0 SetUnitAttribute
Self CONST_CREATEPZ 0 SetUnitAttribute

Self CONST_AMMO 0 SetUnitAttribute
endonce

:awake
<-Owned not if Self 0 Destroy endif

Self CONST_SHOWAMMOBAR 0 SetUnitAttribute


Hopefully it helps a little for someone's issue at some point.
A narrative is a lightly-marked path to another reality.