Larian Banner: Baldur's Gate Patch 9
Previous Thread
Next Thread
Print Thread
Page 2 of 3 1 2 3
Joined: Apr 2013
N
addict
Offline
addict
N
Joined: Apr 2013
Quote

Roderick resurrected immediately after being killed, but neither of the two spiders summoned were resurrected even after their timer ran out.

I tested whether them dying mid-summon changed anything, and they still remained dead. For whatever reason, summons cannot be resurrected. Is there any proof to the contrary?


My bad, it seems that summons are exempt from char triggers.
They are characters though, as they are stored under the Characters node in savegames like any other character.

Originally Posted by FromHolland
magic, great news smile howd you do that?, as the only thing I can think of is the 3dscreenprint and those cant "capture" the skeleton(but im no coder) Good luck man, eagerly awaiting your release!


Mostly by reverse engineering the .GR2 format (as much as i can anyway).
A teaser: :P
https://dl.dropboxusercontent.com/u/32263228/dos/gr2/gr2_skel_export.png

Originally Posted by FromHolland

On-topic again: If there is a way to give a character a script (for all enemies) you can use the spawncharacter on the died character( CharacterGetTemplate(_Me) ) etc.
I do not know what a scriptframe is for CharacterSetScriptframe(CHARACTER _Character,STRING _Scriptframe), someone can shed some light on this?


CharacterSetScriptframe selects the active script frame from the behavior script.
Like:
CharacterSetScriptframe(CHARACTER_CYS_Evelyn,"DeliverStoneToPatient");

... will trigger this:
Code
SCRIPTFRAME DeliverStoneToPatient
ACTIONS
	IF "c1"
		IsEqual(%targetPatient,CHARACTER:CYS_ThelyronPatientSteven_e0da7c51-0ec0-491d-8d9a-85ff09511989)
	THEN
		CharacterMoveTo(%bed_04,0)
	ELSE
		CharacterMoveTo(%bed_03,0)
	ENDIF 


The bad news is that each character has a separate behavior script, so you'd have to rewire all of them separately.
The good news is that most of them #includes State_Manager.charScript, so modifying that may be a good starting point.
The really bad news is that (AFAIK) the state manager of dead characters is disabled, so switching to a "respawn me" behavior won't work for them frown


As an alternative maybe we could create a dummy "spawner" NPC, pass the to-be-resurrected NPC with CharacterSetVarCharacter, then set a behavior flag so that the behavior script is triggered, the script reads the characters position and respawns it like this:
Code
CharacterGetTemplate(_Char, _Template);
GetPosition(_Char, _Pos);
SpawnCharacter(_Spawned, _Template, _Pos, 0);
CharacterDestroy(_Char);

Joined: Jul 2014
R
Rhidian Offline OP
addict
OP Offline
addict
R
Joined: Jul 2014
Alright, so I have a WIP version that is satisfactory enough for me to share:
http://www.mediafire.com/download/x7hha5sa3x3p7c1/RespawningEnemiesWIP.zip

I have removed the experience points upon killing respawned NPCs for now, which means that respawned NPCs will not give any additional exp upon death. I think I have an idea on how to implement experience points correctly, but I have to try implementing it first.

Full story code for this WIP version is here:

INIT section:
Code
DB_RespawnEnabled(1);


KB Section:
Code
IF
CharacterDied(_Character)
AND
DB_RespawnEnabled(1)
AND
NOT _Character.isPlayer()
AND
Time(_,_,_TH)
THEN
DB_DeadCharacters(_Character, _TH);

IF
CharacterEnteredRegion(_Character,_)
AND
_Character.isPlayer()
THEN
ProcResurrectCharacters();

PROC
ProcResurrectCharacters()
AND
Time(_,_,_TH)
AND
DB_DeadCharacters(_Character, _deadTime)
AND
IntegerSubtract(_TH, _deadTime, _delta)
AND
_delta >= 1
THEN
CharacterResurrect(_Character);
NOT DB_DeadCharacters(_Character, _deadTime);
ProcResurrectCharacters();

IF
CharacterCreationFinished(CHARACTER_NULL)
AND
CurrentLevel(_Lvl)
AND
DB_CharacterCreationLevels(_Lvl)
THEN
CharacterAddSkill(CHARACTER_Player1, "Shout_RespawnEnable");
CharacterAddSkill(CHARACTER_Player1, "Shout_RespawnDisable");
CharacterAddSkill(CHARACTER_Player2, "Shout_RespawnEnable");
CharacterAddSkill(CHARACTER_Player2, "Shout_RespawnDisable");


IF
CharacterUsedSkill(_Char, "Shout_RespawnEnable", _)
AND
DB_RespawnEnabled(0)
THEN
NOT DB_RespawnEnabled(0);
DB_RespawnEnabled(1);

IF
CharacterUsedSkill(_Char, "Shout_RespawnDisable", _)
AND
DB_RespawnEnabled(1)
THEN
NOT DB_RespawnEnabled(1);
DB_RespawnEnabled(0);



Enemies will respawn upon changing maps if Respawn is Enabled, and only if it has been at least 1-2 min. since they last died (this time limit is prob. unnecessary, but it's there in case CharacterEnteredRegion doesn't work the way I think it does). Respawn is enabled at the start of the game, and can be switched on/off with the use of the two skills given to the main characters at the start.

I have already encountered some sort of bug. When I Rift traveled to Cyseal from the Homestead, the skeleton group by the tutorial dungeon (who at that point was on their third life) did not show up in the combat order bar at the top even though they were clearly in combat and were taking turns in order.

Edit:
Well, my attempt at making dummy NPC/scripts that spawn/kill characters for exp failed to do anything. I tried modifying a character on one of the test levels with a charScript that does stuff when characters die (in tandem with a Story script).

Last edited by Rhidian; 01/09/14 02:25 AM.
Joined: Jul 2014
journeyman
Offline
journeyman
Joined: Jul 2014
Rhidian, great work man

I tested using templates for exp and treasures for you enabled using:

IF
CharacterTemplateDied(_UUID)
THEN
CharacterCreateAtTrigger(TRIGGER_Point,_UUID,0);

only need to figure out how to teleport that UUID to the position of the dead character

Joined: Jul 2014
journeyman
Offline
journeyman
Joined: Jul 2014
well here is the simple charscript for respawning on init (so reload), attach that to some charscript that most npc uses and its ready to go if you want exp and treasure drop

Code
deleted, check new post to avoid confusion :)


Last edited by FromHolland; 02/09/14 08:49 PM.
Joined: Jul 2014
R
Rhidian Offline OP
addict
OP Offline
addict
R
Joined: Jul 2014
I think that would have the side effect of exponentially respawning enemies the more you kill them. But it's close, and with a few tweaks I think it might just be what I need.

Joined: Jul 2014
journeyman
Offline
journeyman
Joined: Jul 2014
Originally Posted by Rhidian
I think that would have the side effect of exponentially respawning enemies the more you kill them. But it's close, and with a few tweaks I think it might just be what I need.
yup, you're right, just tested it. Maybe add a counter and destroy all spawned characters until there is only 1?

edit:
updated previous post which had the code, now it has a counter so it will spawn a dead char, and only spawns it again when you killed the new spawn

Last edited by FromHolland; 01/09/14 04:59 PM.
Joined: Jul 2014
R
Rhidian Offline OP
addict
OP Offline
addict
R
Joined: Jul 2014
I'm trying to do an optional respawn version, but I'm running into some issues.
First, the code:

Character Script code (under DefaultCharacter)
Code
INIT
INT:%canRespawn=0


EVENT Respawn
VARS
CHARACTERTEMPLATE:_myTemplate
FLOAT3:_myPos
ON
OnInit()
ACTIONS
IF "c1&c2&c3&c4"
IsEqual(%canRespawn, 1)
CharacterIsDead(__Me)
GetPosition(__Me, _myPos)
CharacterGetTemplate(__Me, _myTemplate)
THEN
SpawnCharacter(_, _myTemplate, _myPos, 1)
Set(%canRespawn, 0)
CharacterSetOffStage()
CharacterDestroy(__Me)
ENDIF


Story (always on for now, can change to be conditional later)
Code
IF
CharacterDied(_Char)
THEN
CharacterSetVarInteger(_Char, "canRespawn", 1);



The problem seems to be that the spawned characters are not leaving corpses that persist through a save game/load, meaning that they don't spawn upon loading.

1. I kill the original enemies on the map.
2. I save and then load
3. The original enemies have spawned Generation 1, which have the appropriate stats and such
4. I kill Generation 1, and then save and load
5. No Generation 2 is created, and the corpses of Generation 1 are nowhere to be seen.

My guess is that the newly spawned characters are either not triggering the CharacterDied event or they aren't saving for some reason.

By the way, does anyone know what the difference between playSpawn=1 and playSpawn=0 for the CharacterSpawn command is?

Edit:
Alright, after some debugging it seems that spawned characters do not trigger the CharacterDied event. I suppose the game is treating them like summons.

Last edited by Rhidian; 01/09/14 06:40 PM.
Joined: Apr 2013
N
addict
Offline
addict
N
Joined: Apr 2013
Indeed, stuff created via SpawnCharacter is the same as creating them via summoning skills, so they aren't persistent frown

... meaning that there are no viable options for respawns right now?

Joined: Jul 2014
R
Rhidian Offline OP
addict
OP Offline
addict
R
Joined: Jul 2014
While the corpses of spawned characters aren't persistent, the corpse of the original character *is* persistent, and it should be possible to get it to spawn multiple times.

I'm thinking that there needs to be an unholy alliance between the CharacterScripts and Story Scripts to make this happen.

I just tried this and it didn't work-

Character Script-
Code
INIT
INT:%canRespawn=0
CHARACTER:%parentCharacter=null


EVENTS
EVENT Respawn
VARS
CHARACTERTEMPLATE:_myTemplate
FLOAT3:_myPos
CHARACTER:_spawned
ON
OnInit()
ACTIONS
IF "c1&c2&c3&c4"
IsEqual(%canRespawn, 1)
CharacterIsDead(__Me)
GetPosition(__Me, _myPos)
CharacterGetTemplate(__Me, _myTemplate)
THEN
SpawnCharacter(_spawned, _myTemplate, _myPos, 1)
Set(%canRespawn, 0)
CharacterVisible(__Me, 0)
CharacterEvent(__Me, "PrepRespawnTarget")
CharacterEvent(_spawned, "PrepRespawnSource")
ENDIF
	
EVENT PrepRespawn
ON
OnDie(__Me,_,_,_)
ACTIONS
IF "!c1"
IsEqual(%parentCharacter, null)
THEN
CharacterEvent(__Me, "SetRespawnChild")
CharacterEvent(%parentCharacter, "SetRespawnParent")
ENDIF


Story-
Code
IF
CharacterDied(_Char)
THEN
CharacterSetVarInteger(_Char, "canRespawn", 1);

IF
CharacterEvent(_Char, "PrepRespawnTarget")
THEN
DB_TempRespawnParent(_Char);

IF
CharacterEvent(_Char, "PrepRespawnSource")
AND
DB_TempRespawnParent(_parent)
THEN
CharacterSetVarCharacter(_Char, "parentCharacter", _parent);
NOT DB_TempRespawnParent(_parent);

IF
CharacterEvent(_child, "SetRespawnChild")
AND
CharacterGetPosition(_child, _x, _y, _z)
THEN
DB_TempPos(_x, _y, _z);

IF
CharacterEvent(_parent, "SetRespawnParent")
AND
DB_TempPos(_x, _y, _z)
THEN
CharacterTeleportToPosition(_parent, _x, _y, _z, "NinjaTeleportRespawn");
CharacterSetVarInteger(_parent, "canRespawn", 1);
NOT DB_TempPos(_x, _y, _z);



The problem I think is that the spawned stuff doesn't trigger the OnDie event either, meaning that none of the other stuff happens (SetVisible to 0 didn't appear to work on corpses either).

Now that I think about it a bit more, I think the solution would need to be the following:
1. If the original character is dead, it should always spawn a character at it's current position OnInit(). This is because the spawned characters will go away upon reload/map changes

2. Should a spawned character die, somehow it needs to teleport the original character to its position so that when it next spawns another character, it's where the character 'died' last

The problem is number 2 I think, since spawned characters can't trigger anything upon death. Maybe I could do something with OnDamage?

Edit:
By the way, what is the proper way to overwrite a Main campaign script (like DefaultCharacter)? I think I'm doing it somewhat wrong, because while my changes work the game editor throws a ton of errors and I can only Build the Story once per Editor load.

Last edited by Rhidian; 01/09/14 08:37 PM.
Joined: Jul 2014
R
Rhidian Offline OP
addict
OP Offline
addict
R
Joined: Jul 2014
The game doesn't seem to like throwing events from spawned characters frown

I think that I will just keep it simple and have the original characters spawn copies of themselves wherever they die at if the canRespawn flag is active.

Joined: Jul 2014
journeyman
Offline
journeyman
Joined: Jul 2014
Originally Posted by Rhidian
The game doesn't seem to like throwing events from spawned characters frown

I think that I will just keep it simple and have the original characters spawn copies of themselves wherever they die at if the canRespawn flag is active.
yeh some weird things going on, I tried "OnDie(%Spawn,_,_,_)" (updated post so you can have a look, maybe you can improve mine) but that works somehow. It breaks when the new spawn is loaded twice on oninit.

Last edited by FromHolland; 01/09/14 10:56 PM.
Joined: Jul 2014
R
Rhidian Offline OP
addict
OP Offline
addict
R
Joined: Jul 2014
I don't think I can get it spawned characters to work satisfactorily as a toggleable respawn frown

OnDie is bugging out a lot for me; I just got a crash on my last test. I'm 99% sure I'm overwriting DefaultCharacter incorrectly though; how do you get changes to work on an already-existing character without changing their Template?

Joined: Jul 2014
journeyman
Offline
journeyman
Joined: Jul 2014
Originally Posted by Rhidian
I don't think I can get it spawned characters to work satisfactorily as a toggleable respawn frown

OnDie is bugging out a lot for me; I just got a crash on my last test. I'm 99% sure I'm overwriting DefaultCharacter incorrectly though; how do you get changes to work on an already-existing character without changing their Template?
I can help with overwriting defaultcharacter. Here are my files:
Code
deleted, check new post to avoid confusion :)

Basically you need to redirect the game to the correct path of defaultcharacter.charscript

edit: to be sure I tested that for a main campaign mod (what you are after), using the same approach and it was all working. I need to test it further to see why it breaks only after the second oninit. It seems like the game doesnt recognise the spawned char as %Spawned anymore after the second oninit and doesnt trigger the ondie event. Which is weird because it should do that...

Last edited by FromHolland; 02/09/14 08:47 PM.
Joined: Jul 2014
enthusiast
Offline
enthusiast
Joined: Jul 2014
Originally Posted by Rhidian
By the way, does anyone know what the difference between playSpawn=1 and playSpawn=0 for the CharacterSpawn command is?


I think that determines whether a spawn animation (should one be available) is used upon spawning. So, for example, whether a zombie will spawn by digging up out of the ground (=1), or if it will simply pop into existence(=0).


Escape From Smalcatraz: Steam/Nexus. Forum thread.
Joined: Jul 2014
journeyman
Offline
journeyman
Joined: Jul 2014
Working Version (update, forgot to save :), update 2: .pak file got corrupted somehow)
http://speedy.sh/ZBJ4X/infiniterespawn.pak

Copy to ..\Documents\Larian Studios\Divinity Original Sin\Mods

This mod will respawn all characters when they die on OnInit(). In short this mean that when you load a save game or enter a level all characters will respawn and this allows you to battle them again for loot and exp

If something is not working properly, let me know.

Code used:
Code
/////////////////////////////////////////////////////
INIT
CHARACTER:__Me
CHARACTER:%Spawn= null
/////////////////////////////////////////////////////
EVENTS
/////////////////////////////////////////////////////
EVENT CopyDied
ON
	OnDie(%Spawn,_,_,_)
ACTIONS
	Set(%Spawn = null)

EVENT ResurrectForReset
ON 
	OnInit()
ACTIONS
	IF "c1"
		IsEqual(%Spawn,1)
	THEN
		CharacterResurrect(__Me)
		CharacterSetOffStage()
		CharacterDie(__Me)
	ENDIF

EVENT DieAgainForReset
ON
	OnDie(__Me,_,_,_)
ACTIONS
	CharacterSetOnStage()
	Set(%Spawn = null)

EVENT CopyTheDead
VARS
	CHARACTERTEMPLATE:_template
	FLOAT3:_MyPosition
ON 
	OnInit()
ACTIONS
	IF "c1&c2&c3&c4"
		IsEqual(%Spawn = null)
	        CharacterIsDead(__Me)
		CharacterGetTemplate(__Me,_template)
		GetPosition(__Me,_MyPosition)
	THEN
		SpawnCharacter(%Spawn,_template,_MyPosition,0)
	ENDIF
/////////////////////////////////////////////////////

Last edited by FromHolland; 03/09/14 10:57 AM.
Joined: Sep 2014
V
stranger
Offline
stranger
V
Joined: Sep 2014
Hi... Hum, like the idea... I'm not a code wiz so I'm just going to ask...

Is it possible to do respawn on game time base? Like... a week? 168h (7 days) or 120h (5 days?)?


Hey... Class and Alignment doesn't work well... I'm a Chaotic Good Rogue... Oh, wait, this isn't D&D... :p
Joined: Jul 2014
R
Rhidian Offline OP
addict
OP Offline
addict
R
Joined: Jul 2014
Thanks for the help FromHolland, I think I finally have a fix on how to overwrite the Main Campaign charScripts successfully (even if it throws a few errors).

Here's the method (if I got it correct)-

1. Create a charScript in your mod's Public/(Mod Name)/Scripts/ folder that has the same name and contents as the charScript you're trying to overwrite (ie DefaultCharacter.charScript if you're overwriting DefaultCharacter, copy/pasting the contents as well)

2. In the Editor in the Resources Manager, create a Package for your mod

3. In the Resources Manager, click the Main folder and find the script you're trying to overwrite. Right click that and click "Copy to my mod". In the window that pops up, select the package created in Step 2 (should be auto-filled)

4. In the Resources Manager, click your Package and the script that is now there. With the Sidebar (from View), change the SourceFile path from Public/Main/Scripts/(original script file) to Public/(Mod Name)/Scripts/(your script file)

5. You can now edit your mod's file and have it overwrite successfully (although a lot of errors may still be thrown when saving changes)


I'm pretty close to where I want this mod to be, but there's still one big issue that I'm hoping to resolve (more of an annoyance really, not a CTD error). Here's what I have:

Modified parts of DefaultCharacter
Code
INIT
INT:%canRespawn=0
CHARACTER:%spawn=null
FLOAT3:%spawnPos=null


EVENTS
EVENT RespawnCharacter
VARS
CHARACTERTEMPLATE:_root
FLOAT3:_myPos
ON
OnInit()
ACTIONS
IF "c1&c2&c3&c4"
IsEqual(%canRespawn, 1)
CharacterIsDead(__Me)
CharacterGetTemplate(__Me, _root)
GetPosition(__Me, _myPos) 
THEN
IF "c1"
IsEqual(%spawnPos, null)
THEN
Set(%spawnPos, _myPos)
ENDIF
SpawnCharacter(%spawn, _root, %spawnPos, 0)
ENDIF


EVENT ProgenyDeath
ON
OnDie(%spawn,_,_,_)
ACTIONS
GetPosition(%spawn, %spawnPos)
Set(%spawn,null)
Set(%canRespawn, 0)
CharacterEvent(__Me, "CheckForRespawn")



Story code:
Code
IF
CharacterEvent(_Char, "CheckForRespawn")
THEN
CharacterSetVarInteger(_Char, "canRespawn", 1);


The way it works is that when the original character dies the first time, they set the %spawnPos to _myPos (where they died) so that the next progeny will respawn where they died.

...I just realized, in the middle of writing this post, that this code shouldn't work. canRespawn starts at 0, and theoretically the it shouldn't be spawning any other characters until canRespawn is set to 1. The only thing that sets it to 1 though is the OnDie event which should only be triggering when the spawned characters die.

In anycase, the way it works in-game from my testing is that the characters die, and on reload spawn characters where they died. If the spawned characters move and then die, the next time that they are respawned they are where they died last.

The biggest issue is that there is a huge lag spike when any character dies. I am thinking that it is due to the game processing the OnDie event. The problem, though, is that it seems to be doing this when the original characters die as well. With what I noted above, it seems as if it's doing the OnDie event whenever the character dies, regardless of whether it's the original or the spawned character.

@Vortaka- Whenever I get this to work correctly, the time between respawns can be changed. I am hooking the canRespawn variable to a Story event so that I can check all of the additional conditions as well when a character dies to see if they can respawn. Right now in my test builds it's set to respawn all of the time, but later on it should incorporate both a time delay and the skill toggle.

Edit:
After more testing, it seems that the OnDie command triggers whenever the character with the charScript dies, even if %spawn is a different character. Either that or a character of null defaults to __Me instead.

Last edited by Rhidian; 03/09/14 08:36 AM.
Joined: Jul 2014
R
Rhidian Offline OP
addict
OP Offline
addict
R
Joined: Jul 2014
With a simple change of making %spawn initialize as __Me, I got it to work. Better yet, it eliminated the lag issue upon death as well.

Here is Version 2 of the WIP:
http://www.mediafire.com/download/31a9i32pm8ccd4f/RespawningEnemiesWIPv2.zip

And the code-

DefaultCharacter changes:
Code
INIT
INT:%canRespawn=1
CHARACTER:%spawn=__Me
FLOAT3:%spawnPos=null


EVENTS
EVENT RespawnCharacter
VARS
CHARACTERTEMPLATE:_root
FLOAT3:_myPos
ON
OnInit()
ACTIONS
IF "c1&c2&c3&c4"
IsEqual(%canRespawn, 1)
CharacterIsDead(__Me)
CharacterGetTemplate(__Me, _root)
GetPosition(__Me, _myPos) 
THEN
IF "c1"
IsEqual(%spawnPos, null)
THEN
Set(%spawnPos, _myPos)
ENDIF
SpawnCharacter(%spawn, _root, %spawnPos, 0)
ENDIF


EVENT ProgenyDeath
ON
OnDie(%spawn,_,_,_)
ACTIONS
IF "!c1"
IsEqual(__Me, %spawn)
THEN
GetPosition(%spawn, %spawnPos)
Set(%spawn,null)
Set(%canRespawn, 0)
CharacterEvent(__Me, "CheckForRespawn")
ENDIF



Story Code:
INIT Section-
Code
DB_RespawnEnabled(1);


KB Section-
Code
IF
CharacterCreationFinished(CHARACTER_NULL)
AND
CurrentLevel(_Lvl)
AND
DB_CharacterCreationLevels(_Lvl)
THEN
CharacterAddSkill(CHARACTER_Player1, "Shout_RespawnEnable");
CharacterAddSkill(CHARACTER_Player1, "Shout_RespawnDisable");
CharacterAddSkill(CHARACTER_Player2, "Shout_RespawnEnable");
CharacterAddSkill(CHARACTER_Player2, "Shout_RespawnDisable");


IF
CharacterUsedSkill(_Char, "Shout_RespawnEnable", _)
AND
DB_RespawnEnabled(0)
THEN
NOT DB_RespawnEnabled(0);
DB_RespawnEnabled(1);

IF
CharacterUsedSkill(_Char, "Shout_RespawnDisable", _)
AND
DB_RespawnEnabled(1)
THEN
NOT DB_RespawnEnabled(1);
DB_RespawnEnabled(0);

IF
CharacterDied(_Char)
THEN
CharacterSetEvent(_Char, "CheckForRespawn");

IF
CharacterEvent(_Char, "CheckForRespawn")
AND
DB_RespawnEnabled(1)
THEN
CharacterSetVarInteger(_Char, "canRespawn", 1);



Respawn starts off enabled (and for now works for Players as well). Whenever a character dies, they trigger the CharacterDied story event that calls CheckForRespawn, which allows the character to 'respawn' if Respawn is enabled.

When a 'respawned' character dies, the original character updates their %spawnPos variable with the respawned character's position upon death and checks whether or not Respawn is enabled for further generations. If so, then the next respawn occurs where the last one died.

The skills added after Character Creation can be used to toggle respawning on or off. This toggle matters only when the character is killed; if it is On when a character dies, they will respawn even if it's turned Off later after their death.

----
This is really close to what I want my Respawn mod to be. I'm going to see if I can add one more skill-toggle that will cause everything to 'respawn' when used (ie set all dead characters' canRespawn to 1). I'll also include the check so that Players can't be respawned via this method and maybe add a check for Time since the last spawn died.

As it is right now, the original characters' corpse will remain where they died even when they 'respawn'. I have it this way in case there are some key-items that are stored upon the corpses upon death. Are there any such key-items? If not, I could have them SetOffStage so that they are invisible after respawning.

Edit:
It seems that I left the %canRespawn initialized as 1 instead of 0. This will have the side-effect of making everything respawn at least once even if the Respawn toggle is off. This will be changed in the next WIP version.

Last edited by Rhidian; 03/09/14 09:36 AM.
Joined: Jul 2014
journeyman
Offline
journeyman
Joined: Jul 2014
Quote
Thanks for the help FromHolland, I think I finally have a fix on how to overwrite the Main Campaign charScripts successfully (even if it throws a few errors).

Here's the method (if I got it correct)-

1. Create a charScript in your mod's Public/(Mod Name)/Scripts/ folder that has the same name and contents as the charScript you're trying to overwrite (ie DefaultCharacter.charScript if you're overwriting DefaultCharacter, copy/pasting the contents as well)

2. In the Editor in the Resources Manager, create a Package for your mod

3. In the Resources Manager, click the Main folder and find the script you're trying to overwrite. Right click that and click "Copy to my mod". In the window that pops up, select the package created in Step 2 (should be auto-filled)

4. In the Resources Manager, click your Package and the script that is now there. With the Sidebar (from View), change the SourceFile path from Public/Main/Scripts/(original script file) to Public/(Mod Name)/Scripts/(your script file)

5. You can now edit your mod's file and have it overwrite successfully (although a lot of errors may still be thrown when saving changes)

1. I used a different approach. I believe you are getting errors as I believe you now have 2 different defaultcharacter.charscripts and the game tries to read both of them. Unpak the game .pak files and search for this file ..\Divinity - Original Sin\Data\Public\Main\Content\Assets\Scripts\[PAK]_BaseScripts\BaseScripts.lsb. Copy that file to same path in your public mod folder and open it with lstools. Edit the path of DefaultCharacter to the new one that is in your public mod map.

2. The reason I used this code
Code
EVENT ResurrectForReset
ON 
	OnInit()
ACTIONS
	IF "c1"
		IsEqual(%Spawn,1)
	THEN
		CharacterResurrect(__Me)
		CharacterSetOffStage()
		CharacterDie(__Me)
	ENDIF

EVENT DieAgainForReset
ON
	OnDie(__Me,_,_,_)
ACTIONS
	CharacterSetOnStage()
	Set(%Spawn = null)

was for the sole purpose of not respawning multiple copies ever. As it resurrects __Me(The original) every time and kills it again. This resets the %Spawn to = null so the game recognises that the copy is in fact a %Spawn. As I wrote before the game does not recognise the copy as a %Spawn anymore when I Save, Load, Save, Load, which breaks everything (but not with that code). So are you sure your version never breaks? If it doesnt you're almost there! Now add a new and shiny icon to the respawn Skill and you're all set smile

edit: whoops, check the updated post above for the correct mod file, so you can have a look at how it works smile

Last edited by FromHolland; 03/09/14 11:18 AM.
Joined: Jul 2014
R
Rhidian Offline OP
addict
OP Offline
addict
R
Joined: Jul 2014
Well, the test I did to see that it works was as follows:
1. At the intro fight with the three skeletons, kill them all, move away from them and save.
2. Reload. New enemies have spawned on top of the corpses of the original enemies.
3. Let the new enemies move prior to killing them. Move away and save.
4. Reload. With my code above, enemies spawned at the location that the last ones dies at (not on top of the original corpses).
5. Disable the Respawn toggle. Kill the enemies, save, and then reload. They should be gone.

I suppose I still need to check if consecutive saves/reloads without killing does anything, but I expect it not to. They should be spawning a creature every time since the last generation disappears upon reload (so there is only ever 1 creature spawned per original creature).

Page 2 of 3 1 2 3

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.5