Author Topic: Question  (Read 2128 times)

Aegnor

  • Guest
Question
« on: March 14, 2005, 01:29:26 AM »
here comes a question to the all-powerful "sages of IE wisdom".. (a.k.a the PP modders...) ;)

I've been working on a familiar mod... (see signature if your interested (self-promotion is baaad m'kay...) :D)
Well whatever... So I ran in to a problem... In the mod, I have removed control over the familiar, (made it neutral)
but I still want it to obey commands during combat so I wrote this script..


Quote
IF
  !Global("FamIsGreen","LOCAL",1)
  !CombatCounter(0)
THEN
    RESPONSE #100
             AddFamiliar()
             SetGlobal("FamIsGreen","LOCAL",1)
END

IF
  Global("FamIsGreen","LOCAL",1)
  CombatCounter(0)
THEN
    RESPONSE #100
             RemoveFamiliar()
             SetGlobal("FamIsGreen","LOCAL",0)
END

Well it works somewhat.. but during combat I gain control over it for a while and then for no reason
I can detect it becomes neutral then it becomes an ally again.
The time is somewhat like: neutral for 2 seconds then it is green for 5-10 seconds.
and it keeps doing that.

I've tried replacing it with:
ChangeEnemyAlly(Myself,NEUTRAL) and
ChangeEnemyAlly(Myself,FAMILIAR),
but then it never changes at all.


Any help would be appric..appris... help would make my black cold heart go warm with fuzzy feelings... :D


Quote
Argh... Pirates!
:pirate                                :pirate                                  :pirate                                  :pirate                                  :pirate                                  :pirate                                :pirate                                  :pirate                                  :pirate                                  :pirate                                  :pirate

igi_g

  • Guest
Re: Question
« Reply #1 on: March 14, 2005, 06:56:30 AM »
Assuming they are not a typo's, you want to use LOCALS not LOCAL. And both blocks check for FamIsGreen being 1.

You could try using ActuallyInCombat() instead of CombatCounter.

Aegnor

  • Guest
Re: Question
« Reply #2 on: March 14, 2005, 07:31:14 AM »
heh.. no it wasen't a typo.. copy-pasted from the code.. :) strange i diden't get an error for this...
thx, i'll try this when I get home...

this would explain why ChangeEnemyAlly(Myself,NEUTRAL) and
ChangeEnemyAlly(Myself,FAMILIAR), woulden't work...

But this makes me even more confused about the function of AddFamiliar()..
Since I made this mistake, the code never used RemoveFamiliar.. if this is true
it means that AddFamiliar() is time based.. unless it was a result of the code
keep doing the AddFamiliar() action, even though it already was assigned.

::)

Offline Ghreyfain

  • Moderator
  • Planewalker
  • *****
  • Posts: 4705
  • Gender: Male
    • Pocket Plane Group
Re: Question
« Reply #3 on: March 14, 2005, 02:14:24 PM »
This is a totally random guess, but AddFamiliar() sounds a lot like the MakeGlobal() action.  I think it just adds the creature to the saved game as a familiar.

What you probably want is the ChangeEnemyAlly() stuff, and make sure your checks are working properly.  What I think is happening is that the very flaky CombatCounter is setting to 0, and it's just setting your familiar back to his non-combat state.

Did you try what igi suggested?

Also, you don't need the LOCALS in there.  I suggest a simple check for Allegiance(Myself,NEUTRAL) and FAMILIAR.
Earn Money Sleeping.

Offline Loriel

  • Planewalker
  • *****
  • Posts: 390
  • Gender: Male
    • Loriel's Downloads
Re: Question
« Reply #4 on: March 14, 2005, 02:48:29 PM »
ActuallyInCombat() is a TOB-specific trigger.  If you want this to work in vanilla SOA, you will want to put something like this near the top of your TP2:
Code: [Select]
APPEND ~trigger.ids~ ~0x40D5 ActuallyInCombat()~
    UNLESS ~ActuallyInCombat()~

Offline devSin

  • Planewalker
  • *****
  • Posts: 1632
  • Gender: Male
Re: Question
« Reply #5 on: March 14, 2005, 03:44:57 PM »
Don't ever, ever, ever use !CombatCounter(0). Dialogue, among other things, tends to jiggle the combat counter for some reason. If you want to see if a party is in combat, use CombatCounterGT(0), and to check if they're not in combat, use CombatCounter(0) (or, you can use CombatCounterLT(1), depending on how precise you need the check to be).

I don't know that anybody really knows all the cases where ActuallyInCombat() will evaluate to true. I don't think it will do anything unless the specific character is doing something combat-related, so it probably won't work in your script.

Aegnor

  • Guest
Re: Question
« Reply #6 on: March 15, 2005, 05:09:37 AM »
Heh.. tried it now... and it works flawlessly.. :) (useing ChangeEnemyAlly() not tried AddFamiliar())
I'll use ActuallyInCombat() for the time being.. they're many other things I have to change if I want my mod in vanilla bg2.. :)

thanks for the help everyone..

Offline jcompton

  • Niche Exploiter
  • Administrator
  • Planewalker
  • *****
  • Posts: 7246
Re: Question
« Reply #7 on: March 15, 2005, 09:48:46 AM »
Don't ever, ever, ever use !CombatCounter(0). Dialogue, among other things, tends to jiggle the combat counter for some reason. If you want to see if a party is in combat, use CombatCounterGT(0), and to check if they're not in combat, use CombatCounter(0) (or, you can use CombatCounterLT(1), depending on how precise you need the check to be).

Except I thought it was the other way around, that CombatCounterGT was the broken one...
Cespenar says, "Kelsey and friends be at the Pocket Plane? Ohhh yesssss!" http://www.pocketplane.net

Offline devSin

  • Planewalker
  • *****
  • Posts: 1632
  • Gender: Male
Re: Question
« Reply #8 on: March 15, 2005, 10:05:38 AM »
Quote
that CombatCounterGT was the broken one
Not that I'm aware of. The only thing I've experienced is that dialogue will tend to mess with the combat counter; when this happens, !CombatCounter(0) will erroneously return true and CombatCounterGT(0) will return false.

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: