Jump to content

Trying to get a creature to have a knock-down effect


scarycave

Recommended Posts

Here's the code:

 

;KnockDown

If IsAttacking == 1

Set KdownChance to getrandompercent

If KdownChance > 90

PushActorAway MyTarget,15

endif

 

For some reason it happens with each attack, it's awesome! :dance:

Let's face it though, it would ruin the game for anyone if every enemy keeps flying via dog bite airlines.

I need to know if theirs away to fix it. I'm trying to get the knockdown effect like dog-meat has in FO3.

Link to comment
Share on other sites

I assume this is a gamemode script. IsAttacking would be true for several frames at a time, and each frame the randomchance gets recalculated. Imagine the amount of frames that get calculated during each attack. The chance that the effect hits during one of those frames is pretty large, even with a 10% chance. Either reduce the chance or put a cooldown timer on it (or both) and it should work.
Link to comment
Share on other sites

Okay, I got a working script. :)

The cooldown thing wasn't working so I settled for this (and yes, this is in GameMode):

 


;KnockDown
If IsAttacking == 1 

Set KDChance to GetRandomPercent + GetRandomPercent + GetRandomPercent + GetRandomPercent + GetRandomPercent

if KdChance < 100
	PushActorAway MyTarget,15
endif

endif

 

 

 

Problem now is that the follower gets tossed into the air upon death....perhaps I should change it from PushActoraway to MyTarget.SetAv Fatigue 0?

Link to comment
Share on other sites

I love this kind of script :D

 

So let me get this straight first of all - you want a creature to have a 10% chance of knocking you down when it hits, then have a cooldown period before it can knock you down again?

 

I wouldnt reduce fatigue for that. Negating fatigue has an unpredictable effect. You generally fall in the direction you are running, but how far you fly is pretty random. Funny, but random ;)

 

I think all you need to do is encase the block in a timer. Kind of like this...

 

 

Short KDChance
Float Cooldown


;;;;;;;;;;;;
;;;;;;;;;;;;
If Cooldown > 0
    Set Cooldown to (Cooldown - GetSecondsPassed)
Else
    If IsAttacking
         Set KDChance to (100/99 * GetRandomPercent)                ;0-100 instead of 0-99. I'm picky about these things :P
         If KDChance =< 10
              PushActorAway MyTarget 15
              Set Cooldown to 10                                   ;10 second cooldown
         endif
    endif
endif

 

 

 

This also means that the script won't execute repeatedly from one attack, like evenstargw said. Hope this works for you :thumbsup:

Edited by WarRatsG
Link to comment
Share on other sites

Thanks WarRatsG. :D

 

I modified the code a bit so I could get it to work with the mod, the (100/99 * GetRandomPercent) is much better than the multiple + getrandompercents I had. I couldn't get the seconds-passed to work so I just replaced 10 seconds with 1500, and set it to -1 repeatedly. The forums have been such a great help with modding...do you think I should start adding names to the credits?

Link to comment
Share on other sites

I accidently missed an endif on the end, maybe it messed with the cooldown. My bad :ermm:

 

 

You can add credits if you like. You can credit "the community" for it's help, or give specific names, or just give nothing at all. We technically have nothing to do with your mod, therefore have no right to demand credit.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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