What's new

How do I correctly use "randomskill"?

penswen

New Member
Joined
Dec 22, 2016
Messages
14
I'm trying to make my first mob. I want it to use a random skill at an interval, but I can't seem to figure out the proper format from the manual. Any help would be appreciated, thanks!
Code:
CorruptMage:
  Type: ZOMBIE
  Display: '&cCorrupt Mage'
  Health: 50
  Damage: 4
  Armor: 2
  Options:
    Despawn: true
    FollowRange: 25
    MovementSpeed: 0.25
    PrevenOtherDrops: true
    PreventRandomEquipment: true
  Modules:
    ThreatTable: true
    ImmunityTable: true
  AIGoalSelectors:
  - 0 clear
  - 1 movetowardstarget
  - 2 breakdoors
  - 3 float
  - 4 randomstroll
  AITargetSelectors:
  - 0 players
  - 1 golems
  - 2 villagers
  Drops:
  - exp 20 1
  - book 3 0.75
  DropsPerLevel:
  - exp 10 1
  - book 3 0.75
  DamageModifiers:
  - MAGIC -1
  - PROJECTILE 0.75
  - LIGHTNING 0
  Equipment:
  - stick:0
  - leather_chestplate:3
  - leather_helmet:4
  LevelModifiers:
  - Health: 5
  - Damage: 2
  - Armor: 2
  - MovementSpeed: 0.01
  Skills:
  - randomskill:
{
skills=
shootfireball:{y=1;v=5},
lightning:{d=2;cd=10,
shootskull:{y=1;v=4},
} @target ~onTimer: 40
 

Rickyling

Community Manager
Community Manager
Supporter
Moderator
Quality Assurance
Joined
Jul 24, 2015
Messages
672
I'm trying to make my first mob. I want it to use a random skill at an interval, but I can't seem to figure out the proper format from the manual. Any help would be appreciated, thanks!
Code:
CorruptMage:
  Type: ZOMBIE
  Display: '&cCorrupt Mage'
  Health: 50
  Damage: 4
  Armor: 2
  Options:
    Despawn: true
    FollowRange: 25
    MovementSpeed: 0.25
    PrevenOtherDrops: true
    PreventRandomEquipment: true
  Modules:
    ThreatTable: true
    ImmunityTable: true
  AIGoalSelectors:
  - 0 clear
  - 1 movetowardstarget
  - 2 breakdoors
  - 3 float
  - 4 randomstroll
  AITargetSelectors:
  - 0 players
  - 1 golems
  - 2 villagers
  Drops:
  - exp 20 1
  - book 3 0.75
  DropsPerLevel:
  - exp 10 1
  - book 3 0.75
  DamageModifiers:
  - MAGIC -1
  - PROJECTILE 0.75
  - LIGHTNING 0
  Equipment:
  - stick:0
  - leather_chestplate:3
  - leather_helmet:4
  LevelModifiers:
  - Health: 5
  - Damage: 2
  - Armor: 2
  - MovementSpeed: 0.01
  Skills:
  - randomskill:
{
skills=
shootfireball:{y=1;v=5},
lightning:{d=2;cd=10,
shootskull:{y=1;v=4},
} @target ~onTimer: 40
Ah, that entry definitely needs a bit of work done to it.
So the skills it refers to are these.
For your skill to work, you'll need to create three subskills within the skills folder.
Code:
#Skill.yml
Fireball:
  Skills:
  - shootfireball:{y=1;v=5}

Lightning:
  Skills:
  - lightning:{d=2;cd=10}
# For a 10 second cooldown you could also do this
Lightning:
  Cooldown: 10
  Skills:
  - lightning:{d=2;}

Skull:
  Skills:
  - shootskull:{y=1;v=4}
Then, you can use them in randomskill by doing this:
Code:
  Skills:
  - randomskill{skills=Fireball,Lightning,Skull} @target ~onTimer:40

Hopefully that helps you with your mob.
 

jaylawl

Developer
Developer
Community Manager
Premium Supporter
Supporter
Quality Assurance
Joined
Sep 16, 2015
Messages
1,822
As Ricky said, randomskill{} entries can only point to other meta skills.

however the formatting you used was fine, you can always do it like this:
Code:
- randomskill
    {s=
    skill1,
    skill2,
    skill3,
    }

or the way ricky did
 

penswen

New Member
Joined
Dec 22, 2016
Messages
14
Ah, that entry definitely needs a bit of work done to it.
So the skills it refers to are these.
For your skill to work, you'll need to create three subskills within the skills folder.
Code:
#Skill.yml
Fireball:
  Skills:
  - shootfireball:{y=1;v=5}

Lightning:
  Skills:
  - lightning:{d=2;cd=10}
# For a 10 second cooldown you could also do this
Lightning:
  Cooldown: 10
  Skills:
  - lightning:{d=2;}

Skull:
  Skills:
  - shootskull:{y=1;v=4}
Then, you can use them in randomskill by doing this:
Code:
  Skills:
  - randomskill{skills=Fireball,Lightning,Skull} @target ~onTimer:40

Hopefully that helps you with your mob.
As Ricky said, randomskill{} entries can only point to other meta skills.

however the formatting you used was fine, you can always do it like this:
Code:
- randomskill
    {s=
    skill1,
    skill2,
    skill3,
    }

or the way ricky did
Thanks for your help and quick responses. Could you also help me with the targeting, please? The mob doesn't seem to target players or anything and therefore can't use the skills.
 

Rickyling

Community Manager
Community Manager
Supporter
Moderator
Quality Assurance
Joined
Jul 24, 2015
Messages
672
Thanks for your help and quick responses. Could you also help me with the targeting, please? The mob doesn't seem to target players or anything and therefore can't use the skills.
You're using threattables right? They're weird in that they won't have a target until a player attacks them. Have you tried hitting the mob on question?
 

penswen

New Member
Joined
Dec 22, 2016
Messages
14
Can you post your new config? For the mob.
Code:
CorruptMage:
  Type: ZOMBIE_VILLAGER
  Display: '&cCorrupt Mage'
  Health: 50
  Damage: 4
  Armor: 2
  Options:
    Despawn: true
    FollowRange: 25
    MovementSpeed: 0.25
    PrevenOtherDrops: true
    PreventRandomEquipment: true
  Modules:
    ThreatTable: true
    ImmunityTable: true
  AIGoalSelectors:
  - 0 clear
  - 1 movetowardstarget
  - 2 opendoors
  - 3 float
  - 4 randomstroll
  AITargetSelectors:
  - 0 players
  - 1 attacker
  - 2 golems
  - 3 villagers
  Drops:
  - exp 20 1
  - book 3 0.75
  DropsPerLevel:
  - exp 10 1
  - book 3 0.75
  DamageModifiers:
  - MAGIC -1
  - PROJECTILE 0.75
  - LIGHTNING 0
  Equipment:
  - stick:0
  - leather_chestplate:3
  - leather_helmet:4
  LevelModifiers:
  - Health: 5
  - Damage: 2
  - Armor: 2
  - MovementSpeed: 0.01
  Skills:
  - randomskill{skills=MageFireball,MageLightning,MageSkull} ~onTimer:5
 

Rickyling

Community Manager
Community Manager
Supporter
Moderator
Quality Assurance
Joined
Jul 24, 2015
Messages
672
Code:
CorruptMage:
  Type: ZOMBIE_VILLAGER
  Display: '&cCorrupt Mage'
  Health: 50
  Damage: 4
  Armor: 2
  Options:
    Despawn: true
    FollowRange: 25
    MovementSpeed: 0.25
    PrevenOtherDrops: true
    PreventRandomEquipment: true
  Modules:
    ThreatTable: true
    ImmunityTable: true
  AIGoalSelectors:
  - 0 clear
  - 1 movetowardstarget
  - 2 opendoors
  - 3 float
  - 4 randomstroll
  AITargetSelectors:
  - 0 players
  - 1 attacker
  - 2 golems
  - 3 villagers
  Drops:
  - exp 20 1
  - book 3 0.75
  DropsPerLevel:
  - exp 10 1
  - book 3 0.75
  DamageModifiers:
  - MAGIC -1
  - PROJECTILE 0.75
  - LIGHTNING 0
  Equipment:
  - stick:0
  - leather_chestplate:3
  - leather_helmet:4
  LevelModifiers:
  - Health: 5
  - Damage: 2
  - Armor: 2
  - MovementSpeed: 0.01
  Skills:
  - randomskill{skills=MageFireball,MageLightning,MageSkull} ~onTimer:5
You haven't specified a target, try adding @target to the skill.
 

Rickyling

Community Manager
Community Manager
Supporter
Moderator
Quality Assurance
Joined
Jul 24, 2015
Messages
672
Code:
 - randomskill{skills=MageFireball,MageLightning,MageSkull} @target ~onTimer:5
?
That should work unless you forgot to rename the skills or something like that.
 

penswen

New Member
Joined
Dec 22, 2016
Messages
14
Code:
 - randomskill{skills=MageFireball,MageLightning,MageSkull} @target ~onTimer:5
?
That should work unless you forgot to rename the skills or something like that.
I'm not sure if there's an issue with the skills, but the mob still does not target players.
 

penswen

New Member
Joined
Dec 22, 2016
Messages
14
I tweaked some things and got it to work as intended, thank you for you help!
 

zDrakon

Well-Known Member
Supporter
Quality Assurance
Joined
Jul 31, 2015
Messages
1,044
You're using threattables right? They're weird in that they won't have a target until a player attacks them. Have you tried hitting the mob on question?
Unfortunately I think this was intended. The only way to fix is to use threat mechanic with a=# to @NearestPlayer :p ~onSpawn
 
Top