Fortress Forever

Fortress Forever (https://forums.fortress-forever.com/index.php)
-   Lua (https://forums.fortress-forever.com/forumdisplay.php?f=44)
-   -   Lua Requests (Lua Assistance Division) (https://forums.fortress-forever.com/showthread.php?t=14729)

Dexter 10-27-2013 04:10 AM

The code is right but it didnt fore until I set flags to "Everything" in hammer on the detpack_trigger, try that. it defaults to clients and a detpack isnt a client

Jay Mofo Mills 10-28-2013 02:03 AM

That did not fix my problem however this one little line did, not sure why....
renaming the function to something else and voila.... doesnt make sense to me but I dont know wtf I'm doing anyway.

Thanks for the help dex

detpack_easter_egg = detpack_trigger:new({})

Dexter 10-31-2013 11:54 PM

weird, i have no idea then, i have never had to set flags before either .. so maybe a conflict or halloween spoooky ghosts spooky

Jay Mofo Mills 11-06-2013 06:08 PM

Gravity?
 
Hey peeps, Is there a way I can reset the gravity to normal on spawn? I have a special place in the map that triggers a low gravity change but if you die and respawn you keep the low gravity..... Can I put it in my player_spawn function? It will be easier than setting a trigger_gravity brush on every spawn in the map.

squeek. 11-06-2013 10:05 PM

Can do it all through Lua:

Code:

trigger_name = trigger_ff_script:new({})

function trigger_name:ontouch( touch_entity )
  if IsPlayer( touch_entity ) then
    local player = CastToPlayer( touch_entity )
    player:SetGravity( 0.5 ) -- number > 0 and <= 1
  end
end

function trigger_name:onendtouch( touch_entity )
  if IsPlayer( touch_entity ) then
    local player = CastToPlayer( touch_entity )
    player:SetGravity( 1 ) -- back to normal
  end
end

function player_spawn( player )
  player:SetGravity( 1 )
end


ddm999 05-09-2014 07:06 PM

Quote:

Any way to get the current map's name?
(if not plz add for next patch squeek kthxbye)

Attempting to make a system to rate maps, which I'll expand into a full map voting system.

( Also would really like to know if there's a nice and simple way of making a list short of just making a large table and annoying the hell out of all server admins by forcing them to be unable to copy-paste their old map lists. :P )
EDIT: Found it! host_map is a cvar that shows the current map file.

EDIT 2: NOPE. host_map is a client variable, that is set to 0 on the server. Therefore, Lua can't actually use it. Brilliant.

KubeDawg 05-09-2014 07:28 PM

Please just make it where it won't stop you from switching weapons when you vote, but not make it like the current alternative where you must hit Escape to even see the vote.

ddm999 05-10-2014 02:38 PM

Unfortunately Lua in FF has no access to actual keypresses, so the only real system I can use is the menu system in game.

( Which is the same as the one that mods use - the one that blocks weapon switching - if I remember correctly. :P )

I'll look into an alternative system where rather than using the menu system it uses chat messages. ( I'll probably introduce it with a custom HUD display, say, think of the voting system in Garry's Mod. - Except you can't click the buttons. D: )

Say for instance, you write:

!vote1
!vote2
!vote3

Potentially, the messages can be bound to keys ( say, numpad ) so that you can vote with a single keypress and it doesn't interrupt weapon switching.

I'll look into it further, but the current focus of my system is rating maps more than voting for the next map.

KubeDawg 05-10-2014 04:34 PM

Look at CS:GO's vote system. I believe they have found a way to get around that whole mess.

ddm999 05-10-2014 05:06 PM

The majority of Dota 2 and CS:GO uses Flash for HUD and menu elements.
If you dig around in the files, you'll notice that map overlays use Flash, the main menu is purely written in Flash, etc.

FF doesn't have this support.

Plus, that's Valve. Not like they completely wrote it from scratch in C++ or anything.

[TALOS]Smoke 09-29-2015 04:10 AM

I have a trigger_ff_script that I need to only be *ahem* triggered by an emp. Here is what I have so far, not 100% sure it's correct :oops:

<quote>highvolt_trigger = trigger_ff_script:new({ team = Team.kUnassigned, team_name = "neutral" })

function highvolt_trigger:onexplode( explode_entity )
if grenade:Type() == Grenade.kEmp then
local grenade = CastToGrenade( explode_entity )

OpenDoor( self.team_name .. "_light_doorhack" )

end

return EVENT_ALLOWED
end

red_highvolt_trigger = highvolt_trigger:new({ team = Team.kBlue })
blue_highvolt_trigger = highvolt_trigger:new({ team = Team.kRed })</quote>

squeek. 09-29-2015 07:29 AM

You mixed up the order of the if and the variable definition, and you might want to check that the cast succeeded. Those lines should be:

Code:

local grenade = CastToGrenade( explode_entity )
if grenade ~= nil and grenade:Type() == Grenade.kEmp then

The rest looks fine to me. Just make sure that you have "FF Grenades" checked in the trigger's flags in Hammer.

[TALOS]Smoke 10-03-2015 04:01 PM

It's probably best for me to just explain what I have in mind and maybe one of ya'll nice people can write me a function for it? :oops:

Here is what I need: A trigger_ff_script, that is only triggered by an enemy emp, after being triggered it will open a doorhack which will disable some lights. To close out the function I also need it to have another trigger_ff_script that is very similar to dropdown in that it takes a few hits from the teams engineer with the spanner to restore.
I reworked the code from my previous post and I cannot seem to get it to work at all, so I'm giving up on it and asking for help.


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

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