Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 16 Vote(s) - 4.44 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scripts Recollection
Author Message
jillis Offline
Junior Member

Posts: 4
Threads: 0
Joined: Jan 2012
Reputation: 0
Wink  RE: Scripts Recollection

(01-24-2012, 03:27 AM)flamez3 Wrote: Oops, use (string &in asEntity) instead ^^
Thanks man it worked!! I really appreciate it! Big Grin Big Grin
01-24-2012, 07:41 AM
Find
mrscoomich Offline
Member

Posts: 55
Threads: 6
Joined: Mar 2012
Reputation: 0
RE: Scripts Recollection

(10-20-2010, 02:20 PM)Frontcannon Wrote: Some simple functions covering the basics for the people being completely new to scripting?
Let's see what I can find..

How to make a locked door and a key to unlock it

Spoiler below!

void OnStart()
{
    AddUseItemCallback("", "R01_Key1", "mansion_1", "KeyOnDoor", true);
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
    SetSwingDoorLocked("mansion_1", false, true);
    PlaySoundAtEntity("", "unlock_door.snt", "mansion_1", 0.0f, true);
}

What it does:
AddUseItemCallback - calls a function when an item is used on an entity
R01_Key1 - the item used, in this case our key
mansion_1 - the entity the key is used on, the normal mansion door
KeyOnDoor - the function the callback calls (true means to remove it when called once)

SetSwingDoorLocked - locks/unlocks a door, false means to set it NOT locked, and the true is to wether use effects or not
PlaySoundAtEntity - plays a sound at an entity, in this case the "unlocked a door"- sound at mansion_1, our door, the float value is the time it takes to fade in and the true is some strange boolean Big Grin

this one doesnt work. I tried to place it onto my script but it gave me an error...
but its telling me that this : void KeyOnDoor(string &in asItem, string &in asEntity)
is the problem.

(This post was last modified: 03-18-2012, 06:04 PM by mrscoomich.)
03-18-2012, 05:58 PM
Find
Stepper321 Offline
Senior Member

Posts: 263
Threads: 26
Joined: Nov 2011
Reputation: 8
RE: Scripts Recollection

(03-18-2012, 05:58 PM)mrscoomich Wrote:
(10-20-2010, 02:20 PM)Frontcannon Wrote: Some simple functions covering the basics for the people being completely new to scripting?
Let's see what I can find..

How to make a locked door and a key to unlock it

Spoiler below!

void OnStart()
{
    AddUseItemCallback("", "R01_Key1", "mansion_1", "KeyOnDoor", true);
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
    SetSwingDoorLocked("mansion_1", false, true);
    PlaySoundAtEntity("", "unlock_door.snt", "mansion_1", 0.0f, true);
}

What it does:
AddUseItemCallback - calls a function when an item is used on an entity
R01_Key1 - the item used, in this case our key
mansion_1 - the entity the key is used on, the normal mansion door
KeyOnDoor - the function the callback calls (true means to remove it when called once)

SetSwingDoorLocked - locks/unlocks a door, false means to set it NOT locked, and the true is to wether use effects or not
PlaySoundAtEntity - plays a sound at an entity, in this case the "unlocked a door"- sound at mansion_1, our door, the float value is the time it takes to fade in and the true is some strange boolean Big Grin

this one doesnt work. I tried to place it onto my script but it gave me an error...
but its telling me that this : void KeyOnDoor(string &in asItem, string &in asEntity)
is the problem.
More detail please

Signature to awesome to be displayed.
03-19-2012, 05:22 PM
Find
mrscoomich Offline
Member

Posts: 55
Threads: 6
Joined: Mar 2012
Reputation: 0
RE: Scripts Recollection

(03-19-2012, 05:22 PM)Stepper321 Wrote:
(03-18-2012, 05:58 PM)mrscoomich Wrote:
(10-20-2010, 02:20 PM)Frontcannon Wrote: Some simple functions covering the basics for the people being completely new to scripting?
Let's see what I can find..

How to make a locked door and a key to unlock it

Spoiler below!

void OnStart()
{
    AddUseItemCallback("", "R01_Key1", "mansion_1", "KeyOnDoor", true);
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
    SetSwingDoorLocked("mansion_1", false, true);
    PlaySoundAtEntity("", "unlock_door.snt", "mansion_1", 0.0f, true);
}

What it does:
AddUseItemCallback - calls a function when an item is used on an entity
R01_Key1 - the item used, in this case our key
mansion_1 - the entity the key is used on, the normal mansion door
KeyOnDoor - the function the callback calls (true means to remove it when called once)

SetSwingDoorLocked - locks/unlocks a door, false means to set it NOT locked, and the true is to wether use effects or not
PlaySoundAtEntity - plays a sound at an entity, in this case the "unlocked a door"- sound at mansion_1, our door, the float value is the time it takes to fade in and the true is some strange boolean Big Grin

this one doesnt work. I tried to place it onto my script but it gave me an error...
but its telling me that this : void KeyOnDoor(string &in asItem, string &in asEntity)
is the problem.
More detail please





----
void OnStart()
{
AddUseItemCallback("", "R01_Key1", "mansion_1", "KeyOnDoor", true);
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "mansion_1", 0.0f, true);
}


When I copy and paste that (replacing the examples with my entity/ door names),
it says Error( a number, a number)

and when I stare back at my .hps file, it seems that the error told me it was the line where the
void KeyOnDoor(string &in asItem, string &in asEntity)

was placed. i've tried to fix this a couple times and not sure if there is a typo or where to.

why doesnt it work?
(This post was last modified: 03-21-2012, 12:05 AM by mrscoomich.)
03-21-2012, 12:04 AM
Find
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
RE: Scripts Recollection

Is this your whole script. And what is your error say.

03-21-2012, 12:47 PM
Find
mrscoomich Offline
Member

Posts: 55
Threads: 6
Joined: Mar 2012
Reputation: 0
RE: Scripts Recollection

Ah my apologies. I forgot to leave the void KeyOnDoor out of the OnStart()
I'm only a beginner in scripting.
void OnStart()
//IN OnStart
{
AddUseItemCallback("", "R01_Key1", "mansion_1", "KeyOnDoor", true);
}
//OUTSIDE of OnStart
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "mansion_1", 0.0f, true);
}


^ could you please change it to this? it will seem less complicating. hehe thanks
03-25-2012, 01:41 AM
Find




Users browsing this thread: 1 Guest(s)