Jump to content
Sign in to follow this  
Lifter

Respawning unarmed.

Recommended Posts

In what file, and what do I type in it to make soldiers respawn completely unarmed?

Share this post


Link to post
Share on other sites
In what file, and what do I type in it to make soldiers respawn completely unarmed?

You must either set their default loadout in their config.cpp ( weapons[]={}; magazines[]={}; ), or you can remove their weapons after the respawn by the command "RemoveAllWeapons Player" which you can run from a switch with condition "Alive Player" or something like that.

Share this post


Link to post
Share on other sites

As for now the soldiers (lasers rangers) respawn with the standard BIS M16 with 30rds in the mag.

Can't quite figure this out.

Share this post


Link to post
Share on other sites

Just using alive player condition doesn't work because, well, it removes all weapons when ever the player is alive.

If you don't want to use a respawn script, you can use 2 triggers and a variable like this: (note that this works locally on each player)

-Reset variable playerdead=0; in some units init line or init.sqs

-Make trigger1:

set activation repeatedly

condition NOT alive player AND playerdead==0;

on activation playerdead=1;

-Make trigger2:

set activation repeatedly

condition alive player AND playerdead==1;

on activation removeAllWeapons player; playerdead=0;

Only problem is, that the triggers work somewhat slow, so it takes a fraction of a second before weapon is removed. Someone might shoot you before trigger2 kicks in and grab your rifle. This could be a problem if you're making a mission with only pistols, for example. So, it's better to use a respawn script.

If you want to add load-out automaticly, add it to trigger2 on activation, and if there's more playable sides besides west, you need to use triggers with side condition to get them their corresponding load-outs.

Share this post


Link to post
Share on other sites
Just using alive player condition doesn't work because, well, it removes all weapons when ever the player is alive.

You are right, it will be executed on the mission start - but it's ULTRA easy to prevent it. I thought that it would be obvious.

So here is the exact solution.

Method 1:

Make JUST ONE switch where condition="not Alive Player" and onActivation="[] exec 'some_script.sqs'".

Create the some_script.sqs:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">@Alive Player

...and then here goes what should be executed when the player respawns

Method 2:

Make a switch [condition="Alive Player", onActivation="[] exec "some_script.sqs"",onDeactivation="respawn=true"].

Create mission init.sqs and put "respawn=false" into it.

Create the "some_script.sqs" and put into it whatever you want to be executed when the player respawns.

There are tons of ways, and all of them can be done with just one switch. It makes me angry when i see someone wasting resources by tons of triggers ;-)

Share this post


Link to post
Share on other sites
Quote[/b] ]but it's ULTRA easy to prevent it. I thought that it would be obvious.

Yeah, obvious if you have done scripting or made mp missions before, I think that is not the case here. You shouldn't assume that everyone in the world automaticly knows all the things you consider obvious.

Quote[/b] ]It makes me angry when i see someone wasting resources by tons of triggers ;-)

One extra trigger hardly makes a noticeable difference but I do agree biggrin_o.gif

Share this post


Link to post
Share on other sites

I'm quite lost here, where can I find one of those nice scripts you are talking about?

Share this post


Link to post
Share on other sites

Lots of tutorials, scripts and command reference with examples & comments: Operation Flashpoint Editing Center

...

You can also setup respawn without triggers... for a quick example with very simple instructions:

1. in main menu-> press multiplayer-> new-> select "new-editor"

2. place player

3. place marker named "respawn_west" (otherwise you'll respawn where you died)

4. save mission as "Respawn example" or something

5. alt+tab to desktop

6. create file description.ext to ofp/users/username/MPMissions/Respawn example.Intro:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">respawn=3;

respawndelay=5;

onLoadMission="Respawn example";

7. create file init.sqs:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">~2

[] exec "respawn.sqs";

8. create file respawn.sqs:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">#start

@NOT alive player

@alive player

removeAllWeapons player;

goto "start";

9. That's it. Make sure you have file type extensions visible so you don't have files ending like respawn.sqs.txt if you create them with notepad

Share this post


Link to post
Share on other sites

Metal Heart, thank you! It works now.

Only question I have is if that player covers all the players that are going to be in the mp game (8 ppl).

Does every player go as the name "player" or what?

Share this post


Link to post
Share on other sites

It's not a name, it's sort of a special pointer to the unit that the local player controls. It's pointing to a different unit on every client's computer, and since the "respawn.sqs" is also running _locally_ on each client, it works.

However, if a player disconnects, the AI that takes control of his unit will from then on respawn with the weapon because it's not a player. Makes sense, eh? smile_o.gif

Share this post


Link to post
Share on other sites

Ah, it's all finally becoming clear to me now smile_o.gif

Thanks alot for all the help, I really appreciate it!

Share this post


Link to post
Share on other sites
It's not a name, it's sort of a special pointer to the unit that the local player controls. It's pointing to a different unit on every client's computer, and since the "respawn.sqs" is also running _locally_ on each client, it works.

However, if a player disconnects, the AI that takes control of his unit will from then on respawn with the weapon because it's not a player. Makes sense, eh? smile_o.gif

Is there a pointer discribing any "living" object? I want this script working for players AND ai biggrin_o.gif

Share this post


Link to post
Share on other sites

How about moving this thread to Mission editing ?

I guess it would find a bigger audience there. huh.gif

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  

×