Scripting Help

10 posts / 0 new
Last post
Meej-Dar's picture
Meej-Dar
Quest Developer
Joined:
2017-04-21 23:14
Last seen:
6 years 10 months ago

I have this idea for an item that, when you pick it up, it summons a version of yourself behind you that attacks you. I've done this before and it worked, but I don't remember what I did.

begin meej_lute_script
short done

if ( OnActivate == 1 )
    if ( done == 1 )
        Activate
        return
    else
        Set done to 1
        PlaceAtPC PlayerSaveGame 1 128 1
        Activate
        PlayerSaveGame->setfight 100
        Journal meej_Quest 30
    endif
endif

End

The script won't compile because it says the reference object PlayerSaveGame could not be found. I tried the placeatpc playersavegame and the playersavegame->setfight 100 on the console in-game and it worked perfectly, but the script itself doesn't work. Before I post this, I'm going to try loading Tribunal and Bloodmoon in to see if that works. Yeah, that didn't work. Can anyone help? I tried using Player instead of PlayerSaveGame, but it just put the level 1 player character behind me, and he didn't have anything that I had. The purpose of this is to put a carbon copy of yourself behind you for you to fight, including all the spells, weapons and armor you have.

Kevaar's picture
Kevaar
Developer EmeritusQuest Developer
Joined:
2016-01-19 19:35
Last seen:
1 year 6 months ago

We couldn't figure it out either for the Face Stealer quest, which is why I had to redo the quest design. With a quick glance around the internet, some suggested using a combination of MWSE and PCMesh, but if this is for a showcase, would kind of defeat the purpose since we don't use those mods...

I did find this nugget of gold (see the caption): http://imgur.com/KSWjDdU

Meej-Dar's picture
Meej-Dar
Quest Developer
Joined:
2017-04-21 23:14
Last seen:
6 years 10 months ago

The thing is I've done it before. And it's worked. In-game. I tested it out, didn't think it would work, and I killed myself. I just... I can't remember how I did it...

Meej-Dar's picture
Meej-Dar
Quest Developer
Joined:
2017-04-21 23:14
Last seen:
6 years 10 months ago

I was able to get it to work for placing the player behind yourself, but he's not attacking yet.

EDIT: I got a version of it to work. You just have to talk to yourself. Don't much like that, but whatever works, right?

Rot's picture
Rot
Quest Developer
Joined:
2014-03-16 17:45
Last seen:
1 year 3 months ago

There are issues with duplicating the player which makes it impossible to do in TR,
besides the fact that it duplicates the whole intenvory, referring to it by script ("PlayerSaveGame->") should only work on the first instance ever spawned in the game (unless perhaps it gets deleted before any other is created), which makes it a major source of incompatibilities.

Meej-Dar's picture
Meej-Dar
Quest Developer
Joined:
2017-04-21 23:14
Last seen:
6 years 10 months ago

The only issues I've found with referring to PlayerSaveGame in a script is that it doesn't work. But referring to Player does. It seems to place the version of the player that was last saved, with all the items in your inventory that were present at the last save.

Rakanishu's picture
Rakanishu
Quest Developer
Joined:
2016-09-15 23:12
Last seen:
10 months 3 weeks ago

Can you post/send me a link to your latest script? Sounds interesting.

Meej-Dar's picture
Meej-Dar
Quest Developer
Joined:
2017-04-21 23:14
Last seen:
6 years 10 months ago

Yeah, of course.

begin meej_lute_script
short done

if ( OnActivate == 1 )
    if ( done == 1 )
        Activate
        return
    else
        Set done to 1
        PlaceAtPC Player 1 128 1
        Activate
        Journal meej_Quest 30
    endif
endif

End

In order for your mirror self to attack you, you will need to talk to him/her and set up the dialogue so they end up attacking you. I like for the mirror version to think of you as a strange illusion.

Rakanishu's picture
Rakanishu
Quest Developer
Joined:
2016-09-15 23:12
Last seen:
10 months 3 weeks ago

You might be able to ForceGreeting the player, StartCombat in a cell-specific greeting, and then automatically close the dialogue window with some ToggleMenus.  I'll try to find a script I used once that had ToggleMenus + ForceGreeting.

Edit: It looks like the NPC is labeled "PlayerSaveGame", but I couldn't get PlayerSaveGame->StartCombat player to work in my very limited testing.  Interestingly enough, the NPC auto-attacks you in OpenMW.  Regardless, here's a "MenuExit" script that could be started after StartCombat in the cell-specific greeting (thanks to Greatness7 for this):

begin MenuExit

if ( MenuMode )
    StopScript MenuExit
    MenuTest 0
else
    ToggleMenus
endif

end

You'd probably have to add another ToggleMenus right after the first one.

Rot's picture
Rot
Quest Developer
Joined:
2014-03-16 17:45
Last seen:
1 year 3 months ago

I thought I'd once managed to refer to a spawned double by adding 00000000 to the ID but must've had the console targetting it instead,
it must be hardcoded as exception, no matter how many you spawn they seem to get the same ID in the save. Maybe something with voice results (Hello) can be done to get a script started on them without requiring the player to talk first...