Fortress Forever

Fortress Forever (https://forums.fortress-forever.com/index.php)
-   Mapping (https://forums.fortress-forever.com/forumdisplay.php?f=13)
-   -   Some Lua/FF mapping questions (https://forums.fortress-forever.com/showthread.php?t=12197)

Geenie 10-07-2007 10:35 AM

Some Lua/FF mapping questions
 
Hi,

i have some questions about lua:

- im trying to make a trigger_ff_script that gives u ammo/armor/etc on touch
i tried playing with aardvarks lua file, but cant get it to work.

- i can't seem to get FF spawns to face the way i want them to face to, is this a bug or am i doing something wrong? i tried manually and pointing to a entity, but it always turn to the right side.

Sh4x 10-07-2007 10:46 AM

Spawns are bugged right now, the next patch will probably fix it, so dont worry about it now.

For the lua file, I can't think of any reason why copying the aardvark stuff directly into your map wouldnt work, so make sure you're doing everything correctly, its probably just a little thing you missed out.

Geenie 10-07-2007 11:14 AM

so if i turn the spawns the correct way now, then they will fix themself in the next patch?

what name do i have to give to the trigger?
Code:

-----------------------------------------------------------------------------
-- custom aardvark pack
-----------------------------------------------------------------------------
aardvarkpack = genericbackpack:new({
        health = 20,
        armor = 20,
        grenades = 400,
        bullets = 400,
        nails = 400,
        shells = 400,
        rockets = 400,
        cells = 400,
        respawntime = 6,
        model = "models/items/backpack/backpack.mdl",
        materializesound = "Item.Materialize",
        touchsound = "Backpack.Touch",
        botgoaltype = Bot.kBackPack_Ammo
})

function aardvarkpack:dropatspawn() return false end

-----------------------------------------------------------------------------
-- backpack entity setup (modified for aardvarkpack)
-----------------------------------------------------------------------------
function build_backpacks(tf)
        return healthkit:new({touchflags = tf}),
                  armorkit:new({touchflags = tf}),
                  ammobackpack:new({touchflags = tf}),
                  bigpack:new({touchflags = tf}),
                  grenadebackpack:new({touchflags = tf}),
                  aardvarkpack:new({touchflags = tf})
end

blue_healthkit, blue_armorkit, blue_ammobackpack, blue_bigpack, blue_grenadebackpack, blue_aardvarkpack = build_backpacks({AllowFlags.kOnlyPlayers,AllowFlags.kBlue})
red_healthkit, red_armorkit, red_ammobackpack, red_bigpack ,red_grenadebackpack, red_aardvarkpack = build_backpacks({AllowFlags.kOnlyPlayers,AllowFlags.kRed})
yellow_healthkit, yellow_armorkit, yellow_ammobackpack, yellow_bigpack, yellow_grenadebackpack, yellow_aardvarkpack = build_backpacks({AllowFlags.kOnlyPlayers,AllowFlags.kYellow})
green_healthkit, green_armorkit, green_ammobackpack, green_bigpack, green_grenadebackpack, green_aardvarkpack = build_backpacks({AllowFlags.kOnlyPlayers,AllowFlags.kGreen})

-----------------------------------------------------------------------------
-- aardvark resupply (bagless)
-----------------------------------------------------------------------------
aardvarkresup = trigger_ff_script:new({ team = Team.kUnassigned })

function aardvarkresup:ontouch( touch_entity )
        if IsPlayer( touch_entity ) then
                local player = CastToPlayer( touch_entity )
                if player:GetTeamId() == self.team then
                        player:AddHealth( 400 )
                        player:AddArmor( 400 )
                        player:AddAmmo( Ammo.kNails, 400 )
                        player:AddAmmo( Ammo.kShells, 400 )
                        player:AddAmmo( Ammo.kRockets, 400 )
                        player:AddAmmo( Ammo.kCells, 400 )
                end
        end
end

blue_aardvarkresup = aardvarkresup:new({ team = Team.kBlue })
red_aardvarkresup = aardvarkresup:new({ team = Team.kRed })

im not used to coding stuff D:

[P]Infidel 10-07-2007 01:56 PM

Yes, point them like you want them, they will automatically work next patch, ignore it for now. :)

You want to name your trigger_ff_script's blue_aardvarkresup and red_aardvarkresup (according to the last two lines)

Geenie 10-07-2007 05:06 PM

got it to work,

now i need a trigger hurt effect for force fields at spawns,

now aardvark has those but ofcourse i cant get em to work.

i dont have a shutdown style force field, just standard resup once, what do i need to keep and how do i get it to work?
Code:

-----------------------------------------------------------------------------
-- aardvark security
-----------------------------------------------------------------------------
red_aardvarksec = trigger_ff_script:new()
blue_aardvarksec = trigger_ff_script:new()
bluesecstatus = 1
redsecstatus = 1

function red_aardvarksec:ontouch( touch_entity )
        if IsPlayer( touch_entity ) then
                local player = CastToPlayer( touch_entity )
                if player:GetTeamId() == Team.kBlue then
                        if redsecstatus == 1 then
                                redsecstatus = 0
                                AddSchedule("aardvarksecup10red",50,aardvarksecup10red)
                                AddSchedule("aardvarksecupred",60,aardvarksecupred)
                                OpenDoor("red_aardvarkdoorhack")
                                BroadCastMessage("Red Security Deactivated for 60 Seconds")
                                BroadCastSound( "otherteam.flagstolen")
                                SpeakAll( "SD_REDDOWN" )
                        end
                end
        end
end

function blue_aardvarksec:ontouch( touch_entity )
        if IsPlayer( touch_entity ) then
                local player = CastToPlayer( touch_entity )
                if player:GetTeamId() == Team.kRed then
                        if bluesecstatus == 1 then
                                bluesecstatus = 0
                                AddSchedule("aardvarksecup10blue",50,aardvarksecup10blue)
                                AddSchedule("aardvarksecupblue",60,aardvarksecupblue)
                                OpenDoor("blue_aardvarkdoorhack")
                                BroadCastMessage("Blue Security Deactivated for 60 Seconds")
                                BroadCastSound( "otherteam.flagstolen")
                                SpeakAll( "SD_BLUEDOWN" )
                        end
                end
        end
end

function aardvarksecupred()
        redsecstatus = 1
        CloseDoor("red_aardvarkdoorhack")
        BroadCastMessage("Red Security Online")
        SpeakAll( "SD_REDUP" )
end

function aardvarksecupblue()
        bluesecstatus = 1
        CloseDoor("blue_aardvarkdoorhack")
        BroadCastMessage("Blue Security Online")
        SpeakAll( "SD_BLUEUP" )
end

function aardvarksecup10red()
        BroadCastMessage("Red Security Online in 10 Seconds")
end

function aardvarksecup10blue()
        BroadCastMessage("Blue Security Online in 10 Seconds")
end

-----------------------------------------------------------------------------
-- aardvark lasers and respawn shields
-----------------------------------------------------------------------------
KILL_KILL_KILL = trigger_ff_script:new({ team = Team.kUnassigned })
lasers_KILL_KILL_KILL = trigger_ff_script:new({ team = Team.kUnassigned })

function KILL_KILL_KILL:allowed( activator )
        local player = CastToPlayer( activator )
        if player then
                if player:GetTeamId() == self.team then
                        return EVENT_ALLOWED
                end
        end
        return EVENT_DISALLOWED
end

function lasers_KILL_KILL_KILL:allowed( activator )
        local player = CastToPlayer( activator )
        if player then
                if player:GetTeamId() == self.team then
                        if self.team == Team.kBlue then
                                if redsecstatus == 1 then
                                        return EVENT_ALLOWED
                                end
                        end
                        if self.team == Team.kRed then
                                if bluesecstatus == 1 then
                                        return EVENT_ALLOWED
                                end
                        end
                end
        end
        return EVENT_DISALLOWED
end

blue_slayer = KILL_KILL_KILL:new({ team = Team.kBlue })
red_slayer = KILL_KILL_KILL:new({ team = Team.kRed })
sec_blue_slayer = lasers_KILL_KILL_KILL:new({ team = Team.kBlue })
sec_red_slayer = lasers_KILL_KILL_KILL:new({ team = Team.kRed })


stino 10-07-2007 05:59 PM

only the kill kill kill will do:
Code:

KILL_KILL_KILL = trigger_ff_script:new({ team = Team.kUnassigned })
function KILL_KILL_KILL:allowed( activator )
        local player = CastToPlayer( activator )
        if player then
                if player:GetTeamId() == self.team then
                        return EVENT_ALLOWED
                end
        end
        return EVENT_DISALLOWED
end
blue_slayer = KILL_KILL_KILL:new({ team = Team.kBlue })
red_slayer = KILL_KILL_KILL:new({ team = Team.kRed })

so name the trigger blue_slayer and red_slayer. (i guess it has to be trigger_hurt)

Geenie 10-07-2007 06:25 PM

great that worked thx


All times are GMT. The time now is 12:42 PM.

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