scripting for boat trouble :(


(BroQ) #1

I’m working on a new map were one of the objectifes is to capture a boat en drive it to a certain location. But now when I’am making a test of how to work with the boat and making it move there accure some problems :frowning:
first of all, my boat wont move when an allied person is near ( a spawn flag has been set for allied), it is possible to destoy the boat but NOT to repair it. I wrote the following code, maybe someone could look for my faults…


game_manager
{
}
//::::::::::Boat::Stuff::::::::::

boat_disabler
{
    trigger run
    {
        trigger boatbase boat_disable
    }
}

boat_enabler
{
    trigger run
    {
        trigger boatbase boat_enable
    }
}

trigger boat_enable
{
    trigger self stuck_check
    accum 1 abort_if_bitset 3 // stuck check

    accum 4 set 0 // reset stop counter
    accum 1 bitreset 8 // reset stop check
    accum 1 abort_if_bitset 2 // already following spline
    accum 5 abort_if_not_equal 0// are we not in a script lockout?
    accum 1 abort_if_bitset 7 // death check

    // Any just started moving stuff goes here

    trigger self script_lockout

    startanimation 55 10 15 nolerp norandom
    wait 666
    startanimation 5 40 15 nolerp norandom
    wait 500
    trigger self tracks_forward
    trigger self script_lockout_stop
    trigger self move
}

trigger boat_disable
{
    accum 4 inc 1 // up the stop counter
    accum 4 abort_if_less_than 4

    accum 1 bitset 8 // set stop check

    trigger self deathcheck
}

trigger move_check
{
    trigger self stuck_check
    accum 1 abort_if_bitset 3

    trigger self dispatch
}

trigger move
{
    trigger self move_check
    wait 500
    trigger self move
}

trigger dispatch
{
    accum 3 trigger_if_equal 0 boatbase run_0
    accum 3 trigger_if_equal 1 boatbase run_1
    accum 3 trigger_if_equal 2 boatbase run_2
    accum 3 trigger_if_equal 3 boatbase run_3
    accum 3 trigger_if_equal 4 boatbase run_4
}

trigger run_0
{
    accum 1 bitset 2
    followspline 0 spln2 50 wait length 32
    accum 1 bitreset 2
    trigger self run_continue
}

trigger run_1
{
    accum 1 bitset 2
    followspline 0 spln3 50 wait length 32
    accum 1 bitreset 2
    trigger self run_continue
}

trigger run_2
{
    accum 1 bitset 2
    followspline 0 spln4 50 wait length 32
    accum 1 bitreset 2
    trigger self run_continue
}

trigger run_3
{
    accum 1 bitset 2
    followspline 0 spln5 50 wait length 32
    accum 1 bitreset 2
    trigger self run_continue
}

trigger run_4
{
    accum 1 bitset 2
    followspline 0 spln6 50 wait length 32
    accum 1 bitreset 2
    trigger self run_continue
}

trigger run_incpos
{
    accum 3 inc 1
}

trigger run_continue
{
    trigger self run_incpos
    trigger self deathcheck
    trigger self stopcheck
    trigger self move
}
trigger stuck_check
{
    accum 1 bitreset 3

    trigger self stuck_check_scriptlockout
    trigger self stuck_check_finished
}

trigger stuck_check_finished
{
    accum 3 abort_if_less_than 134
    accum 1 bitset 3
}

trigger stuck_check_scriptlockout
{
    accum 5 abort_if_equal 0
    accum 1 bitset 3
}

trigger stopcheck_setup
{
    accum 1 bitset 6
    accum 1 abort_if_bitset 8
    trigger self stuck_check
    accum 1 abort_if_bitset 3
    accum 1 bitreset 6
}

trigger stopcheck
{
    trigger self stopcheck_setup
    accum 1 abort_if_not_bitset 6
    trigger self script_lockout

    // Any just stopped moving stuff goes here
    startanimation 45 10 15 nolerp norandom
    wait 666
    startanimation 0 1 15 nolerp norandom
    wait 900

    trigger self script_lockout_stop
    resetscript
}

trigger script_lockout
{
    accum 5 inc 1
}

trigger script_lockout_stop
{
    accum 5 inc -1
}

death
{
    accum 1 bitset 7
}

trigger deathcheck
{
    accum 1 abort_if_not_bitset 7
    accum 1 abort_if_bitset 9
    accum 1 abort_if_bitset 2
    accum 5 abort_if_not_equal 0

    accum 1 bitset 9

    alertentity boat_kill

    trigger self script_lockout
    trigger self tracks_stop
    startanimation 45 10 15 nolerp norandom
    wait 666
    startanimation 0 1 15 nolerp norandom
    trigger self script_lockout_stop
    resetscript
}

boat_construct
{
    spawn
    {
        wait 400
        constructible_class 2
    }

    built final
    {
        alertentity boatbase
    }

    trigger final_pos
    {
        constructible_constructxpbonus 3
        constructible_destructxpbonus 3
    }
} 


}

there are no errors when starting up but in game only the destroying goes fine, but even that goes with every weapon.

the boat it self is called “boatbase” and is a brush. anyone has an idea?


(grizzlybear) #2

use /g_scriptdebug 1 (in game)
to help see where the script is failing
:wink:


(chavo_one) #3

Ignoring the syntax errors you have in this bit of code, you also have failed to create a trigger_objective_info and trigger_multiple that moves with the boat. Refer to the LDR concerning these entities to see how they are integral to having a moving objective.

Also, you typically attach the TOI and trigger_multiple to a model’s tags, however since you aren’t using a model this won’t be possible. In your case, each trigger will have to have it’s own run functions. This would increase the complexity of your script.

You may want to look into using olaer069’s dummy tag model.
http://www.splashdamage.com/forums/viewtopic.php?t=5397


(Moonkey) #4

All those triggers you have aren’t related to any entity

Think you forgot


boatbase
{

.
.
.

}