Jump to content
The Dark Mod Forums

Newbie DarkRadiant Questions


demagogue
 Share

Recommended Posts

When calling a script from inside the map, does someone have a way to supply some variables to the script? In the sense that in a test script called:

 

void test(entity book_name)

{

book_name.remove();

}

 

Could I call the script and send 'ghost_tales' as a parameter so that the script looks up my book named ghost_tales and removes it? What would also work is if the calling entity sent its own name. I have a lot of similar entities that I'd like to call the same script on.

Edited by Dragofer
Link to comment
Share on other sites

Second question:

When you hold a moveable such as a candlestick and activate it with enter, is there some way I can get that activation to trigger something else as well? I've got some custom stims and responses on a candle in a candleholder that I'd like to toggle off if the player snuffs out the candle.

Link to comment
Share on other sites

I really don't know about question one, but I've seen scripts using .getKey and .setKey on a dummy entity e.g. have a dummy FS in a blueroom, remove your book, use .setKey on the dummy to copy the book's name as a string and put it as a temporal spawnarg's value on it, then look it up later with .getKey. Something like that. To the second question, extinguishing a light acts as a trigger so if you wire a one-time trigger relay or something of the sort to the candlestick you can go from there.

My FMs: The King of Diamonds (2016) | Visit my Mapbook thread sometimes! | Read my tutorial on Image-Based Lighting Workflows for TDM!

 

 

Link to comment
Share on other sites

To the second question, extinguishing a light acts as a trigger so if you wire a one-time trigger relay or something of the sort to the candlestick you can go from there.

 

Great, that solved this part. I've had to go via a trigger_relay instead of letting the light target the candlestick directly, so it looks like objective completion targets aren't the only kinds of triggers that don't count as triggers in stim/response setups.

 

 

My first question - it's more something like having a room with 40 books and whichever book gets frobbed should run a blendaway_glow script on itself (not a spoiler). The setup I'd have liked to make is that each book has a S/R effect 'Run script' with parameters '_SELF', or failing that, that each book targets a central callscriptfunction which knows by which book it was triggered and passes on the name to the script function.

 

But it seems the closest thing the callscriptfunction entity can do is 'foreach', so that all the books are dematerialised in one go. It looks like the last time someone wanted to pass on variables to a script was Fidcal in 2010.

Edited by Dragofer
Link to comment
Share on other sites

I don't remember the particulars but I think you can create a scriptable object and attach it to entities. The scriptable objects code will then act on the entity it's been attached to. Obsttorte or SteveL are sure to have the details as they both helped me with this on my missions :).

  • Like 1

But you should walk having internal dignity. Be a wonderful person who can dance pleasantly to the rhythm of the universe.

-Sun Myung Moon

 

My work blog: gfleisher.blogspot.com

Link to comment
Share on other sites

Tels implemented a call that passes self and it got reverted because it broke one puzzle, when he could have just made it a new scriptcall entity. I wish he had done that, since it's so useful. Anyway, you can still do it, just a bit more annoying.

 

One is the object script Moonbo mentioned. Put the call in a spawnarg or def file, "scriptobject" "<script name>", and then the script comes on line with the object passed to it. That is, if you give a command without specifying the entity up front, it applies to the calling object.

 

Another way is the frob calls a miniscript (or pushes a button calling it) whose only job is a line calling the action script and passing it a code that stands for that individual book.

  • Like 1

What do you see when you turn out the light? I can't tell you but I know that it's mine.

Link to comment
Share on other sites

Indeed, Tels' call would've been a great thing, feels like something is missing without it. I think you'd have much of the flexibility of scriptobjects from inside DR without having to define any entities.

 

One step further would be to pass a whole line of parameters, maybe even with 'get' commands in there. That might open up interesting new possibilities.

Link to comment
Share on other sites

I thought I'd make use of the moveables system for gameplay in my map but am having problems with this because my thief constantly lets go of moveables. I could pick up any default candlestick and raise it, take my hands off the keyboard, and one or two seconds later it's dropped. It only happens in one area (house + exterior) of my map, in other areas I can walk around with a candlestick as long as I want.

 

Is this maybe a known bug? There was a change to moveables handling in 2.04.

 

 

Edit: also, is there a simple way to apply n points of damage to the player through a script? I've tried a S/R setup to apply a damage def but the damage gets multiplied by 10. That can be worked around with a custom damage def that deals less damage, but more importantly it seems to ignore the 'chance to apply' parameter in the S/R window.

Edited by Dragofer
Link to comment
Share on other sites

In the list on the Wiki there are two script lines for damaging someone. However, I have no idea how to use them exactly. My scripting abilities are very limited.

 


scriptEvent void directDamage(entity damageTarget, string damageDef); no description Spawnclasses responding to this event: idAI

and

 

scriptEvent void damage(entity inflictor, entity attacker, vector dir, string damageDefName, float damageScale); Deals damage to this entity (gets translated into the idEntity::Damage() method within the SDK). inflictor: the entity causing the damage (maybe a projectile) attacker: the "parent" entity of the inflictor, the one that is responsible for the inflictor (can be the same) dir: the direction the attack is coming from. damageDefName: the name of the damage entityDef to know what damage is being dealt to <self> (e.g. "damage_lava") damageScale: the scale of the damage (pass 1.0 as default, this should be ok). Spawnclasses responding to this event: idEntity

Edited by Destined
Link to comment
Share on other sites

scriptEvent void damage(entity inflictor, entity attacker, vector dir, string damageDefName, float damageScale); Deals damage to this entity (gets translated into the idEntity::Damage() method within the SDK). inflictor: the entity causing the damage (maybe a projectile) attacker: the "parent" entity of the inflictor, the one that is responsible for the inflictor (can be the same) dir: the direction the attack is coming from. damageDefName: the name of the damage entityDef to know what damage is being dealt to <self> (e.g. "damage_lava") damageScale: the scale of the damage (pass 1.0 as default, this should be ok). Spawnclasses responding to this event: idEntity

 

Ah right, I remember trying to use that and found that it needed a huge amount of parameters, and I didn't know what each one was meant to do. Thanks for pointing it out, I didn't realise that the script reference page has detailed usage information for certain functions.

So a script line with this could be something like $victim.damage($arrow, $archer, '0 10 0', "damage_generic", 1);

Link to comment
Share on other sites

The script functions page is very extensive. However, if you have little to no idea about scripting (like I do), it is not of too much help... I just use ctrl+f hoping to find, what I want.

It is true, that the standard "damage" has a lot of parameters. So maybe the direct damage could work with a simple "$victim.directDamage(1)"? But this would also just be a guess on my part...

Link to comment
Share on other sites

The script functions page is very extensive. However, if you have little to no idea about scripting (like I do), it is not of too much help... I just use ctrl+f hoping to find, what I want.

It is true, that the standard "damage" has a lot of parameters. So maybe the direct damage could work with a simple "$victim.directDamage(1)"? But this would also just be a guess on my part...

 

The script reference does say that directdamage only applies to idAI, while damage is for idEntity. It'd be interesting to know whether somehow directdamage still works on the player, but it seems unlikely.

 

The cleanest thing would just be a script that goes $victim.damage(1); Enter your target and how much damage you want done, maybe also a sound shader for the 'hurt' sound (player/AI voice, glass cracking, wood breaking), no need to look for or create a fitting damagedef.

Edited by Dragofer
Link to comment
Share on other sites

Is there a way to stop light entities from shooting off random light lines through brushes/patches? it looks like this

 

apEby2h.png

 

I've played around with changing the brushes, making the end cap patches as noshadow, I can't quite get it looking right. It's hard to see in the picture above but it's very noticeable ingame, as you move around the light lines move too.

 

Thanks

Link to comment
Share on other sites

A few things cause that and they are all fixable -

  • The patch hasen't been snapped to grid so there is a tiny gap.
  • The surface directly under or adjoining the patch has the caulk texture (see youtube vid), using any other normal textures fixes this.
  • Make sure the origin of any nearby lights are NOT directly inline with the surface of the patch.

https://www.youtube.com/watch?v=ic0bdX5lATs&feature=youtu.be

Link to comment
Share on other sites

Link to comment
Share on other sites

Good tutorial Biker, but in case you don't know you can copy and paste shaders with the mouse.

To copy a shader, move mouse cursor over the texture and Middlemouse click.

Then move the mouse cursor over the new patch/brush and CTRL+Middle mouse click.

I always assumed I'd taste like boot leather.

 

Link to comment
Share on other sites

Is there someplace where I can see which textures are being used by models in my map? Or even better, which image files? 'Map info' only seems to show what's on brushes and patches. This is for trimming down a custom 50-painting pack which has multiple diffusemaps in various sizes for each painting.

Link to comment
Share on other sites

Is there someplace where I can see which textures are being used by models in my map? Or even better, which image files? 'Map info' only seems to show what's on brushes and patches. This is for trimming down a custom 50-painting pack which has multiple diffusemaps in various sizes for each painting.

 

Select the object in your map.

 

Click on the "model" spawnarg.

 

Click the "select model" button.

 

A new dialogue box pops up, and in the middle there's a materials section.

 

You can't get any closer to the actual textures than this; you'll have to determine the texture behind the material name.

Link to comment
Share on other sites

Thanks, it's unfortunate that there's no overview for model textures like there is for brush&patch textures. It could be reasonably fast then to use map info to highlight and isolate each size of painting, then check which skins are used by which sizes.

Edited by Dragofer
Link to comment
Share on other sites

If the sparkles on the patch still happen even after changing the subdivisions a last resort which always worked for me is to add a center subdivision and bulge the center of the patch outward by one unit.

  • Like 1

But you should walk having internal dignity. Be a wonderful person who can dance pleasantly to the rhythm of the universe.

-Sun Myung Moon

 

My work blog: gfleisher.blogspot.com

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share


×
×
  • Create New...