chameleon team door?


(Digm) #1

I’m working on ideas for things I’d like to incorporate into my first map…

I spent last night building a small bunker that I’d like to hold the command post/ammo. I’d like the command post to be a neutral constructable. Here’s where it gets tricky:

I’d like the door to the bunker to be a team door - but have the team change depending on which command post has been built. So, it’ll start a normal door, then turn to an Axis door when they build the post… when a allied cvops gets in and blows it, it becomes a normal door again, and when the allies build a post it becomes an allied door.

I’m assuming it’s going to be a bunch of triggers & checks. Is it possible though? I’ve never seen it in a map, and want to know if it’ll work before I start to get into it.

And if it WILL work, can someone give me an outline of what I should be doing? You don’t have to spell it out for me, just give me a path to go down :slight_smile:

Thanks!


(Erik-Ftn) #2

You might want to try this:

make three func_rotating_door in the exact same spot, make one a normal one, ona a teamdoor axis and one teamdoor allied, give them distinctive (script- and) targetnames

now script

setstate axisdoor_name default
setstate allieddoor_name invisible
setstate normaldoor_name invisible

and vice versa when appropriate

of course start with setting axis and allied doors invisible on spawn

sorry if I spelled it out :), its a habit of mine

Erik


(sock) #3

Sounds perfect to me, its certainly possible and would make a nice cool angle on the command post idea. Sync’ing the team doors scripts sections to the construction of a command post would be fairly straight forward.

Sock
:moo:


(Shallow) #4

Only thing that might happen is that the command post could be built or destroyed whilst the current door was open, thus replacing that open door with a closed door. This would gib anyone moving through the space where the closed door goes at that time, even though they thought they were walking through a normal door. I guess it’s up to you whether you think this is a bad or good thing, but it seems potentially unfair and annoying to me.

But also quite funny :slight_smile:


(Erik-Ftn) #5

hmm, you’re right about that. then add

setstate door_name underconstruction
wait 2000
setstate door_name default

on the new door appearing for each change.


(Digm) #6

Ok, I’m relatively new to scripting… so bear with me :slight_smile:

After reading some tutorials, this is what I came up with following your advice.

My problem is:

At the start of the game, the door spawns as a axis team door. And, when the command post gets built, nothing happens… any idea where I screwed up? Here’s my script… I bolded the relevant lines…

game_manager
{
spawn
{

wm_axis_respawntime 15
wm_allied_respawntime 15
wm_number_of_objectives 4
wm_set_round_timelimit 15

wm_set_defending_team 0
wm_setwinner 0

accum 1 set 0
accum 2 set 0
accum 3 set 0
accum 4 set 0

trigger game_manager normaldoor_cp
}

trigger objective1
{
accum 2 set 1
wm_announce “The Allies have escaped with the recon photos!”
trigger game_manager checkgame
}

trigger axis_object_stolen
{
accum 1 set 1
}

trigger axis_object_returned
{
accum 1 set 0
}

trigger checkgame
{
accum 2 abort_if_not_equal 1
wm_setwinner 1
wait 1500
wm_endround
}
}

escape_obj
{
spawn
{
}
death
{
trigger game_manager objective1
}
}

// ================================================
// ============ NEUTRAL COMMAND POST ==============
// ================================================
// FROM GOldRush Thx SD!!! prefab by seven 2003

allied_compost_built
{
spawn
{
wait 400
trigger allied_compost_built setup

  constructible_class 2
  [b]trigger game_manager allieddoor_cp[/b]

}

trigger setup
{
setchargetimefactor 1 soldier 1
setchargetimefactor 1 lieutenant 1
setchargetimefactor 1 medic 1
setchargetimefactor 1 engineer 1
setchargetimefactor 1 covertops 1
sethqstatus 1 0
}

buildstart final
{
setstate allied_compost_built_model underconstruction
setstate neutral_compost_closed_clip invisible
setstate neutral_compost_closed_model invisible
}

built final
{
setstate allied_compost_built_model default
setstate neutral_compost_closed_clip invisible
setstate neutral_compost_closed_model invisible

  trigger allied_compost_built_model enable_allied_features

  enablespeaker allies_compost_sound

}

decayed final
{
setstate allied_compost_built_model invisible
setstate neutral_compost_closed_clip default
setstate neutral_compost_closed_model default
}

death
{
setstate allied_compost_built_model invisible
setstate neutral_compost_closed_clip default
setstate neutral_compost_closed_model default

  trigger allied_compost_built_model disable_allied_features

  disablespeaker allies_compost_sound
  [b]trigger game_manager normaldoor_cp[/b]

}
}

allied_compost_built_model
{
spawn
{
wait 400
setstate allied_compost_built_model invisible
}

trigger enable_allied_features
{
setchargetimefactor 1 soldier 0.75
setchargetimefactor 1 lieutenant 0.75
setchargetimefactor 1 medic 0.75
setchargetimefactor 1 engineer 0.75
setchargetimefactor 1 covertops 0.75
sethqstatus 1 1

  wm_announce	"Allied Command Post constructed. Charge speed increased!"

  // *----------------------------------- vo ------------------------------------------*
  wm_teamvoiceannounce 0 "axis_hq_compost_constructed_allies"

  wm_teamvoiceannounce 1 "allies_hq_compost_constructed"

  wm_removeteamvoiceannounce 1 "allies_hq_compost_construct"
  // *---------------------------------------------------------------------------------*

  wm_objective_status 3 0 2
  wm_objective_status 3 1 1

}

trigger disable_allied_features
{
setchargetimefactor 1 soldier 1
setchargetimefactor 1 lieutenant 1
setchargetimefactor 1 medic 1
setchargetimefactor 1 engineer 1
setchargetimefactor 1 covertops 1
sethqstatus 1 0

  wm_announce	"Axis team has destroyed the Allied Command Post!"

  // *----------------------------------- vo ------------------------------------------*
  wm_addteamvoiceannounce 0 "axis_hq_compost_construct"

  wm_addteamvoiceannounce 1 "allies_hq_compost_construct"

  wm_teamvoiceannounce 0 "axis_hq_compost_construct"

  wm_teamvoiceannounce 1 "allies_hq_compost_damaged"
  // *---------------------------------------------------------------------------------*

  wm_objective_status 3 0 0
  wm_objective_status 3 1 0

}
}

axis_compost_built
{
spawn
{
wait 400
trigger axis_compost_built setup

  constructible_class 2
  [b]trigger game_manager axisdoor_cp[/b]

}

trigger setup
{
setchargetimefactor 0 soldier 1
setchargetimefactor 0 lieutenant 1
setchargetimefactor 0 medic 1
setchargetimefactor 0 engineer 1
setchargetimefactor 0 covertops 1
sethqstatus 0 0
}

buildstart final
{
setstate axis_compost_built_model underconstruction
setstate neutral_compost_closed_clip invisible
setstate neutral_compost_closed_model invisible
}

built final
{
setstate axis_compost_built_model default
setstate neutral_compost_closed_clip invisible
setstate neutral_compost_closed_model invisible

  trigger axis_compost_built_model enable_axis_features

  enablespeaker axis_compost_sound

}

decayed final
{
setstate axis_compost_built_model invisible
setstate neutral_compost_closed_clip default
setstate neutral_compost_closed_model default
}

death
{
setstate axis_compost_built_model invisible
setstate neutral_compost_closed_clip default
setstate neutral_compost_closed_model default

  trigger axis_compost_built_model disable_axis_features

  disablespeaker axis_compost_sound
  [b]trigger game_manager normaldoor_cp[/b]

}
}

axis_compost_built_model
{
spawn
{
wait 400
setstate axis_compost_built_model invisible
}

trigger enable_axis_features
{
setchargetimefactor 0 soldier 0.75
setchargetimefactor 0 lieutenant 0.75
setchargetimefactor 0 medic 0.75
setchargetimefactor 0 engineer 0.75
setchargetimefactor 0 covertops 0.75
sethqstatus 0 1

  wm_announce	"Axis Command Post constructed. Charge speed increased!"

  // *----------------------------------- vo ------------------------------------------*
  wm_teamvoiceannounce 0 "axis_hq_compost_constructed"

  wm_teamvoiceannounce 1 "allies_hq_compost_constructed_axis"

  wm_removeteamvoiceannounce 0 "axis_hq_compost_construct"
  // *---------------------------------------------------------------------------------*

  wm_objective_status 4 0 1
  wm_objective_status 4 1 2

}

trigger disable_axis_features
{
setchargetimefactor 0 soldier 1
setchargetimefactor 0 lieutenant 1
setchargetimefactor 0 medic 1
setchargetimefactor 0 engineer 1
setchargetimefactor 0 covertops 1
sethqstatus 0 0

  wm_announce	"Allied team has destroyed the Axis Command Post!"

  // *----------------------------------- vo ------------------------------------------*
  wm_addteamvoiceannounce 0 "axis_hq_compost_construct"

  wm_addteamvoiceannounce 1 "allies_hq_compost_construct"

  wm_teamvoiceannounce 0 "axis_hq_compost_damaged"

  wm_teamvoiceannounce 1 "allies_hq_compost_construct"
  // *---------------------------------------------------------------------------------*

  wm_objective_status 4 0 0
  wm_objective_status 4 1 0

}
}

[b]allieddoor_cp // make allied door team only
{
spawn
{
wait 200
setstate axisdoor invisible
setstate allieddoor default
setstate normaldoor invisible
}
death
{
trigger game_manager normaldoor_cp
}
}

axisdoor_cp // make axis door team only
{
spawn
{
wait 200
setstate axisdoor default
setstate allieddoor invisible
setstate normaldoor invisible
}
death
{
trigger game_manager normaldoor_cp
}
}

normaldoor_cp

{
spawn
{
wait 200
setstate axisdoor invisible
setstate allieddoor invisible
setstate normaldoor default
}
death
{
}
}[/b]

boxes_obj
{
spawn
{
wait 200
constructible_class 3
}
death
{
wm_announce “The Allies have blown up the Axis ammo depot!”
}
}


(Erik-Ftn) #7

some entities have scriptnames

that scriptname is a routine-name in the script

in that routine there are functions

spawn is a function that auto-executes when that entity spawns

within a function you can trigger other functions in other routines with:
trigger routine_name function_name

game_manager is a routine just like every other routine, it just rests in the script_multiplayer entity and serves like… a game manager routine.

move your desired functionality from the spawn functions in your script into trigger functions within your routines and trigger them by

trigger routine_name function_name

a trigger function looks like this

trigger a_name
{
 command1
 command2
 command3
}

and rests inside a routine, a routine looks like this

routine_name
{
 spawn
 {
  command1
  command2
  command3
 }
 
 trigger name_B
 {
  command1
  command2
  command3
 }
}

(sock) #8

Maybe this will help: http://www.planetquake.com/simland/ldr1_1/samplemap04e1.html

When I get some time I will fill in the explaination. Have a look at the sample map/script first.

Sock
:moo:


(Digm) #9

Maybe this will help

Ah! You know when things just become clear in your mind and a confusing topic suddenly makes sense? I think I just had one of those by looking at that. It’s bizarre since I haven’t even had my morning coffee yet so I’m still comatose :stuck_out_tongue:

All this time I’ve understood ‘trigger’ to be a command (when using them in a script). So, I was using “trigger normaldoor_cp” to mean “run this defined script”. Now I see that “trigger normaldoor_cp” itself is the definition (excuse my misnomers).

I’ll edit and post back if it works :slight_smile:

thanks!


(Digm) #10

IT WORKS!

Ahhhhh man jumping over this hurdle feels damn good… especially since I’ve only been mapping for 2 weeks and I spent almost that long trying to figure it out… it feels better than sex!

Ok maybe not that good… but you know what I mean :stuck_out_tongue:

Thanks for all your help everyone!