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


Thread Rating:
  • 2 Vote(s) - 3.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Another Scripting Problem...
Chilton Offline
Member

Posts: 138
Threads: 9
Joined: Sep 2010
Reputation: 0
#11
RE: Another Scripting Problem...

What are you talking about; all i did was forget to put "s around the servantgrunts name, the XML is all correct Big Grin
In the editor, have you unticked the "Active" option on the NPC? If you have, he should be semitransparent and wireframe. If you have not, he will look normal.

(Its supposed to be unticked, or itll just be there when you start, rather than spawning)
10-10-2010, 06:13 PM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#12
RE: Another Scripting Problem...

I don't hear the monster because I made the monster to not be active, but when I unlock the door, the monster becomes active. It is supposed to become active when I go into the trigger area.

10-10-2010, 06:15 PM
Find
Chilton Offline
Member

Posts: 138
Threads: 9
Joined: Sep 2010
Reputation: 0
#13
RE: Another Scripting Problem...

(10-10-2010, 06:15 PM)Kyle Wrote: I don't hear the monster because I made the monster to not be active, but when I unlock the door, the monster becomes active. It is supposed to become active when I go into the trigger area.

Your the one who put the spawner on the function to unlock the door - check the page in a few seconds and itll be edited to not do that

EDIT: Edited and ammended as of now.
10-10-2010, 06:17 PM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#14
RE: Another Scripting Problem...

Thanks everyone! It works perfectly! Big Grin

10-10-2010, 06:24 PM
Find
Entih Offline
Junior Member

Posts: 47
Threads: 4
Joined: Sep 2010
Reputation: 0
#15
RE: Another Scripting Problem...

Since the previous poster laid out the script, let me see if I can help you with syntax, so you become more efficient with your self-scripting. I've been wanting to write a set of tutorials for scripting, but have been too busy, so this will have to do for now.

Lets look at your item use script:

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("MansionDoor", false, true);
PlaySoundAtEntity("", "unlock_door" , "MansionDoor", 0, false);
RemoveItem("Mansion Key");
}

When you called 'AddUseItemCallback' in OnStart(), you said "Whenever the map FIRST runs, make it so whenever that item is used on this door, it does the function 'UsedKeyOnDoor'.

Whenever you see brackets, { }, it means all the stuff between them belong to the function or line that came before them. So don't really think of it as combining scripts or such, think of it as a bunch of chunks of script which do different things.

As such, when the key is used on the door, it skips down the code until it finds that 'void UsedKeyOnDoor(...)'. It then looks at the parentheses and says "Okay, the item used was called 'key', so asItem becomes the name 'key'. Item used on was called 'door', so asEntity becomes the name 'door'."

It then goes into the brackets and performs the instructions line by line, until it hits the closing bracket. Or the keyword 'return', if you're getting a little complicated.

Collides work exactly the same way, just with a different function with different stuff in the parentheses. Take a look at the script provided by the previous poster and dissect it, say to yourself what each line means and what it does, as that tends to help.
10-10-2010, 06:38 PM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#16
RE: Another Scripting Problem...

Thanks Entih!

Now I actually can start understanding syntax! Smile

10-11-2010, 01:40 AM
Find




Users browsing this thread: 1 Guest(s)