Arska134 10 Posted July 30, 2010 Now i have made lots of diffrent skills for units. My mission have respawn and when i respawn. All my skills are gone because they are in init. How do i set init on respawn? Share this post Link to post Share on other sites
NacroxNicke 11 Posted July 30, 2010 Add an killed eventhandler to the units, with the direction of a script with the line of commands that you want for the respawned unit I'm a little hurry now so I can't explain :/ Share this post Link to post Share on other sites
Arska134 10 Posted July 31, 2010 Ok i put this to all units init: player addEventHandler ["killed", {[_player] exec "newinit.sqs"} ] It works great and newinit.sqs is executed. And this is newinit.sqs: http://pastebin.com/bwiCp0jK I got that hint,("You have been killed. You respawn in 10 seconds.") but skills are not returned for unit. Share this post Link to post Share on other sites
faguss 64 Posted July 31, 2010 The event handler code should be: player addEventHandler ["killed", {_this exec "newinit.sqs"} ] You can't add action to dead body so type this condition: @alive player Then add action to the player: player addAction Share this post Link to post Share on other sites
Arska134 10 Posted July 31, 2010 The event handler code should be:You can't add action to dead body so type this condition: Then add action to the player: Works in editor but not in multiplayer. :butbut: How it works in MP? Share this post Link to post Share on other sites
faguss 64 Posted July 31, 2010 You can't add action to dead body Just to clarify: of course you can but that's not what we want to achieve. In multiplayer respawned unit is not the same unit. Gives headaches especially with AI. However Player variable is always updated. Assuming you're using instant respawn the code is: #Start @Alive Player callarty = Player AddAction ["Reguest arty", "comarty.sqs"]; _FormerPlayer = Player @!Alive _FormerPlayer _FormerPlayer RemoveAction callarty GoTo "Start" And this is not event handler script. Share this post Link to post Share on other sites
Arska134 10 Posted July 31, 2010 Are you sure this is right? player addEventHandler ["killed", {_this exec "newinit.sqs"} ] Because newinit.sqs is not executed. Sorry if i don't understand something because my english is not best of the best. :D Share this post Link to post Share on other sites
faguss 64 Posted July 31, 2010 Code is correct but forget about event handler. In Init.sqs type: [] exec "newinit.sqs" And to newinit.sqs copy code from my previous post. Share this post Link to post Share on other sites