Re: Custom Map #1314: Spiral Galacrazy. By: Pastor.Healer

Started by pastor.healer, November 03, 2014, 08:21:45 PM

Previous topic - Next topic

pastor.healer

stdout, so I have looked at the map you sent me and no matter what mode I am in, edit, non-edit, playing the game, I don't see any trace of the crplcore.  Forgive my ignorance in this.  It seems like it should be easy. 

When I play the game I don't see any new emitter show up either. 

The map I am seeing has five emitters, two orbital weapons and two spore towers.  Do I have the right map?

Thanks for your patience with me on this.  I am really looking forward to playing with some of this if I don't find it ridiculous in its learning curve.

stdout

Quote from: pastor.healer on November 05, 2014, 07:19:23 PMThe map I am seeing has five emitters, two orbital weapons and two spore towers.  Do I have the right map?

Ahh, definitely not. The map I uploaded was a small map that only had one spore tower by itself and then the invisible crpl core.

I just now downloaded again the file above and used it and confirmed that the map is good. So please try downloading it again and try again. Make sure you call it "save.cw3" in the folder for your project. We'll get this working and you'll soon see how easy it is to add scripts to your games. (and then we'll have a new world of fun new maps from PH!) :)

pastor.healer

Ok... got it!  I don't know how the other map was showing up.  I deleted the Unset folder and copied it back there again.  Anyway, got the new file and did the same thing and it worked great. 

Now... I see three files with this game. 

CreateCircle.crpl
CreateEmitter.crpl
Wall2Terrain.crpl

My first question is why there are two others when this is a simple map?

And when I open up CreateEmitter.crpl I see one long line of code and instruction.  When I open up CreateCircle.crpl, I see single lines of code.

Will you help me to understand that?

Also, should we be doing this on a game thread?  If not, just let me know what I need to do to keep things 'legal'. 

Blessings stdout

pastor.healer

I re-visited the CreateEmitter file and saw that the formating was just gone.  I moved each line down where it belongs and see the code layed out now.  Excellent!

So the only question I have now is this.  I don't see where the variables are defined. 


$rate:15

$amount:10

# 1800 is the number of frames to wait before creating the emitter.

# So in this example, the emitter will appear at 1 minute into the game.



GetGameTimeFrames 1800 gt
if
  SetImage(Self "Main" "CustomEmitter")
 
   SetUnitAttribute(Self CONST_COUNTSFORVICTORY TRUE)
 
   CurrentCoords <-amount AddCreeper <-rate Delay

endif


I assume the CurrentCoords ties to where I place a crplcore? 

I see where amount is defined above as 10 just as if I set an emitter and gave it a value
of 10

And I am guessing rate Delay is also tied to the rate above.  But why the - sign and how
do the < signs operate in this code?

Lastly is there a list of the actual assigned words used by this software with any definitions
of how they are used?

I didn't think I would play with the software but if I can learn the basics, this might be a good way to get new stuff into the games.

Again, thanks for your help.



Harkler

A full run-down of this code:










$rate:15
$amount:10
Variables

-
GetGameTimeFrames 1800 gt      Checks to see if the time has passed 1800 frames
-
ifSkips to EndIf if above is FALSE
-
SetImage(Self "Main" "CustomEmitter")Applies the "CustomEmitter" image to the CRPL core

-
SetUnitAttribute(Self CONST_COUNTSFORVICTORY TRUE)Sets the core as a unit that must be destroyed to win the game

-
CurrentCoords <-amount AddCreeperAdds the variable "amount" creeper to the cell occupied by the unit
-
<-rate DelayDelays the game by the variable "rate" frames
-
EndIfSignifies the end of the "If" command (duh)
-

Detailed Version










$rate:15
$amount:10
These are where variables are initially defined. You can change these by double clicking on the unit, clicking on the associated script, and modifying them under Input Variables. Placing a "$" before a string at the top defines it as an input variable. (make sure to click "APPLY VALUES AND RECOMPILE" after modifying them in the editor, else they won't take effect)
-
GetGameTimeFrames 1800 gt      This line of code will compare the current game time (in frames) to the number 1800. If it is greater than 1800 (gt), it will leave the number 1 (True), if not, it will leave 0 (False) (The emitter will actually be built on the 1801st frame because "1800 1800 gt" would return 0 (False))
-
ifThis command will look at the number from above. If it is 1 (True), every line until the command "EndIf" will run (unless there is an "Else" command).
If not, It will skip every command until it reaches the "EndIf" command (or the "Else" command)
-
SetImage(Self "Main" "CustomEmitter")The 3 arguments for "SetImage" are "Unit UID", "Image Slot", and "Custom Image Names". "Self" is a command that gets its own UID, "Main" is the default image slot, "CustomEmitter" is a built-in image name along with "CustomSporeTower" and "CustomRunnerNest". All other custom images must be loaded into the game and will look like "Cusom13"
-
SetUnitAttribute(Self CONST_COUNTSFORVICTORY TRUE)The 3 arguments for "SetUnitAttribute" are "Unit UID", "Attribute Constant", and "Value". "Self" again, "CONST_COUNTSFORVICTORY" is one of many constants that can be changed (Rather ironic), TRUE returns 1 (FALSE-0)
-
CurrentCoords <-amount AddCreeper"CurrentCoords" returns the unit's X coordinate followed by the Y coordinate, "<-Amount" places the variable defined at the top, AddCreeper takes the X, Y, and # from before it and adds # creeper at X, Y to the creeper already there. (most emitters use "SetCreeperNoLower", because if you keep adding more and more creeper,  it will eventually flip to AC)
-
<-rate Delay"<-Rate" will place the variable define at the top, then "Delay" will stop the code from doing anything for "<-Rate" frames. (Code will continue after "Delay" once it is complete)
-
EndIfSignifies the end of the "If" command (duh)
-


The code will wait 1 frame after it reaches the end, then will start again from the top
The emitter will actually emit every <-Rate +1 frames due to this delay
[close]


I assume the CurrentCoords ties to where I place a crplcore?
            Yes, This represents the X & Y coordinates of the core

I see where amount is defined above as 10 just as if I set an emitter and gave it a value of 10
            Yes, and it can be changed just by double-clicking the core

And I am guessing rate Delay is also tied to the rate above.  But why the - sign and how do the < signs operate in this code?
            <-InsertWord will place the variable "InsertWord" at the top of the stack

Lastly is there a list of the actual assigned words used by this software with any definitions of how they are used?
            Right here (then hit Ctrl-D)

pastor.healer

Wow!  Thanks so much.  I will begin to look at the key words and see how this all comes together. 

Blessings to you all

stdout

Harkler, thank you for taking the time to explain that. :)

The CreateCircle and Wall2Terrain scripts can be ignored. I included those on accident. They are scripts I was using for the last map project I made. The only script you needed was the CreateEmitter.crpl unit.

In the CreateEmitter script, you could probably add another variable at the top for frames_past. So something like:

$frames: 1800

Then down in the code, you'd change the 1800 number to <-frames and this way you could then set the timer inside the map editor rather than editing a script. This would be helpful if you wanted to create multiple of these emitters in a single map, each with a different appearance time.

stdout

...because variables like that can be changed on a core by core basis in the editor. You double click on the core and it shows you which variables can be changed.

Karsten75

I suggest you guys find the origin of the off-topic discussion and let me know where you want it to be moved (Coders Corner?) - the last one million or so posts are not relevant to this particular map. :)

stdout


DestinyAtlantis

Don't forget that you can edit your posts, so as to not double/triple/quadriple post.