Aller au contenu

Photo

omg! spent 3 hrs trying to figure out something that should have taken 1 minute


  • Veuillez vous connecter pour répondre
11 réponses à ce sujet

#1
dickel

dickel
  • Members
  • 72 messages
All I am trying to do is (via  a conversation), turn a light placeable from off to on.....I have even installed sls2 lighting system into my module and swear i'm doing what should be working. Yet it doesnt.
Also tried ga_create_obj and creating a light source (L) yet that doesnt work either.
Also tried creating a blueprint of the light thinking that mattered, didnt seem to change anything. No matter what I try the light never comes on....oh the pain.....

Anyone know what i'm missing? Because im certain it has got to be something simple or obvious.

#2
El Condoro

El Condoro
  • Members
  • 148 messages
SLS2 has a ga_ script (ga_sls2_lightevent_object) that you can add to the action of a node. Enter the light event number (ON = 221002) and the tag of the light. Otherwise, for a node action,

void main()
{
object oLight = GetObjectByTag(tagLight);
SetLightActive(oLight,TRUE);
}

Hopefully, that'll fix it.

Edit: Oh, and light objects lose their tag after a saved game is loaded. That negates the script above. If the light is the nearest one to the speaker of the conversation you could use,

void main()
{
object oPC = GetPCSpeaker();
object oLight = GetNearestObject(OBJECT_TYPE_LIGHT,oPC);
SetLightActive(oLight, TRUE);
}

Modifié par El Condoro, 23 février 2011 - 12:22 .


#3
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
Another option is to place a local string on the light and check for that string on nearby lights. This is useful in situations where there are many lights and it may be difficult to check for the nearest one.



But if you only have widely spaced lights, like in most mods, then El Condoro's script will be easier to implement.

#4
dickel

dickel
  • Members
  • 72 messages
thanks to El Condoro, i'll give that a try after work tonight.


#5
Dann-J

Dann-J
  • Members
  • 3 161 messages

El Condoro wrote...
void main()
{
object oPC = GetPCSpeaker();
object oLight = GetNearestObject(OBJECT_TYPE_LIGHT,oPC);
SetLightActive(oLight, TRUE);
}


If the light you want isn't the closest to the PC speaker then you can place a waypoint at the light location, give it a unique tag (unlike lights, waypoints don't lose their tags when reloading a saved game), and use the waypoint object instead of 'oPC' as the starting point for GetNearestObject.

I mostly turn lights on and off from conversations or scripts on usable objects (campfires, braziers, lamps, etc), where OBJECT_SELF works as the GetNearest starting point. That way you can avoid having to give anything a unique tag, and can simply place down lightable objects from predefined placeable groups.

It gets more complicated if you want to spawn or remove effects at the same time (fire and smoke, for instance), since you often have to offset the effect slightly in the Z axis from the usable object's origin. Plus there are sound objects to activate and deactivate for fires... that is, if you're a freak for details like I am. Image IPB

#6
dickel

dickel
  • Members
  • 72 messages
Ok, just for the record, I had already tried some of what el condoro wrote above last night ---

"SLS2 has a ga_ script (ga_sls2_lightevent_objct) that you can add to the action of a node. Enter the light event number (ON = 221002) and the tag of the light. Otherwise, for a node action,"

I am not sure why, but this didnt work. I then tried integer "221004" which turns a light on permanently. Neither worked for some reason.

Anyway, I'm home from work now and tried your script above El Condoro..it works fine as the nearest light to the PC (once i moved and deleted other lights that were closer) but the light doesnt stay on after the conversation has ended.
Scripting isnt a strength of mine just quietly. :(

I am interested in Dannj's response just above, that mentions using a waypoint as the getNearestObject....i still have a waypoint at the location of the light from my testing various things last night. If someone could write up a quick script including these that'd be ace.
Waypoint tag: wpl_aram_gmainc
Tag of the light: lt_aramakl_mcgl (might not need to include this - i am not sure)
(thanks for pointing out that lights dont keep their tags after a saved game...good to know. This makes me wonder though, if the PC has yet to enter the area in question, then since that light has yet to be rendered as such....would its tag still get reset after a saved game? Or only once they had entered the area and then saved.)

The scenario of the light turning on i am using, just fyi - is that the PC's enter the main crypt area and a cutscene conversation starts immediately. During this conversation a green light source turns on as a beam of green energy appears...the light is supposed to light up the crypt, its kinda dark without it :wizard:

Modifié par dickel, 24 février 2011 - 05:38 .


#7
El Condoro

El Condoro
  • Members
  • 148 messages
I'm no script wizard but this is what I assume to work.
void main()
{
object oWP = GetObjectByTag("wpl_aram_gmainc");
object oLight = GetNearestObject(OBJECT_TYPE_LIGHT,oWP);
SetLightActive(oLight, TRUE);
}

Not sure why your light is going out at the end of the convo - I thought it would last until SetLightActive was FALSE.

Your question about the light tag is an interesting one. In my module I had a module OnEnter script iterate through all the light objects in all the areas and set them as LocalObjects to be called later, but I like the idea mentioned by M. Reider to SetLocalString for each light obejct and check for that instead.

Edit: tested the above out and it all worked well from a convo. Could turn the light on and off and didn't refer to the light tag at all. Tested with a loaded save game and it also worked properly. The conversation did not affect the light at all (although it was a simple test convo).

Modifié par El Condoro, 24 février 2011 - 09:43 .


#8
Morbane

Morbane
  • Members
  • 1 883 messages
Just by chance, are you trying to ignite the light using a Action** command? If so the queue may be getting interrupted by the conversation.

#9
dickel

dickel
  • Members
  • 72 messages
ok El Condoro, you officially rock :) Thanks a lot.

Such a good feeling to get such an annoying little thing out of the way. My module can now continue :)

Peace

#10
El Condoro

El Condoro
  • Members
  • 148 messages
I'm glad you're on your way with your module but I can't take credit for DannJ's approach. :) I think that approach is probably the best way to get around the light tag bug. Cheers

#11
dickel

dickel
  • Members
  • 72 messages
True true, thanks also goes to DannJ

#12
Dann-J

Dann-J
  • Members
  • 3 161 messages
...and my thanks go to the 'Turn Off That Damn Light!' thread:

http://social.biowar...4/index/5261700