MsHannerBananer
Member
Posts: 218
Threads: 34
Joined: Sep 2013
Reputation:
10
|
HasItem scripting help
Looking over the HasItem script.
Objective is to prevent the player from leaving unless they have a key.
I'm kinda dumb at scripting complicated stuff, and the script for this kind of event isn't working for me.
Code is in the following spoilers.
The door they leave out of once they've completed the map is blocked by a block box called "block". Once they have the key, the block box is supposed to be set inactive, as shown in the script.
I tried to do this right, and even looked up how other users did it in their custom stories, however I can't seem to get it right. Woe is me, haha.
"SecretlKey" is named as such in the Name field and the CustomSubItemTypeName.
|
|
01-29-2014, 09:56 AM |
|
PutraenusAlivius
Posting Freak
Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation:
119
|
RE: HasItem scripting help
Can you show us the whole script and please re-check the names. See if they don't match. If they don't, match them and check again.
EDIT:
In order to have the script to check the name of the item, it needs to be specified so in the .lang file IIRC.
"Veni, vidi, vici."
"I came, I saw, I conquered."
|
|
01-29-2014, 10:00 AM |
|
Daemian
Posting Freak
Posts: 1,129
Threads: 42
Joined: Dec 2012
Reputation:
49
|
RE: HasItem scripting help
AddEntityCollideCallback("Player", "voiceCheck_Area", "notyet", true, 1);
I think you're just missing the zero instead of 1.
|
|
01-29-2014, 05:03 PM |
|
i3670
Posting Freak
Posts: 1,308
Threads: 74
Joined: Oct 2011
Reputation:
36
|
RE: HasItem scripting help
What is is that isn't working? Is the dialogue not working or is there a problem with the block_box?
|
|
01-29-2014, 06:24 PM |
|
MsHannerBananer
Member
Posts: 218
Threads: 34
Joined: Sep 2013
Reputation:
10
|
RE: HasItem scripting help
(01-29-2014, 05:03 PM)Amn Wrote: AddEntityCollideCallback("Player", "voiceCheck_Area", "notyet", true, 1);
I think you're just missing the zero instead of 1.
Didn't work. >.<
(01-29-2014, 06:24 PM)i3670 Wrote: What is is that isn't working? Is the dialogue not working or is there a problem with the block_box?
The dialogue works fine, luckily. However once I have the key in my inventory, the check script box doesn't check for it and remove the block box.
|
|
01-29-2014, 10:01 PM |
|
FlawlessHappiness
Posting Freak
Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation:
171
|
RE: HasItem scripting help
AddEntityCollideCallback("Player", "voiceCheck_Area", "notyet", true, 1);
You put the callback true. This means that it only calls once. Then it's deleted. That's why it's not working more than once.
Trying is the first step to success.
|
|
01-29-2014, 10:06 PM |
|
MsHannerBananer
Member
Posts: 218
Threads: 34
Joined: Sep 2013
Reputation:
10
|
RE: HasItem scripting help
I've changed the script and removed the block box, and just make it so the door unlocks once the check box detects if the player has the key and just unlocks the door if they do, however remains locked if they don't.
The script is now this in the .hps (AddEntityCollide etc didn't change.
I checked, double checked, and triple checked the names between the .lang file and the .hps file. Everything matches up on my end.
(01-29-2014, 10:06 PM)FlawlessHair Wrote: AddEntityCollideCallback("Player", "voiceCheck_Area", "notyet", true, 1);
You put the callback true. This means that it only calls once. Then it's deleted. That's why it's not working more than once.
I figured that out last night. Changed it. Still doesn't work. xD
|
|
01-29-2014, 10:12 PM |
|
FlawlessHappiness
Posting Freak
Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation:
171
|
RE: HasItem scripting help
Things to check off now:
- Is the name "SpecialKey" correctly spelled everywhere? Both with capitalizing and grammar? ALSO in the editor!
- Did you remember the last } in the "notyet" function?
- Instead of unlocking the door, just try playing a sound, to see if anything is actually calling, or even better, call an AddDebugMessage("Message", false);
Trying is the first step to success.
|
|
01-29-2014, 10:18 PM |
|
MsHannerBananer
Member
Posts: 218
Threads: 34
Joined: Sep 2013
Reputation:
10
|
RE: HasItem scripting help
(01-29-2014, 10:18 PM)FlawlessHair Wrote: Things to check off now:
- Is the name "SpecialKey" correctly spelled everywhere? Both with capitalizing and grammar? ALSO in the editor!
- Did you remember the last } in the "notyet" function?
- Instead of unlocking the door, just try playing a sound, to see if anything is actually calling, or even better, call an AddDebugMessage("Message", false);
Spelled correctly everywhere via copy and paste.
The last } is present.
I tried changing it to a sound, didn't work, then used the AddDebugMessage("Message", false); . Neither of them worked. I don't think the function is actually calling. Which now begs the question... now what? LOL
|
|
01-29-2014, 10:42 PM |
|
FlawlessHappiness
Posting Freak
Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation:
171
|
RE: HasItem scripting help
Ok. So this is how it works right now.
You pass the script box without any key.
- The dialogue appears.
You pass the script box with a key
- Does the dialogue still appear?
If it does then something is wrong with your key, because it's not getting that you have "SpecialKey".
Trying is the first step to success.
|
|
01-30-2014, 07:14 AM |
|
|