I know that the GetCoresWithVar Command gives a list of UIDs, but how do i access these UIDs? I looked at the list commands and i really do not know which one to use to get the UIDs. I want to know how to use GetCoresWithVar so i can continue to work on the Creep Forge. Any help will be appreciated and credited for helping me. (Unless you don't want to be credited)
Quote from: Nicant on January 24, 2016, 10:55:54 AM
I know that the GetCoresWithVar Command gives a list of UIDs, but how do i access these UIDs? I looked at the list commands and i really do not know which one to use to get the UIDs. I want to know how to use GetCoresWithVar so i can continue to work on the Creep Forge. Any help will be appreciated and credited for helping me. (Unless you don't want to be credited)
I would use the GetUnitsInRange CurrentCoords 5000+ or something like that then store it in a variable then compare it to see of it is a totem(if you want to access all totems on the map.)
It is not a list, but just a number of UID's on the stack.
"VarName" "ValName" GetCoresWithVar
0 do
->unit
#do whatever you'd like
loop
If you need totems, you can take a look at the code examples on the wiki and copy the 'connect totems to win' script (and change it to your needs). I've used it The Totem 1 and 2 in my alpha sector.
Quote from: J on January 24, 2016, 04:32:16 PM
It is not a list, but just a number of UID's on the stack.
"VarName" "ValName" GetCoresWithVar
0 do
->unit
#do whatever you'd like
loop
If you need totems, you can take a look at the code examples on the wiki and copy the 'connect totems to win' script (and change it to your needs). I've used it The Totem 1 and 2 in my alpha sector.
Yep, I remember those maps. I'm not very sure if I completed them. ::) Back to topic, I would do that to target totem siphons, then you'll need to apply a laser to that. Someone had a map that had a unit that targeted totems and spawned spores from that totem.
No, what i actually want is the totem siphons to find the Creep Forge on the map and then give it's coordinates to the "Creep Rift" that then fly over to the Creep Forge. Note: the "Creep Rift" is not the stuff the Sleeper node collects from the totem siphons, but is something new i made them produce. (If you didn't know i changed the way that the Creep Forge works because it would be easier to Script)
All i need to know is what is the arguments for GetCoresWithVar are. I know they are Variable name and value but when i try it it does not work. Here's code: "ForgeX" "0" GetCoresWithVar ->TotemSiphons
<-TotemSiphons "CTotemSiphon.crpl" "ForgeX" <-CurrentX SetScriptVar
<-TotemSiphons "CTotemSiphon.crpl" "ForgeY" <-CurrentY SetScriptVar
Add this to the bottom of your code:
:buildList
#Trace("@buildList, Args:") TraceStack
->bui_LIM
if(<-bui_LIM 1 lt)
CreateList
else
0 ->bui_ILOOP
CreateList ->bui_LIST
while <-bui_ILOOP <-bui_LIM lt repeat
->unit
AppendToList(<-bui_LIST <-unit)
<-bui_ILOOP add(1) ->bui_ILOOP
endwhile
#Trace("bui_LIST: " concat(<-bui_LIST))
CopyList(<-bui_LIST)
endif
Then edit your existing code:
"ForgeX" "0" GetCoresWithVar @BuildList ->TotemSiphons #GameGibu suggests changing "ForgeX" to a separate var named something like "isTotemSiphon" (must be made to exist in CTotemSiphon.crpl) and is only 1 (meaning TRUE) when it is your special script...
<-TotemSiphons GetListCount ->LIM
0 ->ILOOP
while <-ILOOP <-LIM lt repeat
SetScriptVar(GetListElement(<-TotemSiphons <-ILOOP) "CTotemSiphon.crpl" "ForgeX" <-CurrentX)
SetScriptVar(GetListElement(<-TotemSiphons <-ILOOP) "CTotemSiphon.crpl" "ForgeY" <-CurrentY)
<-ILOOP add(1) ->ILOOP
endwhile
And thar ye go...
Hope this helps!
-GameGibu
Quote from: GameGibu on January 24, 2016, 11:34:38 PM
Add this to the bottom of your code:
:buildList
#Trace("@buildList, Args:") TraceStack
->bui_LIM
if(<-bui_LIM 1 lt)
CreateList
else
0 ->bui_ILOOP
CreateList ->bui_LIST
while <-bui_ILOOP <-bui_LIM lt repeat
->unit
AppendToList(<-bui_LIST <-unit)
<-bui_ILOOP add(1) ->bui_ILOOP
endwhile
#Trace("bui_LIST: " concat(<-bui_LIST))
CopyList(<-bui_LIST)
endif
Then edit your existing code:
"ForgeX" "0" GetCoresWithVar @BuildList ->TotemSiphons #GameGibu suggests changing "ForgeX" to a separate var named something like "isTotemSiphon" (must be made to exist in CTotemSiphon.crpl) and is only 1 (meaning TRUE) when it is your special script...
<-TotemSiphons GetListCount ->LIM
0 ->ILOOP
while <-ILOOP <-LIM lt repeat
SetScriptVar(GetListElement(<-TotemSiphons <-ILOOP) "CTotemSiphon.crpl" "ForgeX" <-CurrentX)
SetScriptVar(GetListElement(<-TotemSiphons <-ILOOP) "CTotemSiphon.crpl" "ForgeY" <-CurrentY)
<-ILOOP add(1) ->ILOOP
endwhile
And thar ye go...
Hope this helps!
-GameGibu
Thank You GameGibu it works! ;D Do you want to be credited for helping me with the creep forge?
Sure, why not? ;D
-GameGibu