Jump to content

Making certain actors flee certain actors, but fighting others


Faceshifter

Recommended Posts

Except for the script then.

The general idea is the followin. I have created several factions, all about creatures (Bears, Wolves, Rabbits, Deers, Boars and foxes). Fighting between them is just a simple game of factions, wolves and bears will hunt everything else, boars fight back etc. But the fox yielded a problem. The fox should attack only the rabbits, let alone the deer, and flee boars, bears and wolves. I have written a script, but I am not sure what to pick and if they'd work:

 

Scriptname FaceScriptFox

; This script makes the Fox run from certain other NPCs

Ref Fox
Ref Enemy

Begin GameMode

Set Fox to GetSelf
Set Enemy to Fox.GetCombatTarget

If ( Enemy.GetInFaction FaceFactionRabbit == 1 )
Fox.SetActorValue Confidence 100
ElseIf ( Enemy.GetInFaction FaceFactionBears == 1 )
Fox.SetActorValue Confidence 0
ElseIf ( Enemy.GetInFaction FaceFactionDeer == 1 )
Fox.SetActorValue Confidence 30
Fox.StopCombat
ElseIf ( Enemy.GetInFaction FaceFactionBoar == 1 )
Fox.SetActorValue Confidence 0
ElseIf ( Enemy.GetInFaction FaceFactionfoxes == 1 )
Fox.SetActorValue Confidence 30
Fox.StopCombat
ElseIf ( Enemy.GetInFaction FaceFactionWolves == 1 )
Fox.SetActorValue Confidence 0
Else
Fox.SetActorValue Confidence 0
EndIf

End

 

The intention is clear, the game checks if the combat target should be fled from, his confidence will be lowered and so run. If the target is a rabbit, it will, instead, attack the rabbit.

I know of the flaws, that the confidence change of the rabbit isn't really necessary, or I could delete the wolves, bears and boars because of the final "Else" but bear with me.

The fox's Confidence would be changed so much, it doesn't really matter what it is.

 

Scriptname FaceScriptFox

; This script makes the Fox run from certain other NPCs

Ref Fox
Ref Enemy

Begin GameMode

Set Fox to GetSelf
Set Enemy to Fox.GetCombatTarget

If ( Enemy.GetInFaction FaceFactionBears == 1 )
Fox.ForceFlee
ElseIf ( Enemy.GetInFaction FaceFactionBoar == 1 )
Fox.ForceFlee
ElseIf ( Enemy.GetInFaction FaceFactionWolves == 1 )
Fox.ForceFlee
EndIf

End

 

Here, the fox's Confidence would be 30 or so, and it's aggression 100. Since the factions are arranged so, it would only attack rabbits, bears, boars and wolves. But they are far stronger than the weak fox, he runs.

I do not have any experience with this command however, and as I see it, this should be perfect.

 

I could test both scripts, but since Oblivion is such a great game, it would be impossible to create, analyse and test every possible scenario. That's why I apply to the all-knowing community for aid.

It'd also be useful if the fox runs when a bear, wolf or boar enters the battle. This could be simulated by checking da 'hood for bears/boars/wolves and run if it so, but this is not really flawless.

 

I hope to hear from you soon!

 

Face

Link to comment
Share on other sites

Firstly: I love accidentally misreading your name.

Secondly: You don't need to 'set Fox to GetSelf'. Because it is a reference script, already running on the fox (why GetSelf works), you can simply say 'ForceFlee' and it will apply it to the whoever GetSelf is.

Thirdly: Whilst I love creative scripting used to effect realism. I think in this case, the idea has already been done by MMM.

Link to comment
Share on other sites

Firstly: How did you misread it then? You made me curious.

Secondly: You're totally right, but it is more clear to me this way.

Thirdly: The script is intended for a stand-alone mod, an island in the north, in a slightly less fantasy-way.

Fourth: Thank you for your response ;)

Link to comment
Share on other sites

How did you misread it then? You made me curious.

Let just say it's probably more of a reflection of the unseemly nature of my own mind, rather than anything else...

 

If you wanted to simplify things for your mod; then instead of having separate factions for each animal, how about having them all in the same faction, but ranked? Then have it so if the fox's enemy is more than, say two, ranks above him, then he will flee. So he might have a go against a normal wolf, but against a timber wolf, or a boar, and he's outa there! Similarly, a timber wolf might try and fight a black bear, but if he meets a mountain lion or a brown bear, then he will flee.

Link to comment
Share on other sites

The script looks good as far as I can tell, although I haven't done an awful lot with scripts on actors. You will need to set the factions. The easiest place to do this would be in a quest script. I think you should be fine to StopQuest it after as well, to save it running once it's done. Edited by PrettyMurky
Link to comment
Share on other sites

  • Recently Browsing   0 members

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