Simple Companion function not working

Support for running, installing or compiling OpenMW

Before you submit a bug report for the first time, please read: Bug reporting guidelines
Post Reply
LegoManIAm94
Posts: 10
Joined: 06 Nov 2019, 01:33

Simple Companion function not working

Post by LegoManIAm94 »

I have a mod which uses the companion local variable to enable and disable the companion share option in the dialogue. I made this mod to be an example. The simple mod will allow Hasphat Antabolis of the Balmora, Guild Of Fighters to offer companion share if you are a member of the fighters guild and not expelled from the fighters guild.

This simple mod works in the Morrowind engine but not in OpenMW. Why is that? Is this a bug in OpenM? Can I make this mod work in OpenMW? I want to have some NPCs in another mod of mine allow companion share if your apart of the same guild as they are and not expelled.
Attachments
companion test.7z
(716 Bytes) Downloaded 117 times
User avatar
akortunov
Posts: 899
Joined: 13 Mar 2017, 13:49
Location: Samara, Russian Federation

Re: Simple Companion function not working

Post by akortunov »

Take a look at script of mercenary from Tribunal, you can use it as example. If I remembered correctly, you need to attach a script to the target NPC with the "companion" local variable. Share window is available when this variable is not 0.
LegoManIAm94
Posts: 10
Joined: 06 Nov 2019, 01:33

Re: Simple Companion function not working

Post by LegoManIAm94 »

Do you mean the Mercenary_Calvus script? I did look at this but no once in the script it sets the companion local variable to 1.

In the mod I uploaded in this post, I have it so it will only set companion to 1 when the player is a member of the fighters guild and is not expelled. The simple script in the mod works in the official Morrowind engine but not in OpenMW. This is the script that does not work in OpenMW

Code: Select all

Begin companiontestscript

short companion

if ( "hasphat antabolis"->samefaction == 1 )
	if ( pcexpelled "Fighters Guild" == 0 )
		set companion to 1
	elseif ( pcexpelled "Fighters Guild" == 1 )
		set companion to 0
	endif
endif

end
LegoManIAm94
Posts: 10
Joined: 06 Nov 2019, 01:33

Re: Simple Companion function not working

Post by LegoManIAm94 »

I also have another mod called Stronghold Speedrun which is not working in OpenMW. It will appear the samefaction function is not working in OpenMW engine. My companion script uses samefaction function and so does the Stronghold Speedrun mod.

Here is small mod I made which is just a startscript and this is the script. This mod works on the original Morrowind engine but not in OpenMW. The script will simply display "hello world" if the player is not apart of the Fighters Guild.

Code: Select all

begin samefactiontestscript

if ( "hasphat antabolis"->samefaction == 0 )
	messagebox "hello world"
	stopscript samefactiontestscript
endif

end
Stonghold Speedrun mod
https://www.nexusmods.com/morrowind/mods/44588
Attachments
samefactiontest.zip
(1.51 KiB) Downloaded 101 times
User avatar
Capostrophic
Posts: 794
Joined: 22 Feb 2016, 20:32

Re: Simple Companion function not working

Post by Capostrophic »

scrawl had made a copypaste mistake when he submitted a fix for faction importing from ESS and accidentally made the function not return anything. 5 years ago (January 2015). Easy fix, but... No wonder nobody noticed it, I wasn't even aware this function existed.
User avatar
Capostrophic
Posts: 794
Joined: 22 Feb 2016, 20:32

Re: Simple Companion function not working

Post by Capostrophic »

Should be fixed now.
LegoManIAm94
Posts: 10
Joined: 06 Nov 2019, 01:33

Re: Simple Companion function not working

Post by LegoManIAm94 »

Thank you! Will this companion fix be in the next release of OpenMW? And what is the ETA of the next release?
User avatar
Capostrophic
Posts: 794
Joined: 22 Feb 2016, 20:32

Re: Simple Companion function not working

Post by Capostrophic »

Yes it will. No ETA. Perhaps this year.
LegoManIAm94
Posts: 10
Joined: 06 Nov 2019, 01:33

Re: Simple Companion function not working

Post by LegoManIAm94 »

This is no longer a issue after testing this mod in nightly build 2019-11-24. Thank you for fixing this.
Post Reply