Skip to content

Commit 00a56dd

Browse files
authored
Content and Scripting additions (#382)
# Description Guards now send players to jail if they down them. ## Changes - Mobs have `onPlayerDowned()` events now. - Added a wildcard option for attacking: `attack *`, `attack *mob`, `attack *player`, which selects randomly. - Scripting `Actor.SetHealth()` - Scripting `Actor.AddEventLog()` - Players being dropped is now a `PlayerDrop{}` event. - `callforhelp` command accepts a distance specifier now: `callforhelp 4:sounds the alarm` will call for help for allies within 4 coordinate rooms away (Manhattan calculated) - Guards in Frostfang now send players to jail if they defeat them. - Guards sometimes call for help if in combat - mob `go` command accepts a RoomId argument now, to semi-teleport to the room specified. ## Example: <img width="754" alt="image" src="https://github.com/user-attachments/assets/340be926-d362-476a-ac24-35179c47defe" />
1 parent 4baeb1c commit 00a56dd

35 files changed

+524
-77
lines changed

_datafiles/guides/building/scripting/FUNCTIONS_ACTORS.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ ActorObjects are the basic object that represents Users and NPCs
5454
- [ActorObject.GetMobKills(mobId int) int](#actorobjectgetmobkillsmobid-int-int)
5555
- [ActorObject.GetRaceKills(raceName string) int](#actorobjectgetracekillsracename-string-int)
5656
- [ActorObject.GetHealth() int](#actorobjectgethealth-int)
57+
- [ActorObject.SetHealth(amt int)](#actorobjectsethealthamt-int)
5758
- [ActorObject.GetHealthMax() int](#actorobjectgethealthmax-int)
5859
- [ActorObject.GetHealthPct() float](#actorobjectgethealthpct-float)
5960
- [ActorObject.GetMana() int](#actorobjectgetmana-int)
@@ -87,6 +88,7 @@ ActorObjects are the basic object that represents Users and NPCs
8788
- [ActorObject.TimerSet(name string, period string)](#actorobjecttimersetname-string-period-string)
8889
- [ActorObject.TimerExpired(name string) bool](#actorobjecttimerexpiredname-string-bool)
8990
- [ActorObject.TimerExists(name string) bool](#actorobjecttimerexistsname-string-bool)
91+
- [ActorObject.AddEventLog(category string, message string)](#actorobjectaddeventlogcategory-string-message-string)
9092

9193

9294

@@ -439,6 +441,14 @@ Returns the number of times the actor has killed a certain race of mob
439441
## [ActorObject.GetHealth() int](/internal/scripting/actor_func.go)
440442
Returns current actor health
441443

444+
## [ActorObject.SetHealth(amt int)](/internal/scripting/actor_func.go)
445+
Sets actor health to a specific amount. If this exceeds their maximum health, sets to their maximum health.
446+
447+
| Argument | Explanation |
448+
| --- | --- |
449+
| amt | number of hitpoints to set them to |
450+
451+
442452
## [ActorObject.GetHealthMax() int](/internal/scripting/actor_func.go)
443453
Returns current actor max health
444454

@@ -586,3 +596,10 @@ Returns true if the specified timer has expired or doesn't exist.
586596
Returns true if the specified timer exists.
587597
Set timers always exist until they are checked for expiration with `TimerExpired(name string)`
588598

599+
## [ActorObject.AddEventLog(category string, message string)](/internal/scripting/actor_func.go)
600+
Adds a line to the users Event Log (`history`)
601+
602+
| Argument | Explanation |
603+
| --- | --- |
604+
| category | A short single word category |
605+
| message | A single line describing the event |

_datafiles/guides/building/scripting/SCRIPTING_MOBS.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,3 +203,13 @@ NOTE: You can safely start a new path with `mob.Command('pathto 123')` before re
203203
| mob | [ActorObject](FUNCTIONS_ACTORS.md) |
204204
| room | [RoomObject](FUNCTIONS_ROOMS.md) |
205205
| eventDetails.status | `start`, `waypoint`, or `end` |
206+
207+
`onPlayerDowned()` is called when a player is downed (not killed), and this mob aggro'd on them.
208+
NOTE: If `true` is returned, will ensure this script only runs once for this type of MobId - for example, only one of the two guards in the room.
209+
210+
| Argument | Explanation |
211+
| --- | --- |
212+
| mob | [ActorObject](FUNCTIONS_ACTORS.md) |
213+
| user | [ActorObject](FUNCTIONS_ACTORS.md) |
214+
| room | [RoomObject](FUNCTIONS_ROOMS.md) |
215+

_datafiles/world/default/mobs/frostfang/10-ivar_froststeel.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ itemdropchance: 2
44
hostile: false
55
groups:
66
- frostfang-npc
7+
combatcommands:
8+
- 'callforhelp 7:guard:calls for the guards.'
79
idlecommands:
810
- 'say type <ansi fg="command">list</ansi> to see my wares'
911
- 'say If you''re looking to sell something, I may be interested... as long as it''s not too special or unique'

_datafiles/world/default/mobs/frostfang/11-brynja_snowdeal.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ itemdropchance: 2
44
hostile: false
55
groups:
66
- frostfang-npc
7+
combatcommands:
8+
- 'callforhelp 7:guard:calls for the guards.'
79
idlecommands:
810
- 'say type <ansi fg="command">list</ansi> to see my wares'
911
- 'say If you''re looking to sell something, I may be interested... as long as it''s not too special or unique'

_datafiles/world/default/mobs/frostfang/2-guard.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ itemdropchance: 2
44
hostile: false
55
maxwander: 20
66
groups:
7-
- frostfang-npc
7+
- frostfang-law
8+
combatcommands:
9+
- 'callforhelp 5:puts their fingers to their mouth and whistle loudly.'
810
activitylevel: 20
911
character:
1012
name: guard

_datafiles/world/default/mobs/frostfang/26-frostfang_citizen.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ itemdropchance: 2
44
hostile: false
55
groups:
66
- frostfang-npc
7+
combatcommands:
8+
- 'callforhelp 7:guard:calls for the guards.'
79
activitylevel: 30
810
maxwander: 5
911
idlecommands:

_datafiles/world/default/mobs/frostfang/3-captain_of_the_guard.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ itemdropchance: 2
44
hostile: false
55
maxwander: 20
66
groups:
7-
- frostfang-npc
7+
- frostfang-law
8+
combatcommands:
9+
- 'callforhelp 5:puts their fingers to their mouth and whistle loudly.'
810
idlecommands:
911
- 'emote mumbles something about the weather'
1012
- 'wander'

_datafiles/world/default/mobs/frostfang/39-elara.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ hostile: false
55
maxwander: 0
66
groups:
77
- frostfang-npc
8+
combatcommands:
9+
- 'callforhelp 7:guard:calls for the guards.'
810
activitylevel: 20
911
character:
1012
name: elara

_datafiles/world/default/mobs/frostfang/40-rodric.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ idlecommands:
77
- 'wander'
88
groups:
99
- frostfang-npc
10+
combatcommands:
11+
- 'callforhelp 7:guard:calls for the guards.'
1012
activitylevel: 20
1113
character:
1214
name: Rodric

_datafiles/world/default/mobs/frostfang/42-master_at_arms.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ hostile: false
55
maxwander: 0
66
groups:
77
- frostfang-npc
8+
combatcommands:
9+
- 'callforhelp 7:guard:calls for the guards.'
810
idlecommands:
911
- 'emote checks the edge of their blade.'
1012
- 'emote inspects the training equipment'

0 commit comments

Comments
 (0)