Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

FPSC Classic Scripts / I have the Pickup Key blues

Author
Message
Meows
13
Years of Service
User Offline
Joined: 12th Oct 2011
Location: Totally over the Rainbow
Posted: 8th Dec 2011 00:15
I have this script

And it does almost everything it is supposed to do Except give the player Key22. I use a Trigger zone and when the player enters the zone, the hud shows that you picked up a key and there is this nice ping sound to remind you that yes you have a key.

Key22 is in the Trigger zone IfUsed section. If I place a Key22 in the zone and pick it up the door works. However the Trigger zone will not give the player the darn key! It says it does but it does not.

What am I doing wrong please?
I spent the last 4 days researching how to give a player a specific item via a script and have gone brain dead. I am so sorry.

Meows

Life is a short trip to another world
BlackFox
FPSC Master
16
Years of Service
User Offline
Joined: 5th May 2008
Location: Knight to Queens Bishop 3
Posted: 8th Dec 2011 01:23 Edited at: 8th Dec 2011 01:29
Quote: "If I place a Key22 in the zone and pick it up the door works. However the Trigger zone will not give the player the darn key! It says it does but it does not."


It is because your script is attached to the trigger, and the player can't "pickup" a trigger zone. The reason I say that is because you have the "playertake" command in the script for the trigger. That is why it is not working like you want it to.

You need to make your trigger script to spawn the key first when the player hits the zone, then assign a pickup script to the key once spawned.

So your trigger zone can use the "plrinzoneactivateused.fpi" script and your key can use the "pickupkey.fpi" or your own pickup script.


Twitter: @NFoxMedia
Meows
13
Years of Service
User Offline
Joined: 12th Oct 2011
Location: Totally over the Rainbow
Posted: 8th Dec 2011 06:14
BlackFox ,

So smart, after reading your post twice, it finally started to sink in. I see the logic, now I need to figure out how to do it.

Meows

Life is a short trip to another world
BlackFox
FPSC Master
16
Years of Service
User Offline
Joined: 5th May 2008
Location: Knight to Queens Bishop 3
Posted: 8th Dec 2011 06:44
Quote: "I see the logic, now I need to figure out how to do it."


Assign a trigger, give it the "plrinzoneactivateused.fpi" script, in the IfUsed field give it the name of your key.

Place a key where you want it to appear for the player. Assign it the "pickupkey.fpi" script. Set the field Spawn at Start to "No" and ensure the name matches the name used in the trigger IFUsed field.

That should do it. Oh and make sure the key is dynamic, not static.


Twitter: @NFoxMedia
Meows
13
Years of Service
User Offline
Joined: 12th Oct 2011
Location: Totally over the Rainbow
Posted: 9th Dec 2011 11:13
What I am attempting to do is add interaction with the Colonel Talker sample.


Now it says
Quote: "desc = Character will activate IFUSED if given item described in speech $1 (uses global:collecteditemA)"

Now the item is ( item e)

So what I figured it would be great to change the voice file to say.
Bring me my flask and I will give you the key you need.

So in IFUSED I put key22 then placed key22 left it dynamic and set it to not spawn at start. But I think the Colonel is too drunk as he never gives the key.

However in rethinking this, the script says it will ( Activate IFUSED ) so a key can not be activated in the IFUSED field i guess.

This is why i tried to change things and went with the code above that doesn't work yet. So for this game I will use BlackFox's suggestion using a trigger and key and place a mob and add a voice file saying something like the area has been cleared (NOT) and here is your key. It is just not as dynamic and interacting as with a NPC.

OK BlackFox, I must thank you again. In testing the Trigger and key I suddenly realized the Trigger only SHOWS the key. It does not GIVE the player the key. Give the player the key is what I wanted.
So I think I can rework my origional idea to add more interaction with the player.


Thank you very much BlackFox.

Life is a short trip to another world
BlackFox
FPSC Master
16
Years of Service
User Offline
Joined: 5th May 2008
Location: Knight to Queens Bishop 3
Posted: 9th Dec 2011 17:03 Edited at: 9th Dec 2011 17:52
You can have characters spawn items that the player can take. For example, I have a character that "gives" a key to the player. In the script, I have the "activatedifused=1" and in the If Used field for the character I put the key entity name in that field, setting the key to not spawn at start and placing it where I want it to appear (which is on a table just in front of the player between player and character). The player then presses the designated key to "take" or "pickup" the key. The main thing is if you want the If Used field to be activated or spawned, then you need to also ensure the "activatedifused=1" appears in the script where you want it to.

Here is a script I made for one of my levels. It has a character named Lt. Holtby, who will brief the player and give him multiple items such as an MP40, pistol, ammo, and radio. I use it for interaction, and it may help you.



Not to try and confuse you, but this is how you can assign one script to spawn multiple items for the player to pickup. You can disregard the commands "globalvar, decvar" as I am using the variables for inventory and such.

Here is the sequence of events for the script:

1. Player approaches Lt. Holtby; when player is within distance of 60, he/she are frozen in place.
2. Briefing starts with a sequence of huds.
3. Player is given the MP40.
4. Player is given the ammo for the MP40.
5. Player given pistol and ammo.
6. Player shown their inventory items.
7. Player given the radio.
8. Briefing ends, player is unfrozen and continues on his/her way.

Now look at this section ";ACTIVATE PLR MP40" and look at this line in the script:

:state=22:settargetname=l01_plr_mp40,activatetarget=1,etimerstart,state=23

What happens is that the character on this line sets the target to be the MP40 (settargetname=l01_plr_mp40), which is on the level and the Spawn at Start is set to No. When the character activates that target, the MP40 says "I've been activated" and it spawns. It works the exact same as if I had a trigger that had the MP40 in the IfUsed field and the item was spawned when the player entered the trigger zone. I do it again later with the pistol, ammo, and radio using the same commands "settargetname=item" and then "activatetarget=1" to spawn that target item.

The main thing to look at is how one script assigned to a character can "settargetname=x" to the particular item, and "activatetarget=1" to spawn that item. The items all have their Spawn at Start set to No and are placed on the map where I want them to appear. The player presses a designated key to "pickup" or "take" the item(s).

Hope this does not confuse you, but this method is how you can have multiple items spawned by one script without having to have trigger zones populating your map. I could assign this to a computer console entity, character, crate, etc. Feel free to use it, modify it, rip it apart and alter for your needs.


Twitter: @NFoxMedia
Meows
13
Years of Service
User Offline
Joined: 12th Oct 2011
Location: Totally over the Rainbow
Posted: 10th Dec 2011 11:30 Edited at: 10th Dec 2011 22:15
OK this is what I have now. Subject to change since I read BlackFox's reply.

I made a self extracting and a 7zip file of the editor file
that can be downloaded here
GivekeyTalk.exe

[href=http://www.filefactory.com/file/c0a6a3a/n/GivekeyTalk.exe ]http://www.filefactory.com/file/c0a6a3a/n/GivekeyTalk.exe [/href]


[href=http://www.filefactory.com/file/c0a6a3e/n/GivekeyTalk.7z ]http://www.filefactory.com/file/c0a6a3e/n/GivekeyTalk.7z [/href]
I was supprised it all worked.

The player walks up to the NPC, presses enter the NPC speaks, asking player to get a item, once player gets item and returns to NPC player gets a prompt to press enter, the NPC thanks them and tells player where the key is at.

In the editor file is the sound files the editor file and scripts.

or dnload attachment
Meows

Life is a short trip to another world

Attachments

Login to view attachments
Meows
13
Years of Service
User Offline
Joined: 12th Oct 2011
Location: Totally over the Rainbow
Posted: 10th Dec 2011 11:31
Now I have to get really into it to use Blackfox's awesome suggestion, I have 5 ideas already.

Many Thanks Blackfox!

Meows

Life is a short trip to another world

Login to post a reply

Server time is: 2024-11-24 04:24:04
Your offset time is: 2024-11-24 04:24:04