Knuckle Cracker

Creeper World 3 => The Coder's Corner => Topic started by: milkev on February 04, 2016, 07:41:24 PM

Title: Creating Emitters Within a Range {original problem solved}
Post by: milkev on February 04, 2016, 07:41:24 PM
Hello, first time on the forums so i hope im not breaking any rules.

So im trying to create A code that spawns Emitters in a range around CurrentCoords. This is my code.

Its telling me that the range has to be previously set.(?) in the create unit line.(Edit: Sorry this if because i accidentally created a $range on the title line)

------------------------------------(not part of code)

$range:30

CreateUnit("EMITTER" CurrentCoords <-range RandCoordsInRange) ->uid

------------------------------------(not part of code)

I hope there is someone smarter than me that can figure this out as i dont know to much about using code in CW3.
Entire code/File is attached

If you see any other problems in this code please tell me and if this isnt the right way to go about this also please tell me.
p.s. Also wondering if i could somehow create it with stats?
Title: Re: Creating Emitters Within a Range
Post by: TLFP on February 04, 2016, 08:16:41 PM
Quote from: milkev on February 04, 2016, 07:41:24 PM
Hello, first time on the forums so i hope im not breaking any rules.

So im trying to create A code that spawns Emitters in a range around CurrentCoords. This is my code.

Its telling me that the range has to be previously set.(?) in the create unit line.

------------------------------------(not part of code)

$range:30

CreateUnit("EMITTER" CurrentCoords <-range RandCoordsInRange) ->uid

------------------------------------(not part of code)

I hope there is someone smarter than me that can figure this out as i dont know to much about using code in CW3.
Entire code/File is attached

If you see any other problems in this code please tell me and if this isnt the right way to go about this also please tell me.
p.s. Also wondering if i could somehow create it with stats?
I had someone create a script that did something like that
CreateUnit("EMITTER" RandCoordsInRange(CurrentCoords 12)) ->unit
If you want to customize the emitters, I can give you the wiki page on that.
Title: Re: Creating Emitters Within a Range
Post by: milkev on February 04, 2016, 10:34:13 PM
Thanks fellow long player, i think i understand how it works. does the ->uid have to be ->unit?
so sorry for such silly questions, im almost completely new to this.
-milkev
Title: Re: Creating Emitters Within a Range
Post by: Builder17 on February 05, 2016, 06:53:12 AM
What you are meaning with stats?
Title: Re: Creating Emitters Within a Range
Post by: TLFP on February 05, 2016, 09:29:00 AM
I used something to change the stats (amount emitted). Here's the script. You can look at it to figure it out.  :)
And you can name the ->unit id anything you want, just so you can customize it.
Title: Re: Creating Emitters Within a Range
Post by: milkev on February 05, 2016, 04:03:04 PM
Wow thanks! just one more question(probably ;) )
So If I wanted it to choose between a set of random cords (pre-made) to create the emitter there how would I do that without it spawning it in a set that already has something there?
Title: Re: Creating Emitters Within a Range
Post by: TLFP on February 05, 2016, 05:30:17 PM
Quote from: milkev on February 05, 2016, 04:03:04 PM
Wow thanks! just one more question(probably ;) )
So If I wanted it to choose between a set of random cords (pre-made) to create the emitter there how would I do that without it spawning it in a set that already has something there?
This should help. http://knucklecracker.com/wiki/doku.php?id=crpl:docs:randcoordsinrange
Unit coordinates can be found in edit mode in the bottom right corner.
Title: Re: Creating Emitters Within a Range {original problem solved}
Post by: Builder17 on February 06, 2016, 02:35:10 AM
You can set now range , emit amount  , emit interval , and delay.
Is it good , or do you want something else to it?
Edit: Could you take a look at this one before you say it's not good? :)
Title: Re: Creating Emitters Within a Range {original problem solved}
Post by: milkev on February 06, 2016, 05:00:11 AM
Quote from: Builder17 on February 06, 2016, 02:35:10 AM
You can set now range , emit amount  , emit interval , and delay.
Is it good , or do you want something else to it?
actually i was wondering if i had a pre made set of coords could i choose randomly between them?
Title: Re: Creating Emitters Within a Range {original problem solved}
Post by: milkev on February 06, 2016, 06:58:21 PM
Quote from: Builder17 on February 06, 2016, 02:35:10 AM
You can set now range , emit amount  , emit interval , and delay.
Is it good , or do you want something else to it?
Edit: Could you take a look at this one before you say it's not good? :)
I put the script into my crpl core, but it doesnt seem to do anything. I compiled the list and it says there's no issues, I don't know what half the stuff actually means so i have no idea what the problem could be.

P.S. My text editor 'edits' out all the
"
" in files that are downloaded, but idk why, so i also have no idea what lines are witch :D
Title: Re: Creating Emitters Within a Range {original problem solved}
Post by: TLFP on February 06, 2016, 07:11:02 PM
Quote from: milkev on February 06, 2016, 06:58:21 PM
Quote from: Builder17 on February 06, 2016, 02:35:10 AM
You can set now range , emit amount  , emit interval , and delay.
Is it good , or do you want something else to it?
Edit: Could you take a look at this one before you say it's not good? :)
I put the script into my crpl core, but it doesnt seem to do anything. I compiled the list and it says there's no issues, I don't know what half the stuff actually means so i have no idea what the problem could be.

P.S. My text editor 'edits' out all the
"
" in files that are downloaded, but idk why, so i also have no idea what lines are witch :D
I looked at the script and the list1 part is where you enter map coords. I think you enter them in and it will create the emitters. You could PM Builder17 and ask him how to do it.
Title: Re: Creating Emitters Within a Range {original problem solved}
Post by: Builder17 on February 07, 2016, 03:01:11 AM
I cannot make it working , try something better.  :-[