Jump to content

Recommended Posts

Posted

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.

Posted (edited)

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

Posted

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

Posted

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
Posted

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

Posted

I don't know if there's a way, but I don't need to override show() because I have a solution that doesn't require overriding it.

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

    • JackFarmer

      "The Year of the Rat." 
      😄

      Al Stewart must be proud of you!
      Happy testing!
      @MirceaKitsune
      · 1 reply
    • datiswous

      I posted about it before, but I think the default tdm logo video looks outdated. For a (i.m.o.) better looking version, you can download the pk4 attached to this post and plonk it in your tdm root folder. Every mission that starts with the tdm logo then starts with the better looking one. Try for example mission COS1 Pearls and Swine.
      tdm_logo_video.pk4
      · 2 replies
    • JackFarmer

      Kill the bots! (see the "Who is online" bar)
      · 3 replies
    • STiFU

      I finished DOOM - The Dark Ages the other day. It is a decent shooter, but not as great as its predecessors, especially because of the soundtrack.
      · 5 replies
    • JackFarmer

      What do you know about a 40 degree day?
      @demagogue
      · 4 replies
×
×
  • Create New...