Page 1 of 1

Help programming CEs

Posted: Wed Aug 08, 2007 11:49 pm
by Davacardo
I was wondering if anyone could help me as I'm having some difficulty with CEs.

1. I'm trying to make a CE like a bug. It has the following properties:
Can move [along right side]
Can move into acid
Deadly when [touching]
Can explode [3x3] by fire / smashed, with content

I copied the bug information from RnD's graphicinfo.conf, using ConfEdit and replaced all 'bug' with 'custom_246'.
ConfEdit found no errors.
But when I put it in a level, it does not "turn", it just changes direction and continues straightaway.
[Help received, thanks Alan]

2. This might be a bug. It probably isn't. But I noticed when there is a 'Change on impact' present, the CE loses its 'Can smash' property. Is there a way around this?
[By changing it to Hit something on bottom side, this works OK. Thanks, Zomis]

3. The change property "set keys" indicates to me e.g. if you collect this CE, it's as if you picked up a red key. Is it possible to do something like this? If so, how?
[Help received, thanks Alan]

4. As an example, when a bomb falls, there is a slight delay in the explosion so you can move out of the way when walking under it. Is there a way to do this with a CE as well? At present, I have CE that can fall, and changes to an extended change target, when destructible upon impact. Problem is that it leaves no time for the player to move away.

Posted: Thu Aug 09, 2007 2:16 am
by Alan
But when I put it in a level, it does not "turn", it just changes direction and continues straightaway
This could be because your bug's move delay is zero, try setting it to 8 (in config page 2)
The change property "set keys" indicates to me e.g. if you collect this CE, it's as if you picked up a red key. Is it possible to do something like this? If so, how?
You don't have to collect anything to add a key to your inventory, any CE can do this with any event.......try making a CE that adds key 1 when the player moves left, but takes key 1 away when he moves right. ;-)

Posted: Thu Aug 09, 2007 7:40 am
by Davacardo
Thanks for the help with the bug. It actually needed a move delay of 9, not 8, but I wouldn't have worked that out without your help.

And I'm still unsure about the keys thing. Following the help (thanks again), I managed to make a CE "give" you the red key with a property of 'Change after 1 second, Set Keys + 1', but this was the only configuration I managed to get to work. What I am trying to do is make a CE so that when you collect it, it "gives" you every key.

Posted: Thu Aug 09, 2007 1:22 pm
by Alan
Bombs always explode on impact and it's explosion delay is for the length of the actual explosion and not the pause before it happens (I think). You're best off making a CE bomb that does what you want.
And I'm still unsure about the keys thing. Following the help (thanks again), I managed to make a CE "give" you the red key with a property of 'Change after 1 second, Set Keys + 1', but this was the only configuration I managed to get to work. What I am trying to do is make a CE so that when you collect it, it "gives" you every key.
You can only use one "change after xx seconds" in any CE (which is a shame), but you can use two or more other triggers and events. For your example (a CE key that gives you all the keys when collected), just duplicate the change page four times with different output....

[Change page 1] Collected by player, add key 1
[Change page 2] Collected by player, add key 2
[Change page 3] Collected by player, add key 3
[Change page 4] Collected by player, add key 4

All four of these events will fire when you collect the multi-key. And yes before anybody asks, I have made disco lights using the add\sub keys ;-)

This is also how you do basic math using CEs (ask Zomis about this, not me!)....You can't add 50+(Score/2) to a value using one change page, but you can do it using two.

Posted: Fri Aug 10, 2007 12:59 am
by Davacardo
Alan wrote:Bombs always explode on impact and it's explosion delay is for the length of the actual explosion and not the pause before it happens (I think). You're best off making a CE bomb that does what you want.
The element I am trying to make is like this:
It is pushable. Can fall & smash everything.
It changes to an extended target upon impact, when destructible like:
O
[impact]
O O O

but if the player walks under it, they get exploded before they can move away. I could use a Can explode with content, but I don't want it to destroy the full 9 tiles, only the 2 beside it.
Also, it won't smash anything as long as the change on impact property is present. Is there a way around this?


I got the key thing working. Thanks. It seems you need a 2nd CE present to trigger this - if only 1 CE was present, nothing happened, but if a 2nd one was also present, it did work.

Posted: Fri Aug 10, 2007 3:26 pm
by Zomis
Davacardo wrote:but if the player walks under it, they get exploded before they can move away. I could use a Can explode with content, but I don't want it to destroy the full 9 tiles, only the 2 beside it.
Also, it won't smash anything as long as the change on impact property is present. Is there a way around this?
Try changing explosion delay or ignition delay to change the delay between impact and explosion. I think it should work.
Unfortunately, I don't think it's any way around that smash & change thing. Or maybe... maybe if you change the change condition from "impact" to "hit something". (Be careful though since hitting can be done without impact!)
I got the key thing working. Thanks. It seems you need a 2nd CE present to trigger this - if only 1 CE was present, nothing happened, but if a 2nd one was also present, it did work.
That sounds strange. Could you send an example level? (You can upload it at http://www.zomis.net/rnd )

Posted: Sat Aug 11, 2007 1:15 am
by Davacardo
Zomis wrote:Unfortunately, I don't think it's any way around that smash & change thing. Or maybe... maybe if you change the change condition from "impact" to "hit something". (Be careful though since hitting can be done without impact!)
Yes, by changing, it to 'hitting something on bottom side'. this works fine.
I'll keep experimenting with the explosion delays.
Zomis wrote:That sounds strange. Could you send an example level? (You can upload it at http://www.zomis.net/rnd )
I sent an example level to the above address under the same user name (Davacardo). It uses an example with Custom Element 1, bearing the same graphic as an EM red key. When only one CE 1 is put in the level, it doesn't work. If 2 or more are put in the level, it does work.

Posted: Sat Aug 11, 2007 9:56 am
by Zomis
Davacardo wrote:I sent an example level to the above address under the same user name (Davacardo). It uses an example with Custom Element 1, bearing the same graphic as an EM red key. When only one CE 1 is put in the level, it doesn't work. If 2 or more are put in the level, it does work.
Ah, I see what the problem is. Or actually, I guessed the problem after reading your description again.
I think I've fixed your problem, take a look at this level:
http://www.zomis.net/rnd/download.php?id=673

The reason why that behaviour appeared was because you used "player collects <custom element 1>", for that to happen there needs to be at least 2 of that element on the map. If you collect the first, the second changes, and vice versa.
My workaround uses the fact that
collecting = entering or snapping
So I unchecked the "collectible" switch for the CE, and also added 4 change pages. So there's 4 change pages for entering (one for each key to be added) and 4 for snapping. One of these change pages also has the "change to empty space" switch. (Well, it works also when all of the change pages has that switch enabled, but I prefer to have it on only one page for some reason).

Posted: Sun Aug 12, 2007 3:11 am
by Davacardo
That works really well. Thanks!

I guess that's all...