Jump to content

AddSpecialAbility Script


silversnuff

Recommended Posts

Hello,

 

I’m having some difficulty with a script of mine. This is actually my first script so I’m admittedly a little out of my depth.

 

The intended effect – I would like, when the player selects the intended HLA, for a script to run that gives the player ability according to their alignment. The ability chosen corresponds to whether they are evil or good and grants them 1 additional use of the HLA already made according to alignment. So obviously the player can select this HLA again from the level-up screen and gain additional uses of the ability.

 

At the moment I’ve been able to get everything working for the spell except the script to run. It only ever gives the player one use of the ability. This occurs regardless whether the player selects the ability again. If I add Global("k2vip","LOCALS",1) +SetGlobal("K2vip","LOCALS",2) the player gets 2 uses rights away. If I get rid of SetGlobal the script runs and gives the character infinite uses of the ability.

 

  1. Is this action possible from the HLA screen?
  2. Anything I’m missing here? Would it be easier to have this happen via the Invisible creature trick?
IF
	Alignment(Myself,MASK_EVIL)
	Kit(Myself,Ninja)
	Global("k2vip","LOCALS",0)
THEN
	RESPONSE #100
		AddSpecialAbility("k2vip") //
		SetGlobal("K2vip","LOCALS",1)
END

IF
	Alignment(Myself,MASK_EVIL)
	Kit(Myself,Ninja)
	Global("k2vip","LOCALS",1)
THEN
	RESPONSE #100
		AddSpecialAbility("k2vip") //
		SetGlobal("K2vip","LOCALS",2)
END

Thanks for the help!

Link to comment

1) Is this action possible from the HLA screen ?

2) Anything I’m missing here? Would it be easier to have this happen via the Invisible creature trick?

1. Yes.

2. Well, it depends on how you wish to do this.... but you probably should set the Global("K2vip","LOCALS",x)'s x back to zero if you wish to give 2 more again, but if you just want it to be one per HLA pick, just use one run of these, so:

IF
	Alignment(Myself,MASK_EVIL)
	Kit(Myself,Ninja)
	Global("k2vip","LOCALS",0)
THEN
	RESPONSE #100
		AddSpecialAbility("k2vip") //
		SetGlobal("K2vip","LOCALS",1)
END

Will do for that one alignment.

 

Also what are you using to run this script ? Is it part of the baldur.bcs ... that's a very bad choise, especially with a use of a LOCAL ... an invisible creature is far better in this respect. As you can summon it via the HLA spell and kill it after it's no longer needed. And it will automate the setting of the LOCAL to 0 each time as it's removal will reset it... but, although I would still use a GLOBAL and reset it with the HLA spell effect.

Link to comment

You could probably do this without resorting to scripting, I think. Assuming you can target .eff effects by alignment. Which I think you can, but someone should maybe confirm this for me - I'm not at my computer.

 

Have the HLA apply a spell (AP_) instead of giving an ability. The spell will have 9 effects, all of them using opcode 177 and each targeting a different alignment. Each of those effects will point to an .eff file that you create. Each of those 9 .eff files uses opcode 171 to give an ability to the player.

 

Et voila - a single HLA that differs by alignment, no invisible creatures needed.

Link to comment

Another possibility is to create different HLAs and restrict them by alignment, so characters can only choose the one associated with their alignment. This is how Summon Planetar / Summon Dark Planetar works.

 

http://gibberlings3.net/iesdp/files/2da/2da_tob/luxx0.htm

 

If you can avoid using scripts and invisible creatures, you'll end up with a much cleaner solution.

Link to comment

Another ...

If you can avoid using scripts and invisible creatures, you'll end up with a much cleaner solution.

Well, there's probably a reason why the silversnuff opted to combine the HLAs, and it's likely to not waste 9 HLA slots out of the 24 possible ones to a single ability since there's very limited slot amount. Yes, we give possibilities, some of them are better in different conditions, but given the premise ... I would consider your suggestion to be out of the question.

Link to comment

Thanks for the help!

 

I've figured it out. Yea Jarno is correct; I opted to combine HLAs to not waste slots. I had initially tried subtledoctor's suggestion but it didn't seem to work, which is why I resorted to scripting. But I just realised that when using opcode 177 NOTEVIL actually means it applies to evil characters. Which is why it wasn’t working on my tests. Dumb I know. Live and learn. Thanks for the help. This is a much more elegant solution

Link to comment

Archived

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

×
×
  • Create New...