Jump to content


Photo

Newbie DarkRadiant Questions


8450 replies to this topic

#8426 Obsttorte

Obsttorte

    Scripting guru, Mapper

  • Active Developer
  • PipPipPipPipPip
  • 5702 posts

Posted 01 November 2018 - 06:04 PM

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.


  • Anderson likes this
FM's: Builder Roads, Old Habits, Old Habits Rebuild
WIP's: Several. Although after playing Thief 4 I really wanna make a city mission.
Mapping and Scripting: Apples and Peaches
Sculptris Models and Tutorials: Obsttortes Models
My wiki articles: Obstipedia
Let's Map TDM YouTube playlist: ObstlerTube
Texture Blending in DR: DR ASE Blend Exporter

End of shameless self promotion.

#8427 Aldo

Aldo

    Member

  • Member
  • PipPip
  • 29 posts

Posted 03 November 2018 - 06:51 PM

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?



#8428 Obsttorte

Obsttorte

    Scripting guru, Mapper

  • Active Developer
  • PipPipPipPipPip
  • 5702 posts

Posted 04 November 2018 - 03:10 AM

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
WIP's: Several. Although after playing Thief 4 I really wanna make a city mission.
Mapping and Scripting: Apples and Peaches
Sculptris Models and Tutorials: Obsttortes Models
My wiki articles: Obstipedia
Let's Map TDM YouTube playlist: ObstlerTube
Texture Blending in DR: DR ASE Blend Exporter

End of shameless self promotion.

#8429 Petike the Taffer

Petike the Taffer

    Member

  • Member
  • PipPip
  • 376 posts

Posted 04 November 2018 - 04:24 PM

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

 

DR error.png

 

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

 

Thanks in advance.

 

 



#8430 Destined

Destined

    Advanced Member

  • Member
  • PipPipPip
  • 1595 posts

Posted 04 November 2018 - 06:03 PM

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)

#8431 Aldo

Aldo

    Member

  • Member
  • PipPip
  • 29 posts

Posted 04 November 2018 - 07:17 PM

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.


  • Anderson likes this

#8432 Petike the Taffer

Petike the Taffer

    Member

  • Member
  • PipPip
  • 376 posts

Posted 05 November 2018 - 02:54 PM

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.



#8433 Destined

Destined

    Advanced Member

  • Member
  • PipPipPip
  • 1595 posts

Posted 05 November 2018 - 04:21 PM

No, not specifically. It is what I got for the 0xc0000005 code. If it runs before that, I have no idea, to be honest.



#8434 some1stoleit

some1stoleit

    Member

  • Member
  • PipPip
  • 55 posts

Posted 08 November 2018 - 12:59 AM

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.



#8435 Obsttorte

Obsttorte

    Scripting guru, Mapper

  • Active Developer
  • PipPipPipPipPip
  • 5702 posts

Posted 08 November 2018 - 03:15 AM

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
WIP's: Several. Although after playing Thief 4 I really wanna make a city mission.
Mapping and Scripting: Apples and Peaches
Sculptris Models and Tutorials: Obsttortes Models
My wiki articles: Obstipedia
Let's Map TDM YouTube playlist: ObstlerTube
Texture Blending in DR: DR ASE Blend Exporter

End of shameless self promotion.

#8436 some1stoleit

some1stoleit

    Member

  • Member
  • PipPip
  • 55 posts

Posted 08 November 2018 - 05:44 AM

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?



#8437 Obsttorte

Obsttorte

    Scripting guru, Mapper

  • Active Developer
  • PipPipPipPipPip
  • 5702 posts

Posted 08 November 2018 - 06:30 AM

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
}

  • ERH+, Anderson and some1stoleit like this
FM's: Builder Roads, Old Habits, Old Habits Rebuild
WIP's: Several. Although after playing Thief 4 I really wanna make a city mission.
Mapping and Scripting: Apples and Peaches
Sculptris Models and Tutorials: Obsttortes Models
My wiki articles: Obstipedia
Let's Map TDM YouTube playlist: ObstlerTube
Texture Blending in DR: DR ASE Blend Exporter

End of shameless self promotion.

#8438 ERH+

ERH+

    Advanced Member

  • Member
  • PipPipPip
  • 740 posts

Posted 08 November 2018 - 08:00 AM

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


Edited by ERH+, 09 November 2018 - 09:21 AM.

  • Bikerdude, Anderson and JackFarmer like this

S2wtMNl.gif


#8439 some1stoleit

some1stoleit

    Member

  • Member
  • PipPip
  • 55 posts

Posted 12 November 2018 - 05:36 AM

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, 12 November 2018 - 05:39 AM.

  • Anderson likes this

#8440 ERH+

ERH+

    Advanced Member

  • Member
  • PipPipPip
  • 740 posts

Posted 12 November 2018 - 07:16 AM

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+, 12 November 2018 - 07:37 AM.

  • HMart, Anderson and some1stoleit like this

S2wtMNl.gif


#8441 Obsttorte

Obsttorte

    Scripting guru, Mapper

  • Active Developer
  • PipPipPipPipPip
  • 5702 posts

Posted 12 November 2018 - 04:12 PM


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.


  • HMart and ERH+ like this
FM's: Builder Roads, Old Habits, Old Habits Rebuild
WIP's: Several. Although after playing Thief 4 I really wanna make a city mission.
Mapping and Scripting: Apples and Peaches
Sculptris Models and Tutorials: Obsttortes Models
My wiki articles: Obstipedia
Let's Map TDM YouTube playlist: ObstlerTube
Texture Blending in DR: DR ASE Blend Exporter

End of shameless self promotion.

#8442 ERH+

ERH+

    Advanced Member

  • Member
  • PipPipPip
  • 740 posts

Posted 13 November 2018 - 12:47 AM

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.thedarkm...ript_file.3F.29


S2wtMNl.gif


#8443 Obsttorte

Obsttorte

    Scripting guru, Mapper

  • Active Developer
  • PipPipPipPipPip
  • 5702 posts

Posted 13 November 2018 - 02:50 AM

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
WIP's: Several. Although after playing Thief 4 I really wanna make a city mission.
Mapping and Scripting: Apples and Peaches
Sculptris Models and Tutorials: Obsttortes Models
My wiki articles: Obstipedia
Let's Map TDM YouTube playlist: ObstlerTube
Texture Blending in DR: DR ASE Blend Exporter

End of shameless self promotion.

#8444 some1stoleit

some1stoleit

    Member

  • Member
  • PipPip
  • 55 posts

Posted 13 November 2018 - 06:43 AM

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.



#8445 Obsttorte

Obsttorte

    Scripting guru, Mapper

  • Active Developer
  • PipPipPipPipPip
  • 5702 posts

Posted 13 November 2018 - 02:50 PM

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
WIP's: Several. Although after playing Thief 4 I really wanna make a city mission.
Mapping and Scripting: Apples and Peaches
Sculptris Models and Tutorials: Obsttortes Models
My wiki articles: Obstipedia
Let's Map TDM YouTube playlist: ObstlerTube
Texture Blending in DR: DR ASE Blend Exporter

End of shameless self promotion.

#8446 some1stoleit

some1stoleit

    Member

  • Member
  • PipPip
  • 55 posts

Posted 14 November 2018 - 09:07 AM

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.



#8447 HMart

HMart

    Advanced Member

  • Member
  • PipPipPip
  • 744 posts

Posted 14 November 2018 - 06:16 PM

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



#8448 Obsttorte

Obsttorte

    Scripting guru, Mapper

  • Active Developer
  • PipPipPipPipPip
  • 5702 posts

Posted 15 November 2018 - 03:18 AM

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.


  • HMart likes this
FM's: Builder Roads, Old Habits, Old Habits Rebuild
WIP's: Several. Although after playing Thief 4 I really wanna make a city mission.
Mapping and Scripting: Apples and Peaches
Sculptris Models and Tutorials: Obsttortes Models
My wiki articles: Obstipedia
Let's Map TDM YouTube playlist: ObstlerTube
Texture Blending in DR: DR ASE Blend Exporter

End of shameless self promotion.

#8449 stumpy

stumpy

    Advanced Member

  • Member
  • PipPipPip
  • 1859 posts

Posted 15 November 2018 - 03:45 PM

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, 15 November 2018 - 03:56 PM.


#8450 Obsttorte

Obsttorte

    Scripting guru, Mapper

  • Active Developer
  • PipPipPipPipPip
  • 5702 posts

Posted 15 November 2018 - 04:31 PM

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
WIP's: Several. Although after playing Thief 4 I really wanna make a city mission.
Mapping and Scripting: Apples and Peaches
Sculptris Models and Tutorials: Obsttortes Models
My wiki articles: Obstipedia
Let's Map TDM YouTube playlist: ObstlerTube
Texture Blending in DR: DR ASE Blend Exporter

End of shameless self promotion.



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users