Jump to content
The Dark Mod Forums

Recommended Posts

Posted

 So I would like to use the call_on entry, call_on_exit method to change skyboxes. I have tried the following, but its causes a crash on map load - 

I have 2x skybox entities 'portalsky_pagan' and 'portalsky_wastlands'

image.thumb.png.88cf04d18d5461e5f2f40d8c40ed3e25.png

bhm_banner.jpg

Posted (edited)

You can just trigger them like you have but they need to be called as an entity:

string curr_skybox = "sky_city_night"; // whatever your starting skybox entity is called 

void change_skybox(entity zone) /passes the location ent
{
    entity skybox = zone.getEntityKey("skybox");
 
        if (curr_skybox != skybox.getName())
        {
        sys.trigger(skybox);    // just trigger it
        curr_skybox = skybox.getName();
        }
        sys.println(" [SKY] Sky set to " + curr_skybox);
 
}

You don't need a call on exit since this will check to see if there is change. 
Use spawn arg on the location entity "skybox" "yourSkyBoxName"

Give this a try and see if it works, might need some tweaking...

 
 
Edited by kingsal
  • Thanks 1
Posted (edited)
49 minutes ago, kingsal said:
Give this a try and see if it works, might need some tweaking...
 

Getting an error, 'curr' dosent seem to be a  valid command?

image.png.c00b26a74b3ec1cc08f05e386bf36c54.png

Edited by Bikerdude

bhm_banner.jpg

Posted (edited)

You can have multiple info_portalsky entities in a map. Triggering one will change the active skybox to that one.

Quote

Specifies location for portal sky. Multiple portalsky locations are supported, with one 'currently active' info_portalSky providing the view for all portal sky brushes. Triggering an info_portalSky will make it 'current', even if it didn't have a 'triggered' flag to start with.

I just quote the entity info on the wiki/DR.

Edited by datiswous
Posted (edited)

It's very simple. Just make a trigger and target the specific info_portalsky.

See added testmap. It has a default portalsky and when you touch the box it will change it to a different portalsky.

 

Edit: Ok maybe I didn't read the topic text correctly, sorry. I guess you already know this, but want to do it via script.

testp.map

Edited by datiswous
Posted (edited)

A trigger needs the player to pass through that trigger brush, where as if I can get it trigger via the location the player is in, the player can be anywhere inside that location.

Edited by Bikerdude
  • Like 1

bhm_banner.jpg

Posted (edited)

Ok I got it working. See attachments. Ignore the ugly look. When you walk into the small room on the right the sky changes to the one with the moon. When you go back it changes back to the thunder sky.

void skymoon(entity room2)
{
sys.println("script skymoon running..");
sys.trigger( $moon );
}
void skythunder(entity main)
{
sys.println("script skythunder running..");
sys.trigger( $thunder );
}

void main()
{
}

image.png.7731b7edc40a865bf305158636c9f4b2.png

See also: https://wiki.thedarkmod.com/index.php?title=Location_Settings#Example_script_to_turn_entities_on/off_when_player_enters_a_location

testp.map testp.script

Edited by datiswous
  • Thanks 1
Posted (edited)

What is weird is that I found I made a small error, but it still works..

 

void skythunder(entity main)

Should actually be:

void skythunder(entity room2)

I think, because I'm doing a "call_on_exit" for zone room2

 

Edit: I think the script example is for triggering a single entity on and of while in this case you trigger different scripts for entry and exit. 

 

Edited by datiswous
Posted

So added it to my WIP and am having an issue. If I walk into another info_location that dosent need to change the skybox (so a connecting room) the skybox is being changed anyway.

I have removed the call_on_exit from the info_loc in the first location, but the change is still happening - 

image.png.0ee073334078c0c065ce893f04d64c0a.png

bhm_banner.jpg

Posted (edited)

Actually this should be inside a zone wrapper so you can do other things when changing zones (set fog, trigger sounds, ect) 
This will also activate any targets the you have on the location entities. 
The debounce part is important since it will prevent zones from getting triggered too fast and causing errors.

‼️If you do get weirdness like the wrong skybox appears or the location entity triggers its targets twice, let me know. Might need to bring the grace period down from 0.4 - 0.1 or 0.2.


 

string curr_skybox = "portalsky_night"; // <<define starting skybox
 
void change_skybox(entity zone)
{
    entity skybox = zone.getEntityKey("skybox");
 
        if (curr_skybox != skybox.getName())
        {
        sys.trigger(skybox);    
        curr_skybox = skybox.getName();
        }
        sys.println(" [SKY] Sky set to " + curr_skybox);
 
}
 
entity __last_zone = $null_entity;
float  __last_zone_time = -9999;
 
void setZone(entity zone)
{
 
    float now = sys.getTime();
    // Debounce
    if (__last_zone == zone && (now - __last_zone_time) < 0.4) {
        return;
    }
    __last_zone = zone;
    __last_zone_time = now;
 
    // do stuff
 
    if (zone.getEntityKey("skybox") != $null_entity) {
        change_skybox(zone);
    }
 
    // Drive one-shot triggers
    zone.activateTargets($player1);
 
}

skybox_edit.map skybox_edit.script

Edited by kingsal
  • Thanks 1
Posted

Ah okay..

We need to set "triggered" "1" on those info_portalsky or the engine will just set whatever sky comes last in your map file as the first skybox.  🤷‍♂️

Also we need to clear curr_skybox = "" to let the location system update it.
This should work now. No need to trigger the skyboxes in the map file or anything like that.


skybox_edit2.scriptskybox_edit2.map

  • Like 1

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

    • jaxa

      Talk GabeCube:
      https://forums.thedarkmod.com/index.php?/topic/18055-2016-cpugpu-news/page/39/#findComment-508710
      · 1 reply
    • The Black Arrow

      Things have been so bad these days for me...
      Just a year ago, I've been feeling dizzy, I thought it was nothing, today's stress, that type of thing, went to sleep...Still dizzy! 9 more days dizzy, went to doctor (I would have gone on the first day if NOT for the long appointment time)
      Said it may be Neck Dizziness...I did exercises for 6 months, no changes.
      Went to a Physical Therapist, went to another, no changes.
      I've asked my doctor for a full check this time.
      I hated yesteryear so much due to personal reasons, this year might be the same.
      To be brutally honest, I'd rather have cancer or/and chronic pain than suffer dizziness any second longer, especially when nothing helps.
      Hard to enjoy Thief when you're dizzy so I was hoping this year, Winter will be best for me.
      · 7 replies
    • JackFarmer

      Hello mappers and taffers! 

      Are you still out there? It is so calm here these days and I am afraid this is no good sign.
      Proof me wrong, tell your best friend (=me), that you are still here and that you will not go away!
      · 5 replies
    • JackFarmer

      Happy Labour Day, my taffing taffers & hard working mapping friends!
      And remember the poor souls who, within the Inventors’ organization, labor under Jonus’s yoke to ensure the success of that very guild! Always remember the hard workers!
      · 2 replies
    • datiswous

      Is there a script command to make a screenshot?
      I just though it could be interesting to be able to create a screenshot at a certain point in time. Then use that screenshot possibly in a debrief.
      I guess the second question is: Can you use a (in-game made) screenshot in a (debrief) gui?
      · 1 reply
×
×
  • Create New...