Functions, but doesnt work online.

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
Ophisâ„¢
Colonel
Posts: 461
Joined: Sun Mar 12, 2006 2:30 pm
Location: England, Manchester
Contact:

Functions, but doesnt work online.

Post by Ophisâ„¢ »

I have two trigger_multiple's with the key/value of setthread take_weaps and the other setthread give_weaps. I use a edited shortcut to test my map so it goes stright into the map from the desktop and changes game type to team death match. The script and triggers work exactly the way i want them to however when i start the game up properly so my friends can join they do not work at all. What have i done wrong?

Code: Select all

//---------------------------T A K E-----W E A P O N S---------------------------------------------

take_weaps:
if ($player.dmteam == "axis")
  {
    $player takeall
  }
 if ($player.dmteam == "allies")
  {
    $player takeall
  } 
end

//---------------------------G I V E-----W E A P O N S---------------------------------------------

give_weaps:
if ($player.dmteam == "axis")
  {
    $player item weapons/p38.tik
  }
 if ($player.dmteam == "allies")
  {
    $player item weapons/colt45.tik
  } 
end
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

$player refers to all players and since all players can be both axis and allies the script won't work you will have to go through each player one at a time for it to work .

Code: Select all

$player takeall // works for all players

for(local.i=1;local.i<=$player.size;local.i++)
{

if ($player[local.i].dmteam == "axis") 
  { 
    $player[local.i] give weapons/p38.tik 
  } 
 if ($player[local.i].dmteam == "allies") 
  { 
    $player[local.i] give weapons/colt45.tik 
  }

}
but the players allready get those weapons when they spawn so you have to change that if you want to see if it works .
Image
Ophisâ„¢
Colonel
Posts: 461
Joined: Sun Mar 12, 2006 2:30 pm
Location: England, Manchester
Contact:

Post by Ophisâ„¢ »

you miss understand what i mean.... because there is a script getting rid of the weapons when they run through one trigger, they don't have them weapons at all. Like i said, the script works as i want it to, when i run through the first trigger i loose my guns, when i run through the other i gain a pistol. The problem is, when on the map playing others online, the script doesn't come into effect, as if the triggers are not that to begin with... So i'm guessing that ive used code for single player only...
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

I understand just look at what I wrote about going through each player either that or if you want to give a weapon to just one player who triggers a trigger then use

local.player = parm.other // parm.other is last player to trigger a trigger since this thread is triggered then it is the player who triggered this trigger but it won't stay as this player if another trigger is triggered so save who triggered this trigger by assigning the player to local.player in this thread

if (local.player.dmteam == "axis")
{
local.player give weapons/p38.tik
}
if (local.player.dmteam == "allies")
{
local.player give weapons/colt45.tik
}
Image
Ophisâ„¢
Colonel
Posts: 461
Joined: Sun Mar 12, 2006 2:30 pm
Location: England, Manchester
Contact:

Post by Ophisâ„¢ »

aaaaarrr i understand now, and it works like a charm thank you very much!
Post Reply