Scripts / [SOLVED] Question about custom scripts for campaign/story

Author
Message
Nerf Rhett Games
4
Years of Service
User Offline
Joined: 27th Jan 2020
Location: Mainland United States
Posted: 9th Apr 2020 22:32 Edited at: 19th Apr 2020 17:51
Hi all, I am in dire need of 3 scripts, or how to find them if they exist.
1. When a weapon is picked up, play a sound (but only first time, such as a voice line)
2. When all of the targets are shot, play a sound
3. When an enemy is killed, play a sound to the player (such as an ally through the radio saying "nice shot" or something along those lines)
Ideas of how they might work:
1. Normal weapon script addon: when the weapon is picked up, check for a variable. If the variable is 0, play a sound and set to 1.
2. I wouldn't know how this one would be set up, but variables are somehow triggered when the target is shot, it adds 1, checks if that variable meets the requirement. If not, do nothing. If the requirement is met, play the sound.
3. Normal enemy AI script addon: when an enemy is killed, play a sound on a certain entity nearby (?).
If any of them exist somewhere, please link them in the replies. Any help is appreciated.
Edit: corrected spelling

The author of this post has marked a post as an answer.

Go to answer
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 9th Apr 2020 23:57
This post has been marked by the post author as the answer.
1- Edit "weapon.lua" file and search for "PlaySound(e,0)" there you can replace it by your own sound/voice.
2- You would have to control when the target is hitted firts, take a look to some related lua commands to achieve it, such as "GetIntersectCollisionX" in "global.lua" file in scriptbank folder.
3- You'll has to control the enemy health, take a look to "g_Entity[e]['health']" also in global.lua. In fact all the GG commands are there.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM

Login to post a reply

Server time is: 2024-04-25 02:17:28
Your offset time is: 2024-04-25 02:17:28