Register
Email: Password:
Forum » Driftmoon Modding

Driftmoon Modding

E_net4 3 years ago
I didn't find any generic Driftmoon Modding discussion topic, so I might as well post about my new mod-wise endeavours here and let everyone else do the same.

I've been tinkering with the map editor and editing ini files, and recently I tried producing a cyclical texture change of an object each time it is clicked. I made some pretty simple textures and tried this. It seems to work on the first press by turning it to green, but any other presses won't change the texture anymore. I checked that the variable is being incremented and reset properly on each use (by using additional message actions). So where did I go wrong? Could it be an unexpected issue of the engine? Tips on a way around it would be nice, although I can think of making one script for each texture that compares the variable for equality in each press (which is uglier).

I also have a few more questions about modding and scripting.

- In the changeTexture action, I might not have understood quite well how the "What" and "Replacement" parameters change the action's behaviour. Can I somehow replace textures using some sort of text pattern ("something1.png" to "something2.png" and "wall1.png" to "wall2.png")? What if I just want to ignore what the current texture is and override the object's texture during the game?
- What exactly is the scope of an ordinary variable? I still can't quite tell if standard variables only apply to the owner of the script or they can be referenced by any other object in the map. Can I make any object have custom variables and reference them from a script of another object? Would there be a problem if the object's name contains spaces or other special characters?
- Imagining I want the player to say something when he pushes a button. Bot->say will make the button object talk instead of the player. How do I easily make the player say it instead?

Edited 3 years ago
#
Pete 3 years ago
1) I didnt actually check in game, but have you tried setting the change with the assumption that the game works as if the texture never got changed (ie: set those replaces all to white.png)?
2) Its just a bit of data attached to an object. Far as I know you can reference it from anywhere.
3) Switch the script target to the player first (by SetActivatorAsTarget or just SetPlayerAsTarget directly. First is handy if something else might end up running around pushing buttons too.)

All from memory, mind you, so might be wrong or outdated.

Edited 3 years ago
#
Endymion 3 years ago
Pete said:
1) I didnt actually check in game, but have you tried setting the change with the assumption that the game works as if the texture never got changed (ie: set those replaces all to white.png)?
I didn't check in game either but I'm pretty sure you need to remove the current texture change before doing another(just leave the Replacement field blank)

Also in case you haven't seen it already the wiki has nice list of special variable names that I think can be quite useful.

Edited 3 years ago
#
E_net4 3 years ago
I did check the wiki on that subject, but still don't quite understand the scope of common variables. I seem to have noticed that giving variables a simple identifier (without *. prefixes) will make it accessible from the whole map. Hopefully, its contents are saved when visiting another map.

As for the textures, I am trying a few other action sequences, but they don't seem to work either. Things are turning a bit upsetting around here. The need to remove the current texture change before setting a new one is also a bit strange.
#
ville 3 years ago
1) The changetexture action cannot be chained - it simply adds a rule to the table of what text to replace with what. So if you want to cycle a texture, you'll have to change the initial texture name to something else. Say you have cat.png as the base texture, it would be something like this:

Cycle 1: changeTexture cat.png to dog.png
Cycle 2: changeTexture cat.png to horse.png

You see? We're not asking it to change dog.png to anything because the call doesn't actually change the texture in the object permanently, it just uses a table of replacement rules.

2) By using the cat.variable notation you can do pretty much anything like you say. I haven't checked if using spaces makes any difference, it probably doesn't. If you have any problems, just use the id number notation. The page Endymion pointed to reveals all options.
#
E_net4 3 years ago
Thanks for the support. I am doing some progress on this side. By using 7 scripts of the same event in the same object I managed to cycle through all 6 colours without a problem. But, at the end of the cycle (Code1 == 6), only the top texture is changed to blue (the first texture), and the following presses of the object won't change the edges either. So the texture of all edges (that are all the same and equal to the top texture) get stuck on the last texture of the cycle.

[edit]One of the scripts simply clears the previous texture change rule.

The remaining scripts change the texture for a specific code, like the following:

The last one, of course, sets the variable to 1 rather than adding 1 to it.[/edit]

One more thing I can't seem to get working around here. I've been trying to make a simple bridge (a wooden plank, basically) with a terrain object. But the player can't get on top of it. I've tinkered with the properties and still couldn't make it work. How am I supposed to do this?

Edited 3 years ago
#
Pete 3 years ago
First off, use terrain. Second, switch off all the flags except Bridge. Third, drag the bridge so that it intersects the impassable terrain edges.

Here's one I prepared earlier (the texture is actually set to invisible, just made it black for clarity) that uses non-solid objects for the visuals:

#
E_net4 3 years ago
All right, after a few more tries and tweaks, I finally made the bridge work. The other issue still remains.
#
ville 3 years ago
Can you post the scripts? Just use the export text button, at least I can read that format.
#
E_net4 3 years ago
So I have these 7 scripts, in this order:

Activation type: start
setVariable("Code1",1) AND changeTexture("default.jpg","blue.PNG")


Activation type: use
changeTexture("default.jpg","")

IF variableIs("Code1",1) THEN addToVariable("Code1",1) AND changeTexture("default.jpg","green.PNG")

IF variableIs("Code1",2) THEN addToVariable("Code1",1) AND changeTexture("default.jpg","yellow.PNG")

IF variableIs("Code1",3) THEN addToVariable("Code1",1) AND changeTexture("default.jpg","red.PNG")

IF variableIs("Code1",4) THEN addToVariable("Code1",1) AND changeTexture("default.jpg","magenta.PNG")

IF variableIs("Code1",5) THEN addToVariable("Code1",1) AND changeTexture("default.jpg","cyan.PNG")

IF variableIs("Code1",6) THEN setVariable("Code1",1) AND changeTexture("default.jpg","blue.PNG")
#
ville 3 years ago
There's nothing wrong with the scripts, as far as I can see. I'm inclined to believe there might be a bug in the engine - if you'd like to mail me the mod (ville@monkkonen.net) I'll have a look.
#
ville 3 years ago
It looks like a bug in the engine - I will see about fixing it in a future update.
#
Forum » Driftmoon Modding

Post Reply


Your email:
Your name: