Colt_H 10 Posted June 24, 2013 I'm making a scenario where players have to run away from a certain point and if they get left behind, a trigger that's slowly creeping up on them will kill them if it catches up. So far I've kind of figured out how to make a trigger kill you when you enter it and I was hoping I could make the trigger visible by using the attachto command and attaching something like flags or something to it, but I haven't a clue on how to make the trigger move in a straight line, perhaps there's a way to increase the size over time as opposed to moving it? Any help is greatly appreciated, Share this post Link to post Share on other sites
xxanimusxx 2 Posted June 24, 2013 setPosATL setTriggerArea attachTo Use setPosATL to change the position of the trigger and use some simple trigonometry (with the help of BIS_fnc_relDir or smth like that) to "creep" after the player. To further increase the creepiness level, you could slowly increase the size of your trigger as you get near to the player. Use attachTo and the size of the trigger to attach objects to the boundary of the trigger (some simple sin/cos calculations). Using some particle effects to create (black) mist/smoke on the boundary of the trigger would be awesome, though I don't know how to do it :D Another thing is: how fast should the trigger catch up? Should the player have the chance to outrun it or will it absolutely catch up and kill the player? Thats important to know because you have to manually script something like a delay to match the speed and you need to define something like a safe point if you want to let the player outrun the trigger. I could try to fix you an example if this doesn't help you out :) Share this post Link to post Share on other sites
Colt_H 10 Posted June 24, 2013 setPosATL setTriggerArea attachTo Use setPosATL to change the position of the trigger and use some simple trigonometry (with the help of BIS_fnc_relDir or smth like that) to "creep" after the player. To further increase the creepiness level, you could slowly increase the size of your trigger as you get near to the player. Use attachTo and the size of the trigger to attach objects to the boundary of the trigger (some simple sin/cos calculations). Using some particle effects to create (black) mist/smoke on the boundary of the trigger would be awesome, though I don't know how to do it :D Another thing is: how fast should the trigger catch up? Should the player have the chance to outrun it or will it absolutely catch up and kill the player? Thats important to know because you have to manually script something like a delay to match the speed and you need to define something like a safe point if you want to let the player outrun the trigger. I could try to fix you an example if this doesn't help you out :) Thanks for your reply! Basically I'm making silly maps in the editor and so far I've been able to make all of them without having to ask for help. This one however has me somewhat puzzled. Basically I am planning on making a long wide corridor with a maze in between the "start" and the "finish line" my friends and I would navigate this maze while the kill trigger slowly but surely comes in and if you're not fast enough it would engulf you. The speed of the trigger would have to be relatively slow, I was thinking walking pace or even slower. Sadly as I progress into more 'serious' scripting I feel like I'm just not good enough, so I'm afraid I might have to take you up on your offer about fixing up an example. If you need me to elaborate on anything, feel free to ask and thanks again for your offer! If anyone is interested, Share this post Link to post Share on other sites
xxanimusxx 2 Posted June 25, 2013 (edited) Okay this kept me awake all night but well, here is the result so far: I added some creepy sounds to the fog externally so it's not part of the script. Here is the example mission I used in the video: http://ul.to/qdtixusj This is just a debug version and should be used for development purposes! Edited June 25, 2013 by XxAnimusxX Share this post Link to post Share on other sites
Colt_H 10 Posted June 25, 2013 Okay this kept me awake all night but well, here is the result so far:Video I added some creepy sounds to the fog externally so it's not part of the script. Thanks again for your effort! How does the script work though? Does it follow the player around or does it go forward in a line? Also, is its speed relative to the player? Ie. if the player stood still, would the trigger move closer at the same pace or would it go faster if the player was moving? Thanks again for your time! If you want, I can add you on steam or something similar. Share this post Link to post Share on other sites
xxanimusxx 2 Posted June 25, 2013 (edited) Okay, help me out here guys, I need your opinions on some issues, but the most pressing one is the multiplayer locality. The fog consists of particle effects (I forget to meantion it, I'm using the fog script by Rockhount so all credits go to him concerning the fog, I just made some minor adjustments) which are unfortunately local. Having the trigger follow around people (a trigger can follow just one player, so keep this in mind!) is easy and doesn't induce further headache, but the fog does :D Because if you want to visualize the trigger (which is by now controlled by the server) you have to apply the fog animation on every client and here begins my headache; I don't know the best course of action to take :D But before we indulge in some other discussions, here are the specifications of the script: the fog follows the player in a straight line, always pointing at him. It doesn't matter where the player goes, the fog will always follow in a straight line. the fog proceeds with a constant speed (measured in m/s). It would be quite easy to let it stop once the player stops but that would take all the thrilling away :D. one has to mark a player using setVariable for the fog to follow him one has to assign a trigger which should be visualized with the fog to the player in question. Basically, if you want a specific player to get followed around, you'd do this: player setVariable ["creepingShadow_trigger", myKillTrigger]; // With myKillTrigger beeing the trigger you prepared before. // The kill-action needs to be implemented by yourself, this script just moves the trigger // and creates the fog. [player, 6] execVM "followingTrigger.sqf"; // the trigger will follow the player with 6m/s which is quite fast (the run speed is approx. 5.5m/s) Now if you want the trigger to start following around that player, set the variable: player setVariable ["creepingShadow_follow", true]; The trigger won't begin following until the follow-command has been given using the above code. The script stops if either of the following conditions are set: the trigger has been deleted, the player which gets followed around is dead or "creepingShadow_follow" is set to false for the followed person. When the script gets stopped because one of these reasons, the trigger will be set back to the position it was BEFORE the following started and set "creepingShadow_follow" to false automatically. Now to the initial problem: multiplayer locality. I know the "tools" to broadcast and sync certain events on every client, but still this faces me with some problems. Let's take the trigger for an instance: the trigger placed in the editor should be local to the server, shouldn't it? So if you want the trigger to follow around the players, you have to execute the script in the server (which could be done in the init.sqf or using a PVEH). The good thing is: the script will only start if the above attributes are set using setVariable, which has the ability to synchronize the given value to all clients. But from there another problem arises: the server has to tell all the other clients to draw the fog on the current position of the trigger - to which they don't have a reference to. Sure, one could send the reference with the publicVariable command, but that seems rather ugly to me. All this would be okay though if it was just for one trigger, but if you want to follow around several players, it is best to do it local on every client. Namely creating a new trigger dynamically for every player and following him around - which would be the easiest way. But that would cause another problem: others wouldn't be able to see the fog of the trigger which follows the other players. And if the activation field of these triggers aren't carefully written, it could also kill other people along its way to the followed person, without others to be able to see the danger coming to them :D I hope you know what my problems are now :D PS: Some little information about the implementation: I use to create (locally!) a ghost HMMWV and attach the trigger to it. This is rather convinient because I can use setVelocity and don't have to use setPos all the time. But because there is a "civilian" vehicle in the center of the trigger, it shouldn't be able to detect the presense of civilians because the trigger would detect the HMMWV all the time otherwise. PPS: @Colt_H: I'd be glad if you could post your requirements and wishes as detailed as possible so I can change the script to match your scenario. P³S: I linked the mission file in my post with the video so you can try out some things. Edited June 25, 2013 by XxAnimusxX Share this post Link to post Share on other sites