Jump to content
The Dark Mod Forums

Newbie DarkRadiant Questions


demagogue

Recommended Posts

Greetings! Complete newbie here just messing around with the editor.

I've been following some youtube tutorials on how to get started with map creation. Before I really got too deep into it I kept encountering unusual problems. While I'm confident that I did every step in the editor well I seem to get inconsistencies while testing the maps. Issues such as invisible objects, deleted objects and textures still in the map during tests, black squares where certain textures or objects should be, misaligned doors...the list goes on. Generally the more I put in the map the worse these issues become, with nearly everything I spawn in appearing...well...broken. I would like to mention that these things only appear broken while testing the maps in-game and there is no trace of these issues in Dark Radiant. I figure that there's something major I'm missing here, but any replies would be appreciated! Thanks :D 

Link to comment
Share on other sites

That sounds very much like you've got a leak (a gap somewhere in your worldspawn brushwork that leads out into the void). You can show a red line showing the path to the leak by going to File > Show Pointfile. In any case, it'd be worth looking at your tutorial's section on sealing/leaks again.

Link to comment
Share on other sites

If you're just mucking around with tutorials you can attach your map here. I'll take a look at it and see if I can figure out what's wrong.

My missions:           Stand-alone                                                      Duncan Lynch series                              

                                      Down and Out on Newford Road              the Factory Heist

                                                                                                  A House Call

                                                                                                  The House of deLisle                                                                                                  

                              

Link to comment
Share on other sites

2 hours ago, datiswous said:

I thought that with a leak the map wouldn't load. I get the impression that it does boot up.

If the map has never been successfully compiled, or you deleted the compilation files, the map won't load. Otherwise, if there are still compilation files from an earlier successful compilation, the map will still load, but with many problems as described above.

  • Like 1
Link to comment
Share on other sites

On 9/16/2021 at 9:19 AM, Dragofer said:

That sounds very much like you've got a leak (a gap somewhere in your worldspawn brushwork that leads out into the void). You can show a red line showing the path to the leak by going to File > Show Pointfile. In any case, it'd be worth looking at your tutorial's section on sealing/leaks again.

Yes! Plugging the leaks fixed the issues on all maps! I knew I was missing something simple. I just wasn't sure how to approach the problem since the issues seemed extremely random to me. Thank you!

  • Like 3
Link to comment
Share on other sites

In my mission, I want to "take away" the melee weapons (blackjack, sword) from the player, and then later give them back. So the game progression is:

  1. Player starts with blackjack/sword/arrows (typical situation)
  2. Some event takes away the blackjack and sword. He still has his bow, and can shoot arrows.
  3. Later, another event gives him a blackjack and sword. Preferably, he would just pick them up and that would re-enable them.

I read this thread but I can't figure out if it has any suggestions for my situation: 

I tried $player1.disableWeapon(), but this disables ALL weapons - I want the bow/arrows to still be available. I messed around with cloning and modifying the tdm_weapon_blackjack.script and tdm_weapon_shortsword.script files, and I got it to mostly work. The player can still hit the "1" and "2" keys - my modifications to those two scripts prevent the weapons from getting raised. But, the lightgem changes (for the sword at least). It would be best of those two keys were totally inactive, but I can't figure out how to do that.

I also am playing with some scripting that @Geep kindly gave me. But, that involves redefining the 'player' object (from tdm_player.script), which I would rather not do. Does anyone have other ideas?

 

  • Like 1
Link to comment
Share on other sites

Is it possible to pass arguments to a script called by an atdm:target_callscriptfunction?

My missions:           Stand-alone                                                      Duncan Lynch series                              

                                      Down and Out on Newford Road              the Factory Heist

                                                                                                  A House Call

                                                                                                  The House of deLisle                                                                                                  

                              

Link to comment
Share on other sites

On 9/7/2021 at 6:19 AM, peter_spy said:

I'm not sure if that's a best example, but I was trying to stress the physics system a bit. I'm using moveable ball models, all having that 16-polygon CM above. Just for fun I gave them friction 0 and bouncyness 1, to make physics work harder than usual. And I was able to get to 150 balls without going below 60fps:

buildercompound_2021-09-07_12_04_24.jpg.818217d93d488b72d2fa813cfadb3709.jpg

buildercompound_2021-09-07_12_04_47.jpg.d16805fe2f51bfec63f2c6d5004413ab.jpg

Given that this is a synthetic test, and in typical situations you won't need more than, let's say, 10 objects interacting with each other simultaneously, it seems to me that those limits could be raised like ten times, and it shouldn't hurt the performance.

Now, I haven't tried this with the latest multicore enhancements, so it might be better, but:

 

  • Haha 1

I always assumed I'd taste like boot leather.

 

Link to comment
Share on other sites

18 hours ago, joebarnin said:
  1. Player starts with blackjack/sword/arrows (typical situation)
  2. Some event takes away the blackjack and sword. He still has his bow, and can shoot arrows.
  3. Later, another event gives him a blackjack and sword. Preferably, he would just pick them up and that would re-enable them.

This sounds like something you could do by removing or adding weapon entities to the player's inventory - Geep's method with disableWeapons() was only intended to stop the player from using his weapons ("too slippery") without taking them anyway.

The script method to remove a weapon would be:

$player1.replaceInvItem($blackjack1, $null_entity);

The script method to add a weapon should be:

$blackjack2.frob($player1);
or
$player1.addInvItem($blackjack2);

As you can see, you'd need 2 different blackjacks in the map - I doubt you can add an item to the player's inventory that was already removed, though it's worth a try.

[This might all fail if the engine doesn't treat weapons as inventory items at all]

  • Thanks 1
Link to comment
Share on other sites

11 minutes ago, Dragofer said:

Hmm... this isn't quite as versatile as I'd hoped. If all it can do is detect which entity triggered it I'll have to think of another way to do what I need.

 

Basically my setup is I have a bunch of buttons that will increment a counter by an amount specific to each button. I'd like for them to all call the same script and pass their unique increment value to the script, eg, declare the script as follows

void increment_counter( float increment_amount ) {
    counter = counter + increment_amount;
}

and then give my atdm:target_callscriptfunction spawnargs of "call increment_counter" and "arg1 13" or whatever that second one would have had to be. What a pity this cannot be done.

I was hoping to avoid having to stuff a bunch of if statements into my script:

if (ent_button == button_13) counter = counter + 13;
if (ent_button == button_17) counter = counter + 17;
if (ent_button == button_19) counter = counter + 19;  //yuck!

because that's gross.

My missions:           Stand-alone                                                      Duncan Lynch series                              

                                      Down and Out on Newford Road              the Factory Heist

                                                                                                  A House Call

                                                                                                  The House of deLisle                                                                                                  

                              

Link to comment
Share on other sites

Why not add the counter increment as a spawn arg on the button? So each button has

”counterIncrement” “13”

or whatever. Then your script gets the value of the “counterIncrement” spawn arg from the button passed into the script function, and uses that to increment the counter. No need for if/then ugliness. 

  • Like 1
Link to comment
Share on other sites

4 hours ago, joebarnin said:

Why not add the counter increment as a spawn arg on the button? So each button has

”counterIncrement” “13”

or whatever. Then your script gets the value of the “counterIncrement” spawn arg from the button passed into the script function, and uses that to increment the counter. No need for if/then ugliness. 

Yep, that seems like the way to go. The "advanced example" uses spawnargs like this on various entities to make a teleportation buttons setup. Once you have an entity you can also get all its spawnargs.

  • Like 1
Link to comment
Share on other sites

@Dragofer

Perhaps that advanced example is a bit hard to grasp, a little too abstract in presentation. Maybe it needs an illustration with 2 buttons, "Jump East" and "Jump West", and two rabbits (func_static model instances) that "jump" in unison. And the salient Entity Views of each button and the target_callscriptfunction.

  • Like 1
Link to comment
Share on other sites

Yes, that wiki example was pretty opaque to me. Now I can see how getting a button's spawnargs works.

My missions:           Stand-alone                                                      Duncan Lynch series                              

                                      Down and Out on Newford Road              the Factory Heist

                                                                                                  A House Call

                                                                                                  The House of deLisle                                                                                                  

                              

Link to comment
Share on other sites

This is an old issue. It's not straightforward to pass the calling entity to a script, because it's technically the "player" that's being passed to the script (the thing frobbing the button, not the button itself, or whatever it is). You can't get the button's spwanargs because the script has no idea what button called it, since the player was the calling entity. (You can get the player's spawnargs, but what good is that?!)

So when you want conditional calls to the same script becomes a big mess, since the same player is always passed; how do you get the conditional value in? Tels actually fixed it, or made a version of a call that would pass the button directly instead, which was great. But IIRC it broke a puzzle in one FM so the idea was torched.

I proposed we could just make a new kind of button that passes itself directly under that new system as a parallel thing (i.e., "pass the frobbee not the frobber" as a parallel call type to "pass the frobber", and a different type of button for each one) so it doesn't break that FM, but I guess by that time the momentum for it was dead, or maybe that idea wouldn't work. Too bad as it'd be a really nice thing for mappers to have. I think there's a way around it, but I can never remember what it is, so it can't be that intuitive by comparison.

Edit: Oh that's right. Yes, you just put the value in as a spawnarg to some dummy object and then getKey it into the script, although then you still need two steps (one to setKey it into the object and one to getKey it into a script; remember the script doesn't know which button to getKey either, so you can't just tell it to getKey "the button you want"), so it's still annoying. Be better if the script could just take it directly from the arbitrary calling button! But alas!

Edit2: Note though I had issues with this years and years ago, so I don't know if any functionality or methods were developed after I looked into it back then.

Edit3: I guess I should have read the wiki entry. So I gather with a "call" "scriptname" set on a button you can use "ent_button.<function>" in the script (instead of the old "$player1.<function>"), so the script get the spawnargs directly off the calling button / ent_button. If you can do that, then this is what me & Tels were talking about. I believe the catch is you're making your own buttons with this functionality instead of the vanilla functionality of buttons, which is fine under the circumstances, but this is the part that needs to be communicated, I guess.

Thanks for that wiki entry by the way, Dragofer. We'd be even more confused without it!

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

@demagogue
Quite a few of the methods for calling a script in fact pass the name of the calling entity. For example, any entity that has a "frob_action_script" passes its own name. This makes it quite straightforward to getKey custom spawnargs that were set on that entity in DR.

The callscriptfunction entity is the most versatile method because it's uniquely able to pass 3 different entities: itself, the entity that triggered it and one of its targets. In the wiki example, the buttons target such entities.

@Geep
Yeah, I suppose at least some of those examples could use visualisation

  • Like 2
Link to comment
Share on other sites

On 9/21/2021 at 8:49 AM, Dragofer said:

The script method to remove a weapon would be:

$player1.replaceInvItem($blackjack1, $null_entity);

Unfortunately that didn't work. It can't find the inventory item, no matter what name I use for it. I think the engine does some special processing when you pick up melee weapons. I also tried code to delete the blackjack weapon:

$player1.selectWeapon("blackjack")
entity weap = $player1.getWeaponEntity();
weap.remove();

but that crashed the game.

Is there any way to temporarily override the key bindings, so that '1' and '2' are inactive?

Link to comment
Share on other sites

Interesting problem.

I thought about using a trigger_timer to just detect twenty times a second whether you've got the blackjack out and then using $player1.selectWeapon("unarmed") to instantly put it away again.

This kinda works. Unfortunately I haven't figured out how to interrupt the animations for getting the weapon out and putting it away.

My missions:           Stand-alone                                                      Duncan Lynch series                              

                                      Down and Out on Newford Road              the Factory Heist

                                                                                                  A House Call

                                                                                                  The House of deLisle                                                                                                  

                              

Link to comment
Share on other sites

5 hours ago, joebarnin said:

I also tried code to delete the blackjack weapon:

How about simply calling remove() directly on the blackjack entity that you placed in DR? getWeapon() might get something else than what you're expecting, like a weapon attachment or something.

Maybe call $player1.selectWeapon("unarmed") in advance (maybe even with a sys.waitFrame() ) if that still crashes.

Link to comment
Share on other sites

5 hours ago, joebarnin said:

I also tried code to delete the blackjack weapon:

How about simply calling remove() directly on the blackjack entity that you placed in DR? getWeapon() might get something else than what you're expecting, like a weapon attachment or something.

Maybe call $player1.selectWeapon("unarmed") in advance (maybe even with a sys.waitFrame() ) if that still crashes.

4 hours ago, thebigh said:

Unfortunately I haven't figured out how to interrupt the animations for getting the weapon out and putting it away.

There must be a way to get and interrupt the animation of the player's arms viewmodel entity. Still the sound to take care of...

Link to comment
Share on other sites

I have a ceiling hatch that flips down in my mission. To avoid all my map being on a nice NS grid and looking boxy, I want to rotate the building a bit once I've finished it. When I do this, I find the rotate spawnarg doesn't update right and the hatch flips down at a skewy angle. Is there a way to bind it to something, or to calculate what the new rotate spwanarg has to be?

My missions:           Stand-alone                                                      Duncan Lynch series                              

                                      Down and Out on Newford Road              the Factory Heist

                                                                                                  A House Call

                                                                                                  The House of deLisle                                                                                                  

                              

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

    • 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
    • OrbWeaver

      I like the new frob highlight but it would nice if it was less "flickery" while moving over objects (especially barred metal doors).
      · 4 replies
    • nbohr1more

      Please vote in the 15th Anniversary Contest Theme Poll
       
      · 0 replies
×
×
  • Create New...