Is it possible to make a CRPL core completely hide an entire section of the world?
By that I mean: All the land is replaced with void, all creeper is temporarily removed, all emitters removed temporarily, etc.
Then when a certain condition is met, return the chunk of land to play?
Depends. Do you mean fog of war? Then yes indeed.
Do you mean save then delete then later restore? Then yes indeed but that would take a bit to write.
fog of war might actually do what I need a lot better than my original idea (which is the second thing you asked)
Where could I find that script?
There was this map in alpha sector, Hunter Seeker:boss that used Virgil's fog to evil effectiveness.
I believe the relevant command is X Y Z R G B CreateMyst.
Edit: I think what people do is just draw black images at a very low z value.
cool, while we're at it, I assume there is something I can enable somewhere to make command nodes immobile, right?
The only way to immobilize commandnodes is make them unselectable. People who want commandnodes immobile will usually not create space for them to land elsewhere.
How do I make them unselectable than? :P
First you have to find them with a script. Then you use SetSelectableOverride.
CurrentCoords 999 TRUE GetAllUnitsInRange
0 do
->u
<-u GetUnitType "COMMANDNODE" eq if
<-u FALSE SetSelectableOverride
endif
loop
Keep in mind I did not test this.
Edit: If all your CNs are already placed, this can go in :awake to save resources.
Edit2: SetUnitSelectableOverride as revealed in testing.
I don't know a lot about coding, what is :awake ?
It CRPL, there is one implicit function that is executed every frame, and a few that execute under special circumstances. You make the explicit functions by prefacing them with :<name>. If the name is not builtin, it will never be called except unless you do it yourself with @<name>. The main three builtins are :awake, which is called before game load or when a script is added through code, :GameLoaded which is called every time the game loads, and :destroyed which occurs when the associated core is deleted.
Functions end at the end of the file or at the start of the next function.
so.. how would I put this into an awake than? I'm kinda confused.
:awake
CurrentCoords 999 TRUE GetAllUnitsInRange
0 do
->u
<-u GetUnitType "COMMANDNODE" eq if
<-u FALSE SetUnitSelectableOverride
endif
loop
This script only needs to go on one random CRPL core. The core should be set to have no image, not take map space, not count for victory, not be nullifiable. Basically create the core, set the image to none, then uncheck everything.
Ok, awesome. I do think I'm understanding some things better now, and I'm going to work on some other scripts in the near future I think will function based on some of those commands you showed me. But this current one doesn't work. It doesn't make the command node non-selectable. I can still click it/move it, even after reloading the map :x
EDIT: I don't know why, but it works if I have 2 of these CRPL's in play. I'm not worried enough about it to try and figure out what went wrong, but it is a bit strange.
@awake
#Basically do all this once when the game starts AND once every frame.
:awake
#Not sure if UnitSelecatbleOverrides persist in saves, so just to be safe:
<-activated eq0 if
1 ->activated
CreateList ->commandnodes
"activated" NotPersist
"commandnodes" NotPersist
endif
0 ->i
while <-commandnodes GetListCount <-i gt repeat
<-commandnodes <-i GetListElement CONST_ISDESTROYED GetUnitAttribute if
<-commandnodes <-i RemoveListElement
else
<-i 1 add ->i
endif
endwhile
<-commandnodes GetListCount GetCommandNodeCount neq if
0 0 999 GetUnitsInRange 0 do
->uid
<-uid GetUnitType "COMMANDNODE" eq if
<-uid 0 SetUnitSelectableOverride
<-commandnodes <-uid AppendToList
<-commandnodes GetListCount GetCommandNodeCount eq if
return
endif
endif
loop
endif
This does look a lot more complex, but it should theoretically be faster than the first script that was posted and *should* also be able to deal with nodes being recalled and re-dropped. Haven't tested it though.
The general advice is, if your CRPL is not working but think it should, go to the scripts page, hit compile scripts, THEN save and load. This is particularly likely to fix problems with the awake function. (EDIT:) The once endonce clause.
You can look at this map. It's a great example of Fog of War
http://knucklecracker.com/forums/index.php?topic=16023.0