Jump to content

Script help


cry0z

Recommended Posts

Posted

I'm making a mod of a boss that hunts the player around the map.

The boss itself is fully done. I just need to figure a way to randomly make it appear in front of the player by a random chance.

Problem is.. i know nothing about scripting, and apparently that's the only way to make this work. Anyone around that knows how to script and can provide a working script for this, or  examples?

Posted

Create a Quest

Create a script on the quest

 

Add a function inside, something like:

 

 

 
Cell Property theCellIWant Auto
Actor Property PlayerRef Auto
Actor Property theBoss Auto
 
Function startHunting()
  if PlayerRef.getparentCell()==theCellIWant
    RegisterForSingleUpdate(Utility.RandomFloat(30, 60.0))
  else
    UnregisterForUpdates()
  endIf
endFunction
 
Event OnUpdate()
  if PlayerRef.getparentCell()!=theCellIWant
    theBoss.disable()
    return
  endIf
 
  theBoss.enable()
  theBoss.MoveTo(PlayerRef, PlayerRef.X+UtilityRandomInt(100)+50, PlayerRef.Y+UtilityRandomInt(100)+50, PlayerRef.Z)
endEvent
 

Then call yourQuest.startHunting() when you want it to start

 

Posted

Thank you for the fast reply.

I think i understood more or less how it works. But... how in there do i chose what npc goes and hunts for the player ?

Also that function only works once the player enters the cell that is chosen right?

Posted

The function is just an example.

 

The property "theBoss" is the actual actor that should hunt the player.

How to select it is up to you (I have no clues of the logic you want to realize.)

 

Ask anytime for help, I will answer when I will have time.

Posted

Ok. So, how do i make it, so that whenever I enter a new cell the script is gonna random a value, if that value is bigger than the one i specified, the script spawns the boss?

 

The idea is to have the script always running until the player kills the boss.

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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