09-27-2006, 04:38 PM | #21 |
Fortress Forever Staff
Join Date: Jan 2005
Location: Texas
Posts Rated Helpful 0 Times
|
Not sure if it's changed since this, or if it was just commented out for some other reason, but this shit was shit Patty had in this little ff_dm map so Red players couldn't be conced, but apparently Blue people would remain conced indefinitely, haha.
There's lots of player_onevent shits. Code:
function player_onconc( player_entity, concer_entity ) -- player_entity is always a player local player = CastToPlayer( player_entity ) local concer = CastToPlayer( concer_entity ) ConsoleToAll( "Running player_onconc! Player: " .. player:GetName() .. " Concer: " .. concer:GetName() ) ConsoleToAll( "conc_duration = " .. conc_duration .. " conc_iconduration = " .. conc_iconduration ) if player:GetTeamId() == Team.kRed then return EVENT_DISALLOWED end conc_duration = -1 conc_iconduration = -1 ConsoleToAll( "conc_duration = " .. conc_duration .. " conc_iconduration = " .. conc_iconduration ) return EVENT_ALLOWED end Code:
function base_ball:dropitemcmd( drop_entity ) if IsPlayer( drop_entity ) then -- throw the ball local ball = CastToInfoScript( entity ) local player = CastToPlayer( drop_entity ) if not player:IsInUse() then ball:Drop(BALL_RETURN_TIME, BALL_THROW_SPEED) ConsoleToAll( player:GetName() .. " passed the ball!" ) else -- ball:Drop(BALL_RETURN_TIME, BALL_THROW_SPEED * 2) -- speed actually seems to be capped or somehtin' on the C++ side, because watch this ball not go fast at * 100... ball:Drop(BALL_RETURN_TIME, BALL_THROW_SPEED * 100) ConsoleToAll( player:GetName() .. " passed the ball really far!" ) end SmartSound( player, "misc.woop", "misc.woop", "misc.woop" ) -- Make it so the player can't touch the ball for 1 second -- (so it can't be thrown and not stick to the player) self:addnotouch(player:GetId(), 1) end end My jizz is on it. |
|
09-27-2006, 06:13 PM | #22 |
Retired FF Staff
|
yeah, i had that in ff_dm for easily testing it. the ff_dm map is so awesome that i wanted to return it to its normal awesome self so i removed the testing script. that's why it was removed. that maps so awesome too, i know you love it.
btw, all that shit is still valid ^^ except we'll probably remove the ConsoleToAll as it's mainly for just making sure shit works by printing some info to make sure the script is doing what you want it to do.
__________________
Head of the Orca Revolution (TM) |
|
09-27-2006, 08:08 PM | #23 |
Join Date: May 2005
Location: Changes every few months
Posts Rated Helpful 0 Times
|
Will ff_dm be released to the public with FF?
|
|
09-27-2006, 08:23 PM | #24 |
Retired FF Staff
|
if defrag quits complaining about how tiny the ramps are in the respawn, maybe.
__________________
Head of the Orca Revolution (TM) |
|
09-27-2006, 08:48 PM | #25 | |
Join Date: May 2005
Location: Somewere in Nevada
Posts Rated Helpful 0 Times
|
Quote:
For the few people who won't figure it out: I'm joking. |
|
|
09-27-2006, 09:45 PM | #26 |
Join Date: Jun 2005
Location: Carlisle, UK
Posts Rated Helpful 0 Times
|
Ugh, that looks far too much like C++ for my liking
|
|
09-28-2006, 12:04 AM | #27 |
Retired FF Staff
|
Well it's lua syntax and everything combined w/ "objects" and "functions" we've coded and are accessible through luabind. it's really awesome/easy compared to what we were doing.
__________________
Head of the Orca Revolution (TM) |
|
09-28-2006, 04:09 AM | #28 | |
Join Date: Mar 2005
Location: The Peoples Republic of Harmfull Free Radicals
Posts Rated Helpful 0 Times
|
Ok, that was awesome. Thanks for the example guys.
These scripts are just sections of code in a .txt file or something, right? Like a soundscape or something? How easy it it to get info between the lua script and an entity in the game? Like if you wanted a door to open if a particular player was going faster than a certain speed (or whatever) could you just call the door by it's name in the script and send it an output? edit: Quote:
|
|
|
09-28-2006, 04:34 AM | #29 | |||
Fortress Forever Staff
Join Date: Jan 2005
Location: Texas
Posts Rated Helpful 0 Times
|
Quote:
Quote:
Quote:
I got the cooooooooooobra. |
|||
|
09-28-2006, 01:00 PM | #30 |
Retired FF Staff
|
You can get the player's velocity so you could do something like...
Code:
-- Lua function my_door:allowed( allowed_entity ) if IsPlayer( allowed_entity ) then local player = CastToPlayer( allowed_entity ) local speed = player:GetVelocity() if speed:LengthSqr() > 200 then -- Put the OpenDoor in the ontouch instead OpenDoor( self.name ) return EVENT_ALLOWED end end return EVENT_DISALLOWED end And actually, the better way to do it would be to remove the OpenDoor line from the allowed function and put it in ontouch() like so: Code:
-- Lua function my_door:ontouch( touch_entity ) OpenDoor( self.name ) end
__________________
Head of the Orca Revolution (TM) Last edited by Mulchman MM; 09-28-2006 at 01:11 PM. |
|
09-28-2006, 01:20 PM | #31 | |
Fear teh crowbar.
Retired FF Staff
|
Quote:
|
|
|
09-29-2006, 12:48 AM | #32 |
Join Date: Jun 2006
Posts Rated Helpful 0 Times
|
Did you guys make it OO, or is that just fancy metatable work? (player, speed objects. Not sure about the door one :P)
I know of a World of Warcraft addon project (wow uses lua for the interface) that has managed to make an OO system with mixins Last edited by o_industrial; 09-29-2006 at 12:53 AM. |
|
09-29-2006, 03:08 AM | #33 |
Retired FF Staff
|
Tables and luabind. The base info_ff_scripts & trigger_ff_scripts are all table jizz. Everything else is luabind.
Like... Vector, QAngle, Player, Team, etc.
__________________
Head of the Orca Revolution (TM) |
|
09-29-2006, 07:17 PM | #35 |
Join Date: Mar 2005
Location: The Peoples Republic of Harmfull Free Radicals
Posts Rated Helpful 0 Times
|
What is the CastToPlayer() function? What's it do?
|
|
09-29-2006, 10:32 PM | #36 |
Join Date: Jul 2006
Posts Rated Helpful 0 Times
|
With your mouth, shows you how to suck a guy's cock obviously.
|
|
09-30-2006, 01:15 PM | #37 |
Join Date: Jan 2005
Location: Montreal
Posts Rated Helpful 0 Times
|
Discussions have become more and more interesting in the mapping forum lately.
|
|
09-30-2006, 01:57 PM | #38 | |
Fortress Forever Staff
|
Quote:
Like uh... Code:
function ona_trigger:OnTrigger( trigger_entity ) if IsPlayer( trigger_entity ) then local player = CastToPlayer( trigger_entity ) if player:HasItem("ona_party_rock") then BroadCastMessageToPlayer( player, "O&A PARTY ROCK!" ) end end end There's also a CastToInfoScript so you can do things like call Return() to send an item/flag/script entity back to its origin. Last edited by trepid_jon; 10-01-2006 at 11:03 AM. |
|
|
10-02-2006, 10:57 AM | #39 |
Join Date: Mar 2005
Location: The Peoples Republic of Harmfull Free Radicals
Posts Rated Helpful 0 Times
|
So, something like
Code:
if trigger_entity:HasItem("ona_party_rock") then |
|
10-02-2006, 12:29 PM | #40 |
Retired FF Staff
|
Eh, what is trigger_entity?
__________________
Head of the Orca Revolution (TM) |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|