Jump to content

Help needed with friendly cats script


ericp07

Recommended Posts

Whenever a big cat sees Erysseril (EP#Ery), I want it to have a 75% chance of becoming friendly (ally) to her. I wrote a script that APPENDs to HUNTER.BCS, but my clumsy attempt fails to compile. I'm not clear on how to correct what I've written:

 

IF
See("EP#Ery")
!Dead("EP#Ery")
!Allegiance("EP#Ery",ALLY)
THEN
RESPONSE #75
 Allegiance("EP#Ery",ALLY)
RESPONSE #25
NoAction()
END

 

What changes are needed to make this work? Can it be made to work if the creature sees any elf (that would be ideal, as big cats are friendly toward elves in the Realms), or would it be best to limit the reaction to the mod NPC herself?

Link to comment

You can use See(0.0.ELF) etc. to make it apply to all elves. But that could cause some conflicts. What happens when your party has elves and there's hostile elves and also cats in the area? If you make it an ALLY it always wins the party's allegiance, as opposed to the ENEMY's.

 

Also, from the looks of it you're trying to change your character's allegiance, when you probably want to change the scripted CRE's allegiance (the target of which would thus be Myself and not EP#Mel).

 

Also note hunter.bcs is used on more than just cats, but also bears, wolves etc. You'll need a race check or the like.

IF
 Race(Myself,CAT)
 See([GOODCUTOFF.0.ELF])
 See([EVILCUTOFF.0.ELF])
 !Global("eacheck","LOCALS",1)
THEN
 RESPONSE #38
SetGlobal("eacheck","LOCALS",1)
ChangeEnemyAlly(Myself,ALLY)
 RESPONSE #38
SetGlobal("eacheck","LOCALS",1)
ChangeEnemyAlly(Myself,ENEMY)
 RESPONSE #24
SetGlobal("eacheck","LOCALS",1)
END

IF
 Race(Myself,CAT)
 See([GOODCUTOFF.0.ELF])
 !Global("eacheck","LOCALS",1)
THEN
 RESPONSE #75
SetGlobal("eacheck","LOCALS",1)
ChangeEnemyAlly(Myself,ALLY)
 RESPONSE #25
SetGlobal("eacheck","LOCALS",1)
END

IF
 Race(Myself,CAT)
 See([EVILCUTOFF.0.ELF])
 !Global("eacheck","LOCALS",1)
THEN
 RESPONSE #75
SetGlobal("eacheck","LOCALS",1)
ChangeEnemyAlly(Myself,ENEMY)
 RESPONSE #25
SetGlobal("eacheck","LOCALS",1)
END

That should, in theory, give the cats a 50/50 chance of allying to either side if they see elves on both sides, or just one side if they only see one or the other. As usual, nothing in the IE scripting engine is guaranteed to work though. Edit: adjusted weights to give 25% chance of not changing allegiance.

Link to comment

Interesting idea, but for how long will those big cats remain her ally? A little while like Korax the Ghoul, or until you rest/leave the area?

Also, Korax had a specific function, as ghouls can't be petrified. What function do the big cats have, other than story value and having a purring rawrcat following you around?

 

I'm not complaining. I like big purring rawrcats. Heck, I'm making a mod about one.

But yeah, from a gamer and modding viewpoint, I have to ask...is this necessary for your NPC's story, or is it a bonus?

Link to comment

This seems kind of Sue-ish to me. Especially if only she can do it.

 

If you are going to add it, then make it optional, and make it applicable to all elves, I'd say. Just my 2p. :)

 

I agree that it should be applicable to all elves in the game (except for drow).

Link to comment

Interesting idea, but for how long will those big cats remain her ally? A little while like Korax the Ghoul, or until you rest/leave the area?

Also, Korax had a specific function, as ghouls can't be petrified. What function do the big cats have, other than story value and having a purring rawrcat following you around?

 

I'm not complaining. I like big purring rawrcats. Heck, I'm making a mod about one.

But yeah, from a gamer and modding viewpoint, I have to ask...is this necessary for your NPC's story, or is it a bonus?

 

This component could conceivably stand alone, but I'm not developing anything separately, and I'm still on the fence about whether to make any content optional, or to just have an "all-or-nothing" mod package.

 

According to the 3.5 D&D _Players Handbook_, Sylvan elves favor great cats as animal companions, especially mountain lions, pumas, and leopards. I wanted to reflect this in the game by giving creatures identified as both hunter and cat a chance to be friendly toward elves. Rather than have it as a limited-duration effect, or an automatic effect, I felt it would be better to just assign a percentage.

Link to comment

You can use See(0.0.ELF) etc. to make it apply to all elves. But that could cause some conflicts. What happens when your party has elves and there's hostile elves and also cats in the area? If you make it an ALLY it always wins the party's allegiance, as opposed to the ENEMY's.

 

Also, from the looks of it you're trying to change your character's allegiance, when you probably want to change the scripted CRE's allegiance (the target of which would thus be Myself and not EP#Ery).

 

Also note hunter.bcs is used on more than just cats, but also bears, wolves etc. You'll need a race check or the like.

IF
 Race(Myself,CAT)
 See([GOODCUTOFF.0.ELF])
 See([EVILCUTOFF.0.ELF])
 !Global("eacheck","LOCALS",1)
THEN
 RESPONSE #38
SetGlobal("eacheck","LOCALS",1)
ChangeEnemyAlly(Myself,ALLY)
 RESPONSE #38
SetGlobal("eacheck","LOCALS",1)
ChangeEnemyAlly(Myself,ENEMY)
 RESPONSE #24
SetGlobal("eacheck","LOCALS",1)
END

IF
 Race(Myself,CAT)
 See([GOODCUTOFF.0.ELF])
 !Global("eacheck","LOCALS",1)
THEN
 RESPONSE #75
SetGlobal("eacheck","LOCALS",1)
ChangeEnemyAlly(Myself,ALLY)
 RESPONSE #25
SetGlobal("eacheck","LOCALS",1)
END

IF
 Race(Myself,CAT)
 See([EVILCUTOFF.0.ELF])
 !Global("eacheck","LOCALS",1)
THEN
 RESPONSE #75
SetGlobal("eacheck","LOCALS",1)
ChangeEnemyAlly(Myself,ENEMY)
 RESPONSE #25
SetGlobal("eacheck","LOCALS",1)
END

That should, in theory, give the cats a 50/50 chance of allying to either side if they see elves on both sides, or just one side if they only see one or the other. As usual, nothing in the IE scripting engine is guaranteed to work though. Edit: adjusted weights to give 25% chance of not changing allegiance.

 

I had the checks in place earlier for cat and hunter, or else for cat and hunter_creature, I don't recall which, but clearly there was much missing from my script. Thanks very much for this!

Link to comment

Is there a way to code this in the .tp2 to efficiently patch the vanilla big cats? If so, would it still be a matter of assigning the script to a script slot, or is there a different WeiDU way of doing it?

 

[EDIT]

I'm now wondering if it would be better to further limit the specific feline creatures affected. Also, I don't want the script to run on supernatural creatures (magical/summoned cats, for example, and perhaps not the Fell Cat...and definitely not the Beast of Malar, a custom creature for this mod).

 

Thanks very much for this! I look forward to nailing the script down and moving along with dialogue.

[/EDIT]

Link to comment

OK, pretty sure this is sorted, as checking for Race(CAT) and Class(HUNTER) should satisfy what I'm after. Got the file fixed up, and added into the .tp2 to extend hunter.bcs with the script. Onward and upward!

Link to comment

I didn't see your last post. Yes, there is a WeiDU way to do it... would take about 5-10 lines of code.

 

If you're doing it via hunter script, you also want to make sure the cats you want to influence actually have that script. A lot of generic greatcats don't (generic panthers, jaguars etc.). Also, I suppose you'd want to exclude cats that someone has summoned (which should be faithful to the summoner regardless of race, I should think) as well as specific cats (Drizzt's panther Guenhwyvar which probably wouldn't leave him just for seeing some other elf).

Link to comment
would take about 5-10 lines of code.
A few more I guess, to do it properly, but not much code.

<<<<<<<< catcharm.baf
IF
 Race(Myself,CAT)
 Class(Myself,HUNTER_CREATURE)
 !Gender(Myself,SUMMONED)
 See([GOODCUTOFF.0.ELF])
 See([EVILCUTOFF.0.ELF])
 !Global("eacheck","LOCALS",1)
THEN
 RESPONSE #38
	SetGlobal("eacheck","LOCALS",1)
	ChangeEnemyAlly(Myself,ALLY)
 RESPONSE #38
	SetGlobal("eacheck","LOCALS",1)
	ChangeEnemyAlly(Myself,ENEMY)
 RESPONSE #24
	SetGlobal("eacheck","LOCALS",1)
END

IF
 Race(Myself,CAT)
 Class(Myself,HUNTER_CREATURE)
 !Gender(Myself,SUMMONED)
 See([GOODCUTOFF.0.ELF])
 !Global("eacheck","LOCALS",1)
THEN
 RESPONSE #75
	SetGlobal("eacheck","LOCALS",1)
	ChangeEnemyAlly(Myself,ALLY)
 RESPONSE #25
	SetGlobal("eacheck","LOCALS",1)
END

IF
 Race(Myself,CAT)
 Class(Myself,HUNTER_CREATURE)
 !Gender(Myself,SUMMONED)
 See([EVILCUTOFF.0.ELF])
 !Global("eacheck","LOCALS",1)
THEN
 RESPONSE #75
	SetGlobal("eacheck","LOCALS",1)
	ChangeEnemyAlly(Myself,ENEMY)
 RESPONSE #25
	SetGlobal("eacheck","LOCALS",1)
END
>>>>>>>>

ACTION_FOR_EACH gcat IN ~catpan01~ ~cattig01~ ~cb585an1~ ~cb585an5~ BEGIN //Generic greatcats without hunter scripts
 ACTION_IF FILE_EXISTS_IN_GAME ~%gcat%.cre~ BEGIN
COPY_EXISTING ~%gcat%.cre~ ~override~
  PATCH_IF SOURCE_SIZE > 0x71 BEGIN
	sf = 0 //Script offset
	fg = 0 //Ending script
	READ_ASCII 0x250 s1 //Class script
	PATCH_IF (~%s1%~ STRING_EQUAL_CASE ~none~ = 1) OR (~%s1%~ STRING_EQUAL ~~ = 1) BEGIN
	  sf = 0x250
	END ELSE BEGIN
	  READ_ASCII 0x248 s2 //Override script
	  PATCH_IF (~%s2%~ STRING_EQUAL_CASE ~none~ = 1) OR (~%s2%~ STRING_EQUAL ~~ = 1) BEGIN
		sf = 0x248
	  END ELSE BEGIN
		READ_ASCII 0x258 s3 //Race script
		PATCH_IF (~%s3%~ STRING_EQUAL_CASE ~none~ = 1) OR (~%s3%~ STRING_EQUAL ~~ = 1) BEGIN
		  sf = 0x258
		END ELSE BEGIN
		  READ_ASCII 0x260 s4 //General script
		  PATCH_IF (~%s4%~ STRING_EQUAL_CASE ~none~ = 1) OR (~%s4%~ STRING_EQUAL ~~ = 1) BEGIN
			sf = 0x260
		  END ELSE BEGIN
			READ_ASCII 0x268 s5 //Default script
			PATCH_IF (~%s5%~ STRING_EQUAL_CASE ~none~ = 1) OR (~%s5%~ STRING_EQUAL ~~ = 1) BEGIN
			  sf = 0x260
			  fg = 1
			END
		  END
		END
	  END
	END
	WRITE_BYTE 0x273 200 //Class (hunter_creature)
	PATCH_IF sf > 0 BEGIN
	  PATCH_IF ((fg = 1) AND (~%s4%~ STRING_EQUAL_CASE ~none~ = 0) AND (~%s4%~ STRING_EQUAL ~~ = 0)) BEGIN
		WRITE_ASCIIE 0x268 ~%s4%~ #8 //Move general script to default if necessary
	  END
	  WRITE_ASCII sf ~hunter~ #8
	END
  END
BUT_ONLY
 END
END

ACTION_FOR_EACH hscr IN ~hunter~ ~hunter2~ BEGIN
 ACTION_IF FILE_EXISTS_IN_GAME ~%hscr%.bcs~ BEGIN
EXTEND_BOTTOM ~%hscr%.bcs~ ~catcharm.baf~
 END
END

I should make a component that lets all worgs/wolves ally to goblinoids (e.g. half-orcs). Just to even the balance for this pointy-eared cat-friend thing...

Link to comment

I didn't see your last post. Yes, there is a WeiDU way to do it... would take about 5-10 lines of code.

 

If you're doing it via hunter script, you also want to make sure the cats you want to influence actually have that script. A lot of generic greatcats don't (generic panthers, jaguars etc.). Also, I suppose you'd want to exclude cats that someone has summoned (which should be faithful to the summoner regardless of race, I should think) as well as specific cats (Drizzt's panther Guenhwyvar which probably wouldn't leave him just for seeing some other elf).

 

Yes, exactly...and I forgot to check the summoned versions of the cats to see if they also have the hunter script. Still thinking WeiDU is the way to go, though, for some odd reason.

Link to comment

Archived

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

×
×
  • Create New...