Fortress Forever

Go Back   Fortress Forever > Editing > Mapping > Lua

Reply
 
Thread Tools Display Modes
Old 05-28-2008, 10:05 PM   #1
Dr.Satan
Wiki Team
Fortress Forever Staff
 
Dr.Satan's Avatar
 
Join Date: Sep 2007
Location: Greeley, CO
Class/Position: Med / Solly
Gametype: PAYLOAD
Affiliations: DET-
Posts Rated Helpful 19 Times
Need lua to disallow the conc explosion

Ok here's what I want / need.

I want for a conc to only be able to be fired inside the trigger IF the player is holding it.

If they toss it, I want it to either disappear or not be fired.

I tired using this code from the no_annoyances and it's not working for some reason:

Code:
function noannoyances:onexplode( explode_entity )
	if IsGrenade( explode_entity ) then
		return EVENT_DISALLOWED
	end
	return EVENT_ALLOWED
end
Right now I have the trigger going around the whole room...do I need to just make it like 4 units high on the ground...so that if the conc gets tossed in there is doesn't work or do I need a new code for it?
__________________
(Released) conc_school | hellion_classic | ksour_PAYLOAD | mulch_faf
(Beta) alchimy_b1
(Lua) base_payload_2015
(Models) props_trainyard
Support FF:
Dr.Satan is offline   Reply With Quote


Old 05-28-2008, 10:42 PM   #2
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
Well, this isn't perfect, but it does what you want...

Code:
function player_onthrowgren2(player, prime)
	return EVENT_DISALLOWED
end
... should do it. As long as you don't mind that the timer for disabled grenades still appears
__________________
Support FF:

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

Preferable to death. But only just...

Last edited by Pon; 05-28-2008 at 10:48 PM.
Pon is offline   Reply With Quote


Old 05-28-2008, 11:00 PM   #3
Dr.Satan
Wiki Team
Fortress Forever Staff
 
Dr.Satan's Avatar
 
Join Date: Sep 2007
Location: Greeley, CO
Class/Position: Med / Solly
Gametype: PAYLOAD
Affiliations: DET-
Posts Rated Helpful 19 Times
lol not really...as long as they can't toss it down then that's fine by me. Plus this is all I need to run my last compile and release so something that small isn't really going to bug / stop me.
__________________
(Released) conc_school | hellion_classic | ksour_PAYLOAD | mulch_faf
(Beta) alchimy_b1
(Lua) base_payload_2015
(Models) props_trainyard
Support FF:
Dr.Satan is offline   Reply With Quote


Old 05-28-2008, 11:08 PM   #4
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
Thats good 'cos I'm not sure how to remove it :P
__________________
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 05-28-2008, 11:26 PM   #5
Jester
Fortress Forever Staff
 
Jester's Avatar
 
Join Date: Sep 2007
Class/Position: O: Scout
Affiliations: {NFO} - New Family Order
Posts Rated Helpful 0 Times
You could just remove their concs when they are out of the area and add them again when they are back?
Jester is offline   Reply With Quote


Old 05-29-2008, 12:42 AM   #6
Dr.Satan
Wiki Team
Fortress Forever Staff
 
Dr.Satan's Avatar
 
Join Date: Sep 2007
Location: Greeley, CO
Class/Position: Med / Solly
Gametype: PAYLOAD
Affiliations: DET-
Posts Rated Helpful 19 Times
well I want / need them to be able to HH the conc, but not to toss it.

Also me and pon have been going back and forth trying shit and nothing is working...any other ideas?
__________________
(Released) conc_school | hellion_classic | ksour_PAYLOAD | mulch_faf
(Beta) alchimy_b1
(Lua) base_payload_2015
(Models) props_trainyard
Support FF:
Dr.Satan is offline   Reply With Quote


Old 05-29-2008, 12:51 AM   #7
Jester
Fortress Forever Staff
 
Jester's Avatar
 
Join Date: Sep 2007
Class/Position: O: Scout
Affiliations: {NFO} - New Family Order
Posts Rated Helpful 0 Times
Something like if the grenade is yours and is not more than 1 unit away, allow blast. Dunno how to code that though.
Jester is offline   Reply With Quote


Old 05-29-2008, 12:55 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.
You could try enabling a trigger_remove that only removes grenades in player_onthrowgren2()
__________________
#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 05-29-2008, 12:57 AM   #9
Jester
Fortress Forever Staff
 
Jester's Avatar
 
Join Date: Sep 2007
Class/Position: O: Scout
Affiliations: {NFO} - New Family Order
Posts Rated Helpful 0 Times
I think if the whole onthrowgren2 thing was working, the above code from Pon would have fixed it already.
Jester is offline   Reply With Quote


Old 05-29-2008, 12:59 AM   #10
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 Jester
I think if the whole onthrowgren2 thing was working, the above code from Pon would have fixed it already.
It does work. It just doesn't work like onexplode; it's not meant to return a true/false allowed statement, it's meant to be a function (like player_spawn, entity:ontrigger, 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 05-29-2008, 01:04 AM   #11
Dr.Satan
Wiki Team
Fortress Forever Staff
 
Dr.Satan's Avatar
 
Join Date: Sep 2007
Location: Greeley, CO
Class/Position: Med / Solly
Gametype: PAYLOAD
Affiliations: DET-
Posts Rated Helpful 19 Times
yeah that seems to be the problem...I can't tie it to a trigger_ff_script b/c it's an entity so it either works all the time or never.
__________________
(Released) conc_school | hellion_classic | ksour_PAYLOAD | mulch_faf
(Beta) alchimy_b1
(Lua) base_payload_2015
(Models) props_trainyard
Support FF:
Dr.Satan is offline   Reply With Quote


Old 05-29-2008, 01:14 AM   #12
Jester
Fortress Forever Staff
 
Jester's Avatar
 
Join Date: Sep 2007
Class/Position: O: Scout
Affiliations: {NFO} - New Family Order
Posts Rated Helpful 0 Times
Quote:
Originally Posted by squeek.
You could try enabling a trigger_remove that only removes grenades in player_onthrowgren2()
I guess you could try this thing out, just do a disallow instead of removing though.
Jester is offline   Reply With Quote


Old 05-29-2008, 01:46 AM   #13
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
Ok, on the offchance that this might help someone else finish it off, here's what i was trying to do:

Code:
local c = Collection()

nonades = trigger_ff_script:new({})

function nonades:ontouch( touch_entity )
	if IsPlayer( touch_entity ) then
		local player = CastToPlayer( touch_entity )
		-- Add this player to the collection
		c:AddItem( player )
	end
end


function nonades:onendtouch( touch_entity )
	if IsPlayer( touch_entity ) then
		local player = CastToPlayer( touch_entity )
		-- Remove player from collection
		c:RemoveItem( player )
	end	
end


-- This is fired when everyone has stopped touching "nonades"
-- and it goes to its inactive state
function nonades:oninactive()
	-- Clear out the items in the collection
	c:RemoveAllItems()
end



function player_onthrowgren2(player, prime)

	if c:Count() == 0 then
		return EVENT_ALLOWED
	end

	for temp in c.items do
		local c_player = CastToPlayer( temp )
		
		if c_player == player then
			return EVENT_DISALLOWED
		end
	end

	return EVENT_ALLOWED
end
Didn't work, however using a gren inside the nonades area did produce an error, whereas using it outside of it did not... so it must be on the right track, I think.
__________________
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 05-29-2008, 03:09 AM   #14
Dr.Satan
Wiki Team
Fortress Forever Staff
 
Dr.Satan's Avatar
 
Join Date: Sep 2007
Location: Greeley, CO
Class/Position: Med / Solly
Gametype: PAYLOAD
Affiliations: DET-
Posts Rated Helpful 19 Times
so yeah...I'm an idiot and am very sorry to have wasted everyone's time:

http://developer.valvesoftware.com/wiki/Trigger_push

Speed of Push:

2000

Flags:

Clients (un-check)
Physics Objects (check)
FF Grenades (check)

Dropping conc sends it flying across the room, problem solved!

Again very sorry everyone...
__________________
(Released) conc_school | hellion_classic | ksour_PAYLOAD | mulch_faf
(Beta) alchimy_b1
(Lua) base_payload_2015
(Models) props_trainyard
Support FF:
Dr.Satan is offline   Reply With Quote


Old 05-29-2008, 03:48 AM   #15
Jester
Fortress Forever Staff
 
Jester's Avatar
 
Join Date: Sep 2007
Class/Position: O: Scout
Affiliations: {NFO} - New Family Order
Posts Rated Helpful 0 Times
Oh good it worked

We are victorious!
Jester is offline   Reply With Quote


Old 05-29-2008, 05:57 AM   #16
Dr.Satan
Wiki Team
Fortress Forever Staff
 
Dr.Satan's Avatar
 
Join Date: Sep 2007
Location: Greeley, CO
Class/Position: Med / Solly
Gametype: PAYLOAD
Affiliations: DET-
Posts Rated Helpful 19 Times
yeah I didn't have the map you told me about, but I did remember that concmap_cave had the same thing so I decompiled it and copied what PSF had in there and it worked great!

thanks for your help everyone! I am running the last (hopefully) compile right now and should have this thing released tomorrow.
__________________
(Released) conc_school | hellion_classic | ksour_PAYLOAD | mulch_faf
(Beta) alchimy_b1
(Lua) base_payload_2015
(Models) props_trainyard
Support FF:
Dr.Satan 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 10:37 PM.


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