Adding doors
Option 1: Standard Doors
These doors can rotate or move at the set zombie_cost
TL;DR
script_model
| Key | Value |
|---|---|
| targetname | Your Door Name |
| script_angles | 0 0 0 |
| script_vector | 0 0 0 |
script_brushmodel
| Key | Value |
|---|---|
| DYNAMICPATH | ❎ True |
| targetname | Your Door Name |
| script_noteworthy | clip |
trigger_use
| Key | Value |
|---|---|
| targetname | zombie_door |
| script_flag | Your Zone Flag |
| target | Your Door Name |
| zombie_cost | 1000 |
- Make model
script_model - Set
targetname - Add KVP(s)
script_angles: rotation to be set toscript_vector: offset position to be moved- Optionally, you can add the following KVP's:
script_firefx script_fxid script_noteworthy script_transition_time Clip
- Add
script_brushmodel - Set
targetname - Add KVP
script_noteworthyand set toclip
Buy
- Add
trigger_use - Set
targetnametozombie_door - Add KVPs:
script_flag: zone activation flagtarget: targetname of models and clipzombie_cost: point costOption 2: Scripted doors
These doors can rotate AND move at the set zombie_cost
TL;DR
script_model
| Key | Value |
|---|---|
| targetname | Your Door Name |
| script_angles | 0 0 0 |
| script_vector | 0 0 0 |
script_brushmodel
| Key | Value |
|---|---|
| DYNAMICPATH | ❎ True |
| targetname | Your Door Name |
| script_noteworthy | clip |
trigger_use
| Key | Value |
|---|---|
| targetname | custom_zombie_door |
| script_flag | Your Zone Flag |
| target | Your Door Name |
| zombie_cost | 1000 |
- Open your map
.gscfile - Add the following near the top:
#using scripts\zm\_zm_score;
- In the function
main()add:
custom_doors = GetEntArray("custom_zombie_door", "targetname");
foreach(trigger in custom_doors)
{
trigger SetHintString("Hold ^3[{+activate}]^7 to open Door [Cost: " + trigger.zombie_cost + "]");
trigger SetCursorHint("HINT_NOICON");
trigger thread door_trigger_wait();
}
- Under the
main()function, outside of any other functions, add the following:
function door_trigger_wait()
{
while(true)
{
self waittill("trigger", player);
player custom_zombie_door(self);
}
}
function custom_zombie_door(trigger)
{
if(!zm_score::can_player_purchase(trigger.zombie_cost))
{
zm_utility::play_sound_at_pos("no_purchase", self.origin);
return;
}
zm_score::minus_to_player_score(trigger.zombie_cost);
zm_utility::play_sound_at_pos("purchase", self.origin);
models = GetEntArray(trigger.target, "targetname");
if(IsDefined(trigger.script_flag))
{
level flag::set(trigger.script_flag);
}
trigger delete();
foreach(model in models)
{
if(model.script_noteworthy == "clip")
{
model delete();
} else
{
target_angles = model GetAngles();
if(IsDefined(model.script_angles))
{
target_angles = model.script_angles;
}
if(IsDefined(model.script_vector))
{
target_offset = model.script_vector;
target_origin = model GetOrigin();
target_position = (target_origin[0] + target_offset[0],
target_origin[1] + target_offset[1],
target_origin[2] + target_offset[2]);
} else
{
target_position = model GetOrigin();
}
transition_time = 1.5;
if(IsDefined(model.script_transition_time))
{
transition_time = model.script_transition_time;
}
model MoveTo(target_position, transition_time, 0.5, 0.5);
model RotateTo(target_angles, transition_time, 0.5, 0.5);
}
}
}
Models
- Make model script_model
- Set
targetname - Add KVP(s)
script_angles: rotation to be set toscript_vector: offset position to be moved- Optionally, you can add the following KVP's:
script_transition_time Clip
- Add script_brushmodel
- Set
targetname - Add KVP
script_noteworthyand set toclip
Buy
- Add
trigger_use - Set
targetnametocustom_zombie_door - Add KVPs:
script_flag: zone activation flagtarget: targetname of models and clipzombie_cost: point cost