Simple script isn't working - Why not?

Started by Inglonias, February 26, 2014, 11:15:56 AM

Previous topic - Next topic

Inglonias

So, I have a simple script that's supposed to unlock the remaining two command nodes for use after 5 minutes, and the script does everything it is supposed to except that.

Here it is. What's wrong with this script?

# Unlock another CN.crpl
# Created on: 2/26/2014 10:54:14 AM
# ------------------------------------------'
once
300 delay #10 second delay for debug purposes.
ClearConversation
AddConversationMessage(1 "Skars, I was able to complete some minor repairs to the ship. The two other Command Nodes are at your disposal")
ShowConversation
PauseGame
"COMMANDNODE" -1 SetBuildLimit
endonce

Clean0nion

Quote from: Inglonias on February 26, 2014, 11:15:56 AM
So, I have a simple script that's supposed to unlock the remaining two command nodes for use after 5 minutes, and the script does everything it is supposed to except that.

Here it is. What's wrong with this script?

# Unlock another CN.crpl
# Created on: 2/26/2014 10:54:14 AM
# ------------------------------------------'
once
300 delay #10 second delay for debug purposes.
ClearConversation
AddConversationMessage(1 "Skars, I was able to complete some minor repairs to the ship. The two other Command Nodes are at your disposal")
ShowConversation
PauseGame
"COMMANDNODE" -1 SetBuildLimit
endonce

I hate to sound patronising - I really do - but are you unpausing the game? Because if you are, everything seems fine to me.
The only other possible problem is that the once--endonce loop has already happened and you haven't recompiled. Or possibly changing CN count by CRPL was disabled?
But as far as I can see, this should work.

Inglonias

#2
I have tried unpausing, yes. And the rest of the script runs every time I try testing it, so I'm recompiling it correctly. I even tried saving and reloading the save. It's not working.

Weird. I guess this doesn't work with CRPL.

EDIT: Thinking there might be some conflict with Unit Limits set by the map, I set the map's CN limit to -1, and had the script set it to 1 at the start of the map before changing it back. Still doesn't work. I don't think you can change CN limits with CRPL.

Grauniad

Yes, you can change CN limits. At the very least you can add a pick-up tech that adds one ore more CNs to the map.
A goodnight to all and to all a good night - Goodnight Moon

Clean0nion

You could setting it to 3 instead of -1. That might work.

J

Quote from: Clean0nion on February 26, 2014, 11:54:45 AM
You could setting it to 3 instead of -1. That might work.
That should work yes. I had trouble with enabling the forge in my #UnitSeries because I set it to -1 instead of 1...
Probably a good idea for a feature request to make our lives easier (allow -1 for forge and CN limits, auto-convert them into 1 and 3)

Grauniad

It is working as designed and intended. All other units have unlimited, or no limit  (-1) values. The Forge and CNs have limits, 1 and 3 respectively. Giving an invalid value is ignored. Might be better to update the wiki documentation... (hint).
A goodnight to all and to all a good night - Goodnight Moon

Grayzzur

I tried, and I couldn't get it to work with 2 or 3, using "COMMANDNODE" or "CN". It may not be settable via CRPL's SetBuildLimit. (And then just saw G's second post.)

You can create a tech artifact and set the type to COMMANDNODE, and if you want to enable all CN's that's fine -- as there doesn't seem to be a way to set a number/limit on tech artifacts, those created via CRPL are unlimited-only.
"Fate. It protects fools, little children, and ships named 'Enterprise.'" -William T. Riker

knucracker

For the next build I have added a "COUNT" script var to the TechArtifact.  So you can do this:

CreateUnit("TechArtifact" 10 10) ->uid
SetTechArtifactType(<-uid "Bertha")
SetScriptVar(<-uid "" "COUNT" 5)


Yes I know that the 'SetTechArtifactType' is an oddball given the existence of 'SetScriptVar'.  But it predates 'SetScriptVar'...

As for the CommandNode problem I have made it so that you can call SetBuildLimit and supply "COMMANDNODE" and it will work.  Previously it would not because CN's weren't in the list of units that could be built, and I used that same list for SetBuildLimit.

Grauniad

A goodnight to all and to all a good night - Goodnight Moon

thepenguin

Quote from: Grauniad on February 27, 2014, 12:16:57 PM
Wiki...
Grauniad, you should add it to the wiki if you feel so passionate about it.  After all, isn't that the point of a wiki? ;)
We have become the creeper...

knucracker

I already took care of it right after I added the change to the source tree.  I figured I better do it before I totally forgot about it :)