View Full Version : Respawning unarmed.
In what file, and what do I type in it to make soldiers respawn completely unarmed?
5133p39
Jan 10 2006, 02:29
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.
As for now the soldiers (lasers rangers) respawn with the standard BIS M16 with 30rds in the mag.
Can't quite figure this out.
Metal Heart
Jan 11 2006, 07:33
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.
5133p39
Jan 11 2006, 12:14
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">@<hidden> Player
...and then here goes what should be executed when the player respawns[/QUOTE]
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 ;-)
Metal Heart
Jan 11 2006, 23:14
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 http://forums.bistudio.com/oldsmileys/biggrin_o.gif
I'm quite lost here, where can I find one of those nice scripts you are talking about?
Metal Heart
Jan 12 2006, 10:00
Lots of tutorials, scripts and command reference with examples & comments: Operation Flashpoint Editing Center (http://www.ofpec.com/editors/index.php)
...
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";[/QUOTE]
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";
[/QUOTE]
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
@<hidden> alive player
@<hidden> player
removeAllWeapons player;
goto "start";[/QUOTE]
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
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?
Metal Heart
Jan 12 2006, 10:37
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? http://forums.bistudio.com/oldsmileys/smile_o.gif
Ah, it's all finally becoming clear to me now http://forums.bistudio.com/oldsmileys/smile_o.gif
Thanks alot for all the help, I really appreciate it!
Metal Heart
Jan 12 2006, 10:44
No problem http://forums.bistudio.com/oldsmileys/smile_o.gif
Turowicz
Jan 19 2006, 21:08
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? http://forums.bistudio.com/oldsmileys/smile_o.gif
Is there a pointer discribing any "living" object? I want this script working for players AND ai http://forums.bistudio.com/oldsmileys/biggrin_o.gif
Balschoiw
Jan 20 2006, 07:12
How about moving this thread to Mission editing ?
I guess it would find a bigger audience there. http://forums.bistudio.com/oldsmileys/huh.gif
Placebo
Jan 23 2006, 09:43
Moving to ME&S http://forums.bistudio.com/oldsmileys/smile_o.gif
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.