Professions for Taterzens powered by Scarpet lang.
- Install fabric-carpet and taterzens mods.
-
- download the script professions you want and put them in
world/scripts
- use
/carpet scriptsAppStore samolego/TaterzenScarpetProfessions/contents/scripts
, followed by/script download <script to install>
- download the script professions you want and put them in
- Run the server.
- Make sure the script is loaded (
/script load <script name>
). (To autoload the scripts, use/carpet setDefault scriptsAutoload true
) - Give taterzen the
taterzens:scarpet_profession
(/npc edit professions add taterzens:scarpet_profession
). - Set the scarpet traits if needed (
/profession scarpetTraits add <trait name>
). - Enjoy and modify scripts to your needs.
Feel free to fork the repo and add any scripts for taterzens!
Let's assume you have two taterzens; foo
and bar
. bar
can trade use items using merchant
script and foo
prints the picked up item name with printitem.sc
(both respond to __on_taterzen_tries_pickup
event).
Since a taterzen can only have 1 scarpet_profession
, you can't distinguish whether an event was triggered by a taterzen that should
respond to it or not - e.g. when bar
picks up an item
- The
__on_taterzen_tries_pickup
is triggered. - Both event listeners (
merchant.sc
andprintitem.sc
) get called.
How can we execute only the merchant.sc
event on bar
?
Here's where traits come in place. In your script, check if taterzen has an e.g. merchant
trait.
If it's not present, just use return()
.
if( (traits ~ 'merchant' == null),
return(); // 'merchant' trait not present
);
See github source page.
All events start with __on_<event name>
.
You can also use the events below to add them in IDEA highlighting.
__on_taterzen_tries_pickup(taterzen, traits, item) ->
__on_taterzen_interacted(taterzen, traits, item) ->
__on_taterzen_is_attacked(taterzen, traits, attacker) ->
__on_taterzen_movement_ticks(taterzen, traits) ->
__on_taterzen_removed(taterzen, traits) ->
__on_taterzen_nbt_loaded(taterzen, traits, nbt) ->
__on_taterzen_nbt_saved(taterzen, traits, nbt) ->
__on_taterzen_movement_set(taterzen, traits, movement_type) ->
__on_taterzen_taterzen_behaviour_set(taterzen, traits, behaviour_type) ->
__on_taterzen_tries_ranged_attack(taterzen, traits, target_entity) ->
__on_taterzen_tries_melee_attack(taterzen, traits, target_entity) ->
__on_taterzen_approached_by(taterzen, traits, player_list) ->