Jump to content
Sign in to follow this  
Arska134

Set init when respawned

Recommended Posts

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

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

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

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
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
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

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

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×