Fortress Forever

Go Back   Fortress Forever > Editing > Mapping > Lua

Reply
 
Thread Tools Display Modes
Old 02-25-2008, 01:41 AM   #1
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.
Lua Requests (Lua Assistance Division)

Make any and all lua scripting requests here, and the LADs will attempt to get it done.
__________________
#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-25-2008, 01:54 AM   #2
GambiT
Fortress Forever Staff
 
GambiT's Avatar
 
Join Date: Mar 2007
Location: Baton Rouge
Class/Position: Spy
Affiliations: -=DoM=-
Posts Rated Helpful 0 Times
ok, heres a task. this is for rock2.

i have 2 triggers(for each team), one for wo entry(call it "wolight"[red/bluewolight]) and one for yard entry spotlight(call it "yardlight"[red/blueyardlight]). heres the thing, when a "disguised" enemy spy goes through the trigger i do NOT want it to light up, but for all other enemies i do.

enough info?

also, dunno how we're going to do it, but if you could get something rolling with the green gas effect via lua that'd be sweet.
__________________
-------------------------------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-25-2008, 02:16 AM   #3
Pon
Not choking. Yet.
Lua Team
Wiki Team
Fortress Forever Staff
 
Pon's Avatar
 
Join Date: Jul 2007
Location: Scotland
Class/Position: Demo/Def - Spy/Off
Gametype: Anything but yet more fucking CTF
Affiliations: FF.AvD [FF AvD/ID guild]
Posts Rated Helpful 0 Times
Code:
if player:GetDisguisedTeam == *whateverteam* then return end
      else
light her up (whatever code you already have)....

*whateverteam* really depends on the code you already have, I guess. If you have the team variable already picked out (which I guess you should seeing as the lights are team based, but meh)

Without seeing the code you have, I can't really give you much more than that. But this should point you in the right direction, and if you post/send me the code I'd be happy to fit it in for you if you like.

I'd also consider what would happen when a disguised and cloaked spy enters the base... would the situation be similar to SG's tracking in that instance? If so i can expand upon the code further.
__________________
Support FF:

YOU GUYS REALLY SHOULD UPDATE YOUR STAFF LIST!
I haven't posted since 2010...

Preferable to death. But only just...
Pon is offline   Reply With Quote


Old 02-25-2008, 02:19 AM   #4
GambiT
Fortress Forever Staff
 
GambiT's Avatar
 
Join Date: Mar 2007
Location: Baton Rouge
Class/Position: Spy
Affiliations: -=DoM=-
Posts Rated Helpful 0 Times
lol, here....

Code:
IncludeScript("base_teamplay");

function startup()

	SetPlayerLimit( Team.kBlue, 0 )
	SetPlayerLimit( Team.kRed, 0 )
	SetPlayerLimit( Team.kYellow, -1 )
	SetPlayerLimit( Team.kGreen, -1 )
end
haha...

anyway, the spotlights i'm talking about are the ones that light up when the enemy comes into your yard and also the one for the wardens office entry. basically trigger the lights when an enemy comes through the trigger, but i dont want it to trigger the lights when the spy is disguised.

maybe it's to soon to worry about this. but we do need to figure something out with the gas...
__________________
-------------------------------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-25-2008, 02:20 AM   #5
GambiT
Fortress Forever Staff
 
GambiT's Avatar
 
Join Date: Mar 2007
Location: Baton Rouge
Class/Position: Spy
Affiliations: -=DoM=-
Posts Rated Helpful 0 Times
thanks ya'll, Squeek that looks like what i need.

appreciate it man!
__________________
-------------------------------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-25-2008, 02:24 AM   #6
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
maybe it's to soon to worry about this. but we do need to figure something out with the gas...
I haven't messed much with this, but it could be possible to force the spy gas effect. I'll look into it.

Quote:
Originally Posted by Pon
EDIT: Wow, clambering over eachother to help....
Haha, I was quite surprised by the activity in this thread. And, yeah, my code would let any disguised spy through, no matter the team he's disguised as. That could be changed really easily 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 02-25-2008, 02:28 AM   #7
GambiT
Fortress Forever Staff
 
GambiT's Avatar
 
Join Date: Mar 2007
Location: Baton Rouge
Class/Position: Spy
Affiliations: -=DoM=-
Posts Rated Helpful 0 Times
no its fine, if i'm diguised as a friendly and it doesnt set off the light they might think i'm a friendly spy. thats what i call good confusion.

the spy gas is exactly what i want with the gas. i sure as hell hope thats possible!
__________________
-------------------------------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-25-2008, 02:16 AM   #8
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: GambiT
Code:
triggerlight = trigger_ff_script:new({ team = Team.kUnassigned })

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

function triggerlight:ontouch( touch_entity )
   if IsPlayer( touch_entity ) then 
      OutputEvent( self.light, "TurnOn" ) 
   end 
end 

function triggerlight:onendtouch( touch_entity )
   if IsPlayer( touch_entity ) then 
      OutputEvent( self.light, "TurnOff" ) 
   end 
end 

blueyardlight = triggerlight:new({ team = Team.kBlue, light = "blueyardlight_light" })
bluewolight = triggerlight:new({ team = Team.kBlue, light = "bluewolight_light" })
redyardlight = triggerlight:new({ team = Team.kRed, light = "redyardlight_light" })
redwolight = triggerlight:new({ team = Team.kRed, light = "redwolight_light" })
Also, you could have the spotlights follow the player. But with multiple players in the trigger it could be hard to make sure it works.
__________________
#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-25-2008, 02:21 AM   #9
Pon
Not choking. Yet.
Lua Team
Wiki Team
Fortress Forever Staff
 
Pon's Avatar
 
Join Date: Jul 2007
Location: Scotland
Class/Position: Demo/Def - Spy/Off
Gametype: Anything but yet more fucking CTF
Affiliations: FF.AvD [FF AvD/ID guild]
Posts Rated Helpful 0 Times
^^ boss showing off in front of the team...

Of course, your way would let spies in that are disguised as their own team

Aside from that, I guess squeek's way pretty much fits what you weant then, if thats all the Lua you have

EDIT: Wow, clambering over eachother to help....
__________________
Support FF:

YOU GUYS REALLY SHOULD UPDATE YOUR STAFF LIST!
I haven't posted since 2010...

Preferable to death. But only just...
Pon is offline   Reply With Quote


Old 02-25-2008, 02:19 AM   #10
ensiform
Time Lord, Doctor
Beta Tester
 
ensiform's Avatar
 
Join Date: Dec 2007
Location: The TARDIS
Class/Position: Engineer
Gametype: CTF
Posts Rated Helpful 1 Times
Quote:
Originally Posted by GambiT
ok, heres a task. this is for rock2.

i have 2 triggers(for each team), one for wo entry(call it "wolight"[red/bluewolight]) and one for yard entry spotlight(call it "yardlight"[red/blueyardlight]). heres the thing, when a "disguised" enemy spy goes through the trigger i do NOT want it to light up, but for all other enemies i do.
From base_teamplay... involving respawn door triggers:

Code:
function respawndoor:allowed( allowed_entity )
	if IsPlayer( allowed_entity ) then
		
		local player = CastToPlayer( allowed_entity )
		
		if player:GetTeamId() == self.team then
			return EVENT_ALLOWED
		end
		
		if self.allowdisguised then
			if player:IsDisguised() and player:GetDisguisedTeam() == self.team then
				return EVENT_ALLOWED
			end
		end
	end
	return EVENT_DISALLOWED
end
So maybe... trigger_ff_script that with an ontrigger callback that looks for enemies (and also do a check for disguised spies that match the allied team) and then have it fail same as if regular allies touch it
ensiform is offline   Reply With Quote


Old 10-24-2010, 06:55 PM   #11
Jay Mofo Mills
Jay|mOfO|Mills
Beta Tester
 
Join Date: Feb 2009
Location: Santa Fe, NM
Gametype: Snag the flag beotches
Posts Rated Helpful 8 Times
Bonus Point Triggers that disable after touch for 10 sec

Hello, I have a concmap I would like to release. I have some skill points that are trigger_ff_scripts. I would like it when any player passes through the trigger they get the points, then the trigger deactivates for say 10 seconds then reactivates....
Here is the code Bri was helping me with.


basescoretrigger = info_ff_script:new({
canscore = true,
score = 0,
})

function basescoretrigger:reallowscoring() self.canscore = true end

function basescoretriggerntouch(touch_entity)
if IsPlayer(touch_entity) then
local player = CastToPlayer(touch_entity)
if self.canscore then
player:AddFortPoints(self.score, "You have been awarded some points.")
BroadCastMessageToPlayer(player, "Nice Conc! You've been awarded some bonus points.")
self.canscore = false
AddSchedule("Reenable Scoring", 1, reallowscoring)
end
end
return true
end

beg_points = basescoretrigger:new({ score = 1 })
med_points = basescoretrigger:new({ score = 2 })
adv_points = basescoretrigger:new({ score = 3 })
crow_points = basescoretrigger:new({ score = 10 })



Any assistance would be awesome. Thanks,
m0f0
Jay Mofo Mills is offline   Reply With Quote


Old 10-24-2010, 09:21 PM   #12
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.
What's wrong with it?

This line determines how long the trigger is disabled for:
Code:
AddSchedule("Reenable Scoring", 1, reallowscoring)
I'd change it to:
Code:
AddSchedule("reenablescoring", self.disabletime, self.reallowscoring)
That will both allow you to set a different disable time per-trigger and call the right function, since reallowscoring is a member function of the basescoretrigger class.

And then change
Code:
basescoretrigger = info_ff_script:new({
canscore = true,
score = 0,
})
to

Code:
basescoretrigger = trigger_ff_script:new({
canscore = true,
score = 0,
disabletime = 10
})
Do you want it to only disable for the player that touched it or for all players everytime someone touches it?
__________________
#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.; 10-24-2010 at 09:22 PM.
squeek. is offline   Reply With Quote


Old 10-25-2010, 10:18 PM   #13
Jay Mofo Mills
Jay|mOfO|Mills
Beta Tester
 
Join Date: Feb 2009
Location: Santa Fe, NM
Gametype: Snag the flag beotches
Posts Rated Helpful 8 Times
Bonuse Point Triggers

Tried the new code and it still has the same problem.

In map, when you run through the trigger the first time it acts properly and adds points and disables the scoring. Problem is that it never re-enables.

There are no errors when the .lua runs at startup.
Jay Mofo Mills is offline   Reply With Quote


Old 10-27-2010, 01:28 PM   #14
Bridget
Banned
 
Bridget's Avatar
 
Join Date: Sep 2008
Class/Position: Soldier
Gametype: AVD
Affiliations: TALOS
Posts Rated Helpful 5 Times
You're using something similar to this?

Code:
base_score_trigger = info_ff_script:new({
	can_score = true,
	disable_time = 30,
	score = 0,
})

function base_score_trigger:reset_scoring() self.can_score = true end

function base_score_trigger:ontouch(touch_entity)
	if IsPlayer(touch_entity) then
		local player = CastToPlayer(touch_entity)
		if self.can_score then
			player:AddFortPoints(self.score, "Nice Conc!")
			BroadCastMessageToPlayer(player, "Blah blah")
			self.can_score = false
			AddSchedule("Re-Enable Scoring", self.disable_time, self.reset_scoring)
		end
	end
	return true
end

beg_points = base_score_trigger({ score = 1 })
med_points = base_score_trigger({ score = 2 })
adv_points = base_score_trigger({ score = 3 })
crow_points = base_score_trigger({ score = 10 })

Last edited by Bridget; 10-27-2010 at 01:31 PM.
Bridget is offline   Reply With Quote


Old 10-27-2010, 08:19 PM   #15
Jay Mofo Mills
Jay|mOfO|Mills
Beta Tester
 
Join Date: Feb 2009
Location: Santa Fe, NM
Gametype: Snag the flag beotches
Posts Rated Helpful 8 Times
This is the exact code I just tried out below. Still does not re-enable. I don't really know shit about .lua but could it be because disable_time is not called as some kind of function of the trigger? It gives me points the first time I run through the trigger, it displays the messages, just never reactivates the trigger.

I have tried using the base_score_trigger as both info_ff_script and trigger_ff_script with the same result.



base_score_trigger = trigger_ff_script:new({
can_score = true,
disable_time = 5,
score = 0,
})

function base_score_trigger:reset_scoring() self.can_score = true end

function base_score_triggerntouch(touch_entity)
if IsPlayer(touch_entity) then
local player = CastToPlayer(touch_entity)
if self.can_score then
player:AddFortPoints(self.score, "Nice Conc!")
BroadCastMessageToPlayer(player, "You've been awarded bonus points!")
self.can_score = false
AddSchedule("Re-Enable Scoring", self.disable_time, self.reset_scoring)
end
end
return true
end

beg_points = base_score_trigger:new({ score = 1 })
med_points = base_score_trigger:new({ score = 2 })
adv_points = base_score_trigger:new({ score = 3 })
crow_points = base_score_trigger:new({ score = 10 })
Jay Mofo Mills is offline   Reply With Quote


Reply


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

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 11:54 AM.


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