Jump to content
The Dark Mod Forums

Newbie DarkRadiant Questions


demagogue

Recommended Posts

Overlapping brushes and patches aren't really a problem, just make sure to turn those kind of detail work into func_static or export them as a model if you are going to use it several times in your fm to avoid the visportal interacting with it. There are also several window models available so you don't neccessarely have to create them from scratch.

  • Like 1

FM's: Builder Roads, Old Habits, Old Habits Rebuild

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Link to comment
Share on other sites

Thanks for the advise Obsttorte. I have been mostly using func_statics but I still have a lot of brush combinations that I should be converting. Sometimes I have been forced to build custom windows so that they fit into place, when I cannot modify the window models. I have been getting this message during dmap: Entity 0, brush 820: mirrored plane. Is this what is making my map unstable? Is it possible to find a particular brush so I can figure out whats going on?

Link to comment
Share on other sites

You can resize models. If you wan't to find a particular brush, go onto map->find brush. I am not sure what the mirrored plane message refers to. But if you take a look at the brush in question you might see whether and what the problem is.

FM's: Builder Roads, Old Habits, Old Habits Rebuild

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Link to comment
Share on other sites

Apologies if this fits a tech support thread better, but I occassionally get this error on DarkRadiant startup:

 

post-35080-0-89986300-1541366590_thumb.png

 

It doesn't happen frequently, but it does occassionally pop up. Any idea on what the issue could be ?

 

Thanks in advance.

 

 

Link to comment
Share on other sites

You can resize models. If you wan't to find a particular brush, go onto map->find brush. I am not sure what the mirrored plane message refers to. But if you take a look at the brush in question you might see whether and what the problem is.

 

Of course, map->find brush, missed that, there's so much to learn about DR. I found the 'mirrored brush', it was a decal-like thin brush hidden inside a wall. Deleted it and that 'error' is gone. I am resizing models using the rotate technique that bikerdude kindly taught us, sometimes I find it easier with a fairly simple window to just build it myself. Thanks for the quick reply, I am getting a bit more done on my map everyday. Am at 3540 brushes, 2050 patches, 1306 entities, although I will be grouping a fair few of those brushes.

  • Like 1
Link to comment
Share on other sites

Google says this error is either a virus in a boot sector or your anti-virus software has caused a faulty installation (which is quite ironic: either it was a missing or an exisiting anti-virus software)

 

For DarkRadiant specifically ?

 

I think the latter is more likely. Please note that DR works just fine for me, but it occassionally has issue starting. I think this tends to happen after I use it for a long time (literally hours), then close it fairly quickly. More of a bug.

Link to comment
Share on other sites

Is there a simple way to make an objective where you complete it by satisfying X amount of the objective components.

 

My objective has 5 components, and I want to make it so that the player can complete it by satisfying 3 components whether that be 1,2 and 3 or 1, 4 and 5. I thought about doing this with the success conditions but I couldn't see a way to word the logic to make it work unless it reacted to 3 specific components. If it helps each component is the same thing, acquire an certain entity. I believe I could make this objective work if I made each entity a certain entity class, but I'm not sure how to do that so a solution that involves the components would be great if it's possible.

Link to comment
Share on other sites

The objectives editor is relatively restricted in that case. If you want to use the success logic it would look like this:

1 AND 2 AND 3 OR 1 AND 2 AND 4 OR .... (and so one, it gets pretty long).

 

The easiest way would be to sum up the states of the components and check whether they are three or greater, but the objectives editor doesn't accept such things, it seems. So I would suggest to do this with a script. Leave the success logic field empty and use a script that checks the components states every now and then. If at least three components are fulfilled, it can then check off the objective.

 

Example code (not tested):

float statesum;
float i;
do
{
    sys.waitFrame(); // you probable can wait longer then a frame for the components check
    statesum = 0
    for (i=1;i<6;i++)
    {
         statesum += $player1.getObjectiveComp(1,i); // the first argument is the objective number, if it is not the first use the proper one
    }
} while (statesum < 3); // run the infinite loop as long as less then three components are fulfilled
$player1.setObjectiveState(1,OBJ_COMPLETE); // like above, if it isn't the first objective use the proper number

wrap this code into a function and call it from the main() function.

FM's: Builder Roads, Old Habits, Old Habits Rebuild

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Link to comment
Share on other sites

The objectives editor is relatively restricted in that case. If you want to use the success logic it would look like this:

1 AND 2 AND 3 OR 1 AND 2 AND 4 OR .... (and so one, it gets pretty long).

 

The easiest way would be to sum up the states of the components and check whether they are three or greater, but the objectives editor doesn't accept such things, it seems. So I would suggest to do this with a script. Leave the success logic field empty and use a script that checks the components states every now and then. If at least three components are fulfilled, it can then check off the objective.

 

Example code (not tested):

float statesum;
float i;
do
{
    sys.waitFrame(); // you probable can wait longer then a frame for the components check
    statesum = 0
    for (i=1;i<6;i++)
    {
         statesum += $player1.getObjectiveComp(1,i); // the first argument is the objective number, if it is not the first use the proper one
    }
} while (statesum < 3); // run the infinite loop as long as less then three components are fulfilled
$player1.setObjectiveState(1,OBJ_COMPLETE); // like above, if it isn't the first objective use the proper number

wrap this code into a function and call it from the main() function.

 

Okay I can see how the code works, but how exactly do I wrap it into the main function and have it applied on the map?

Link to comment
Share on other sites


void checkObjective()
{
float statesum;
float i;
do
{
sys.waitFrame();
statesum = 0;
for (i=0;i<6;i++)
{
statesum += $player1.getObjectiveComp(1,i); // objective components are either incomplete (0) or complete (1)
}
} while(statesum < 3);
$player1.setObjectiveState(1,OBJ_COMPLETE);
} // end of checkObjective()
void main() // main function, gets called upon mission start
{
thread checkObjective(); // run our function in its own thread
}
  • Like 3

FM's: Builder Roads, Old Habits, Old Habits Rebuild

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Link to comment
Share on other sites

Or make every component also target trigger_count, and this one will actually toggle objective after n times.

 

void checkObjective()
{
float statesum;
float i;
  do
  {
    sys.waitFrame();
    statesum = 0;
    for (i=0;i<6;i++)
    {
      statesum += $player1.getObjectiveComp(1,i); // objective components are either incomplete (0) or complete (1)
    }
  } while(statesum < 3);
  $player1.setObjectiveState(1,OBJ_COMPLETE);
} // end of checkObjective()
void main() // main function, gets called upon mission start
{
  thread checkObjective(); // run our function in its own thread
}

 

Sorry, I still don't quite understand (not the code, how I insert the code into the mission). Can you please spell it out for me? Thanks

Edited by some1stoleit
  • Like 1
Link to comment
Share on other sites

Add targets/atdm:target_callscriptfunction;
add spawnarg

"call" "checkObjective"

to it.
target this entity from every object that supposed to be one of objectives. (I'm not sure if every frobable acts as a switch, but loot should do).
also add text file yourmissionname.script to darkmod/scripts folder (containing Obsttorte's script), and line

#include "script/yourmissionname.script"

to tdm_custom_scripts.script file in said folder (if it's not there, make one).

 

**********


Or in my approach:
add triggers/trigger_count
add to it spawnarg

 "count" "4"

(if you want to toggle objective after finding 4 pieces)
add targets/atdm:target_setobjective_state
add to it spawnarg

"obj_id1" "2"

(if the objective number is 2)
target trigger_count from every piece of objectives,
target target_setobjective_state from trigger_count.

 

Remember that if frobbed objects remain in game, player could toggle one object n times to comlete whole objective - in this case the object should be i.e. rendered unfrobable by script.

Edited by ERH+
  • Like 3

S2wtMNl.gif

Link to comment
Share on other sites

 


Add targets/atdm:target_callscriptfunction;
add spawnarg

"call" "checkObjective"

to it.
target this entity from every object that supposed to be one of objectives. (I'm not sure if every frobable acts as a switch, but loot should do).
also add text file yourmissionname.script to darkmod/scripts folder (containing Obsttorte's script), and line

#include "script/yourmissionname.script"

to tdm_custom_scripts.script file in said folder (if it's not there, make one).

That is actually how to do it not.

 

Just create a text file in your maps folder and rename it to mymap.script, where mymap is the name of your map file (so if it is mymission.map, name the text file mymission.script). Add the above code in said text file. That's it.

  • Like 2

FM's: Builder Roads, Old Habits, Old Habits Rebuild

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Link to comment
Share on other sites

That is actually how to do it not.

 

Just create a text file in your maps folder and rename it to mymap.script, where mymap is the name of your map file (so if it is mymission.map, name the text file mymission.script). Add the above code in said text file. That's it.

Wiki don't say it is prohibited:

 

http://wiki.thedarkmod.com/index.php?title=Scripting_basics#Discovery_.28or.2C_why_is_TDM_ignoring_my_script_file.3F.29

S2wtMNl.gif

Link to comment
Share on other sites

Nothing in your linked article refers to the case here. Note that the script I posted contains a main function, which then calls the checkObjective() function. The main script goes into the script file belonging to the actual mission, as it is executed after mission start (and NOT by any other conditions like triggers etc...). You are mixing up different use-cases here.

FM's: Builder Roads, Old Habits, Old Habits Rebuild

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Link to comment
Share on other sites

That is actually how to do it not.

 

Just create a text file in your maps folder and rename it to mymap.script, where mymap is the name of your map file (so if it is mymission.map, name the text file mymission.script). Add the above code in said text file. That's it.

 

I've run into a problem, the function activates when I complete three components and I see Objective Complete pop up on the top of the screen as well as the sound cue, however when I check my objectives doesn't tick off. It only ticks off if I complete all five components, which is defeats the purpose of the script. I've configured the code to use the correct objective number and made i start at 1 so it doesn't look for components out of bounds, that's all I've modified.

 

Strangely enough when I implemented the code using the way ERH initially suggested and made it call the function every time I picked up the targeted items it did tick off the objective, however it also made it say objective complete when the fourth and fifth items were picked up.

Link to comment
Share on other sites

Could be an issue with the setObjectiveState function. Would have to take a look to make sure.

 

Oh, and of course objective and objective component indices starts with one (although I have no clue, why). I'Ve forgotten that.

FM's: Builder Roads, Old Habits, Old Habits Rebuild

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Link to comment
Share on other sites

Could be an issue with the setObjectiveState function. Would have to take a look to make sure.

 

Oh, and of course objective and objective component indices starts with one (although I have no clue, why). I'Ve forgotten that.

 

Fixed it, made the objective irreversible and now it's working as intended.

 

Thanks for the help Obsttorte and ERH+, really appreciate it. Now I know how to use scripts in other maps if they're needed.

Link to comment
Share on other sites

That is actually how to do it not.

 

Just create a text file in your maps folder and rename it to mymap.script, where mymap is the name of your map file (so if it is mymission.map, name the text file mymission.script). Add the above code in said text file. That's it.

 

IMO you are more or less right, your method is map based scripting but his method is not wrong, is what's called object based scripting, more times than not you will run both in unison and call from within map scripts functions of object scripts, like so $object.function_name(), on object scripts you can call functions directly, just using function_name() (behind the scenes it is doing: this.function_name()).

 

In map scripts you initialize (call initial functions) everything on the main() function, on object scripts you initialize (call initial functions) everything from Spawn() or Init(), plus other differences.

 

Both are valid ways to make scripts work on a map, but yours is indeed the prefered option (and the one id software used the most) to do scripting for a entire map, in this way you have all the code on a single file instead of on multiple files attached to multiple objects.

 

In map scripting to prevent naming conflicts and make functions unique to the mission you're making, wrap all of them around a namespace, that is not needed for object scripts.

 

like so:

namespace map_name {

void main(){
   otherfunction();
}

void otherfunction(){
   $object_name.show();
}

} 

In both ways you need to #include "path to the script" on the main script file (in TDM you can do it in tdm_custom_scripts.script) for the game to see it.

 

Map scripting

 

Object scripting

Link to comment
Share on other sites

I am totally aware of that. ;) But the script I've posted above contains a main function, which isn't used in object scripting, and was intented to solve a simple problem in a mission that probably doesn't contain tons of different scripts, so bundling it all up in seperate objects may not seem necessary. What ERH+ proposed simple added a lot of extra clunk not needed here. So I may should have written 'that is actually not how it was intented to be used' or sort of.

 

BTW: You don't need to include the map script. Only additional script files.

  • Like 1

FM's: Builder Roads, Old Habits, Old Habits Rebuild

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Link to comment
Share on other sites

if you use the tdm_custom_scripts.script method and there's something wrong with one of the included scripts then TheDarkMod.exe will error on start and you get a grey box with a blue screen and no error message. or it will error when you go to run your map, crash to desktop with same grey box with blue screen. then you think there something wrong with your map file when its actually something in the tdm_custom_scripts.script that caused the problem if you are using it.

Edited by stumpy
Link to comment
Share on other sites

Well, most of the time this happens to me is when I forgot to put a wait command inside an infinite loop. However, in this case you'll get a warning message ("runaway loop error"). I am not sure whether there are other issues that would lead to an immediate crash, but my workflow is that if the game crashes after a change made by me I go check my changes for an error. Works pretty well for me.

FM's: Builder Roads, Old Habits, Old Habits Rebuild

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

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.


  • Recent Status Updates

    • Ansome

      Finally got my PC back from the shop after my SSD got corrupted a week ago and damaged my motherboard. Scary stuff, but thank goodness it happened right after two months of FM development instead of wiping all my work before I could release it. New SSD, repaired Motherboard and BIOS, and we're ready to start working on my second FM with some added version control in the cloud just to be safe!
      · 0 replies
    • Petike the Taffer  »  DeTeEff

      I've updated the articles for your FMs and your author category at the wiki. Your newer nickname (DeTeEff) now comes first, and the one in parentheses is your older nickname (Fieldmedic). Just to avoid confusing people who played your FMs years ago and remember your older nickname. I've added a wiki article for your latest FM, Who Watches the Watcher?, as part of my current updating efforts. Unless I overlooked something, you have five different FMs so far.
      · 0 replies
    • Petike the Taffer

      I've finally managed to log in to The Dark Mod Wiki. I'm back in the saddle and before the holidays start in full, I'll be adding a few new FM articles and doing other updates. Written in Stone is already done.
      · 4 replies
    • nbohr1more

      TDM 15th Anniversary Contest is now active! Please declare your participation: https://forums.thedarkmod.com/index.php?/topic/22413-the-dark-mod-15th-anniversary-contest-entry-thread/
       
      · 0 replies
    • JackFarmer

      @TheUnbeholden
      You cannot receive PMs. Could you please be so kind and check your mailbox if it is full (or maybe you switched off the function)?
      · 1 reply
×
×
  • Create New...