Jump to content

Random repeating Wilderness attacks... Help wanted.


Recommended Posts

Does anyone know of a simple template/tutorial to use to add random repeating wilderness attacks?

 

I've tried looking through the WE/WI scripts etc. from basic game but I'm still left confused as to what I'd need to do :sad:

 

I know there are a few mods that do this but unfortunately they don't include any source scripting code with their release to look through for details of how they do it for ideas.

 

This is a bit of code I've started trying to work this out with... this is probably nowhere near to what is needed...

but there again I don't really know what would be.

 

 

 

Scriptname ThugAttackScr extends Quest  

Actor property PlayerRef Auto

Actor property ThugBoss auto
Actor property Thug01 auto
Actor property Thug02 auto

ObjectReference Property ThugMarker1 Auto

MiscObject Property BagMiscRef Auto

GlobalVariable property GameHour auto    
GlobalVariable property Thugattacks auto    

int iNumDays = 10

Event OnInit()
    RegisterForSingleUpdateGameTime(24*iNumDays)    ;Updates once per #days in-game.
endEvent

Event OnUpdateGameTime()

If Thugattacks.GetValue() == 0.00
;They don't want the thug attacks so don't renew... but if they reset it should continue again
Else
    if (PlayerRef.GetItemCount(BagMiscRef) > 0) ; They still have the bag on them
        If Utility.RandomInt(1,3) == 2 ; a 1 in 3 chance it will fire
        ;If PlayerREf in outside space... how to identify ???

            if GameHour.GetValue() >= 7.0 && GameHour.GetValue() <= 19.0 ;Between 7AM and 7PM
                ; Add the thugs.
                ThugBoss.TryToMoveTo(ThugMarker1.GetReference())
                Thug1.TryToMoveTo(ThugMarker1.GetReference())
                Thug2.TryToMoveTo(ThugMarker1.GetReference())
                ThugBoss.TryToEnable()
                Thug1.TryToEnable()
                Thug2.TryToEnable()

            else
            ;maybe reset to random 10-30 days
            ;iNumDays = Utility.RandomInt(10, 30)
            endif
            
        endIf
    Endif
    
    ; Keep checking...
    RegisterForSingleUpdateGameTime(24*iNumDays) ;Check again in #days if not the right time

Endif
endEvent

; Not sure if or where this might be needed...
;ThugBoss.GetReference().DeleteWhenAble()
;Thug01.GetReference().DeleteWhenAble()
;Thug02.GetReference().DeleteWhenAble()

 


The idea is to have the ThugMarker1 dynamically placed in game if/where wanted near/next to player. Random wilderness location.

Then have the thugs placed according to the marker.

 

Currently have no idea how to decide if the location is in a suitably location for them to appear either...

 

I'm aslo pretty sure I'll need to use the Story Manager (never used it before!) started to look at it but again stil confused as to what needs to be done...

 

I've not tried this code in game yet to see what if anything it does. Probably nothing useful as ThugMarker1 is not at this point in game :D

 

 

So any help would be greatly appreciated.

Edited by TheWanderer001
Link to comment
Share on other sites

There are different ways to do this, but the most appropriate is to use the SM as things like this are done in-game with it and that's the reason why SM exists, plus the SM is a very light and powerful tool.


Using the SM does not require to pull system resources and all its functions fires ONLY on the corresponding events, this means that you won't have a script active in the background.


The SM may seem a little confusing, but i assure you if you invest 1 day in it you will see that it ain't that hard, just study a vanilla SM Event + quest and you'll get the hang of it.

Link to comment
Share on other sites

'The SM may seem a little confusing'

Ha... that's an understatment :D

 

I've been looking through it for hours and still confused how to do what I want to do...

For instance it seems the only way to only trigger when the player is in the wilderness is to set it so every other location is excluded...

and at first glance it looks to me that that list would be huge ???

or

Am I not seeing the tree for the woods.

Link to comment
Share on other sites

This was going to be an added feature for my bag of holding.... a sort of small penalty for using it…
but I've now spent far to long going over scripts/code that... to me... makes no sense.

 

For now I'm going to drop the idea... unless... Someone here can put it all together for me ;)

Link to comment
Share on other sites

  • Recently Browsing   0 members

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