10-15-2007, 12:04 AM | #1 |
Retired Mapper
Join Date: Mar 2007
Location: Tulsa, OK
Posts Rated Helpful 1 Times
|
[LUA Help] Trigger Hurt, Momentary_Rot_Button HELP!!!
Things I got working.
func_rot_button works now. Toggles between teams. toggled spawns, lever turns spawn on and off. Things to Do (maybe). Add Detpack points, had some probs with this so far. Add ALERTS and hud icons for gas/warehouse events. Things I still need help with. Making Trigger_Hurt give the player that enables it with a button, the kills it gets. There is some LUA code about killer/attacker in the rocket arena include but I havent found a way to pass the killer along to the hurt. Also, no clue how to test this so atm im not working on it. Momentary_Rot_button. While I have got func_rot_button working fine, momentary_rot_button does not work at all. I can get OnPressed and things to work fine in my LUA but, ALLOWED never gets called so i cant make it a team button. If I try to call the player in the OnPressed its always a nil value error no matter what I try to do. Any Ideas on this would be helpfull, Edit Redid the button part to see whats happening. Only OnPressed and OnFullyClosed are being called when I use it. Heres what I got on the Momentary_Rot_Button atm Code:
----------------------------------------------------------------------------- -- Buildables ----------------------------------------------------------------------------- momentary_rot_button = baseclass:new({}) function momentary_rot_button:allowed() return true end function momentary_rot_button:onpressed() end function momentary_rot_button:onunpressed() end function momentary_rot_button:onfullyopen() end function momentary_rot_button:onfullyclosed() end function momentary_rot_button:onreachedposition() end red_assaultramp_build = momentary_rot_button:new({ team = Team.kRed }) function red_assaultramp_build:Allowed() ConsoleToAll( "Allowed" ) end function red_assaultramp_build:OnPressed() ConsoleToAll( "Pressed" ) end function red_assaultramp_build:OnUnPressed() ConsoleToAll( "UnPressed" ) end function red_assaultramp_build:OnFullyOpen() ConsoleToAll( "Fully Open" ) end function red_assaultramp_build:OnFullyClosed() ConsoleToAll( "Fully Closed" ) end function red_assaultramp_build:OnReachedPosition() ConsoleToAll( "Reached Postion" ) end base_ramp_trigger = trigger_ff_script:new({ team = Team.kUnassigned }) function base_ramp_trigger:onexplode( explosion_entity ) if IsDetpack( explosion_entity ) then local detpack = CastToDetpack( explosion_entity ) -- GetTemId() might not exist for buildables, they have their own seperate shit and it might be named differently if detpack:GetTeamId() ~= self.team then OutputEvent( self.team_name .. "_assaultramp", "Disable" ) OutputEvent( self.team_name .. "_assaultramp_trigger", "Disable" ) end end -- I think this is needed so grenades and other shit can blow up here. They won't fire the events, though. return EVENT_ALLOWED end red_assaultramp_trigger = base_ramp_trigger:new({ team = Team.kRed, team_name = "red" }) green_assaultramp_trigger = base_ramp_trigger:new({ team = Team.kGreen, team_name = "green" }) My current full LUA for Andever: Code:
-- ff_andever.lua ----------------------------------------------------------------------------- -- includes ----------------------------------------------------------------------------- IncludeScript("base_ctf"); IncludeScript("base_location"); IncludeScript("base_respawnturret"); ----------------------------------------------------------------------------- -- global overrides ----------------------------------------------------------------------------- POINTS_PER_CAPTURE = 10 FLAG_RETURN_TIME = 60 function startup() -- set up team limits on each team SetPlayerLimit(Team.kBlue, -1) SetPlayerLimit(Team.kRed, 0) SetPlayerLimit(Team.kYellow, -1) SetPlayerLimit(Team.kGreen, 0) -- CTF maps generally don't have civilians, -- so override in map LUA file if you want 'em local team = GetTeam(Team.kGreen) team:SetClassLimit(Player.kCivilian, -1) team:SetClassLimit( Player.kSpy, 0 ) team = GetTeam(Team.kRed) team:SetClassLimit(Player.kCivilian, -1) team:SetClassLimit( Player.kSpy, 0 ) end function flaginfo( player_entity ) -- at the moment this is crappy workaround - simply displays the home icon local player = CastToPlayer( player_entity ) -- copied from green_flag variables AddHudIcon( player, green_flag.hudstatusiconhome, ( green_flag.name.. "_h" ), green_flag.hudstatusiconx, green_flag.hudstatusicony, green_flag.hudstatusiconw, green_flag.hudstatusiconh, green_flag.hudstatusiconalign ) AddHudIcon( player, red_flag.hudstatusiconhome, ( red_flag.name.. "_h" ), red_flag.hudstatusiconx, red_flag.hudstatusicony, red_flag.hudstatusiconw, red_flag.hudstatusiconh, red_flag.hudstatusiconalign ) local flag = GetInfoScriptByName("green_flag") if flag:IsCarried() then AddHudIcon( player, green_flag.hudstatusiconcarried, ( green_flag.name.. "_h" ), green_flag.hudstatusiconx, green_flag.hudstatusicony, green_flag.hudstatusiconw, green_flag.hudstatusiconh, green_flag.hudstatusiconalign ) elseif flag:IsDropped() then AddHudIcon( player, green_flag.hudstatusicondropped, ( green_flag.name.. "_h" ), green_flag.hudstatusiconx, green_flag.hudstatusicony, green_flag.hudstatusiconw, green_flag.hudstatusiconh, green_flag.hudstatusiconalign ) end flag = GetInfoScriptByName("red_flag") if flag:IsCarried() then AddHudIcon( player, red_flag.hudstatusiconcarried, ( red_flag.name.. "_h" ), red_flag.hudstatusiconx, red_flag.hudstatusicony, red_flag.hudstatusiconw, red_flag.hudstatusiconh, red_flag.hudstatusiconalign ) elseif flag:IsDropped() then AddHudIcon( player, red_flag.hudstatusicondropped, ( red_flag.name.. "_h" ), red_flag.hudstatusiconx, red_flag.hudstatusicony, red_flag.hudstatusiconw, red_flag.hudstatusiconh, red_flag.hudstatusiconalign ) end end ----------------------------------------------------------------------------- -- Hurts ----------------------------------------------------------------------------- hurt = trigger_ff_script:new({ team = Team.kUnassigned }) function hurt:allowed( allowed_entity ) if IsPlayer( allowed_entity ) then local player = CastToPlayer( allowed_entity ) if player:GetTeamId() == self.team then return EVENT_ALLOWED end end return EVENT_DISALLOWED end -- red lasers hurt green and vice-versa green_laser_hurt_flag = hurt:new({ team = Team.kRed }) green_laser_hurt_button = hurt:new({ team = Team.kRed }) red_laser_hurt_flag = hurt:new({ team = Team.kGreen }) red_laser_hurt_button = hurt:new({ team = Team.kGreen }) ----------------------------------------------------------------------------- -- Grates ----------------------------------------------------------------------------- base_grate_trigger = trigger_ff_script:new({ team = Team.kUnassigned, team_name = "neutral" }) function base_grate_trigger:onexplode( explosion_entity ) if IsDetpack( explosion_entity ) then local detpack = CastToDetpack( explosion_entity ) -- GetTemId() might not exist for buildables, they have their own seperate shit and it might be named differently if detpack:GetTeamId() ~= self.team then OutputEvent( self.team_name .. "_det_grate", "Kill" ) end end -- I think this is needed so grenades and other shit can blow up here. They won't fire the events, though. return EVENT_ALLOWED end red_det_grate_trigger = base_grate_trigger:new({ team = Team.kRed, team_name = "red" }) green_det_grate_trigger = base_grate_trigger:new({ team = Team.kGreen, team_name = "green" }) ----------------------------------------------------------------------------- -- Locations ----------------------------------------------------------------------------- location_greenbase = location_info:new({ text = "Inside Base", team = Team.kGreen }) location_greenwarehouse = location_info:new({ text = "Warehouse", team = Team.kGreen }) location_greenoutside = location_info:new({ text = "Outside Base", team = Team.kGreen }) location_greenflagbunker = location_info:new({ text = "Flag Bunker", team = Team.kGreen }) location_greensniper = location_info:new({ text = "Battlement", team = Team.kGreen }) location_greenbackway = location_info:new({ text = "Backway", team = Team.kGreen }) location_greenflag = location_info:new({ text = "Flag Room", team = Team.kGreen }) location_redbase = location_info:new({ text = "Inside Base", team = Team.kRed }) location_redwarehouse = location_info:new({ text = "Warehouse", team = Team.kRed }) location_redoutside = location_info:new({ text = "Outside Base", team = Team.kRed }) location_redflagbunker = location_info:new({ text = "Flag Bunker", team = Team.kRed }) location_redbattlement = location_info:new({ text = "Battlement", team = Team.kRed }) location_redbackway = location_info:new({ text = "Backway", team = Team.kRed }) location_redflagroom = location_info:new({ text = "Flag Room", team = Team.kRed }) ----------------------------------------------------------------------------- -- Spawns ----------------------------------------------------------------------------- togglespawn = info_ff_teamspawn:new({ team = Team.kUnassigned, toggledoff = false }) function toggle_allowedmethod(self, player_entity) if (IsPlayer(player_entity) == false) then return false end local player = CastToPlayer( player_entity ) local teamId = player:GetTeamId() return (teamId == self.team and self.toggledoff == false) end greenspawn_w = togglespawn:new({ team = Team.kGreen, validspawn = toggle_allowedmethod }) greenspawn_f = togglespawn:new({ team = Team.kGreen, validspawn = toggle_allowedmethod }) redspawn_w = togglespawn:new({ team = Team.kRed, validspawn = toggle_allowedmethod }) redspawn_f = togglespawn:new({ team = Team.kRed, validspawn = toggle_allowedmethod }) ----------------------------------------------------------------------------- -- Warehouse Levers ----------------------------------------------------------------------------- func_rot_button = baseclass:new({}) function func_rot_button:allowed() return true end function func_rot_button:onuse() end function func_rot_button:allowed( touch_entity ) if IsPlayer( touch_entity ) then local player = CastToPlayer( touch_entity ) return player:GetTeamId() == self.team end return EVENT_DISALLOWED end green_warehouse_lever_rot = func_rot_button:new({ team = Team.kRed }) function green_warehouse_lever_rot:OnIn( trigger_entity ) greenspawn_w.toggledoff = true self.team = Team.kGreen local player = CastToPlayer( trigger_entity ) player:AddFortPoints( 100, "Warehouse Spawn Disabled" ) end function green_warehouse_lever_rot:OnOut( trigger_entity ) greenspawn_w.toggledoff = false self.team = Team.kRed local player = CastToPlayer( trigger_entity ) player:AddFortPoints( 250, "Warehouse Spawn Enabled" ) end red_warehouse_lever_rot = func_rot_button:new({ team = Team.kGreen }) function red_warehouse_lever_rot:OnIn( trigger_entity ) redspawn_w.toggledoff = true self.team = Team.kRed local player = CastToPlayer( trigger_entity ) player:AddFortPoints( 100, "Warehouse Spawn Disabled" ) end function red_warehouse_lever_rot:OnOut( trigger_entity ) redspawn_w.toggledoff = false self.team = Team.kGreen local player = CastToPlayer( trigger_entity ) player:AddFortPoints( 250, "Warehouse Spawn Enabled" ) end ----------------------------------------------------------------------------- -- Gas Chambers ----------------------------------------------------------------------------- green_gasbutton = func_rot_button:new({ team = Team.kRed }) function green_gasbutton:allowed( touch_entity ) if IsPlayer( touch_entity ) then local player = CastToPlayer( touch_entity ) return player:GetTeamId() == self.team end return EVENT_DISALLOWED end function green_gasbutton:OnIn( trigger_entity ) greenspawn_f.toggledoff = true local player = CastToPlayer( trigger_entity ) player:AddFortPoints( 150, "Gas Chamber Enabled" ) end function green_gasbutton:OnOut() greenspawn_f.toggledoff = false end red_gasbutton = func_rot_button:new({ team = Team.kGreen }) function red_gasbutton:allowed( touch_entity ) if IsPlayer( touch_entity ) then local player = CastToPlayer( touch_entity ) return player:GetTeamId() == self.team end return EVENT_DISALLOWED end function red_gasbutton:OnIn( trigger_entity ) redspawn_f.toggledoff = true local player = CastToPlayer( trigger_entity ) player:AddFortPoints( 150, "Gas Chamber Enabled" ) end function red_gasbutton:OnOut() redspawn_f.toggledoff = false end ----------------------------------------------------------------------------- -- Testing ----------------------------------------------------------------------------- Last edited by Major Lee High; 10-29-2007 at 08:26 AM. Reason: update |
|
10-15-2007, 11:53 AM | #2 |
Retired Mapper
Join Date: Mar 2007
Location: Tulsa, OK
Posts Rated Helpful 1 Times
|
-------------------- Original Post
So I've got most my map done, just finishing up some loose ends and I cant get these to work at all. I have some Spawns that I want to deactivate with a func_rot_button (its a lever). Atm the button works (without LUA teams or anything, it just opens some doors and turns off lasers to spawn), but the spawns don't work at all, greenspawn_w. Cant seem to find much info in the LUA files for spawns, searched the forums and found mulchs post on valid spawn but haven't had any luck. Everything I have tried with my LUA seems like it isn't even trying to work, like I said my spawns don't work at all but I think I'm missing something I need to do to make spawns not named greenspawn work in the first place, but my button doesn't ever link to a team or send messages to players no matter what i try to do with it. What I want to happen, is have the lever be RED, OnIn I want it to disable the spawn, and change the buttons team to GREEN (I have the lever toggle), then OnOut enable the spawn and change team back to red. Not really sure what i need to do to make the spawns work, atm im just trying to get the button to do something. I have my LUA file working for everything else, it loads the teams right, and everything else seems fine. Just cant seem to get anywhere with this. Heres the LUA stuff. Code:
----------------------------------------------------------------------------- -- Spawns ----------------------------------------------------------------------------- greenspawn_w = info_ff_teamspawn:new ({ team = Team.kGreen }) function greenspawn_w:validspawn() if green_warehouse_lever_rot.team == self.team then return false end return true end greenspawn_f = info_ff_teamspawn:new ({ team = Team.kGreen }) function greenspawn_f:validspawn() if green_gasbutton.team == self.team then return false end return true end ----------------------------------------------------------------------------- -- Warehouse Levers ----------------------------------------------------------------------------- func_rot_button = baseclass:new({}) function func_rot_button:allowed() return true end function func_rot_button:onuse() end green_warehouse_lever_rot = func_rot_button:new({ team = Team.kRed }) function green_warehouse_lever_rot:allowed( touch_entity ) if IsPlayer( touch_entity ) then local player = CastToPlayer( touch_entity ) return player:GetTeamId() == self.team end return EVENT_DISALLOWED end function green_warehouse_lever_rot:OnIn() self.team = Team.kGreen end function green_warehouse_lever_rot:OnOut() self.team = Team.kRed end ----------------------------------------------------------------------------- -- Gas Chambers ----------------------------------------------------------------------------- green_gasbutton = func_rot_button:new({ team = Team.kRed }) function green_gasbutton:allowed( touch_entity ) if IsPlayer( touch_entity ) then local player = CastToPlayer( touch_entity ) return player:GetTeamId() == self.team end return EVENT_DISALLOWED end function green_gasbutton:OnIn() self.team = Team.kGreen end function green_gasbutton:OnOut() self.team = Team.kRed end Few more questions now. When I set the start locked flag, none of the buttons I've made have ever started locked lol, is there a bug with that? I have another entity locking one of my buttons on spawn so it works, just wondering. In my above code, for disabling the greenspawn_f spawns, I changed the gasbuttons teams even though I don't need the teams to change, just to get the validspawn to work for the spawns. I tried making a new setting like sec_up in shutdowns code but it never worked. It works like this and i don't see a problem with it, but I'm sure there is a proper way to do it. One more. Is there a way for me to pass the player that uses my gasbutton, onto a trigger hurt so they get the kills for gassing people? Last edited by Major Lee High; 10-26-2007 at 11:16 PM. |
|
10-17-2007, 11:04 PM | #3 |
Retired Mapper
Join Date: Mar 2007
Location: Tulsa, OK
Posts Rated Helpful 1 Times
|
Ok the spawns I had up there didn't actually work right. They were disabling, but they weren't actually team spawns, either team could spawn there. I changed their code some and now they all have teams working, but I'm still not sure how to disable them with the buttons, I need to know how to properly add a boolean I guess so that I can toggle their valid spawns on or off. I have tried adding something like sec_up from the shutdown stuff, but I always get a error.
I still need to know if I can pass the button presser onto the trigger hurt to make it give them kills, and if I can do that how too. I'm down to just having these and some tweaking to do before I can make a beta release, so any help would be appreciated. Heres my code now: Code:
----------------------------------------------------------------------------- -- Spawns ----------------------------------------------------------------------------- greenspawn_w = info_ff_teamspawn:new ({ }) greenspawn_w = { validspawn = greenallowedmethod } greenspawn_f = info_ff_teamspawn:new ({ team = Team.kGreen }) greenspawn_f = { validspawn = greenallowedmethod } redspawn_w = info_ff_teamspawn:new ({ team = Team.kRed }) redspawn_w = { validspawn = redallowedmethod } redspawn_f = info_ff_teamspawn:new ({ team = Team.kRed }) redspawn_f = { validspawn = redallowedmethod } ----------------------------------------------------------------------------- -- Warehouse Levers ----------------------------------------------------------------------------- func_rot_button = baseclass:new({}) function func_rot_button:allowed() return true end function func_rot_button:onuse() end green_warehouse_lever_rot = func_rot_button:new({ team = Team.kRed }) function green_warehouse_lever_rot:allowed( touch_entity ) if IsPlayer( touch_entity ) then local player = CastToPlayer( touch_entity ) return player:GetTeamId() == self.team end return EVENT_DISALLOWED end function green_warehouse_lever_rot:OnIn() self.team = Team.kGreen end function green_warehouse_lever_rot:OnOut() self.team = Team.kRed end red_warehouse_lever_rot = func_rot_button:new({ team = Team.kGreen }) function red_warehouse_lever_rot:allowed( touch_entity ) if IsPlayer( touch_entity ) then local player = CastToPlayer( touch_entity ) return player:GetTeamId() == self.team end return EVENT_DISALLOWED end function red_warehouse_lever_rot:OnIn() self.team = Team.kRed end function red_warehouse_lever_rot:OnOut() self.team = Team.kGreen end ----------------------------------------------------------------------------- -- Gas Chambers ----------------------------------------------------------------------------- green_gasbutton = func_rot_button:new({ team = Team.kRed }) function green_gasbutton:allowed( touch_entity ) if IsPlayer( touch_entity ) then local player = CastToPlayer( touch_entity ) return player:GetTeamId() == self.team end return EVENT_DISALLOWED end function green_gasbutton:OnIn() end function green_gasbutton:OnOut() end red_gasbutton = func_rot_button:new({ team = Team.kGreen }) function red_gasbutton:allowed( touch_entity ) if IsPlayer( touch_entity ) then local player = CastToPlayer( touch_entity ) return player:GetTeamId() == self.team end return EVENT_DISALLOWED end function red_gasbutton:OnIn() end function red_gasbutton:OnOut() end |
|
10-18-2007, 02:38 PM | #4 |
Join Date: Sep 2007
Posts Rated Helpful 0 Times
|
I noticed none of your methods have a return EVENT_ALLOWED. I do not know if this will fix anything or even if it is necessary. Just pointing that out.
|
|
10-18-2007, 03:15 PM | #5 |
Newb
|
EVENT_DISALLOWED and EVENT_ALLOWED are just aliases for false and true, respectivly.
He has "return player:GetTeamId() == self.team" which will return true (EVENT_ALLOWED) if their team is the correct team. I personally just stick with true and false for return values, but I guess the dev team thought it would be easier for some people to understand if they were to have EVENT_ALLOWED/DISALLOWED |
|
10-18-2007, 03:56 PM | #6 |
Join Date: Sep 2007
Posts Rated Helpful 0 Times
|
thanks. Can you explain to me what the self.team means. That is pretty much the only thing i am getting stuck on ATM. Not just self.team but self.*
For example return player:GetTeamId() == self.team I know his is checking the Team of the player against the team of self but what is self exactly? |
|
10-18-2007, 11:53 PM | #7 |
Retired Mapper
Join Date: Mar 2007
Location: Tulsa, OK
Posts Rated Helpful 1 Times
|
Pretty sure self means that your just referencing the, ehh not sure what to call it, the function or whatever it is that has the self inside it.
Like if you had self.team inside a teamdoor, it would just be checking what team the door is on, or changing the team of the door. Like on my rot_buttons, i set their teams when i make them, then when the button is turned on/off farther down, self.team = Team.KGreen or whatever changes it to a new team. Wasn't sure myself what those events meant, thanks for clearing that up ;P What would be the way to add that to the OnIn/OnOut function though? greenspawn_w.validspawn = return false Or something like that? Ive been getting errors and the LUA wont load when i try stuff like that or when i try to add a new true/false. |
|
10-19-2007, 12:35 AM | #8 |
Join Date: Sep 2007
Posts Rated Helpful 0 Times
|
what are your includes
|
|
10-19-2007, 05:31 AM | #9 |
Retired Mapper
Join Date: Mar 2007
Location: Tulsa, OK
Posts Rated Helpful 1 Times
|
Code:
IncludeScript("base"); IncludeScript("base_ctf"); IncludeScript("base_teamplay"); IncludeScript("base_location"); IncludeScript("base_respawnturret"); |
|
10-19-2007, 03:06 PM | #10 |
Join Date: Sep 2007
Posts Rated Helpful 0 Times
|
No you definitely dont. take out these two lines
IncludeScript("base"); IncludeScript("base_teamplay"); Base is always loaded no matter what and base_ctf calls base_teamplay. I will look through the rest now. |
|
10-20-2007, 03:56 AM | #11 |
Retired Mapper
Join Date: Mar 2007
Location: Tulsa, OK
Posts Rated Helpful 1 Times
|
Here is where I am with the spawns (nowhere still lol):
Code:
togglespawn = info_ff_teamspawn:new({ team = Team.kUnassigned, toggledoff = true }) function togglespawn:validspawn( player_entity ) if IsPlayer( player_entity ) then local player = CastToPlayer( player_entity ) if player:GetTeamId() == self.team and self.toggledoff == false then return EVENT_ALLOWED end end return EVENT_DISALLOWED end greenspawn_w = togglespawn:new({ team = Team.kGreen, toggledoff = false }) My problem is that no matter how I try to change toggledoff in greenspawn_w with the levers it wont work. Atm my levers are the same as posted above, nothing I tried so far does anything. How do i properly change that with the OnIn and OnOut of my levers? Also I still havent looked into making the trigger hurt give players kills (no clue where to start really), but I still want to try and do that once these spawns work, before I release it. So if anyone has any ideas on that or wants to figure it out that would be nice Edit - Got the spawns working, just need trigger hurt help!!! Last edited by Major Lee High; 10-20-2007 at 10:53 AM. |
|
10-20-2007, 11:02 AM | #12 |
Retired Mapper
Join Date: Mar 2007
Location: Tulsa, OK
Posts Rated Helpful 1 Times
|
Got everything working now except the trigger hurt giving the player that pushes the button the kills for while its enabled.
I don't really know where to start with that, but I will play with it some. I still have some tweaks and things my map needs before full compile and test, and I could live without this working but I want to get as much in as i can for first beta. Here is my whole LUA, if someone who is good with this could figure out how to make the trigger hurt work like that, it would be sweet AFAIK this all works, but I'm not sure if i need everything I have or not, or if its done the right way lol. Code:
----------------------------------------------------------------------------- -- includes ----------------------------------------------------------------------------- IncludeScript("base_ctf"); IncludeScript("base_location"); IncludeScript("base_respawnturret"); ----------------------------------------------------------------------------- -- global overrides ----------------------------------------------------------------------------- POINTS_PER_CAPTURE = 10 FLAG_RETURN_TIME = 60 function startup() -- set up team limits on each team SetPlayerLimit(Team.kBlue, -1) SetPlayerLimit(Team.kRed, 0) SetPlayerLimit(Team.kYellow, -1) SetPlayerLimit(Team.kGreen, 0) -- CTF maps generally don't have civilians, -- so override in map LUA file if you want 'em local team = GetTeam(Team.kGreen) team:SetClassLimit(Player.kCivilian, -1) team = GetTeam(Team.kRed) team:SetClassLimit(Player.kCivilian, -1) end function flaginfo( player_entity ) -- at the moment this is crappy workaround - simply displays the home icon local player = CastToPlayer( player_entity ) -- copied from green_flag variables AddHudIcon( player, green_flag.hudstatusiconhome, ( green_flag.name.. "_h" ), green_flag.hudstatusiconx, green_flag.hudstatusicony, green_flag.hudstatusiconw, green_flag.hudstatusiconh, green_flag.hudstatusiconalign ) AddHudIcon( player, red_flag.hudstatusiconhome, ( red_flag.name.. "_h" ), red_flag.hudstatusiconx, red_flag.hudstatusicony, red_flag.hudstatusiconw, red_flag.hudstatusiconh, red_flag.hudstatusiconalign ) local flag = GetInfoScriptByName("green_flag") if flag:IsCarried() then AddHudIcon( player, green_flag.hudstatusiconcarried, ( green_flag.name.. "_h" ), green_flag.hudstatusiconx, green_flag.hudstatusicony, green_flag.hudstatusiconw, green_flag.hudstatusiconh, green_flag.hudstatusiconalign ) elseif flag:IsDropped() then AddHudIcon( player, green_flag.hudstatusicondropped, ( green_flag.name.. "_h" ), green_flag.hudstatusiconx, green_flag.hudstatusicony, green_flag.hudstatusiconw, green_flag.hudstatusiconh, green_flag.hudstatusiconalign ) end flag = GetInfoScriptByName("red_flag") if flag:IsCarried() then AddHudIcon( player, red_flag.hudstatusiconcarried, ( red_flag.name.. "_h" ), red_flag.hudstatusiconx, red_flag.hudstatusicony, red_flag.hudstatusiconw, red_flag.hudstatusiconh, red_flag.hudstatusiconalign ) elseif flag:IsDropped() then AddHudIcon( player, red_flag.hudstatusicondropped, ( red_flag.name.. "_h" ), red_flag.hudstatusiconx, red_flag.hudstatusicony, red_flag.hudstatusiconw, red_flag.hudstatusiconh, red_flag.hudstatusiconalign ) end end ----------------------------------------------------------------------------- -- Hurts ----------------------------------------------------------------------------- hurt = trigger_ff_script:new({ team = Team.kUnassigned }) function hurt:allowed( allowed_entity ) if IsPlayer( allowed_entity ) then local player = CastToPlayer( allowed_entity ) if player:GetTeamId() == self.team then return EVENT_ALLOWED end end return EVENT_DISALLOWED end -- red lasers hurt green and vice-versa green_laser_hurt_flag = hurt:new({ team = Team.kRed }) green_laser_hurt_button = hurt:new({ team = Team.kRed }) red_laser_hurt_flag = hurt:new({ team = Team.kGreen }) red_laser_hurt_button = hurt:new({ team = Team.kGreen }) ----------------------------------------------------------------------------- -- Grates ----------------------------------------------------------------------------- base_grate_trigger = trigger_ff_script:new({ team = Team.kUnassigned, team_name = "neutral" }) function base_grate_trigger:onexplode( explosion_entity ) if IsDetpack( explosion_entity ) then local detpack = CastToDetpack( explosion_entity ) -- GetTemId() might not exist for buildables, they have their own seperate shit and it might be named differently if detpack:GetTeamId() ~= self.team then OutputEvent( self.team_name .. "_det_grate", "Kill" ) end end -- I think this is needed so grenades and other shit can blow up here. They won't fire the events, though. return EVENT_ALLOWED end red_det_grate_trigger = base_grate_trigger:new({ team = Team.kRed, team_name = "red" }) green_det_grate_trigger = base_grate_trigger:new({ team = Team.kBlue, team_name = "green" }) ----------------------------------------------------------------------------- -- Locations ----------------------------------------------------------------------------- location_greenbase = location_info:new({ text = "Inside Base", team = Team.kGreen }) location_greenwarehouse = location_info:new({ text = "Warehouse", team = Team.kGreen }) location_greenoutside = location_info:new({ text = "Outside Base", team = Team.kGreen }) location_greenflagbunker = location_info:new({ text = "Flag Bunker", team = Team.kGreen }) location_greensniper = location_info:new({ text = "Battlement", team = Team.kGreen }) location_greenbackway = location_info:new({ text = "Backway", team = Team.kGreen }) location_greenflag = location_info:new({ text = "Flag Room", team = Team.kGreen }) location_redbase = location_info:new({ text = "Inside Base", team = Team.kRed }) location_redwarehouse = location_info:new({ text = "Warehouse", team = Team.kRed }) location_redoutside = location_info:new({ text = "Outside Base", team = Team.kRed }) location_redflagbunker = location_info:new({ text = "Flag Bunker", team = Team.kRed }) location_redbattlement = location_info:new({ text = "Battlement", team = Team.kRed }) location_redbackway = location_info:new({ text = "Backway", team = Team.kRed }) location_redflagroom = location_info:new({ text = "Flag Room", team = Team.kRed }) ----------------------------------------------------------------------------- -- Spawns ----------------------------------------------------------------------------- togglespawn = info_ff_teamspawn:new({ team = Team.kUnassigned, toggledoff = false }) function toggle_allowedmethod(self, player_entity) if (IsPlayer(player_entity) == false) then return false end local player = CastToPlayer( player_entity ) local teamId = player:GetTeamId() return (teamId == self.team and self.toggledoff == false) end greenspawn_w = togglespawn:new({ team = Team.kGreen, validspawn = toggle_allowedmethod }) greenspawn_f = togglespawn:new({ team = Team.kGreen, validspawn = toggle_allowedmethod }) redspawn_w = togglespawn:new({ team = Team.kRed, validspawn = toggle_allowedmethod }) redspawn_f = togglespawn:new({ team = Team.kRed, validspawn = toggle_allowedmethod }) ----------------------------------------------------------------------------- -- Warehouse Levers ----------------------------------------------------------------------------- func_rot_button = baseclass:new({}) function func_rot_button:allowed() return true end function func_rot_button:onuse() end function func_rot_button:allowed( touch_entity ) if IsPlayer( touch_entity ) then local player = CastToPlayer( touch_entity ) return player:GetTeamId() == self.team end return EVENT_DISALLOWED end green_warehouse_lever_rot = func_rot_button:new({ team = Team.kRed }) function green_warehouse_lever_rot:OnIn() greenspawn_w.toggledoff = true self.team = Team.kGreen end function green_warehouse_lever_rot:OnOut() greenspawn_w.toggledoff = false self.team = Team.kRed end red_warehouse_lever_rot = func_rot_button:new({ team = Team.kGreen }) function red_warehouse_lever_rot:OnIn() redspawn_w.toggledoff = true self.team = Team.kRed end function red_warehouse_lever_rot:OnOut() redspawn_w.toggledoff = false self.team = Team.kGreen end ----------------------------------------------------------------------------- -- Gas Chambers ----------------------------------------------------------------------------- green_gasbutton = func_rot_button:new({ team = Team.kRed }) function green_gasbutton:allowed( touch_entity ) if IsPlayer( touch_entity ) then local player = CastToPlayer( touch_entity ) return player:GetTeamId() == self.team end return EVENT_DISALLOWED end function green_gasbutton:OnIn() greenspawn_f.toggledoff = true end function green_gasbutton:OnOut() greenspawn_f.toggledoff = false end red_gasbutton = func_rot_button:new({ team = Team.kGreen }) function red_gasbutton:allowed( touch_entity ) if IsPlayer( touch_entity ) then local player = CastToPlayer( touch_entity ) return player:GetTeamId() == self.team end return EVENT_DISALLOWED end function red_gasbutton:OnIn() redspawn_f.toggledoff = true end function red_gasbutton:OnOut() redspawn_f.toggledoff = false end Last edited by Major Lee High; 10-20-2007 at 11:11 AM. |
|
10-21-2007, 02:47 PM | #13 |
Join Date: Mar 2007
Posts Rated Helpful 0 Times
|
just use the standard input/output to enable/disable the trigger .....
hl2 has a very good I/O system, so USE IT!! |
|
10-21-2007, 10:10 PM | #14 | |
Retired Mapper
Join Date: Mar 2007
Location: Tulsa, OK
Posts Rated Helpful 1 Times
|
Quote:
But I want the player that enables it to get the kills from the hurt. |
|
|
10-23-2007, 12:06 AM | #15 |
Newb
|
Hey, just got back from a weekend away and read your message. Uh, I guess you could set a global "owner" for the hurts, default to nil, and on button press set the activator as the owner until the OnOut call, set it back to nil. Then on the OnTrigger part, set it to kill the player and award the owner points for the kill. That's really the only thing I can think of, but not sure that would fit your need?
|
|
10-23-2007, 12:41 AM | #16 |
Retired Mapper
Join Date: Mar 2007
Location: Tulsa, OK
Posts Rated Helpful 1 Times
|
The gas area will or atleast will be able to kill the whole other team over and over for a few seconds if they get stuck spawning there (and keep spawning lol), and all I really want to happen is for the player that hits the button to get kills like if they had a sentry gun killing people.
I'm not really good with the scripting stuff yet, but i would guess that I do need to pass owner onto the hurt, and then for each player getting killed, do something to let the game know who IsKiller or something. No clue how to go about doing that. Didn't think of points though, I will atleast add points for each button now too. Another question about hurts, anyway to stop them from pushing people? It kills people fine but pushing them around doesnt make sense with gas. |
|
10-23-2007, 01:12 AM | #17 |
Newb
|
I haven't really messed with hurts, other than ff_murderball_nyro... There, the hurt was at maximum damage, so it was a instant kill.
Uh, what I remember from TFC though, was on trigger_hurts you could specify a name for the logs. Such as, name it "evil gas" and when the player dies, it printed in console, "Player was killed by evil gas" or something similar. Maybe (if that value still exists) you could set it to the "owner's" name and that might trick the game into awarding the player the kills. I doubt it, but I guess you could try. Otherwise, all I can think of is the dev team giving access to modify the Damage class by commands such as SetAttacker(), then you could get the attacker and if the attacker is your trigger hurt, then change the attacker to it's owner. |
|
10-29-2007, 01:13 AM | #18 |
Retired Mapper
Join Date: Mar 2007
Location: Tulsa, OK
Posts Rated Helpful 1 Times
|
Updated OP with where I'm at on this so far.
Decided to hold my map off for another week or so to fis some problems I noticed in the full compile and add some things that might not have been welcomed after a first beta (people hate change ;P). I think I can live without trigger hurt giving kills (though I still want to attempt it in this map, and probably others) but i would really like to figure out the momentary_rot_button, because I already know i want to use a trick like that for most my maps, and different classes. It would be easy to make it a button or do some other trick to make this work, but imo holding USE to make it build (orwhatever I make it to in other maps ;P) is the main feature of it. Just making a team button or a trigger wouldnt be the same. |
|
10-29-2007, 03:49 AM | #19 |
Nade Whore
Server Owner
Beta Tester Join Date: Sep 2007
Location: Oklahoma
Class/Position: Scout/Soldier Gametype: CTF/TDM Affiliations: blunt. Moto Posts Rated Helpful 128 Times
|
Just wondering, this is for rock2, amirite?
If so, gl on your map making. I can't wait to see a rock2 remake. |
|
10-29-2007, 03:58 AM | #20 |
Retired Mapper
Join Date: Mar 2007
Location: Tulsa, OK
Posts Rated Helpful 1 Times
|
Na Ive just got a room in my map that gases.
Loved Rock2 though, hopefully someone does it. I will probably do something similar eventually, but I probably wont do any remakes. |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|