Jump to content

Photo

Help with a script

help script papyrus

  • Please log in to reply
6 replies to this topic

#1
Retton

Retton

    Stranger

  • Members
  • Pip
  • 3 posts

Hi! I've recently found and edited a script, which should place a shade upon Targets death. The problem is that it places two shades instead of one. I think that the problem may be related to placeatme, but im not sure.

 

Scriptname DrainShadeSCRIPT extends ActiveMagicEffect  


ACTORBASE PROPERTY necroLord AUTO
EXPLOSION PROPERTY necroExplosion AUTO


; //////////
; //ASH PILE VARIABLES
; //////////
float property fDelay = 0.75 auto
{time to wait before Spawning Ash Pile}
float property fDelayEnd = 1.75 auto
{time to wait before Removing Base Actor}
float property ShaderDuration = 0.00 auto
{Duration of Effect Shader.}
Activator property pDefaultAshPile1 auto
{The object we use as a pile.}
Bool property bSetAlphaZero = True auto
{The Effect Shader we want.}
FormList Property pDisintegrationMainImmunityList auto
{If the target is in this list, they will not be disintegrated.}


race VictimRace
ACTOR victim
bool TargetIsImmune = True


EVENT onEffectStart(Actor akTarget, Actor akCaster)
victim = akTarget


endEVENT


EVENT onDying(ACTOR akkiller)
victim.placeAtMe(necroExplosion)
createAshPile()
utility.wait(0.1)
victim.placeactoratme(necrolord, 1)


endEVENT


FUNCTION createAshPile()


; //check to see if the target is in the immunity list
IF(pDisintegrationMainImmunityList == none)
TargetIsImmune = False
ELSE
ActorBase VictimBase = victim.GetBaseObject() as ActorBase
VictimRace = VictimBase.GetRace()


IF(pDisintegrationMainImmunityList.hasform(VictimRace) || pDisintegrationMainImmunityList.hasform(VictimBase))
TargetIsImmune = True
ELSE
TargetIsImmune = False
ENDIF
ENDIF


; //if the target is not immune, disintegrate them
IF(TargetIsImmune == False)
;  debug.trace("victim just died")




victim.kill(game.getPlayer())
victim.SetCriticalStage(victim.CritStage_DisintegrateStart)


victim.SetAlpha (0.0,True)


; //attach the ash pile
victim.AttachAshPile(pDefaultAshPile1)


utility.wait(fDelayEnd)
IF(bSetAlphaZero == True)
victim.SetAlpha (0.0,True)
ENDIF
victim.SetCriticalStage(victim.CritStage_DisintegrateEnd)
ENDIF


endFUNCTION

 

 


#2
maxarturo

maxarturo

    Faithful poster

  • Members
  • PipPipPipPip
  • 1,841 posts
First of all you are not playing a "Shader" but placing an explosion.
Second you have 2 different explosions and only 1 'Explosion Property'.
If you want just 1 explosion, then remove 1 from the script.
 
* If (necrolord, 1) is an explosion.
 
* Some (few) explosions by nature play twice, Bang... BANG !.
 
victim.placeAtMe(necroExplosion)
createAshPile()
utility.wait(0.1)
victim.placeactoratme(necrolord, 1)
 
I hope it helps.

Edited by maxarturo, 28 July 2020 - 10:41 PM.


#3
Retton

Retton

    Stranger

  • Members
  • Pip
  • 3 posts

 

First of all you are not playing a "Shader" but placing an explosion.
Second you have 2 different explosions and only 1 'Explosion Property'.
If you want just 1 explosion, then remove 1 from the script.
 
* If (necrolord, 1) is an explosion.
 
* Some (few) explosions by nature play twice, Bang... BANG !.
 
victim.placeAtMe(necroExplosion)
createAshPile()
utility.wait(0.1)
victim.placeactoratme(necrolord, 1)
 
I hope it helps.

 

Nah, not that's not what i mean. By "shade" i mean an npc, like a Corrupted Shade in Kilkreath. 



#4
dylbill

dylbill

    Faithful poster

  • Supporter
  • PipPipPipPip
  • 1,363 posts

If you're getting 2 NPC's, it makes me think that the Event OnDying is running twice. If this is the case, you can try putting a bool check in the script like so. 

 

Bool RunCheck = False

EVENT onDying(ACTOR akkiller)
    If RunCheck == False
        RunCheck = True
        victim.placeAtMe(necroExplosion)
        createAshPile()
        utility.wait(0.1)
        victim.placeactoratme(necrolord, 1)
    Endif
endEVENT


#5
maxarturo

maxarturo

    Faithful poster

  • Members
  • PipPipPipPip
  • 1,841 posts
Aaaa ok, so this line:
victim.placeactoratme(necrolord, 1)
Is your actor.
 
Replace it with:
victim.PlaceActorAtMe(necrolord)
 
A better way to script this is to:
victim.PlaceActorAtMe(necrolord, 2).StartCombat(Game.GetPlayer())
 
Here is the link to the function so you can understad it better:
 
Be sure that you don't have assigned the "necrolord" actor in both of your properties that have the "PlaceAtMe", but if you use the function i posted above ( PlaceActorAtMe() ) this won't happen.
 
Have a happy modding.

Edited by maxarturo, 29 July 2020 - 08:09 PM.


#6
ReDragon2013

ReDragon2013

    Old hand

  • Members
  • PipPipPip
  • 540 posts

At first if you create your own mod, which means you won't overwrite an existing script, use a unique name for that script. Because all scripts share the same folder !!!

What I understand with your issue:

 

retDrainShadeSCRIPT

Spoiler

Edited by ReDragon2013, 30 July 2020 - 08:10 AM.


#7
Retton

Retton

    Stranger

  • Members
  • Pip
  • 3 posts

Alright, thanks for your answers.


Edited by Retton, 30 July 2020 - 12:59 PM.






Also tagged with one or more of these keywords: help, script, papyrus

Page loaded in: 2.134 seconds