Fortress Forever

Go Back   Fortress Forever > Editing > Mapping

Reply
 
Thread Tools Display Modes
Old 09-27-2006, 04:38 PM   #21
trepid_jesse
Fortress Forever Staff
 
trepid_jesse's Avatar
 
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
This was some shit Jon was fucking with awhile back for throwin' the ball. Cause it'd be cool to be able to throw a ball based on the player's current shit. So, if you're moving at some speed > X, jumping, and whatever else then you could modify the throw speed and shit. I don't think this worked right though, or at the time wasn't fully implemented on the C++ side of shit.

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
I don't even know how current that shit is, cause I just copied it out of some old scripts, so, I don't even know if that shit even still works the same cause the Lua shit was changing a lot awhile back.

My jizz is on it.
__________________
Support FF:

Trepid, what?
trepid_jesse is offline   Reply With Quote


Old 09-27-2006, 06:13 PM   #22
Mulchman MM
Retired FF Staff
 
Mulchman MM's Avatar
 
Join Date: Dec 2004
Location: Lacey, WA
Posts Rated Helpful 0 Times
Send a message via ICQ to Mulchman MM Send a message via AIM to Mulchman MM Send a message via MSN to Mulchman MM Send a message via Yahoo to Mulchman MM Send a message via Skype™ to Mulchman MM
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)
Mulchman MM is offline   Reply With Quote


Old 09-27-2006, 08:08 PM   #23
o_imbrifer
 
o_imbrifer's Avatar
 
Join Date: May 2005
Location: Changes every few months
Posts Rated Helpful 0 Times
Will ff_dm be released to the public with FF?
o_imbrifer is offline   Reply With Quote


Old 09-27-2006, 08:23 PM   #24
Mulchman MM
Retired FF Staff
 
Mulchman MM's Avatar
 
Join Date: Dec 2004
Location: Lacey, WA
Posts Rated Helpful 0 Times
Send a message via ICQ to Mulchman MM Send a message via AIM to Mulchman MM Send a message via MSN to Mulchman MM Send a message via Yahoo to Mulchman MM Send a message via Skype™ to Mulchman MM
if defrag quits complaining about how tiny the ramps are in the respawn, maybe.
__________________
Head of the Orca Revolution (TM)
Mulchman MM is offline   Reply With Quote


Old 09-27-2006, 08:48 PM   #25
o_sizeablessonic
 
o_sizeablessonic's Avatar
 
Join Date: May 2005
Location: Somewere in Nevada
Posts Rated Helpful 0 Times
Quote:
Originally Posted by trepid_jesse
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
This was some shit Jon was fucking with awhile back for throwin' the ball. Cause it'd be cool to be able to throw a ball based on the player's current shit. So, if you're moving at some speed > X, jumping, and whatever else then you could modify the throw speed and shit. I don't think this worked right though, or at the time wasn't fully implemented on the C++ side of shit.

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
I don't even know how current that shit is, cause I just copied it out of some old scripts, so, I don't even know if that shit even still works the same cause the Lua shit was changing a lot awhile back.

My jizz is on it.
FF script leakage *GASP*

For the few people who won't figure it out: I'm joking.
o_sizeablessonic is offline   Reply With Quote


Old 09-27-2006, 09:45 PM   #26
o_ginger lord
 
o_ginger lord's Avatar
 
Join Date: Jun 2005
Location: Carlisle, UK
Posts Rated Helpful 0 Times
Ugh, that looks far too much like C++ for my liking
o_ginger lord is offline   Reply With Quote


Old 09-28-2006, 12:04 AM   #27
Mulchman MM
Retired FF Staff
 
Mulchman MM's Avatar
 
Join Date: Dec 2004
Location: Lacey, WA
Posts Rated Helpful 0 Times
Send a message via ICQ to Mulchman MM Send a message via AIM to Mulchman MM Send a message via MSN to Mulchman MM Send a message via Yahoo to Mulchman MM Send a message via Skype™ to Mulchman MM
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)
Mulchman MM is offline   Reply With Quote


Old 09-28-2006, 04:09 AM   #28
o_nezumi
 
o_nezumi's Avatar
 
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:
Originally Posted by Ginger Lord
Ugh, that looks far too much like C++ for my liking
If it's code and it doesn't look like C/C++ then something is wrong. Or did you mean you want it to be like the key/value pair deal that all of valve's scripts are?
o_nezumi is offline   Reply With Quote


Old 09-28-2006, 04:34 AM   #29
trepid_jesse
Fortress Forever Staff
 
trepid_jesse's Avatar
 
Join Date: Jan 2005
Location: Texas
Posts Rated Helpful 0 Times
Quote:
Originally Posted by Nezumi
These scripts are just sections of code in a .txt file or something, right?
It's Lua, in a .lua file, and has the same name as your map.

Quote:
How easy it it to get info between the lua script and an entity in the game?
Pretty god damn easy. By the time FF comes out, setting up the gameplay for gameplay modes that we release with FF will be as easy, and literally, just putting trigger_ff_script/info_ff_script entities in your map, giving them the correct names, and there's no other work. That isn't meant as an over simplification. Assuming you just wanna do exactly what some pre-existing gameplay shit does, you just need to give the right entities the right names. You ain't have to fuck around with anything except the name. Name? People with zero coding/scripting experience will be able to setup basic gameplay if they know how to put entities in a map, and give entities names, and keep their dick hard.

Quote:
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?
I think the player's speed is exposed, but I can't remember if it's accessible by something easy like player.speed. I remember bothering Patty about this awhile back, so, if he reads this and there's not some easily accessible way to get the player's speed -- there should be.

I got the cooooooooooobra.
__________________
Support FF:

Trepid, what?
trepid_jesse is offline   Reply With Quote


Old 09-28-2006, 01:00 PM   #30
Mulchman MM
Retired FF Staff
 
Mulchman MM's Avatar
 
Join Date: Dec 2004
Location: Lacey, WA
Posts Rated Helpful 0 Times
Send a message via ICQ to Mulchman MM Send a message via AIM to Mulchman MM Send a message via MSN to Mulchman MM Send a message via Yahoo to Mulchman MM Send a message via Skype™ to Mulchman MM
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
The EVENT_ALLOWED / EVENT_DISALLOWED is just true / false but set up kind of like an alias for readability.

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
Right now when you touch a trigger_ff_script the allowed function is called and if it (allowed()) returns true then ontouch is called. If it (allowed()) returns false then onfailtouch is called. (so hopefully you see where I'm going with this and can follow what I'm saying!)
__________________
Head of the Orca Revolution (TM)

Last edited by Mulchman MM; 09-28-2006 at 01:11 PM.
Mulchman MM is offline   Reply With Quote


Old 09-28-2006, 01:20 PM   #31
Lost
Fear teh crowbar.
Retired FF Staff
 
Lost's Avatar
 
Join Date: Jan 2005
Location: Oklahoma
Gametype: CTF ftw, yeh
Posts Rated Helpful 6 Times
Send a message via Yahoo to Lost
Quote:
Originally Posted by trepid_jesse
keep their dick hard
Sweeeeeet, I can program now!
__________________
Do what you want cuz a pirate is free!

You are a pirate!
Lost is offline   Reply With Quote


Old 09-29-2006, 12:48 AM   #32
o_industrial
 
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.
o_industrial is offline   Reply With Quote


Old 09-29-2006, 03:08 AM   #33
Mulchman MM
Retired FF Staff
 
Mulchman MM's Avatar
 
Join Date: Dec 2004
Location: Lacey, WA
Posts Rated Helpful 0 Times
Send a message via ICQ to Mulchman MM Send a message via AIM to Mulchman MM Send a message via MSN to Mulchman MM Send a message via Yahoo to Mulchman MM Send a message via Skype™ to Mulchman MM
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)
Mulchman MM is offline   Reply With Quote


Old 09-29-2006, 04:57 AM   #34
trepid_jesse
Fortress Forever Staff
 
trepid_jesse's Avatar
 
Join Date: Jan 2005
Location: Texas
Posts Rated Helpful 0 Times
Show me how you suck a guy's cock. Show me with your mouth.
__________________
Support FF:

Trepid, what?
trepid_jesse is offline   Reply With Quote


Old 09-29-2006, 07:17 PM   #35
o_nezumi
 
o_nezumi's Avatar
 
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?
o_nezumi is offline   Reply With Quote


Old 09-29-2006, 10:32 PM   #36
o_dancingfool
 
o_dancingfool's Avatar
 
Join Date: Jul 2006
Posts Rated Helpful 0 Times
With your mouth, shows you how to suck a guy's cock obviously.
o_dancingfool is offline   Reply With Quote


Old 09-30-2006, 01:15 PM   #37
o_sh4x
 
o_sh4x's Avatar
 
Join Date: Jan 2005
Location: Montreal
Posts Rated Helpful 0 Times
Discussions have become more and more interesting in the mapping forum lately.
o_sh4x is offline   Reply With Quote


Old 09-30-2006, 01:57 PM   #38
trepid_jon
Ray Ray Johnson
Fortress Forever Staff
 
trepid_jon's Avatar
 
Join Date: Feb 2005
Location: Dallas, TX
Class/Position: D Civilian
Gametype: Rocket Jousting
Affiliations: EAFD
Posts Rated Helpful 78 Times
Send a message via ICQ to trepid_jon Send a message via AIM to trepid_jon
Quote:
Originally Posted by Nezumi
What is the CastToPlayer() function? What's it do?
You use that so you can do the player-specific shit with that entity (only if it's actually a player, though).

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
Those HasItem and BroadCastMessageToPlayer functions wouldn't work if you didn't make "player" an actual player.

There's also a CastToInfoScript so you can do things like call Return() to send an item/flag/script entity back to its origin.
__________________
Support FF:
Trepid
steamcommunity.com/id/trepid_jon/

Last edited by trepid_jon; 10-01-2006 at 11:03 AM.
trepid_jon is offline   Reply With Quote


Old 10-02-2006, 10:57 AM   #39
o_nezumi
 
o_nezumi's Avatar
 
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
doesn't work?
o_nezumi is offline   Reply With Quote


Old 10-02-2006, 12:29 PM   #40
Mulchman MM
Retired FF Staff
 
Mulchman MM's Avatar
 
Join Date: Dec 2004
Location: Lacey, WA
Posts Rated Helpful 0 Times
Send a message via ICQ to Mulchman MM Send a message via AIM to Mulchman MM Send a message via MSN to Mulchman MM Send a message via Yahoo to Mulchman MM Send a message via Skype™ to Mulchman MM
Eh, what is trigger_entity?
__________________
Head of the Orca Revolution (TM)
Mulchman MM 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 01:56 AM.


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