Post your scripting questions / solutions here
Moderator: Moderators
The Jackal
Sergeant Major
Posts: 101 Joined: Wed May 07, 2003 10:09 am
Contact:
Post
by The Jackal » Fri Sep 26, 2003 11:07 am
I am trying another script. Its for a sniper only server. What I have done is script it so that when a player joins the server, he automatically joins a team and selects the sniper rifle.
I am stumped at the next step. I would like to take all his weapons after he dies and respawns and give him a set list. But my script does not work!
Code: Select all
$player thread _weapon
_weapon:
wait .1
self waittill death
self waittill spawn
self takeall
wait .1
self weapon weapons/springfield.tik
self useweaponclass rifle
self ammo rifle 50
self weapon weapons/silencedpistol.tik
wait .5
thread _weapon
end
I read several threads and the seem to do it this way.
jv_map
Site Admin
Posts: 6521 Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:
Post
by jv_map » Sat Sep 27, 2003 7:52 am
I don't think self waittill spawn works.
Major Pain
Moderator
Posts: 346 Joined: Fri Mar 07, 2003 3:22 pm
Location: Epe, NL
Contact:
Post
by Major Pain » Sat Sep 27, 2003 7:55 am
Take a look @ this:
/tutorials/player_weapons.php
.MAP Administrator
The Jackal
Sergeant Major
Posts: 101 Joined: Wed May 07, 2003 10:09 am
Contact:
Post
by The Jackal » Sat Sep 27, 2003 10:23 pm
Major Pain that method does not work.
For some reason, "waittill spawn" and "waittill death" does nothing. Once I ignore them the script runs, but it takes all and gives specific weapon and keeps looping it.
Code: Select all
while(1)
{
wait .1
for(local.p = 1; local.p < $player.size+1;local.p++)
{
if ($player != NULL && $player[local.p].health > 0 $player[local.p].dmteam != "spectator" && $player[local.p].dmteam == "allies")
{
// waittill death
// waittill spawn
$player[loca.p][local.p] takeall
wait .1
$player[loca.p] weapon weapons/springfield.tik
$player[loca.p] useweaponclass rifle
$player[loca.p] ammo rifle 50
$player[loca.p] weapon weapons/silencedpistol.tik
}
if ($player != NULL && $player[local.p].health > 0 $player[local.p].dmteam != "spectator" && $player[local.p].dmteam == "axis")
{
// waittill death
// waittill spawn
$player[loca.p][local.p] takeall
wait .1
$player[loca.p] weapon weapons/kar98sniper.tik
$player[loca.p] useweaponclass rifle
$player[loca.p] ammo rifle 50
$player[loca.p] weapon weapons/silencedpistol.tik
}
}
wait .1
}
end I am stuck at getting the script to watch the player till he dies and respawns. HELP!
jv_map
Site Admin
Posts: 6521 Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:
Post
by jv_map » Sun Sep 28, 2003 7:43 am
waittill death for some reason may not be used on players, but it is easily replaced by:
while(self != NIL && isAlive self)
waitframe
The (self != NIL) check is to see whether the player is still on the server.
The waittill spawn is much more troublesome though. I've only found one effective way to do so, which is by glueing a very small trigger to every player. When this trigger is triggered, this is a proof the player is in the game.
The Jackal
Sergeant Major
Posts: 101 Joined: Wed May 07, 2003 10:09 am
Contact:
Post
by The Jackal » Sun Sep 28, 2003 5:45 pm
Can you give me an example script of the kind of trigger ? Because the script requires a "waittill spawn" effect workaround.
jv_map
Site Admin
Posts: 6521 Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:
Post
by jv_map » Mon Sep 29, 2003 4:24 pm
Instead of self waittill spawn type self waitthread player_join_game
Code: Select all
player_join_game:
local.trigger = spawn trigger_multiple
local.trigger setsize ( -16 -16 -16) (16 16 16)
local.trigger glue self
while(1)
{
local.trigger waittill trigger
if(parm.other == self)
break
waitframe
}
local.trigger remove
end
(quoted from global/jv_mp_players.scr <-- included in bots scripts)