Not logged inOpenClonk Forum
Up Topic General / General / Scripting Help
- - By J. J. [py] Date 2012-10-13 23:40
I would consider myself a novice at scripting but I am interested in trying some harder stuff and I would love some tips on scripting maybe some simple scripting phrases and explanations of what they do would help me get started. Yes I know it's not a simple task to learn how to script but I still think I can do it. :)
Parent - - By Ringwaul [ca] Date 2012-10-14 01:12 Edited 2012-10-14 01:19
Object scripting is probably the most rewarding and immediately visible work you can do as a newbie scripter. I learned it through going through others' scripts and figuring out how the script translated into an effect in the game world. Once you get the hang of scripting objects it becomes a lot easier to properly script things like rules/goals and other abstract scripted devices. Also, make sure you have a standard text editor; I recommend Notepad++.

Newbie scripters should first look Firestones; they don't do a whole lot (explode on hit), so they're pretty easy to understand. The Dynamite stick and Iron Bomb are is similar in that they explode, but use a timed fuse (timer-effect) to cause detonation instead of on collision with terrain. The ice resource is also a good target, in that it uses a DefCore defined timer as opposed to a script defined timer-effect (it melts when it's above 0°C).

Even the Dynamite and Iron Bomb are pretty complex for newbies; while their base functions are very simple, they have a bunch of neat features and special effects scripted in (dynamite stick can be stuck by hand into walls, iron bomb has shrapnel and smoke-trail) which complicates them for the unfamiliar user.
Parent - By J. J. [py] Date 2012-10-14 22:41
Thanks for your advice and encouragement. ;)
- By J. J. [py] Date 2012-10-17 20:01
I would love more advice on this topic. PLEAS!!! :D
- - By J. J. [py] Date 2012-10-18 23:23
I was trying to make a floating gas in Clonk Rage and It was perfect except that it didn't float, or go up at all for that matter. :(

PS: Can you tell me how to fix this problem. :D
Parent - - By Ringwaul [ca] Date 2012-10-19 03:06
You're going to need to explain how you attempted to do this, in detail, before anyone will be able to lend assistance. Were you trying to do this with a Landscape Material?
Parent - - By J. J. [py] Date 2012-10-19 18:30
Yes. I first went into the CR editor then I made a new file and then I put all the stuff from the original Materials file into my new folder, then I looked at the water and acid. I created a new text file and copied some of the the stuff from that, then I renamed the text file to [Gas.c4m], Gas is the name of my new material, and put it into my new folder
then I exited the editor and went into program files/Clonk Rage then renamed the original Materials to Materials1 then renamed my new folder to Materials.

PS: If you need more information tell me. :)
Parent - - By Ringwaul [ca] Date 2012-10-20 01:51
Ok, this seems straight-forward enough. However, I'm inclined to believe what you're trying to do isn't possible with the current set of landscape material/particle features available in the engine. :(

Someone who understands the mass-mover/particle handler should probably chime in here, because I am not well acquainted with that code (or any engine code for that matter :p).
Parent - - By J. J. [py] Date 2012-10-20 02:56
That's to bad. I wish I could get more input on this mater, but you seem to be the only one that's given input so far and thank you very much for your advice. :)

PS: Is scripting in open clonk much different then clonk rage. I haven't downloaded the editor for it yet. :\
Parent - - By Ringwaul [ca] Date 2012-10-20 03:25
Not much different, but it's definitely a lot better in terms of flexibility. For a full list, read here. There are also some other neat things above you might want to check out too. :)
Parent - - By J. J. [py] Date 2012-10-20 03:41
Thanks for your help again and give so much good advice. :>

>There are also some other neat things above you might want to check out too. :)

Do you mean on your previous post or on the link site?
Parent - - By Ringwaul [ca] Date 2012-10-20 03:42
No problem! :D

In the link; I linked directly to the script-changes section, but the other changes have relevant stuff too.
Parent - By J. J. [py] Date 2012-10-20 03:48
OK. Thank you. :)
Parent - - By Clonkonaut [de] Date 2012-10-20 04:13
No, sorry. The material system does not support gaseous materials. You can make invisble liquids (to simulate heavy gases) but then you need to hack the clonk so it doesn't start swimming (possible but a little bit more advanced scripting).
Parent - By ala [nl] Date 2012-10-20 09:17
The best might be emitting Gas by script, explosive gas is easy for example because you can easily make objects which react on incineration.

Still, I would support improvement on materials in the long run. Hm I had even a concept for that 2(?) years ago, maybe it is even in the forum.
Parent - - By J. J. [py] Date 2012-10-22 23:42 Edited 2012-10-22 23:51
I just finished the gas and some proper equipment (gas bottle with a light that turns on when you fill it with the gas) to go with it. The gas is like a dark green acid that you can't swim in. I have a problem with the gas bottle though  it holds the gas and you can dump it on the ground like water but, it sells for 0 even when I changed the value. I made it so that the barrels don't carry the gas only the gas bottles do. :)

PS: After I fix the barrel problem maybe I will make a download. With instructions on how to put it in the game.
Parent - - By Ringwaul [ca] Date 2012-10-23 05:33
You would definitely need some check in the bottle to raise its Value property when it contains liquid. If you're using a modified version of the barrel's script, you could do something like this:

var baseVal = 10; //there is probably a better way of doing this :P change 10 to whatever value the object normally is
if(iVolume > 0){   
  this.Value = baseVal + (iVolume / 20);
else {
  this.Value = baseVal;

Assuming your max iVolume is 300, this will add a linear progression of value from 10 to 25, between the iVolume of 0 to 300. You'd need to put this script somewhere in which the barrel's iVolume is updated (most likely at the end of FillBarrel).

I look forward to seeing what you make!
Parent - By J. J. [py] Date 2012-10-23 21:15
OK. I will try that. Oh, by the way the empty gas bottle has the same problem as the full one. I guess I will try it on both. :)
- By J. J. [py] Date 2012-10-24 23:07
I found the problem I missed rewriting two of the barrel scripts into "Can" because my gas barrel's script name is Can. After I fined out what price would be good for the gas maybe I will post a download for CR on the forum. Oh! I forgot there is one more minor problem my gas is always in squares. I bet you know how to fix that. If you do then the gas will be absolutely perfect other than it can't float oh well I will have to get over that I guess it is a heavy gas. :)
- - By J. J. [py] Date 2012-10-25 00:32 Edited 2012-10-29 22:34
Thanks for the help. :D
Parent - By Newton [de] Date 2012-10-28 22:27
Up Topic General / General / Scripting Help

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill