Jump to content

A little help with a script :) :)


Recommended Posts

Could anyone let me know how I could develop this script? Many thanks in advance!! :)

 

Script goal - Fire target npc with weapon - npc equips hat (they can't remove it but I can) - npc plays idle for 5 seconds then resume normal behavior (still wearing hat)

 

 

Event OnEffectStart(actor akTarget, actor akCaster)
akTarget.EquipItem(HatProperty, true)

; Start Npc idle
if akTarget.PlayIdle(danceIdle)
Debug.Trace("Npc is dancing!")
else
Debug.Trace("Something went wrong")
endIf
EndEvent

 

I know very little about scripting and would appreciate some advice! <3 <3

Link to comment
Share on other sites

Ok, fire weapon, target equips hat and dances :)

 

1) Create a new magic effect with Casting Type of Fire And Forget, Effect Archetype - Script and Delivery - Contact. Attach new script on it, Paste Following inside:

Event OnEffectStart(Actor akTarget, Actor akCaster)
    akTarget.Equipitem(HatProperty, true)
    akTarget.PlayIdle(danceidle)
endEvent

2) Create a new Enchantment and add your magic effect there.

 

3) Attach your enchantment on your weapon.

 

That's all.

Link to comment
Share on other sites

Ok, fire weapon, target equips hat and dances :smile:

 

1) Create a new magic effect with Casting Type of Fire And Forget, Effect Archetype - Script and Delivery - Contact. Attach new script on it, Paste Following inside:

Event OnEffectStart(Actor akTarget, Actor akCaster)
    akTarget.Equipitem(HatProperty, true)
    akTarget.PlayIdle(danceidle)
endEvent

2) Create a new Enchantment and add your magic effect there.

 

3) Attach your enchantment on your weapon.

 

That's all.

 

Wow that's fantastic ! Thanks a lot, I'll give that a shot <3 <3

Link to comment
Share on other sites

Hi there! Well it seemed the script worked fine but it needs something extra. Been trying to figure it out for hours - no luck.

 

It works with non-hostile NPCs but with hostile npcs they only equip the hat and don't do the animation.

Scriptname HatScript extends activemagiceffect
{Equipt hat on enemy}
Armor Property NewProperty Auto Const
{Hat}
Idle Property IdleProperty Auto Const
{Plays Idle}
Event OnEffectStart(Actor akTarget, Actor akCaster)
akTarget.Equipitem(NewProperty, true)
akTarget.PlayIdle(IdleProperty)
endEvent
Any help would be much appreciated! Thanks :) :)
Link to comment
Share on other sites

If the npc is in combat I believe idle playback is disabled so as to not interfere with the combat animations. Because of course you can't be idle if you're in combat. You could force a stop combat with akTarget.StopCombatAlarm() and see if that works.

Link to comment
Share on other sites

If the npc is in combat I believe idle playback is disabled so as to not interfere with the combat animations. Because of course you can't be idle if you're in combat. You could force a stop combat with akTarget.StopCombatAlarm() and see if that works.

 

Thanks for that! :) It seemed to work on half the script but perhaps my idea is a little ambitious. I'm having multiple issues so think I'm going to have to put the idea on halt for now! ;P thanks again

Link to comment
Share on other sites

Keep going! That's the challenge of coding!

 

The guys have already got you nearly there. Now you just need to keep figuring out the little things :smile:

 

Didn't see this until now. Thanks a lot for the encouragement! Coding really is such a challenge, strangely satisfying though when the 'script compiled' message comes up and then it works like a charm in game xD

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...