Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Shelf | Store

Privacy Policy


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Lantern script
Author Message
Hooumeri Offline
Member

Posts: 57
Joined: Oct 2010
Reputation: 0
Post: #1
Heart Lantern script
Hey.
I'm trying to make a script, which makes some grunts activated when the lantern is activated. When ever the lantern is not activated, the grunts are not active.

I tried a script (if HasItem....) but I couldnt get it to work. Could someone please help in creating it?

I'm calling the area which triggers this action "LightsOutArea_01" So when ever inside the area, this happens
The grunts are from servant_brute_1 to servant_brute_13.

I'm calling the area which brings everything to normal "LightsBackArea_01"
10-21-2010 08:00 PM
Find all posts by this user Quote this message in a reply
Everlone Offline
Member

Posts: 178
Joined: Oct 2010
Reputation: 2
Post: #2
RE: Lantern script
Why you write a script? You can make them very easy. open the model editor then the path:
Models/hand object/lantern and open the lantern model. there you add the sound and choose the configuration you will. save it and its ready Wink

for more help, ask me Wink

[Image: 555233.jpg]
10-21-2010 08:26 PM
Find all posts by this user Quote this message in a reply
Pandemoneus Offline
Senior Member

Posts: 328
Joined: Sep 2010
Reputation: 0
Post: #3
RE: Lantern script
OnStart()
{
AddEntityCollideCallback("Player", "AreaNameHere", "GruntLightEventOn", true, 1);
AddEntityCollideCallback("Player", "AreaNameHere", "GruntLightEventOff", true, 1);
}

void GruntLightEventOn(string &in asParent, string &in asChild, int alState)
{
AddTimer("", 0.1f, "GruntLightEvent");
}

void GruntLightEventOff(string &in asParent, string &in asChild, int alState)
{
RemoveTimer("GruntLightEvent");
}

void GruntLightEvent(string &in asTimer)
{
if(GetLanternActive() == true) {
    for(int i=1;i<13;i++) {
         SetEntityActive("servant_brute_" + i, true);
    }
}
else {
    for(int i=1;i<13;i++) {
         SetEntityActive("servant_brute_" + i, false);
    }
}

AddTimer("", 0.1f, "GruntLightEvent");
}

Something like that.

10-21-2010 08:33 PM
Find all posts by this user Quote this message in a reply
Everlone Offline
Member

Posts: 178
Joined: Oct 2010
Reputation: 2
Post: #4
RE: Lantern script
change my way Wink i change the sound in one minute. my lantern whisper Tongue it was a test ^^

[Image: 555233.jpg]
10-21-2010 08:48 PM
Find all posts by this user Quote this message in a reply
Pandemoneus Offline
Senior Member

Posts: 328
Joined: Sep 2010
Reputation: 0
Post: #5
RE: Lantern script
Everlone, I don't think you get what he wants to do.
He wants monsters active when he holds his latern and inactive when not.

He doesn't want to edit any sounds.

10-21-2010 09:01 PM
Find all posts by this user Quote this message in a reply
Everlone Offline
Member

Posts: 178
Joined: Oct 2010
Reputation: 2
Post: #6
RE: Lantern script
oh okay ^^ sorry

[Image: 555233.jpg]
10-21-2010 09:15 PM
Find all posts by this user Quote this message in a reply
Hooumeri Offline
Member

Posts: 57
Joined: Oct 2010
Reputation: 0
Post: #7
RE: Lantern script
(10-21-2010 08:33 PM)Pandemoneus Wrote:  
OnStart()
{
AddEntityCollideCallback("Player", "AreaNameHere", "GruntLightEventOn", true, 1);
AddEntityCollideCallback("Player", "AreaNameHere", "GruntLightEventOff", true, 1);
}

void GruntLightEventOn(string &in asParent, string &in asChild, int alState)
{
AddTimer("", 0.1f, "GruntLightEvent");
}

void GruntLightEventOff(string &in asParent, string &in asChild, int alState)
{
RemoveTimer("GruntLightEvent");
}

void GruntLightEvent(string &in asTimer)
{
if(GetLanternActive() == true) {
    for(int i=1;i<13;i++) {
         SetEntityActive("servant_brute_" + i, true);
    }
}
else {
    for(int i=1;i<13;i++) {
         SetEntityActive("servant_brute_" + i, false);
    }
}

AddTimer("", 0.1f, "GruntLightEvent");
}

Something like that.

Couldnt get this to work. If someone could possibly try it themselves and post a solution? plz Sad
10-22-2010 02:04 PM
Find all posts by this user Quote this message in a reply
house Offline
Member

Posts: 195
Joined: Oct 2010
Reputation: 1
Post: #8
RE: Lantern script
You ALMOST have a problem like me. Exept, I'm trying to make a door unlock when you PICK UP the lantern. I could never get that to work. Sad
10-22-2010 03:12 PM
Find all posts by this user Quote this message in a reply
ThePaSch Offline
Member

Posts: 103
Joined: Sep 2010
Reputation: 0
Post: #9
RE: Lantern script
(10-22-2010 03:12 PM)house Wrote:  You ALMOST have a problem like me. Exept, I'm trying to make a door unlock when you PICK UP the lantern. I could never get that to work. Sad

*snip*
Sorry, didn't see your thread.

10-22-2010 03:23 PM
Find all posts by this user Quote this message in a reply
Mofo Offline
Member

Posts: 71
Joined: Sep 2010
Reputation: 2
Post: #10
RE: Lantern script
(10-22-2010 03:12 PM)house Wrote:  You ALMOST have a problem like me. Exept, I'm trying to make a door unlock when you PICK UP the lantern. I could never get that to work. Sad

Open your map in the level editor and select the lantern. select the entity tab on the right side of the screen and add a callback funtion named: PickLantern.

[Image: 15ygi9f.jpg]


Open the .HPS file and add the following lines:

void PickLantern(string &in asEntity, string &in asType)
{
SetSwingDoorLocked("your_door_here", false, false);
}

(If your door is a Level Door, change SetSwingDoorLocked("your_door_here", false, false); to SetLevelDoorLocked("your_door_here", false);

*EDIT*
Just noticed you had opened a thread about this. http://frictionalgames.com/forum/thread-5152.html
10-22-2010 03:34 PM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)