Skip to content

Commit 794a494

Browse files
add more example scripts
1 parent a65f464 commit 794a494

6 files changed

Lines changed: 189 additions & 0 deletions

File tree

Code/Examples/BreachScript.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
namespace SER.Code.Examples;
2+
3+
public class BreachScript : Example
4+
{
5+
public override string Name => "breach";
6+
7+
public override string Content =>
8+
"""
9+
!-- CustomCommand breach
10+
11+
Cassie jingle "Containment breach detected . All heavy containment doors locked ." ""
12+
13+
CloseDoor HeavyContainment
14+
LockDoor HeavyContainment 30s
15+
16+
Wait 30s
17+
18+
Cassie jingle "Lockdown lifted ." ""
19+
UnlockDoor HeavyContainment
20+
""";
21+
}

Code/Examples/GnomingTimeScript.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
namespace SER.Code.Examples;
2+
3+
public class GnomingTimeScript : Example
4+
{
5+
public override string Name => "gnomingTime";
6+
7+
public override string Content =>
8+
"""
9+
!-- OnEvent Death
10+
11+
if {VarExists @evAttacker} is false
12+
stop
13+
end
14+
15+
@plr = @evAttacker
16+
17+
# lower scale by .1 when killing someone
18+
SetSize @plr ({@plr scaleX} - .1) ({@plr scaleY} - .1) ({@plr scaleZ} - .1)
19+
Hint @plr 5s "KILLED PLAYER - IT'S GNOMING TIME!"
20+
21+
Wait 15s
22+
23+
# return them to normal
24+
SetSize @plr ({@plr scaleX} + .1) ({@plr scaleY} + .1) ({@plr scaleZ} + .1)
25+
Hint @plr 5s "Gnoming potential depleted :("
26+
""";
27+
}

Code/Examples/HotPotatoScript.cs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
namespace SER.Code.Examples;
2+
3+
public class HotPotatoScript : Example
4+
{
5+
public override string Name => "hotPotato";
6+
7+
public override string Content =>
8+
"""
9+
!-- OnEvent RoundStarted
10+
11+
forever
12+
Wait 1m
13+
14+
# Get a random player from the alive players
15+
@potatoCarrier = LimitPlayers @alivePlayers 1
16+
17+
Hint @potatoCarrier 3s "YOU HAVE THE HOT POTATO! DROP IT OR DIE!"
18+
GiveItem @potatoCarrier GunA7
19+
20+
Wait 3s
21+
22+
# Check if they still have the item (GunA7) in their inventory
23+
&inv = {@potatoCarrier inventory}
24+
over &inv
25+
with *item
26+
27+
if {ItemInfo *item type} isnt "GunA7"
28+
continue
29+
end
30+
31+
Explode @potatoCarrier
32+
Broadcast @all 5s "{@potatoCarrier name} failed the Hot Potato!"
33+
stop
34+
end
35+
36+
Broadcast @all 5s "The Hot Potato has been neutralized... for now."
37+
end
38+
""";
39+
}

Code/Examples/KillStreakScript.cs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
namespace SER.Code.Examples;
2+
3+
public class KillStreakScript : Example
4+
{
5+
public override string Name => "killStreak";
6+
7+
public override string Content =>
8+
"""
9+
!-- OnEvent Death
10+
11+
if {VarExists @evAttacker} is true
12+
# increment killer's streak
13+
if {HasPlayerData @evAttacker "streak"}
14+
$new = ({GetPlayerData @evAttacker "streak"} + 1)
15+
else
16+
$new = 1
17+
end
18+
19+
# save the new kill streak
20+
SetPlayerData @evAttacker "streak" $new
21+
22+
# announce milestone
23+
if $new is 5
24+
Broadcast @all 5s "{@evAttacker name} is on a KILLING SPREE (5 Kills)!"
25+
elif $new is 10
26+
Broadcast @all 5s "{@evAttacker name} is UNSTOPPABLE (10 Kills)!"
27+
end
28+
end
29+
30+
if {VarExists @evPlayer} is true
31+
# reset the victim's streak
32+
SetPlayerData @evPlayer "streak" 0
33+
end
34+
""";
35+
}

Code/Examples/PinataLootScript.cs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
namespace SER.Code.Examples;
2+
3+
public class PinataLootScript : Example
4+
{
5+
public override string Name => "pinataLoot";
6+
7+
public override string Content =>
8+
"""
9+
!-- OnEvent Hurt
10+
11+
# Only trigger if the victim exists
12+
if {VarExists @evPlayer} is false
13+
stop
14+
end
15+
16+
# Only trigger if the victim is SCP-173
17+
if {@evPlayer role} isnt "Scp173"
18+
stop
19+
end
20+
21+
# Trigger only with 25% chance
22+
if {Chance 25%} is false
23+
stop
24+
end
25+
26+
# 80% to get pills, 20% to get medkit
27+
if {Chance 80%} is true
28+
*pickup = CreatePickup Painkillers
29+
else
30+
*pickup = CreatePickup Medkit
31+
end
32+
33+
SpawnPickupPlayer *pickup @evPlayer
34+
35+
if {VarExists @evAttacker} is true
36+
Hint @evAttacker 3s "You hit the piñata!"
37+
end
38+
""";
39+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using JetBrains.Annotations;
2+
3+
namespace SER.Code.Examples;
4+
5+
[UsedImplicitly]
6+
public class SurfaceSmiteScript : Example
7+
{
8+
public override string Name => "surfaceSmite";
9+
10+
public override string Content =>
11+
"""
12+
!-- CustomCommand surfacesmite
13+
-- availableFor RemoteAdmin
14+
-- description "Kills a random player currently in the Surface Zone."
15+
16+
# 1. Get all players on the surface and limit the selection to 1 random person.
17+
@target = LimitPlayers @surfacePlayers 1
18+
19+
# 2. Check if anyone was actually found to avoid a runtime error.
20+
if {AmountOf @target} > 0
21+
# 3. Execute the kill with a custom reason.
22+
Kill @target "The surface is no longer safe."
23+
Broadcast @sender 5s "Eliminated {@target nickname} from the surface."
24+
else
25+
Broadcast @sender 5s "No players found in the Surface Zone."
26+
end
27+
""";
28+
}

0 commit comments

Comments
 (0)