Jump to content
Ghost Graphic Designs

Virtual Objects, Triggers and Scripts?

Recommended Posts

Hi.

 

I would like to know if it's possible (I'm almost sure they all are):

  1. Force a squad vehicle to disable the headlights when inside a VO (and enabling when it's outside that VO).
  2. Force a VO to change from "Freely Accessible" to "Barricade" with a trigger (by squad vehicle).
  3. Play a looped sound while the pump switch (from the Limited Water Supply mod) is active.

I also request some guidelines on how to do this. Just tell me what to edit and I'll do it, I'm kind of experienced with script editing.

 

Thank you for reading. :)

Link to comment
Share on other sites

I am not used to the Scripting language used for EM4 but I have been trying figuring out the pump loop as well. I have not tested this but after quickly searching through some code I have found that the thing that could make it loop is the addition of "soundID ="

 

Number one is a sample from the Water Switch script for the limited supply and number two is for the Communication vehicles in Brooklyn mod (Which the Audio loops for). Apart from the endings (CarPos and Get Pos) which I believe are just the positions so shouldn't make a difference to looping, the only difference is the "soundID =" part. Number three is the edit I would try, I could be wrong but who knows :P

 

1) Audio::PlaySample3D("mod:Audio/FX/misc/pump_on.wav", v.GetPosition());

 

2) soundID = Audio::PlaySample3D("mod:Audio/Ambient/FirehouseRadio.wav", CarPos, true);

 

3) soundID = Audio::PlaySample3D("mod:Audio/FX/misc/pump_on.wav", v.GetPosition());

Link to comment
Share on other sites

Unfortunately, what your doing requires a constantly checking script that would eat a considerable amount of FPS. Instead I propse this:

Hi.

 

I would like to know if it's possible (I'm almost sure they all are):

  1. Force a squad vehicle to disable the headlights when inside a VO (and enabling when it's outside that VO).
  2. Force a VO to change from "Freely Accessible" to "Barricade" with a trigger (by squad vehicle).
  3. Play a looped sound while the pump switch (from the Limited Water Supply mod) is active.

I also request some guidelines on how to do this. Just tell me what to edit and I'll do it, I'm kind of experienced with script editing.

 

Thank you for reading. :)

 

 

  • In your ToStation script, when the vehicle is in the station at the start of the game, disable its headlights. Then when you send them out through a script, enable their headlights. Then when you send them back into station, disable their headlights. These are all manually done and not automatically when the vehicle leaves the VO. Use this code:
    void EnableHeadLights(bool enable_);
  • For the trigger thing, it isnt possible in normal freeplay. The game does not recognize triggers in freeplay, only mission scripts. So you'd have to just set it manually instead of relying on a trigger.

    bool SetVirtualObjectTerrain(const char* terrain_);
Link to comment
Share on other sites

Well, I use this for playing and stopping a 3D sound for my Automatic Fire Alarm script, playing then stopping the sound.

int x;x = Audio::PlaySample3D(Sound3D, obj->GetPosition(), true);obj->SetUserData(x);
int ref = Target->GetUserData();Audio::StopSample(ref);

The SetUserData might conflict with the functioning of whatever script you're adding it to.

Link to comment
Share on other sites

 

Unfortunately, what your doing requires a constantly checking script that would eat a considerable amount of FPS. Instead I propse this:

  • In your ToStation script, when the vehicle is in the station at the start of the game, disable its headlights. Then when you send them out through a script, enable their headlights. Then when you send them back into station, disable their headlights. These are all manually done and not automatically when the vehicle leaves the VO. Use this code:

    void EnableHeadLights(bool enable_);
  • For the trigger thing, it isnt possible in normal freeplay. The game does not recognize triggers in freeplay, only mission scripts. So you'd have to just set it manually instead of relying on a trigger.

    bool SetVirtualObjectTerrain(const char* terrain_);

 

Yeah, I exactly that with my alarm and ToStation scripts (headlights on/off and engine sounds aswell).  About the VO, I had an idea and I'm going to try something out with LA Mod's ToStation script... :)

 

Well, I use this for playing and stopping a 3D sound for my Automatic Fire Alarm script, playing then stopping the sound.

int x;x = Audio::PlaySample3D(Sound3D, obj->GetPosition(), true);obj->SetUserData(x);
int ref = Target->GetUserData();Audio::StopSample(ref);

The SetUserData might conflict with the functioning of whatever script you're adding it to.

Alright, thanks. :) 

 

I am not used to the Scripting language used for EM4 but I have been trying figuring out the pump loop as well. I have not tested this but after quickly searching through some code I have found that the thing that could make it loop is the addition of "soundID ="

 

Number one is a sample from the Water Switch script for the limited supply and number two is for the Communication vehicles in Brooklyn mod (Which the Audio loops for). Apart from the endings (CarPos and Get Pos) which I believe are just the positions so shouldn't make a difference to looping, the only difference is the "soundID =" part. Number three is the edit I would try, I could be wrong but who knows :P

 

1) Audio::PlaySample3D("mod:Audio/FX/misc/pump_on.wav", v.GetPosition());

 

2) soundID = Audio::PlaySample3D("mod:Audio/Ambient/FirehouseRadio.wav", CarPos, true);

 

3) soundID = Audio::PlaySample3D("mod:Audio/FX/misc/pump_on.wav", v.GetPosition());

OK, thank you! I'm gonna take a deeper look into that, I'll keep you posted. :)

Link to comment
Share on other sites

Hello everyone,

Can you introduce me how to make the animated gate can auto open and close when the vehicle is coming nearly and go far away, i tried to create Trigger but it;s nothing changed :(

Name the trigger and the gate the same thing and make sure the gate has the animations open and close

Tutorial: http://forum.emergency-planet.com/tutorials/article/45-creating-an-automatic-gate/

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.
Note: Your post will require moderator approval before it will be visible.

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.



×
×
  • Create New...