Jump to content
The Dark Mod Forums

Toggling the Player Lantern


grayman

Recommended Posts

I can't find a way to toggle the player lantern via script.

 

I could write a script event to add this ability, but if there's a workaround anyone knows about, I'm willing to do that.

 

Anyone know how to toggle the lantern on and off?

 

Thanks.

Link to comment
Share on other sites

You could identify the initial inventory item, flip to the lantern, activate it, and then flip back to the initial inventory item via script.

Edited by Moonbo

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

Currently the lantern works like this:

  • If the player uses it, it checks whether the light is already there
  • in this case it removes it, in the other case it spawns a light and attaches it to the player

You could change the scriptobject (to be found in tdm_playertools.script in the tdm_base01.pk4) so that it spawns and attaches the light in the init() method, and later one only turns it on and off. The light gets attached to a position called "lantern_light". This way you could access the entity via

 

entity lantern = $player1.getAttachment("lantern_light");

 

and than turn it of using On() and Off().

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

I used Obs' suggestion:

 

1 - Grabbed a copy of the lantern's script object code and pasted it into my mission's script file.

 

2 - Changed the name of the script object, otherwise there's a namespace collision at game start time.

 

3 - Gave the new script object to the lantern in the mission.

 

4 - Rewrote the script object so it spawned a light during init, then turned it on and off when used in the inventory.

 

5 - When it's time to have the script (not the script object) manipulate the lantern light, I grabbed it using the attach position and did what was needed.

 

6 - With this design (spawning a light during init), I had to be careful when a camera has control. The camera automatically turns on the player light when the camera passes control back to the player, whether the lantern is on or off. This wasn't a problem with the original script object, because when the lantern was off, there was no light. The player is hidden during a cinematic by using the Hide() method, and when the cinematic is finished, the Show() method is run. Show() on the player runs Show() on all attachments, so it gets run on the lantern light, and that turns it on.

 

 

Thanks, Obs.

 

And thanks to Moonbo for your suggestion. Unfortunately, w/o the script object change to make the light available, there's no way to toggle the lantern on and off.

  • Like 1
Link to comment
Share on other sites

I can'T remember, but is it possible to overwrite functions in doom3 scripting? If so you could overwrite the show() method.

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

    • nbohr1more

      Was checking out old translation packs and decided to fire up TDM 1.07. Rightful Property with sub-20 FPS areas yay! ( same areas run at 180FPS with cranked eye candy on 2.12 )
      · 2 replies
    • taffernicus

      i am so euphoric to see new FMs keep coming out and I am keen to try it out in my leisure time, then suddenly my PC is spouting a couple of S.M.A.R.T errors...
      tbf i cannot afford myself to miss my network emulator image file&progress, important ebooks, hyper-v checkpoint & hyper-v export and the precious thief & TDM gamesaves. Don't fall yourself into & lay your hands on crappy SSD
       
      · 5 replies
    • OrbWeaver

      Does anyone actually use the Normalise button in the Surface inspector? Even after looking at the code I'm not quite sure what it's for.
      · 7 replies
    • Ansome

      Turns out my 15th anniversary mission idea has already been done once or twice before! I've been beaten to the punch once again, but I suppose that's to be expected when there's over 170 FMs out there, eh? I'm not complaining though, I love learning new tricks and taking inspiration from past FMs. Best of luck on your own fan missions!
      · 4 replies
    • The Black Arrow

      I wanna play Doom 3, but fhDoom has much better features than dhewm3, yet fhDoom is old, outdated and probably not supported. Damn!
      Makes me think that TDM engine for Doom 3 itself would actually be perfect.
      · 6 replies
×
×
  • Create New...