Dear forum users! In compliance with the new European GDPR regulations, we'd just like to inform you that if you have an account, your email address is stored in our database. We do not share your information with third parties, and your email address and password are encrypted for security reasons.

New to the forum? Say hello in this topic! Also make sure to read the rules.

Activating a button once a weapon is lifted OR giving a player a weapon

Here you can find answered ScriptAPI topics.
Forum rules
By using the forum you agree to the following rules.
Post Reply
Captain JO
Meatbag
Posts: 3
Joined: Sat Nov 26, 2022 1:10 am

Activating a button once a weapon is lifted OR giving a player a weapon

Post by Captain JO » Tue Nov 29, 2022 3:48 pm

Hello,
so I like to make maps but have no idea how to script anything an I would like to add a feature where if an item is picked up it activates something kind of like in Indiana Jones where a trap activates once he lifts up the treasure.

If anyone knows how to script this help would be very nice

Thank you in advance :mrgreen:
0 x

User avatar
Mighty Spirit the 2
Superfighter
Superfighter
Posts: 180
Joined: Mon Jun 25, 2018 5:02 pm
Title: Wasted potential
SFD Account: ake004
SFD Alias: Retired SFD player
Started SFD: When melee was good
Location: SFD Veteran trauma hospital
Gender:
Age: 21

Post by Mighty Spirit the 2 » Mon Dec 12, 2022 3:14 am

To make a trap in the map editor use triggers to create cinematic moments. I wouldn't use scripting as that's far too complex for smth simple.
I made a small test map example.
The treasure is the Katana.
Here are some small clips i took -> https://imgur.com/a/JqnKdFY
"OnDestroyTrigger" monitors the Katana, and checks if it disappears. If this happens, it will trigger a "DestroyTrigger" which destroys the rocks which are holding back a huge ball. That's about as simple as it gets. You can make the effect much more dramatic, add for example Screen shacking, and explosion trigger and SpawnFire trigger. Use your fantasy.
1 x
🎶I will tell your story if you die
I will tell your story and keep you alive the best i can
...
But I've always had the feeling we would die young
Some die young
🎵

Captain JO
Meatbag
Posts: 3
Joined: Sat Nov 26, 2022 1:10 am

Post by Captain JO » Mon Dec 12, 2022 3:01 pm

Thank you so much!
I actually didn't realize that OnDestroyTrigger would activate once an item was picked up so thats what I was struggling with but now I will just use your method!
:mrgreen:
1 x

User avatar
Mighty Spirit the 2
Superfighter
Superfighter
Posts: 180
Joined: Mon Jun 25, 2018 5:02 pm
Title: Wasted potential
SFD Account: ake004
SFD Alias: Retired SFD player
Started SFD: When melee was good
Location: SFD Veteran trauma hospital
Gender:
Age: 21

Post by Mighty Spirit the 2 » Tue Dec 13, 2022 1:20 am

I didn't know this either, until i tried it....
At first i tried at writing a script but i'm glad that was totally unnecessary. :D
0 x
🎶I will tell your story if you die
I will tell your story and keep you alive the best i can
...
But I've always had the feeling we would die young
Some die young
🎵

Post Reply