CRPL making CRPL making CRPL error

Started by cpaca, January 03, 2016, 06:24:54 PM

Previous topic - Next topic

cpaca

I don't know what's wrong. Here's the code: (Green text means it works, red means it does not)

This is called CreatorNest2
$Delay:30

CreateUnit("CRPLCORE" CurrentX CurrentY) ->PlaceHolder
AddScriptToUnit(<-PlaceHolder "CreatorNest1.crpl")
<-Delay Delay
if (GetQueuedMoveCount 0 eq)
QueueMove(RandCoords 1)
endif


This is called CreatorNest1
CreateUnit("CRPLCORE" CurrentX CurrentY) ->Unit
AddScriptToUnit(<-Unit "Flying.crpl")
<-SpawnAmount 1 subtract ->SpawnAmount
if(<-SpawnAmount 0 lt)
destroy(self 2)
endif
30 Delay

Can't figure out what is wrong with it. It will not spawn the "Flying" Unit.
Here's the code for the Flying unit (Haven't tested it, occupied with CreatorNest1)
#variables are $<Variablename>:<DefaultValue>
# <-<variablename> to input a current variable
# <variablename>-> to export a new variable
$output:1
$SelfDestructionTimer:100
$Speed:1.0

do
if (GetQueuedMoveCount 0 eq)
QueueMove(RandCoords <-Speed)
end
place CurrentCoords <-output AddCreeper
<-SelfDestructionTimer 1 subtract ->SelfDestructionTimer
If <-SelfDestructionTimer is <=0 then
Destroy(Self 2)
endif
loop

I also double-checked the caps-sensitivity before you yell at me! Noting this cause otherwise someone will be all  8) and ask about case sensitivity!
To use [OUR] Custom Modules, go to Forums/Knuckle Cracker/PFE/Map Makers, Ship Builders, and Coders, Go to the pinned posts, find the one named "Custom Modules Thread", Open it, Scroll down until you find ShipModule, Apply that into your map, do not apply it into map if one copy already exists, Apply the Adder script (Sometimes named "Master.prpl, sometimes [shipname]Adder, etc.) and the actual used scripts [which i will state in my posts]. If one copy already exists, do not apply another copy. -The CMC :-)

GameGibu

are you sure that the units are not underneath the spawner? That happened to me today while debugging my own scripts, as my cannonball cores weren't moving, but they were being spawned.

If nothing seems to work, try rewriting that section of code without referencing the old version. That's worked for me 10/5 times.

Best of luck,fellow CRPL scripter!  ;D ;D
-GameGibu
Bringing you Custom maps since 2971!
☆CRPL Master☆

Builder17

#2
You don't set spawn amount of CreatorNest1 anywhere?

And should this be endif in FlyingUnit script?
And place isn't command in FlyingUnit.
You want eq instead is in FlyingUnit script.
<=0 should be changed into lte.
And in CRPL then isn't used.  :o
Using loop in FlyingUnit seems to be unnecessary.





cpaca

#3
The create new CRPL and give it a code command is directly from teknotiss, gibu. But thanks for the assistance.

I'm more used to lua, so i made those mistakes builder17. I'll try the fixes soon. (I got to go sleep)


Months later edit: Just going to make 5 creatornest 2's. The creatornest1's suicide after spawning 5 things was my intent, but it works my way too.
To use [OUR] Custom Modules, go to Forums/Knuckle Cracker/PFE/Map Makers, Ship Builders, and Coders, Go to the pinned posts, find the one named "Custom Modules Thread", Open it, Scroll down until you find ShipModule, Apply that into your map, do not apply it into map if one copy already exists, Apply the Adder script (Sometimes named "Master.prpl, sometimes [shipname]Adder, etc.) and the actual used scripts [which i will state in my posts]. If one copy already exists, do not apply another copy. -The CMC :-)