I first heard about clonk yesterday and me and my friend had so much fun climbing the outside of Shiver Peak that i decided to have a go at making it a bit more of a challenge. So far i've got it pretty challenging and it works well but as i've never coded in C4Script before and i dont understand the way the engine works so my knowledge of C can only take me so far.
Firstly in order to get the spawn out of the mountain i moved it to the edge and used the checkpoint dynamite clearing method to open it up. The problem is that the explosives cause rubble which hurts the players when they spawn. Is there any way of either clearing the space without rubble or of making the people invulnerable for a short while?
On the other hand we have found that the fall damage is almost non existent and so i'm wondering if it would be possible to make it a bit more powerful?
Lastly, my vision is to make it a highly cooperative climbing experience so i'd love to be able to give each player a different kit load-out when they spawn but i cant seem to get the map to differentiate between players when they spawn.
And for a bonus question it would be awesome if the grappling hook didn't attach to ice or snow very reliably.
Thanks for the help.
EDIT: I also seem to have run into a problem with eclipse as whenever i try to run a scenario it immediately crashes the engine. It also says that debugging is not supported when i try to use the debugger. Not sure what i did as even stock scenarios crash.
Glad to hear that you like the scenario and would even like to improve it! I for my part always played it very... non-cooperative ;-)
>Is there any way of either clearing the space without rubble
have you tried the function DigFree?
>On the other hand we have found that the fall damage is almost non existent and so i'm wondering if it would be possible to make it a bit more powerful?
There is no falling damage in Clonk. IMO it shouldn't be enabled for just one scenario. If, it should be standard but I reckon that many people would not like that, to have his clonk vulnerable like that. Anyway, this would require a bit more knowledge about C4Script. You basically catch the Hit callback and check for the speed the clonk had on impact - then you deal damage accordingly.
>so i'd love to be able to give each player a different kit load-out when they spawn but i cant seem to get the map to differentiate between players when they spawn.
I haven't looked into the (respawn) code yet, but each player is numbered in the script. This number should be passed around in any function that deals with the respawning of the player as well as the initial spawn of the player (InitializePlayer function).
>And for a bonus question it would be awesome if the grappling hook didn't attach to ice or snow very reliably.
I think that feature would be considered as a bug then ;-). You would have to write an #appendto script to the grappler which you then put into System.ocg/Grappler.c (or something) of your scenario which overwrites the parts of the grappler where it is about attaching to surfaces. Could be not-so-easy to do.
>have run into a problem with eclipse as whenever i try to run a scenario it immediately crashes the engine. It also says that debugging is not supported when i try to use the debugger. Not sure what i did as even stock scenarios crash.
Do you use the release version or a nightly build/development snapshot? You should use a development snapshot for developing (IMO).
>have you tried the function DigFree?
No but i'll give it a go when i get the editor working again.
>I haven't looked into the (respawn) code yet, but each player is numbered in the script. This number should be passed around in any function that deals with the respawning of the player as well as the initial spawn of the player (InitializePlayer function).
Thinking about it now when i tried to do it before with a couple if statements i didn't know what the syntax was so it probably would work if i fixed that.
>Do you use the release version or a nightly build/development snapshot? You should use a development snapshot for developing (IMO).
I downloaded the snapshot but found lots of textures to be missing and so didn't use it for the editing. Is that not supposed to happen? I've only tried the 64bit version.
I think i'll experiment for a bit when i get it running again and then have a go with the more advanced parts. Good to know that theoretically it should all be possible though.
EDIT: Actually thinking about it I remember the first time i downloaded the dev snapshot i got a bunch of errors extracting it with winrar. I just tried again and they're still there. Maybe the file on the server is corrupt?
And since you mentioned you know C: If you already worked with revision control systems, you could use HG (for example TortoiseHG (windows)) to get the up-to-date-version from the repository we work with. But if not, the development snapshot works just as well :)
PS:
>I downloaded the snapshot but found lots of textures to be missing and so didn't use it for the editing.
That could be related to the introduction of the new, fancy landscape shader (see http://forum.openclonk.org/topic_show.pl?pid=13511#pid13511 ). The shader needs a fixed size of the textures. You can deactivate it by deactivating "High Res Landscapes" in the options (and maybe "Shaders", too).
As for the snapshot when i load a scenario around half of the textures are just transparent. Not sure how some are missing if it's all in one package.
Thanks for all the help. I should be able to get a lot more done now.
FoW bug; quite recent as far as I can tell. If it becomes a nuisance just turn the Fog of War off:
/script SetFoW(false)
If high res is off then it's fine.
The "classic" landscape rendering should really be the same as before. I ended up not touching any rendering code of it, just moved the shading calculation to C4LandscapeRenderClassic.cpp. That's pretty conservative.
>I'll get it set up with eclipse tomorrow.
I've got the nightly build loaded into eclipse now but i still crash every time i try to run a scenario. Would it be worth reinstalling eclipse or is this a known issue?
EDIT: It also crashes when starting in debug mode.
EDIT: Seems that it dies when the player is named. the error it's giving before it crashes is:
>[21:10:40] File not found or invalid: C:\...\OpenClonk\\Foamy.ocp\Foamy.oci\Portrait.png
>[21:10:40] File not found or invalid: C:\...\OpenClonk\\Foamy.ocp\Pancakes.oci\Portrait.png
EDIT 2: Fixed the errors by deleting and remaking the player but not i'm just back to it crashing with no error.
If i remove all of the player files it doesn't crash and you can view the map but obviously it doesn't spawn anyone so testing is impossible.
It's not a major problem though as now i'm using the repository it's able to just save the scenario directly and i can leave the game running and just abort/reload whenever i need to test something new.
I've no idea what i did to cause the crash but i was playing around with several bits just before it happened. The most likely thing i was messing with was the player files.
>I think that feature would be considered as a bug then ;-). You would have to write an #appendto script to the grappler which you then put into System.ocg/Grappler.c (or something) of your scenario which overwrites the parts of the grappler where it is about attaching to surfaces. Could be not-so-easy to do.
I've got the code working so that the hook wont attach to digable terrain but amusingly the bit i've got stuck on is making it work as an #appendto file. What have i done wrong?
my code:
// Stop the grappling hook working on diggable terrain
#appendto Hook
public func Hit(x, y)
{
if(GetMaterialVal("DigFree","Material",GetMaterial(x, y)))
{
return;
}
else
{
Stick();
}
}
EDIT: I've also tried to get the fall damage to work but i'm having some trouble. If i use "Explode" instead of "DoDamage" then it works perfectly. Do i need to be sending something else for the damage instruction?
func Hit(int iXSpeed, int iYSpeed)
{
if(iYSpeed < 350) return;
if(GetAction() != "Walk") return;
if(iYSpeed >= 450) DoDamage(500);
var iKneelDownSpeed = 18; // Fall damage
SetXDir(0);
SetAction("Kneel");
PlayAnimation("KneelDown", 5, Anim_Linear(0, 0, GetAnimationLength("KneelDown"), iKneelDownSpeed, ANIM_Remove), Anim_Linear(0, 0, 1000, 5, ANIM_Remove));
ScheduleCall(this, "EndKneel", iKneelDownSpeed, 1);
}
GrappleHookMod.ocd\System.ocg\HookNoStick.c
Edit:
To deal damage to the clonk you should use a negative value of "DoEnergy(int change)" instead of DoDamage(). Damage is another variable unrelated to 'Energy' (used for 'health' for living objects). Damage is more script friendly for vehicles, because the object does not require to be alive. Have a look at the Airship's Hitbox object for a clean example of how 'damage' works.
For fall damage for the clonk, you'd probably want something like this:
var yhurt = 60;
if(GetYDir() >= yhurt) DoEnergy((GetYDir() - yhurt) * -1)
60 is a relatively fast falling speed (from a fall of around 200pixels, or the height of 10 clonks), so damage would start being taken from there (yhurt). The greater the clonk falls past 60px/s would equate to the damage taken (so a hit-speed of 75 would deal 15 damage).
The append files are already inside a system folder though. Do i have the id set correctly for them?
EDIT: Seems that my hook code is having some problems. I was wondering why it was being so unpredictable and so i added a line to display the material at the hook's position. When testing it just gives random results with the most common being "vehicle". I've tried offsetting it but cant get a reliable reading.
>I've got the code working so that the hook wont attach to digable terrain but amusingly the bit i've got stuck on is making it work as an #appendto file. What have i done wrong?
>#appendto Hook
The ID of the grappler's hook is "GrappleHook" :)
PS: And you might want to divide the speed (x and y) by 10, since the parameters of Hit() have a higher precision than the usual 10pixel/frame. (So if you would use SetYDir(-y) instead of SetYDir(-y/10) in Hit(x, y) the hook would not only bounce back but it would accelerate! )
EDIT: Also the grapple append file works now, thank you! You wouldn't happen to know the ID for the fall damage or how to find it would you?
EDIT2: Never mind i got it working. Must have been a small mistake somewhere before but it works and the ID was correct after all.
>I'm not sure i understand, aren't x and y position coordinates rather than speed values?
The x and y value in Hit(x, y) are the value of the old speed before hitting the landscape, since the speed was probably already reset there. Usually the unit is pixels/10frames so a speed of 35 would mean 3.5 pixels/frame. In Hit(x, y) the unit is pixels/100frames so instead of the expected 35 you would get a 350 (and to get the real value in pixels you might even want to divide it by 100 instead of 10).
Thinking about it, you could also just cap the value to the closest pixels around the impact point: x = BoundBy(x, -2, 2);
The reason why your GetMaterial(x, y) works even though the values are speed values instead of coordinates is, because the coordinates of GetMaterial are local coordinates - that means they are relative to the object from where you call the function.
So GetMaterial(3, 5) would use the coordinates that are equal to GetX()+3 | GetY()+5
>You wouldn't happen to know the ID for the fall damage or how to find it would you?
There is no fall damage object.
You could try appending your script to "Clonk" if that is what you mean. But I could imagine that there are some subtle problems with the Hit-callback there where you don't always get the correct parameters (since the speed was already reset before the callback). But that might also have been fixed since CR
>Lastly, my vision is to make it a highly cooperative climbing experience so i'd love to be able to give each player a different kit load-out when they spawn but i cant seem to get the map to differentiate between players when they spawn.
In the scenario script there is a function
OnPlayerRespawn(int plr, object cp)
where you can differentiate between players and checkpoints.
Is this a known problem? Both running windows by the way.
I can upload the logs if it would be helpful.
EDIT: The pickaxe has also stopped working which is strange because i have not modified it with an append and i just tried reverting everything back to the repository version and it still does it. The problem is that when you swing it it just stays in the hit position while looping the hit sound and shooting sparks without removing any material.
>Dunno exactly what was the outcome of this.
We (as in: Guenther) fixed one bug with the player loading. But that was not the "main" crash reason. Maybe we should just try to get the engine to crash using debugbuilds this evening to see whether we can find those crashes.
Having good game content is great and all - but doesn't help a lot if noone can play it ;)
Someone making the engine crash with a build with debug informations (not necessarily a debug version of the engine, just enough for the debugger to generate a stacktrace) and a debugger attached would really help.
http://www.openclonk.org/download/
Just remember that the file endings are c4d, c4g, etc. instead of ocd, ocg, etc.
Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill