Jump to content

Need help with creating two scripts


Med111

Recommended Posts

I'm working on evil faction mod for player character and I need assistance with creating two scripts.

First one will cause all guards to attack player on sight if player is within 700 range and global PCEvilFaction is set to 1.

Second one will be attached to castable spell - if any citizen (don't know how to make it work only for them) is within 700 range, player's crime gold will be increased by 100 and citizen will run looking for any guard.

Link to comment
Share on other sites

scn questscript

Begin GameMode

if (PCEvilFaction == 1) && (IsFactionEvil PlayerFaction == 0)
	SetFactionEvil PlayerFaction 1
elseif (PCEvilFaction == 0) && (IsFactionEvil PlayerFaction == 1)
	SetFactionEvil PlayerFaction 0
endif

if (someglobal == 1)
	set someglobal to 2
	Return
elseif (someglobal == 2)
	Player.ModCrimeGold 100
	set someglobal to 0
endif

End

 

scn spellscript

ref factionref

short factions
short count
short evil

Begin ScriptEffectStart

let factions := GetNumFactions
let count := 1
while (count <= factions)
	let factionref := GetNthFaction count
	if (IsFactionEvil factionref == 1)
		let evil := 1
		Break
	endif
	let count := count + 1
loop
if (evil == 0)
	let someglobal := 1
endif

End

Link to comment
Share on other sites

Those are both part of OBSE. Break is a command that breaks the loop. "Let ... :=" is basically the same as "set ... to" but unlike set, you can assign stuff with OBSE functions. For example,

 

set factionref to GetNthFaction

 

would not work because GetNthFaction is an OBSE function and the set command doesn't recognize it as valit.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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