Fortress Forever

Go Back   Fortress Forever > Editing > Mapping > Lua

Reply
 
Thread Tools Display Modes
Old 02-25-2008, 11:56 PM   #21
TheWetMule
 
TheWetMule's Avatar
 
Join Date: Mar 2007
Location: England, Midlands
Posts Rated Helpful 0 Times
Send a message via MSN to TheWetMule Send a message via Skype™ to TheWetMule
How 'bout TEAM specific teleports? I'd like to have Forward and Reverse teams on my concmap and I canney understand how to do it in FF.

No specifics, generic terms can be used for tele destinations and such, I'd love a basic outline though

EDIT: Said class specific lewlz ;x

Last edited by TheWetMule; 02-26-2008 at 12:15 AM.
TheWetMule is offline   Reply With Quote


Old 02-26-2008, 12:00 AM   #22
GambiT
Fortress Forever Staff
 
GambiT's Avatar
 
Join Date: Mar 2007
Location: Baton Rouge
Class/Position: Spy
Affiliations: -=DoM=-
Posts Rated Helpful 0 Times
use a "trigger_teleport"
__________________
-------------------------------FF_Rock2(WIP)------------------------------
---------------------------FF_RedGiant(Released)-------------------------
--------------------------FF_Fragzone_G(Released)------------------------
--------------------------FF_Civibash_G(Released)------------------------
-------------------FF_Conc_G1(WIP)--------------------
-------------------FF_Hollow_G(WIP)---------------------
GambiT is offline   Reply With Quote


Old 02-26-2008, 12:10 AM   #23
TheWetMule
 
TheWetMule's Avatar
 
Join Date: Mar 2007
Location: England, Midlands
Posts Rated Helpful 0 Times
Send a message via MSN to TheWetMule Send a message via Skype™ to TheWetMule
Team/class specific, I need, not just one teleport for everybody
TheWetMule is offline   Reply With Quote


Old 02-26-2008, 12:21 AM   #24
squeek.
Stuff Do-er
Lua Team
Wiki Team
Fortress Forever Staff
 
squeek.'s Avatar
 
Join Date: Mar 2007
Location: Northern California
Class/Position: Rallygun Shooter
Gametype: Conc tag (you just wait)
Affiliations: Mustache Brigade
Posts Rated Helpful 352 Times
Send a message via AIM to squeek.
Re: TheWetMule
Code:
specific_tele = info_ff_script:new({ class = Player.kCivilian, team = Team.kUnassigned })

function specific_tele:allowed( touch_entity ) 
   if IsPlayer( touch_entity ) then 
             local player = CastToPlayer( touch_entity ) 
             return player:GetTeamId() == self.team and player:GetClass() == self.class
   end
   return EVENT_DISALLOWED 
end

blue_scout_tele = specific_tele:new({ class = Player.kScout, team = Team.kBlue })
red_demo_tele = specific_tele:new({ class= Player.kDemoman, team = Team.kRed })
Make the trigger_teleport's names match the bottom-most names (blue_scout_tele, red_demo_tele, etc).
__________________
#FF.Pickup ¤ Fortress-Forever pickups

My Non-official Maps
Released FF_DM_Squeek - FF_2Mesa3_Classic - FF_Siege_Classic
Beta FF_Myth - FF_Redlight_Greenlight

Sick of the people on the internet, always moanin'. They just moan.
- Karl Pilkington
squeek. is offline   Reply With Quote


Old 02-26-2008, 12:22 AM   #25
GambiT
Fortress Forever Staff
 
GambiT's Avatar
 
Join Date: Mar 2007
Location: Baton Rouge
Class/Position: Spy
Affiliations: -=DoM=-
Posts Rated Helpful 0 Times
your the man squeek, you will be the first one i let play rock2!
__________________
-------------------------------FF_Rock2(WIP)------------------------------
---------------------------FF_RedGiant(Released)-------------------------
--------------------------FF_Fragzone_G(Released)------------------------
--------------------------FF_Civibash_G(Released)------------------------
-------------------FF_Conc_G1(WIP)--------------------
-------------------FF_Hollow_G(WIP)---------------------
GambiT is offline   Reply With Quote


Old 02-26-2008, 12:24 AM   #26
squeek.
Stuff Do-er
Lua Team
Wiki Team
Fortress Forever Staff
 
squeek.'s Avatar
 
Join Date: Mar 2007
Location: Northern California
Class/Position: Rallygun Shooter
Gametype: Conc tag (you just wait)
Affiliations: Mustache Brigade
Posts Rated Helpful 352 Times
Send a message via AIM to squeek.
Quote:
Originally Posted by GambiT
your the man squeek, you will be the first one i let play rock2!
What's a #2 rock?
__________________
#FF.Pickup ¤ Fortress-Forever pickups

My Non-official Maps
Released FF_DM_Squeek - FF_2Mesa3_Classic - FF_Siege_Classic
Beta FF_Myth - FF_Redlight_Greenlight

Sick of the people on the internet, always moanin'. They just moan.
- Karl Pilkington
squeek. is offline   Reply With Quote


Old 02-26-2008, 12:25 AM   #27
GambiT
Fortress Forever Staff
 
GambiT's Avatar
 
Join Date: Mar 2007
Location: Baton Rouge
Class/Position: Spy
Affiliations: -=DoM=-
Posts Rated Helpful 0 Times
8-ball what?
__________________
-------------------------------FF_Rock2(WIP)------------------------------
---------------------------FF_RedGiant(Released)-------------------------
--------------------------FF_Fragzone_G(Released)------------------------
--------------------------FF_Civibash_G(Released)------------------------
-------------------FF_Conc_G1(WIP)--------------------
-------------------FF_Hollow_G(WIP)---------------------
GambiT is offline   Reply With Quote


Old 02-26-2008, 10:27 PM   #28
TheWetMule
 
TheWetMule's Avatar
 
Join Date: Mar 2007
Location: England, Midlands
Posts Rated Helpful 0 Times
Send a message via MSN to TheWetMule Send a message via Skype™ to TheWetMule
Me luv you long tiem squeek
TheWetMule is offline   Reply With Quote


Old 02-27-2008, 12:29 AM   #29
GambiT
Fortress Forever Staff
 
GambiT's Avatar
 
Join Date: Mar 2007
Location: Baton Rouge
Class/Position: Spy
Affiliations: -=DoM=-
Posts Rated Helpful 0 Times
2 dolla!
__________________
-------------------------------FF_Rock2(WIP)------------------------------
---------------------------FF_RedGiant(Released)-------------------------
--------------------------FF_Fragzone_G(Released)------------------------
--------------------------FF_Civibash_G(Released)------------------------
-------------------FF_Conc_G1(WIP)--------------------
-------------------FF_Hollow_G(WIP)---------------------
GambiT is offline   Reply With Quote


Old 03-01-2008, 10:04 PM   #30
TheWetMule
 
TheWetMule's Avatar
 
Join Date: Mar 2007
Location: England, Midlands
Posts Rated Helpful 0 Times
Send a message via MSN to TheWetMule Send a message via Skype™ to TheWetMule
Right, decided to put that nifty piece of code to the test, just want to clear up that I'm doing everything right.
  1. I make a trigger_teleport named blue_scout_tele
  2. I give it the destination I want it to teleport too

After I've done that, it should ONLY teleport blue scouts, not blue demomen or something? If so, it doesn't appear to be working! It teleports me regardless of class/team
TheWetMule is offline   Reply With Quote


Old 03-01-2008, 10:58 PM   #31
DD`
 
Join Date: Mar 2007
Posts Rated Helpful 0 Times
Code:
specific_tele = info_ff_script:new({})

function specific_tele:allowed( touch_entity ) 
   if IsPlayer( touch_entity ) then 
             local player = CastToPlayer( touch_entity ) 
             return player:GetTeamId() == self.team
   end
   return EVENT_DISALLOWED 
end

blue_tele = specific_tele:new({ team = Team.kBlue })
red_tele = specific_tele:new({ team = Team.kRed })
tiny edit of squeeks code and I got it working for him the way he wanted it (team specific).
DD` is offline   Reply With Quote


Old 03-01-2008, 11:45 PM   #32
squeek.
Stuff Do-er
Lua Team
Wiki Team
Fortress Forever Staff
 
squeek.'s Avatar
 
Join Date: Mar 2007
Location: Northern California
Class/Position: Rallygun Shooter
Gametype: Conc tag (you just wait)
Affiliations: Mustache Brigade
Posts Rated Helpful 352 Times
Send a message via AIM to squeek.
Quote:
Originally Posted by DD`
tiny edit of squeeks code and I got it working for him the way he wanted it (team specific).
He wants team and class specific. My code was untested, I might have gotten something wrong. I'll test it and see what's wrong.
__________________
#FF.Pickup ¤ Fortress-Forever pickups

My Non-official Maps
Released FF_DM_Squeek - FF_2Mesa3_Classic - FF_Siege_Classic
Beta FF_Myth - FF_Redlight_Greenlight

Sick of the people on the internet, always moanin'. They just moan.
- Karl Pilkington
squeek. is offline   Reply With Quote


Old 03-02-2008, 12:10 AM   #33
TheWetMule
 
TheWetMule's Avatar
 
Join Date: Mar 2007
Location: England, Midlands
Posts Rated Helpful 0 Times
Send a message via MSN to TheWetMule Send a message via Skype™ to TheWetMule
No no, they worked seperately, just not together :P Don't worry, you did a grand job squeek.

EDIT: As in, scout teles only or team teles only, just not together.
TheWetMule is offline   Reply With Quote


Old 03-02-2008, 05:10 PM   #34
TheWetMule
 
TheWetMule's Avatar
 
Join Date: Mar 2007
Location: England, Midlands
Posts Rated Helpful 0 Times
Send a message via MSN to TheWetMule Send a message via Skype™ to TheWetMule
LOLDROUBLEPROAST

Anyway, got another one for you, is there a way to restock people ,constantly, no matter where they are without the use of mass trigger_ff_scripts :X?
TheWetMule is offline   Reply With Quote


Old 03-02-2008, 08:41 PM   #35
squeek.
Stuff Do-er
Lua Team
Wiki Team
Fortress Forever Staff
 
squeek.'s Avatar
 
Join Date: Mar 2007
Location: Northern California
Class/Position: Rallygun Shooter
Gametype: Conc tag (you just wait)
Affiliations: Mustache Brigade
Posts Rated Helpful 352 Times
Send a message via AIM to squeek.
Quote:
Originally Posted by TheWetMule
LOLDROUBLEPROAST

Anyway, got another one for you, is there a way to restock people ,constantly, no matter where they are without the use of mass trigger_ff_scripts :X?
Yeah, give me a bit. Not totally sure if the tick() function is working or not.
__________________
#FF.Pickup ¤ Fortress-Forever pickups

My Non-official Maps
Released FF_DM_Squeek - FF_2Mesa3_Classic - FF_Siege_Classic
Beta FF_Myth - FF_Redlight_Greenlight

Sick of the people on the internet, always moanin'. They just moan.
- Karl Pilkington
squeek. is offline   Reply With Quote


Old 03-02-2008, 09:05 PM   #36
TheWetMule
 
TheWetMule's Avatar
 
Join Date: Mar 2007
Location: England, Midlands
Posts Rated Helpful 0 Times
Send a message via MSN to TheWetMule Send a message via Skype™ to TheWetMule
Not to seem like I'm forcing you into slave labour, but is there a way to make rockets/pipes/grenades/concs effect only the person that dropped them/used them?
TheWetMule is offline   Reply With Quote


Old 03-02-2008, 09:16 PM   #37
squeek.
Stuff Do-er
Lua Team
Wiki Team
Fortress Forever Staff
 
squeek.'s Avatar
 
Join Date: Mar 2007
Location: Northern California
Class/Position: Rallygun Shooter
Gametype: Conc tag (you just wait)
Affiliations: Mustache Brigade
Posts Rated Helpful 352 Times
Send a message via AIM to squeek.
Quote:
Originally Posted by TheWetMule
Not to seem like I'm forcing you into slave labour, but is there a way to make rockets/pipes/grenades/concs effect only the person that dropped them/used them?
Rockets/Pipes would be rather easy... grenades as well (I think). Concs I'm not totally sure about.
__________________
#FF.Pickup ¤ Fortress-Forever pickups

My Non-official Maps
Released FF_DM_Squeek - FF_2Mesa3_Classic - FF_Siege_Classic
Beta FF_Myth - FF_Redlight_Greenlight

Sick of the people on the internet, always moanin'. They just moan.
- Karl Pilkington
squeek. is offline   Reply With Quote


Old 03-02-2008, 10:10 PM   #38
squeek.
Stuff Do-er
Lua Team
Wiki Team
Fortress Forever Staff
 
squeek.'s Avatar
 
Join Date: Mar 2007
Location: Northern California
Class/Position: Rallygun Shooter
Gametype: Conc tag (you just wait)
Affiliations: Mustache Brigade
Posts Rated Helpful 352 Times
Send a message via AIM to squeek.
Quote:
Originally Posted by TheWetMule
Not to seem like I'm forcing you into slave labour, but is there a way to make rockets/pipes/grenades/concs effect only the person that dropped them/used them?
Code:
function player_onconc(player_entity, effector_entity)

	if IsPlayer( player_entity ) and IsPlayer( effector_entity ) then
		local player = CastToPlayer( player_entity )
		local playerEffector = CastToPlayer( effector_entity )
		if player:GetId() == playerEffector:GetId() then
			return true
		end
	end
	
	return false
	
end

function player_ondamage( player, damageinfo )
	
  -- Entity that is attacking
  local attacker = damageinfo:GetAttacker()
  
  -- If no attacker do nothing
  if not attacker then 
	return
  end
  
  -- If attacker not a player do nothing
  if not IsPlayer(attacker) then 
	return
  end
  
  local playerAttacker = CastToPlayer(attacker)

  -- If player is damaging self do nothing; else no damage/no push
  if player:GetId() == playerAttacker:GetId() then
	return 
  else
	damageinfo:SetDamage(0)
	damageinfo:SetDamageForce(Vector( 0, 0, 0 ))
  end
  
end
The concs still push everyone around... but the effect is only added to the conc's owner; not sure if it's possible to stop the push. Rockets/pipes/nades (anything that does damage) works as intended, though.
__________________
#FF.Pickup ¤ Fortress-Forever pickups

My Non-official Maps
Released FF_DM_Squeek - FF_2Mesa3_Classic - FF_Siege_Classic
Beta FF_Myth - FF_Redlight_Greenlight

Sick of the people on the internet, always moanin'. They just moan.
- Karl Pilkington
squeek. is offline   Reply With Quote


Old 03-02-2008, 10:32 PM   #39
squeek.
Stuff Do-er
Lua Team
Wiki Team
Fortress Forever Staff
 
squeek.'s Avatar
 
Join Date: Mar 2007
Location: Northern California
Class/Position: Rallygun Shooter
Gametype: Conc tag (you just wait)
Affiliations: Mustache Brigade
Posts Rated Helpful 352 Times
Send a message via AIM to squeek.
Quote:
Originally Posted by TheWetMule
Anyway, got another one for you, is there a way to restock people ,constantly, no matter where they are without the use of mass trigger_ff_scripts :X?
Add this to startup():
Code:
AddScheduleRepeating( "Restock", RESTOCK_ITERATION_TIME, restock )
And then here's the bulk of the code:
Code:
playerStateTable = {}
RESTOCK_ITERATION_TIME = 1

function player_spawn( player_id )

	local player = GetPlayer(player_id)
	
	-- Remove any players not on a team from table
	for playerx, recordx in pairs(playerStateTable) do
		ConsoleToAll("RECORD: "..playerStateTable[playerx].restock)
		local playert = GetPlayerByID( playerx )
		if (playert:GetTeamId() ~= Team.kRed) and (playert:GetTeamId() ~= Team.kBlue) and (playert:GetTeamId() ~= Team.kGreen) and (playert:GetTeamId() ~= Team.kYellow) then
			playerStateTable[playerx] = nil
		end
	end
	
	-- add to table and set restock to 1
	playerStateTable[player:GetId()] = {restock = 1}
	
end


function restock()
	for playerx, recordx in pairs(playerStateTable) do
		if playerStateTable[playerx].restock == 1 then
			local player = GetPlayerByID( playerx )
			player:AddHealth( 400 )
			player:AddArmor( 400 )
			player:AddAmmo(Ammo.kCells, 400)
			player:AddAmmo(Ammo.kShells, 400)
			player:AddAmmo(Ammo.kNails, 400)
			player:AddAmmo(Ammo.kRockets, 400)
			player:AddAmmo(Ammo.kGren1, 400)
			player:AddAmmo(Ammo.kGren2, 400)
		end
	end
end
This will restock every 1 second. Change RESTOCK_ITERATION_TIME if it's too long/too short.
__________________
#FF.Pickup ¤ Fortress-Forever pickups

My Non-official Maps
Released FF_DM_Squeek - FF_2Mesa3_Classic - FF_Siege_Classic
Beta FF_Myth - FF_Redlight_Greenlight

Sick of the people on the internet, always moanin'. They just moan.
- Karl Pilkington

Last edited by squeek.; 03-03-2008 at 01:54 AM.
squeek. is offline   Reply With Quote


Old 03-02-2008, 10:59 PM   #40
TheWetMule
 
TheWetMule's Avatar
 
Join Date: Mar 2007
Location: England, Midlands
Posts Rated Helpful 0 Times
Send a message via MSN to TheWetMule Send a message via Skype™ to TheWetMule
Wonderful, you're a genius Squeek, one little problem with the reload code though, I get the error

[SCRIPT] Error calling player_spawn ([string "maps\ddbbdd.lua"]:84: bad argument #1 to 'pairs' (table expected, got nil)) ent: NULL
TheWetMule is offline   Reply With Quote


Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:35 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.