Jump to content


Photo

Solved!: Help. How to make Party Members go neutral and then green


  • Please log in to reply
10 replies to this topic

#1 BCaesar

BCaesar
  • Modder
  • 62 posts

Posted 01 May 2017 - 07:12 PM

Hello everyone.

I've got some times when I want to make party members (in this case Cernd) go neutral and then turn green again after the event is over. Here's the code as I have it now (it ends up in cernd.bcs)
 

IF
    Global("_bMazzyHostile","GLOBAL",4)
    InParty("Cernd")
    !StateCheck("Cernd",CD_STATE_NOTVALID)
THEN
    RESPONSE #100
    ChangeEnemyAlly(Myself,NEUTRAL)
END

IF
    Global("_bMazzyHostile","GLOBAL",5)
    InParty("Cernd")
    !StateCheck("Cernd",CD_STATE_NOTVALID)
    Global("_bmahocerndfight","GLOBAL",0)
THEN
    RESPONSE #100
    ChangeEnemyAlly(Myself,ALLY)
    SetGlobal("_bmahocerndfight","GLOBAL",1)
END


And it works exactly as it should except that when he turns neutral the circle around him turns into four pulsing triangles and stays that way even when he turns green again. Is there a way to make that go away or a better way to code this so that doesn't happen?

 

I also posted this here: https://forums.beamd...riangles#latest

and here: http://gibberlings3....showtopic=28747


Edited by BCaesar, 07 May 2017 - 10:18 PM.

Mod: All Things Mazzy (banters, romance, expanded friendship and more)
Tutorial/Coding: Rest Check (coding for anyone to make their Mod's rest scenes yield to those from BG2:EE and additional coding to make them yield to those from a list of other mods as well.


#2 Roxanne

Roxanne

    Modder

  • Member
  • 3564 posts

Posted 01 May 2017 - 08:47 PM

Hello everyone.

I've got some times when I want to make party members (in this case Cernd) go neutral and then turn green again after the event is over. Here's the code as I have it now (it ends up in cernd.bcs)
 
IF
    Global("_bMazzyHostile","GLOBAL",4)
    InParty("Cernd")
    !StateCheck("Cernd",CD_STATE_NOTVALID)
THEN
    RESPONSE #100
    ChangeEnemyAlly(Myself,NEUTRAL)
END

IF
    Global("_bMazzyHostile","GLOBAL",5)
    InParty("Cernd")
    !StateCheck("Cernd",CD_STATE_NOTVALID)
    Global("_bmahocerndfight","GLOBAL",0)
THEN
    RESPONSE #100
    ChangeEnemyAlly(Myself,ALLY)
    SetGlobal("_bmahocerndfight","GLOBAL",1)
END


And it works exactly as it should except that when he comes back into the party the green circle around him turns into four pulsing triangles and stays that way. Is there a way to make that go away or a better way to code this so that doesn't happen?

In the second block, use JoinParty() for him to change from neutral to party member. An ally helps the party but is not member, NPCs are neutral before joining.


The Sandrah Saga

another piece of *buggy, cheesy, unbalanced junk*

 


#3 BCaesar

BCaesar
  • Modder
  • 62 posts

Posted 06 May 2017 - 04:51 PM

Hello everyone.

I've got some times when I want to make party members (in this case Cernd) go neutral and then turn green again after the event is over. Here's the code as I have it now (it ends up in cernd.bcs)
 
IF
    Global("_bMazzyHostile","GLOBAL",4)
    InParty("Cernd")
    !StateCheck("Cernd",CD_STATE_NOTVALID)
THEN
    RESPONSE #100
    ChangeEnemyAlly(Myself,NEUTRAL)
END

IF
    Global("_bMazzyHostile","GLOBAL",5)
    InParty("Cernd")
    !StateCheck("Cernd",CD_STATE_NOTVALID)
    Global("_bmahocerndfight","GLOBAL",0)
THEN
    RESPONSE #100
    ChangeEnemyAlly(Myself,ALLY)
    SetGlobal("_bmahocerndfight","GLOBAL",1)
END


And it works exactly as it should except that when he comes back into the party the green circle around him turns into four pulsing triangles and stays that way. Is there a way to make that go away or a better way to code this so that doesn't happen?

In the second block, use JoinParty() for him to change from neutral to party member. An ally helps the party but is not member, NPCs are neutral before joining.

 

Oh sorry, I misspoke. He never leaves the party. He remains a party member the whole time, he just turns neutral and then turns green again.

 

This is what I should've said (and what the first post now does say),

 


"And it works exactly as it should except that when he turns neutral the circle around him turns into four pulsing triangles and stays that way even when he turns green again. Is there a way to make that go away or a better way to code this so that doesn't happen?"

 

But that is another option, I could make him just leave and rejoin which would accomplish the same thing.


Edited by BCaesar, 06 May 2017 - 04:57 PM.

Mod: All Things Mazzy (banters, romance, expanded friendship and more)
Tutorial/Coding: Rest Check (coding for anyone to make their Mod's rest scenes yield to those from BG2:EE and additional coding to make them yield to those from a list of other mods as well.


#4 BCaesar

BCaesar
  • Modder
  • 62 posts

Posted 06 May 2017 - 05:00 PM

They say here that it'll go away after someone saves and loads.

 

http://gibberlings3....showtopic=28747

 

Though someone also suggested changing it to PC not ALLY and seeing if that makes a difference.


Mod: All Things Mazzy (banters, romance, expanded friendship and more)
Tutorial/Coding: Rest Check (coding for anyone to make their Mod's rest scenes yield to those from BG2:EE and additional coding to make them yield to those from a list of other mods as well.


#5 Artemius I

Artemius I
  • Modder
  • 48 posts

Posted 06 May 2017 - 08:50 PM

Have you thought of using MakeUnselectable(999999) instead of changing their state to neutral? That is how the game handles cases of uncontrollable party members (e.g. the Bhaal dream sequence in Spellhold, the duel against Sendai's drow captain in ToB, etc.) It turns their selection circle purple.


My major projects:

NPCs: Sirene (BG:EE | BG2:EE), Drake (BG:EE), Aura (BG:EE), Pai'Na (BG2:EE)

Kits: The Artisan's Kitpack, Bardic Wonders, Warlock, Shadow Magic

Tweaks: Artemius' House Tweaks

In-progress: Aura BG2, Drake BG2, The Fallen Light, Shadow Magic: Thultanthar

A comprehensive list of my mods

The Artisan's Corner (my personal mod site)


#6 Roxanne

Roxanne

    Modder

  • Member
  • 3564 posts

Posted 06 May 2017 - 09:21 PM

For a party member to change from enemy back to green, I use

ChangeEnemyAlly("ScriptName",PC)

There was never an issue with that..

 

Using

MakeUnselectable(999999)

also works if you control the intermediate actions of the PC by script. You need a second MakeUnselectable(1) to change back.


The Sandrah Saga

another piece of *buggy, cheesy, unbalanced junk*

 


#7 BCaesar

BCaesar
  • Modder
  • 62 posts

Posted 07 May 2017 - 08:04 PM

For a party member to change from enemy back to green, I use

ChangeEnemyAlly("ScriptName",PC)

There was never an issue with that..

 

Using

MakeUnselectable(999999)

also works if you control the intermediate actions of the PC by script. You need a second MakeUnselectable(1) to change back.

 

Changing back doesn't seem to be the problem. The triangles start when I use

ChangeEnemyAlly(Myself,NEUTRAL)

and then just don't stop when it's changed back.

 

So I'll try MakeUnselectable instead.


Mod: All Things Mazzy (banters, romance, expanded friendship and more)
Tutorial/Coding: Rest Check (coding for anyone to make their Mod's rest scenes yield to those from BG2:EE and additional coding to make them yield to those from a list of other mods as well.


#8 Roxanne

Roxanne

    Modder

  • Member
  • 3564 posts

Posted 07 May 2017 - 08:38 PM

For a party member to change from enemy back to green, I use

ChangeEnemyAlly("ScriptName",PC)

There was never an issue with that..

 

Using

MakeUnselectable(999999)

also works if you control the intermediate actions of the PC by script. You need a second MakeUnselectable(1) to change back.

 

Changing back doesn't seem to be the problem. The triangles start when I use

ChangeEnemyAlly(Myself,NEUTRAL)

and then just don't stop when it's changed back.

 

So I'll try MakeUnselectable instead.

I see- I never saw this effect ever. Maybe it is a GUI issue, (I use EET onlx and I use the EET SoD GUI.)

 

PS - I go directly to either PC or CONTROLLED not via NEUTRAL (in case this makes the difference).


Edited by Roxanne, 07 May 2017 - 11:36 PM.

The Sandrah Saga

another piece of *buggy, cheesy, unbalanced junk*

 


#9 BCaesar

BCaesar
  • Modder
  • 62 posts

Posted 07 May 2017 - 10:16 PM

Using

MakeUnselectable(999999)

also works if you control the intermediate actions of the PC by script. You need a second MakeUnselectable(1) to change back.

 

Thanks. I had the hardest time getting it to work until I remembered reading in the IESDP, "MakeUnselectable(I:Time*)

This action changes the active creature's selection circle to purple - making it unselectable. Creatures made unselectable stop processing scripts."
 
Because I had the script to make them selectable again in their script file so it wasn't triggering. I had to move those to Baldur.baf to get them to work.
 
So in Jan's Script file I have:
IF //Jan's script If Mazzy goes hostile.
	Global("_bMazzyHostile","GLOBAL",4)
	InParty("Jan") 
	!StateCheck("Jan",CD_STATE_NOTVALID)
THEN
	RESPONSE #100
	MakeUnselectable(999999)
END

IF	
	InParty("Jan")
	!StateCheck("Jan",CD_STATE_NOTVALID)
	Global("_bmahojanfight","GLOBAL",1)
THEN
	RESPONSE #100
	StartDialogNoSet(Player1)
END

 

And in Cernd's script file I have:

IF //Cernd's script If Mazzy goes hostile.
	Global("_bMazzyHostile","GLOBAL",4)
	InParty("Cernd") 
	!StateCheck("Cernd",CD_STATE_NOTVALID)
THEN
	RESPONSE #100
	MakeUnselectable(999999)
END

Cernd's is shorter since Jan has dialogue that triggers at the end of combat.

 

And then in the Baldur script file I have:

IF //Once combat ends after Mazzy going hostile. Turns off everything. Script is here because Mazzy's dead.
Global("_bMazzyHostile","GLOBAL",4)
CombatCounter(0)
Dead("Mazzy")
THEN
	RESPONSE #100
	SetGlobal("_bMazzyHostile","GLOBAL",5)
END

IF //End of hostilities. Turn everyone selectable again. Script is here because being unselectable turns off script files.
	Global("_bMazzyHostile","GLOBAL",5)
	Global("_bMazzyFightOver","GLOBAL",0)
THEN
	RESPONSE #100
	ActionOverride("Jan",MakeUnselectable(0))
	ActionOverride("Cernd",MakeUnselectable(0))
	SetGlobal("_bMazzyFightOver","GLOBAL",1)
	SetGlobal("_bmahojanfight","GLOBAL",1)
END

 

And it works like a charm. No more pulsing triangles. They only come when I use: ChangeEnemyAlly(Myself,NEUTRAL)

 

Thanks!


Edited by BCaesar, 07 May 2017 - 10:17 PM.

Mod: All Things Mazzy (banters, romance, expanded friendship and more)
Tutorial/Coding: Rest Check (coding for anyone to make their Mod's rest scenes yield to those from BG2:EE and additional coding to make them yield to those from a list of other mods as well.


#10 Roxanne

Roxanne

    Modder

  • Member
  • 3564 posts

Posted 07 May 2017 - 11:38 PM

Using

MakeUnselectable(999999)

also works if you control the intermediate actions of the PC by script. You need a second MakeUnselectable(1) to change back.

 

Thanks. I had the hardest time getting it to work until I remembered reading in the IESDP, "MakeUnselectable(I:Time*)

This action changes the active creature's selection circle to purple - making it unselectable. Creatures made unselectable stop processing scripts."
 
Because I had the script to make them selectable again in their script file so it wasn't triggering. I had to move those to Baldur.baf to get them to work.
 
So in Jan's Script file I have:
IF //Jan's script If Mazzy goes hostile.
	Global("_bMazzyHostile","GLOBAL",4)
	InParty("Jan") 
	!StateCheck("Jan",CD_STATE_NOTVALID)
THEN
	RESPONSE #100
	MakeUnselectable(999999)
END

IF	
	InParty("Jan")
	!StateCheck("Jan",CD_STATE_NOTVALID)
	Global("_bmahojanfight","GLOBAL",1)
THEN
	RESPONSE #100
	StartDialogNoSet(Player1)
END

 

And in Cernd's script file I have:

IF //Cernd's script If Mazzy goes hostile.
	Global("_bMazzyHostile","GLOBAL",4)
	InParty("Cernd") 
	!StateCheck("Cernd",CD_STATE_NOTVALID)
THEN
	RESPONSE #100
	MakeUnselectable(999999)
END

Cernd's is shorter since Jan has dialogue that triggers at the end of combat.

 

And then in the Baldur script file I have:

IF //Once combat ends after Mazzy going hostile. Turns off everything. Script is here because Mazzy's dead.
Global("_bMazzyHostile","GLOBAL",4)
CombatCounter(0)
Dead("Mazzy")
THEN
	RESPONSE #100
	SetGlobal("_bMazzyHostile","GLOBAL",5)
END

IF //End of hostilities. Turn everyone selectable again. Script is here because being unselectable turns off script files.
	Global("_bMazzyHostile","GLOBAL",5)
	Global("_bMazzyFightOver","GLOBAL",0)
THEN
	RESPONSE #100
	ActionOverride("Jan",MakeUnselectable(0))
	ActionOverride("Cernd",MakeUnselectable(0))
	SetGlobal("_bMazzyFightOver","GLOBAL",1)
	SetGlobal("_bmahojanfight","GLOBAL",1)
END

 

And it works like a charm. No more pulsing triangles. They only come when I use: ChangeEnemyAlly(Myself,NEUTRAL)

 

Thanks!

Sorry, forgot to mention that the return from unselectable needs to be in area/outsidecreature/baldur script not the affected NPCs.

 

PS - I go directly to either PC or CONTROLLED not via NEUTRAL (in case this makes the difference).


The Sandrah Saga

another piece of *buggy, cheesy, unbalanced junk*

 


#11 temnix

temnix
  • Member
  • 983 posts

Posted 19 October 2017 - 12:59 PM

A late shot, but if you want to avoid scripts for this altogether, you can Apply a spell with opcode 72 from inside a dialogue. Also, neutrality is one thing and circle color is another. There are allegiances GOODBUTRED, GOODBUTBLUE, EVILBUTGREEN and all those other combinations. GOOD is GOODCUTOFF, no matter the color, and EVIL is EVILCUTOFF. The only real neutrality is indifference - NEUTRAL. This may be useful for things like walking a neutral-seeming party, who are actually enemies, over a trapped area. You change them into EVILBUTBLUE and get them into conversation with the party. Or you could do the same to the party itself, even to the main character, for a cutscene.


Edited by temnix, 19 October 2017 - 12:59 PM.