Larian Studios
Posted By: TheMasterRat Standalone project template - 10/01/15 04:06 AM
I have been talking to Baardvaark lately and he wanted a basic project setup. I've made a simple one that includes the MAIN scripts ( Affinity, attitude, stats etc etc...).

Here it is!
Nexus Mod Link


Posted By: Burgee Re: Standalone project template - 10/01/15 04:43 AM
Definitely a good idea. A lot of my trip ups early were getting things set up.
Posted By: Baardvark Re: Standalone project template - 10/01/15 05:29 AM
So far the template will contain:

Basic story script systems like start goals, attitude and ownership so that if you attack or steal from people, they'll respond.

Basic default dialogs when you attack people and the like.

The translated key string localizations files (so that books have their text, for example)

The alignment folder so combat functions properly

The character creation level and class templates

Stats folder with excels and text files so you don't have to unpack main to mod characters and items.


And probably some other stuff I'm forgetting. I hope this helps some people out. Thanks to The_Master_Rat for putting most of it together (especially the scripts)!
Posted By: Windemere Re: Standalone project template - 10/01/15 01:32 PM
Nice idea, thanks for working on this.
Posted By: Baardvark Re: Standalone project template - 11/01/15 04:14 AM
Another cool thing we'll be including is an awesome script that TheMasterRat developed which generates flags according to your attributes. So if you have 8 strength, it'll generate the flag "Strength8" as well all the preceding Strengths down to Strength5. This code works for attributes up to 20, and could easily expand by adding more numbers in the AttributeValues database. So in the dialog of a global character you could make the flag "Strength8" a condition for a certain keyword (such as a "Flex" keyword where you try to impress or intimidate someone with a show of strength).

Here's the code. There might still be some bugs, but it seems to work well. Note that in this current iteration, it will check for both players when you enter a dialog. So even if player1 initiates a dialog across the map from player2, player1 will benefit from player2's attributes for generating strings.

TheMasterRat also has code for traits so that if you have certain traits, a string will generate and you'll be able to use those in dialog. E.G., you're spiritual so you'll have more dialog options when talking to someone religious. We're going to bug test that a bit more and then we'll post the code for that.

Code
INIT

DB_CharacterToCount(CHARACTER_Player1);
DB_CharacterToCount(CHARACTER_Player2);

DB_AttributeNames("Strength");
DB_AttributeNames("Intelligence");
DB_AttributeNames("Constitution");
DB_AttributeNames("Speed");
DB_AttributeNames("Perception");
DB_AttributeNames("Dexterity");

DB_AttributeValues(5,"5");
DB_AttributeValues(6,"6");
DB_AttributeValues(7,"7");
DB_AttributeValues(8,"8");
DB_AttributeValues(9,"9");
DB_AttributeValues(10,"10");
DB_AttributeValues(11,"11");
DB_AttributeValues(12,"12");
DB_AttributeValues(13,"13");
DB_AttributeValues(14,"14");
DB_AttributeValues(15,"15");
DB_AttributeValues(16,"16");
DB_AttributeValues(17,"17");
DB_AttributeValues(18,"18");
DB_AttributeValues(19,"19");
DB_AttributeValues(20,"20");

KB

IF 
DialogStarted(_DialogName,_InstanceID)
THEN
ProcTriggerAttributeCheck();

IF
DialogStartRequested(_Character1,_Character2)
THEN
ProcTriggerAttributeCheck();

PROC
ProcTriggerAttributeCheck()
AND
DB_AttributeNames(_AttributeName)
AND
DB_CharacterToCount(_Character)
AND
CharacterGetAttribute(_Character,_AttributeName,_AttributeValue)
THEN
SetAttributeFlag(_AttributeName,_AttributeValue);


PROC
SetAttributeFlag((STRING)_Attribute,(INTEGER)_Value)
THEN
ProcGetValueAsString(_Attribute,_Value);

//This part generates a string and then subtracts 1 from the attribute value
 so that it will then generate all the appropriate strings down to 5. So if you have Strength8, it will generate "Strength8,"
 then "Strenth7," then "Strength6," etc.

PROC
ProcGetValueAsString((STRING)_Attribute,(INTEGER)_Value)
AND
DB_AttributeValues(_Value,_ValueAsString)
AND
StringConcatenate(_Attribute,_ValueAsString,_StringResult)
AND
NOT DB_EventSet(_StringResult)
AND
IntegerSubtract(_Value,1,_ValueMinusOne)
THEN
GlobalSetEvent(_StringResult);
DB_EventSet(_StringResult);
ProcGetValueAsString(_Attribute,_ValueMinusOne);


Ability code:

Code
DB_Abilities("WarriorLore");
DB_Abilities("RangerLore");
DB_Abilities("SingleHanded");
DB_Abilities("TwoHanded");
DB_Abilities("Blackrock");
DB_Abilities("Bow");
DB_Abilities("Crossbow");
DB_Abilities("Shield");
DB_Abilities("Reflexes");
DB_Abilities("ArmorMastery");
DB_Abilities("Sourcery");
DB_Abilities("Telekinesis");
DB_Abilities("Willpower");
DB_Abilities("FireSpecialist");
DB_Abilities("WaterSpecialist");
DB_Abilities("AirSpecialist");
DB_Abilities("EarthSpecialist");
DB_Abilities("Repair");
DB_Abilities("Sneaking");
DB_Abilities("Pickpocket");
DB_Abilities("Lockpicking");
DB_Abilities("Loremaster");
DB_Abilities("Crafting");
DB_Abilities("Barter");
DB_Abilities("Charm");
DB_Abilities("Intimidate");
DB_Abilities("Reason");
DB_Abilities("Charisma");
DB_Abilities("Leadership");
DB_Abilities("Luck");
DB_Abilities("DualWielding");

DB_AbilityLevel(0,"0");
DB_AbilityLevel(1,"1");
DB_AbilityLevel(2,"2");
DB_AbilityLevel(3,"3");
DB_AbilityLevel(4,"4");
DB_AbilityLevel(5,"5");


DB_CharacterToCount(CHARACTER_Player1);
DB_CharacterToCount(CHARACTER_Player2);

IF 
	DialogStarted(_DialogName,_InstanceID)
THEN
	ProcTriggerAbilityCheck();

IF
	DialogStartRequested(_Character1,_Character2)
THEN
	ProcTriggerAbilityCheck();

PROC
	ProcTriggerAbilityCheck()
AND
	DB_Abilities(_Ability)
AND
	DB_CharacterToCount(_Character)
AND
	CharacterGetAbility(_Character,_Ability,_AbilityLevel)
THEN
	ProcSetAbilityFlag(_Ability,_AbilityLevel);


PROC
	ProcSetAbilityFlag((STRING)_Ability,(INTEGER)_AbilityLevel)
AND
	DB_AbilityLevel(_AbilityLevel,_AbilityLevelAsString)
AND
	StringConcatenate(_Ability,_AbilityLevelAsString,_StringResult)
AND
	IntegerSubtract(_AbilityLevel,1,_AbilityLevelMinusOne)
AND
	NOT DB_AbilitySet(_StringResult)
THEN
	GlobalSetEvent(_StringResult);
	DB_AbilitySet(_StringResult);
	ProcSetAbilityFlag(_Ability,_AbilityLevelMinusOne);













Posted By: TheMasterRat Re: Standalone project template - 11/01/15 04:16 AM
This is work in progress, I'll include this script with the template project. It will also include two similar scripts for Abilities and Traits that will work the same way.

I just want to make sure it works properly before sending it to sea :P
Posted By: TheMasterRat Re: Standalone project template - 12/01/15 12:41 AM
I have added a link to the mod, I've edited the first post to add the link.
Posted By: SniperHF Re: Standalone project template - 05/03/15 02:47 AM
Hi, I have a question about the Attribute check script.

I was looking at making one of these and see you already have one but just want to understand how it works before using it. Does this run every time you initiate a dialog?
Posted By: Baardvark Re: Standalone project template - 06/03/15 02:01 AM
Yes, it just checks Player1 and Player2's stats and generates global flags every time dialog is either initiated (from a trigger, for example) or requested, like when you click on someone. Probably unnecessary redundancy, because presumably initiated dialog covers all the possibilities, but I'd keep both to be safe.

If you want to make companion stats to count, you'll probably have to add some code like:

IF
DB_Companion(_Companion)
THEN
DB_CharacterToCount(_Companion)

And also the NOT version for when you dismiss a companion. We don't have companions count because it feels like it'd be too easy for people to access essentially every dialog option by spreading skills and attributes across the four characters.
Posted By: ALF Re: Standalone project template - 06/03/15 08:08 AM
You could modify the script to iterate over the isPlayer database. Companions that are inside your party are also added to that database.

Good job, otherwise!
Posted By: SniperHF Re: Standalone project template - 07/03/15 02:24 AM
Originally Posted by Baardvark
Yes, it just checks Player1 and Player2's stats and generates global flags every time dialog is either initiated (from a trigger, for example) or requested, like when you click on someone. Probably unnecessary redundancy, because presumably initiated dialog covers all the possibilities, but I'd keep both to be safe.


Since I already had some dialogs mapped out for future stat checks I plugged it in. Worked instantly.

Highly recommended. Good work guys.
Posted By: Baardvark Re: Standalone project template - 07/03/15 04:46 AM
Glad it's useful. We also have code for detecting abilities for dialog options if you want that. For example, a nice way to make pickpocket useful is to give scenarios where you can steal something from someone or do a sleight of hand maneuver in certain situations.
Posted By: SniperHF Re: Standalone project template - 07/03/15 09:08 AM
_GLOBAL_Abilities.txt from the template?
Posted By: Zoltan Re: Standalone project template - 07/03/15 07:11 PM
I would suggest adding HOM_Waypoints.txt to your story scripts (from main story). It handles the way point menu and system.
Posted By: SniperHF Re: Standalone project template - 10/03/15 10:13 PM
Originally Posted by Baardvark
Another cool thing we'll be including is an awesome script that TheMasterRat developed which generates flags according to your attributes. So if you have 8 strength, it'll generate the flag "Strength8" as well all the preceding Strengths down to Strength5. This code works for attributes up to 20, and could easily expand by adding more numbers in the AttributeValues database. So in the dialog of a global character you could make the flag "Strength8" a condition for a certain keyword (such as a "Flex" keyword where you try to impress or intimidate someone with a show of strength).


Currently having a problem with this attribute script. It works but seems to generate attributes 1 level above where you should be. My character with 5 intelligence is getting the flag for 6.

Have you run into this?
Posted By: TheMasterRat Re: Standalone project template - 10/03/15 10:20 PM
Quote
Currently having a problem with this attribute script. It works but seems to generate attributes 1 level above where you should be. My character with 5 intelligence is getting the flag for 6.

Have you run into this?


Te script takes both players into consideration. Check if your second player has 6 Intel.
Posted By: SniperHF Re: Standalone project template - 11/03/15 01:39 AM
Originally Posted by TheMasterRat

The script takes both players into consideration. Check if your second player has 6 Intel.


I actually took out the 2nd player since it's a 1 player mod.
Posted By: SniperHF Re: Standalone project template - 11/03/15 08:21 PM
Did some more testing today and found that the issue is only present at exactly attribute level 5. If I have Strength5 the script spits out Strength6 flag. But if I actually have Strength6 I only get 6 (and not 7). So it's only giving me an extra flag on level 5.

I tried this up to level 10 and got the same results.
5=6
6=6
7=7
8=8
etc.
Posted By: TheMasterRat Re: Standalone project template - 11/03/15 10:42 PM
Originally Posted by SniperHF
Did some more testing today and found that the issue is only present at exactly attribute level 5. If I have Strength5 the script spits out Strength6 flag. But if I actually have Strength6 I only get 6 (and not 7). So it's only giving me an extra flag on level 5.

I tried this up to level 10 and got the same results.
5=6
6=6
7=7
8=8
etc.


hoho nice catch!

Thanks for letting me know, I'll figure this issue out and post a fix.
Posted By: karlgoran Re: Standalone project template - 12/03/15 12:08 AM
Is it possible to add this stuff to a mod that's already been made or is it only possible to use if you start from scratch?
Posted By: SniperHF Re: Standalone project template - 12/03/15 12:22 AM
Originally Posted by karlgoran
Is it possible to add this stuff to a mod that's already been made or is it only possible to use if you start from scratch?


You can put it in after. Just put the files where they are supposed to go.

I'd probably backup everything first. And check what you add before you add it.
Posted By: karlgoran Re: Standalone project template - 12/03/15 04:53 PM
ah that's good. I'm unsure what to put in though, i basically want people to attack me if i attack them, have people protect their stuff, have the alignment stuff and combat function properly and the trade stuff work, if that's connected to all of this.
Posted By: karlgoran Re: Standalone project template - 12/03/15 06:37 PM
Just copy pasting the mods/playground/story folders gives alot of "TRIGGER_DUMMY_T" "ITEM_DUMMY_I" not defined etc when i build, can i remove those lines of code or is there some folder in the project template that contains those resources?
Posted By: SniperHF Re: Standalone project template - 12/03/15 07:26 PM
EDIT: Okay I see what it is. Those were placed explicitly to stop those errors. Just create your own in your mod. A box trigger named DUMMY_T and an item named DUMMY_I. Make them global and generate definitions. Errors should clear.

Then at a later time you might end up placing the appropriate triggers for their functionality in the story files. But possibly not since most of them are reffering to specific things like when the trunks yell at the player character from MAIN.


Probably. I wouldn't remove them entirely without knowing what it does though. Perhaps just change what the script is looking for and point at a trigger in your mod.

I would probably take a more nuanced approach. Try adding the GLOBAL rawfiles first. Load the mod, see what breaks and if it's easy to fix.

You could upload your messasgeoutput.txt file from DATA\EDITOR\
Posted By: karlgoran Re: Standalone project template - 13/03/15 05:00 PM
It all builds properly now, so that's good. with that said none of the systems seem to be working, if i attack a guy he does nothing and conversations have been screwed up so a bunch of nodes that i haven't put in myself appear, like "what can you tell me about silverglen" and "i'll take my leave". like this:

[Linked Image]

maybe a better approach would be to take the files i have in my mod and put them in the playground project folders instead of the other way around?.
Posted By: karlgoran Re: Standalone project template - 13/03/15 06:45 PM
It seemed to work better when i simply took the files used to create the level and put it in the playgroundf folder. Now i have three playable characters, two that are showing up in the level despite them not being seen as resources in the characters window and then the character i included for my original mod. The combat seem to be working for the "invisible" characters so i figured i use them to continue modding, the problem is though that i only want one character to be playable and i also don't get how they can be in the game without being seen as resources in the game, like this, note that i have one of the characters selected while it's not being shown as a character in the character window.:

[Linked Image]
Posted By: SniperHF Re: Standalone project template - 13/03/15 08:47 PM
Originally Posted by karlgoran
It all builds properly now, so that's good. with that said none of the systems seem to be working, if i attack a guy he does nothing


I don't know much about these systems unfortunately. Haven't gotten there yet. Might have something to do with alignments?

Quote

and conversations have been screwed up so a bunch of nodes that i haven't put in myself appear, like "what can you tell me about silverglen" and "i'll take my leave". like this:


This sounds like an issue with global or story keywords.
Check these two files:
Story\Keywords\GenericKeyWords.lsx
Story\Keywords\StorykeyWords.lsx

You could also try unchecking "auto import global nodes".

Keep in mind that you still want some of the generickeywords like changesubject and possibly greeting.

Posted By: Baardvark Re: Standalone project template - 13/03/15 09:12 PM
For the guy not responding to your attacks: is he global? Remember, characters have to be global to interact with the code. Also make sure your player characters are the "Hero" alignment and people you're attacking are Good NPC or Neutral NPC.

I think if you rename your character to not have CYS,LUCS,DAF, etc. in the first part of their name, those keywords won't show up. We need to figure out how to prevent those keywords from showing up.

Not sure why those two extra characters added, but they might be listed under the "global others" in the characters, which you can see by clicking on that silver "O" button on the characters menu (next to the green and purple buttons). You might just be able to delete them, and if any code refers to them, just find and replace all instances of code referring to them and instead have them refer to your character.
Posted By: karlgoran Re: Standalone project template - 14/03/15 06:44 PM
I think changing the CYS solved the conversation problem. As for combat not starting when i attack an NPC it seems like any new NPC's that i put into the playground mod remain unresponsive, only the original CYS_NPC reacts when i attack. Is there some sort of setting or script i need attached to any new NPC's for it to work?

ed: this is a problem with the basic project template, i haven't put any of my own mod files into it.
Posted By: karlgoran Re: Standalone project template - 14/03/15 10:05 PM
you have this problem as well Sniper?
Posted By: Baardvark Re: Standalone project template - 14/03/15 10:49 PM
But did you make the new NPCs global? They won't respond to being attacked if they aren't global characters.
Posted By: karlgoran Re: Standalone project template - 14/03/15 11:26 PM
Yeah it's global, weird:

[Linked Image]


after being bashed around for a while:

[Linked Image]
Posted By: Baardvark Re: Standalone project template - 14/03/15 11:45 PM
Did you generate definitions and build the story?
Posted By: karlgoran Re: Standalone project template - 15/03/15 12:13 AM
no frown man i suck at this. thanks for the help.
Posted By: Baardvark Re: Standalone project template - 15/03/15 12:39 AM
Lots of little things to keep in mind. Takes a while to get used to. Don't worry, I was frustrated for days about getting people to respond to attacks before Rat realized that you need to make characters global to get them to respond attacks.
Posted By: karlgoran Re: Standalone project template - 15/03/15 06:28 PM
heh good to know that i'm not alone at doing stuff like that smile.

ed2: just removing auto-import global nodes solved the issue with the conversations.
Posted By: karlgoran Re: Standalone project template - 23/03/15 12:07 PM
I've been having trouble lately with conversations, when i try to end a conversation it gets stuck. I'm thinking this might have something to do with the project template, any ideas?
Posted By: SniperHF Re: Standalone project template - 23/03/15 12:46 PM
Do you have a conditional statement somewhere starting a second dialog?

The template has MAIN's dialog functionality for global character dialog so if you are duplicating that effect by starting dialog the way most of the tutorials around here say to do it,that could be causing your problem.
Posted By: karlgoran Re: Standalone project template - 23/03/15 01:29 PM
Yeah i'm using this:

IF
DialogStartRequested(CHARACTER_Gothard,CHARACTER_Player1)
THEN
DialogStartTwoSpeakerDialog("gothardavmelse",CHARACTER_Gothard,CHARACTER_Player1);

Is there another way to get dialog to work with global characters without using that code?
Posted By: Burgee Re: Standalone project template - 23/03/15 01:51 PM
Dialog really only gets stuck for one reason: You haven't "ended" it and it has nowhere to go.

Make sure you tick the "End Dialog" box in the editor for your conversations when you want dialog to terminate. The game will freeze as soon as you you try to end it otherwise.

Aside from that, if it's freezing in mid-conversation: Make sure you've pushed the correct dialog options for the player to use. I don't know how many times I've written an entire dialog tree and then forgot to give the player access to the options I'd wrote.

Edit:
Also, if your game is going to be two players you might want to consider turning this:

Quote
IF
DialogStartRequested(CHARACTER_Gothard,CHARACTER_Player1)
THEN
DialogStartTwoSpeakerDialog("gothardavmelse",CHARACTER_Gothard,CHARACTER_Player1);


Into this:

Quote
IF
DialogStartRequested(CHARACTER_Gothard,_Player)
THEN
DialogStartTwoSpeakerDialog("gothardavmelse",CHARACTER_Gothard,_Player);


That simple little change from CHARACTER_PLayer1 to _Player will let either character start dialog with your NPCs.
Posted By: karlgoran Re: Standalone project template - 23/03/15 03:12 PM
I'm actually trying to figure out how to remove the second player within the project template! As for the end dialog box, it's ticked. The problem with dialogs not ending started to appear when i merged my mod with the project template, so i think it might be related to that. Here's how it looks:

[Linked Image]


[Linked Image]


[Linked Image]


[Linked Image]
Posted By: Burgee Re: Standalone project template - 23/03/15 03:23 PM
Yeah, it's likely because you merged with the project template - you're right about that.

Sniper's post a few posts back mentions that you're probably getting a double startup on dialog, which would cause issues. Hopefully he can expand on that info, because I haven't looked at his template yet so I'm in the dark here.

Posted By: karlgoran Re: Standalone project template - 24/03/15 06:46 AM
Originally Posted by Burgee
Yeah, it's likely because you merged with the project template - you're right about that.

Sniper's post a few posts back mentions that you're probably getting a double startup on dialog, which would cause issues. Hopefully he can expand on that info, because I haven't looked at his template yet so I'm in the dark here.



Seems like the problem occured because i had something in defaultdialog, now it works again. onwards etc.

ed: that solution only works temporarily, if you restart the editor you need to have something in the defaultdialog field or conversations won't start. ah well.
Posted By: Burgee Re: Standalone project template - 24/03/15 05:34 PM
Originally Posted by karlgoran
Originally Posted by Burgee
Yeah, it's likely because you merged with the project template - you're right about that.

Sniper's post a few posts back mentions that you're probably getting a double startup on dialog, which would cause issues. Hopefully he can expand on that info, because I haven't looked at his template yet so I'm in the dark here.



Seems like the problem occured because i had something in defaultdialog, now it works again. onwards etc.

ed: that solution only works temporarily, if you restart the editor you need to have something in the defaultdialog field or conversations won't start. ah well.


Sniper made it sound like you don't need:


IF
DialogStartRequested(CHARACTER_Gothard,CHARACTER_Player1)
THEN
DialogStartTwoSpeakerDialog("gothardavmelse",CHARACTER_Gothard,CHARACTER_Player1);

if you're using that template. Try commenting it out in your script and leave the dialog settings in the sidebar see if it works.
Posted By: SniperHF Re: Standalone project template - 24/03/15 07:00 PM
Originally Posted by Burgee

Sniper made it sound like you don't need:


IF
DialogStartRequested(CHARACTER_Gothard,CHARACTER_Player1)
THEN
DialogStartTwoSpeakerDialog("gothardavmelse",CHARACTER_Gothard,CHARACTER_Player1);

if you're using that template. Try commenting it out in your script and leave the dialog settings in the sidebar see if it works.


Yup, there's a PROC in there that starts dialog just like main does and it pulls dialog from the defaultdialog option in the sidebar instead. As if it were a non-global character.

It's basically how MAIN does it and if I hadn't already done dozens of manual starts like the code above I'd have switched my mod to this method. I found this exact same problem when I pasted the two goal files from the template in my mod.
They are:
Dialogs
_GLOBAL_DIALOGS

I'm not sure exactly which one has this code in it and I didn't bother trying to figure it out since I was already somewhat advanced in my mod. Trying to stay focused horsey

If you aren't very far I'd suggest using it. Delete the DialogStartTwoSpeakerDialog stuff you have for individual global characters. And properly fill out the defaultdialog in the sidebar for each character.

Otherwise just delete those two goal files and the conditional statement like the one Burgee posted should start working again and you can close dialog.

The benefit of the way Larian starts global dialogs is it allows you to keep the systemic stuff like all NPCs can trade and responses to combat and such without having to enter conditional dialog starts for every single stupid character.

There are some semi-interesting comments by larian in those goal files I mentioned but I'm trying to stop monkeying around with stuff like that and stay focused. It's hard cause I like these kinda puzzles ouch
Posted By: karlgoran Re: Standalone project template - 25/03/15 08:47 AM
Ah now it works. Thanks a lot for the help. Good to not need to do the whole global character code thing for conversations anymore!
Posted By: SniperHF Re: Standalone project template - 22/05/15 08:44 PM
Originally Posted by TheMasterRat
Originally Posted by SniperHF
Did some more testing today and found that the issue is only present at exactly attribute level 5. If I have Strength5 the script spits out Strength6 flag. But if I actually have Strength6 I only get 6 (and not 7). So it's only giving me an extra flag on level 5.


hoho nice catch!

Thanks for letting me know, I'll figure this issue out and post a fix.


Finally figured out what is causing this. Level Override.
Got rid of my characters level override and poof, problem gone.
Posted By: SniperHF Re: Standalone project template - 18/06/15 05:53 AM
Another problem found in the GLOBAL_Abilities file.
The script is counting for the ability Reflexes but that is not a ability. The ability is called BodyBuilding.

Just change in the INIT section:
DB_Abilities("Reflexes");

To

DB_Abilities("BodyBuilding");

Posted By: Baardvark Re: Standalone project template - 18/06/15 09:25 PM
You're probably one of the only people modding right now :P Thanks for pointing that out though. We'll update/redo the template when the enhanced edition comes out.
Posted By: SniperHF Re: Standalone project template - 19/06/15 03:45 AM
Probably :P

I figure even if I lose tons of work I'll be better off having the whole thing designed out. Re-implementing being faster than designing + implementing.

I'm sure Larian's new files will have all sorts of different stuff so it would be better to make another template from scratch. There's also the big possibility that a new editor doesn't come up till much later. Fun times.
Posted By: Abraxas* Re: Standalone project template - 23/06/16 06:53 PM
Reviving this useful thread, thanks to SniperHF for the link! I wasn't aware of this great project.

I'm not familiar with using Osiris but I tried to get into it a little bit over the last days due to the _GLOBAL_Attributes and the _GLOBAL_Traits file which I absolutely need for my mod. Thank you, gentlemen, for sharing this!

Now: As mentioned above, using global events implies that every character in DB_CharacterToCount profits or suffers from the other character's attributes. And there doesn't seem to be a command in the script to clear the attribute events, yet (which would be important in case attributes change in the meantime).

I have tried to solve both issues and as far as I see I was successfull. I hope it's okay to post the modified _GLOBAL_Attributes script lines here. 99% is your work.

Some words on my changes first:

1) I used Dialog Character Events instead of global events, so the flags are personalized. The developers use this kind of event for storing the players' gender, reputation or attitude towards NPCs, for example.

2) Now there is a process that clears all dialog character events every time a dialog starts, before character events are set.

Now it's possible to have several characters in dialog, each with his own attribute flags.

The only problem may be that moment when another player character starts a dialog. All character flags get removed and re-generated for all characters in the CharacterToCount database. So there will be a very short moment other player characters (who already are in dialog) don't have attribute flags. I wasn't able to personalize clearing character events, too.

I hope the script is fine now. It's my first time with Osiris and testings in the editor deluded me once:

Quote


INITSECTION
DB_CharacterToCount(CHARACTER_Player1);
DB_CharacterToCount(CHARACTER_Player2);

DB_AttributeNames("Strength");
DB_AttributeNames("Intelligence");
DB_AttributeNames("Constitution");
DB_AttributeNames("Speed");
DB_AttributeNames("Perception");
DB_AttributeNames("Dexterity");

DB_AttributeValues(5,"5");
DB_AttributeValues(6,"6");
DB_AttributeValues(7,"7");
DB_AttributeValues(8,"8");
DB_AttributeValues(9,"9");
DB_AttributeValues(10,"10");
DB_AttributeValues(11,"11");
DB_AttributeValues(12,"12");
DB_AttributeValues(13,"13");
DB_AttributeValues(14,"14");
DB_AttributeValues(15,"15");
DB_AttributeValues(16,"16");
DB_AttributeValues(17,"17");
DB_AttributeValues(18,"18");
DB_AttributeValues(19,"19");
DB_AttributeValues(20,"20");

KBSECTION
IF
DialogStarted(_DialogName,_InstanceID)
THEN
ProcClearDialogEvents();
ProcTriggerAttributeCheck();

/*IF
DialogStartRequested(_Character1,_Character2)
THEN
ProcTriggerAttributeCheck();*/
/*With DialogStarted (only) the script got executed in both cases: dialog actively started by the player and started by script. So it's quite sure it works in all possible cases.*/

PROC
ProcTriggerAttributeCheck()
AND
DB_AttributeNames(_AttributeName)
AND
DB_CharacterToCount(_Character)
AND
CharacterGetAttribute(_Character,_AttributeName,_AttributeValue)
THEN
ProcGetValueAsString(_AttributeName,_AttributeValue,_Character);

PROC
ProcGetValueAsString((STRING)_Attribute,(INTEGER)_Value,(CHARACTER)_Character)
AND
DB_AttributeValues(_Value,_ValueAsString)
AND
StringConcatenate(_Attribute,_ValueAsString,_StringResult)
//AND
// NOT DB_EventSet(_StringResult)
/*-->not needed, I think; prevents the other players in the CharacterToCount database to get character flags if included.*/
AND
IntegerSubtract(_Value,1,_ValueMinusOne)
THEN
DialogSetCharacterEvent(_StringResult,_Character,0);
DB_EventSet(_StringResult);
ProcGetValueAsString(_Attribute,_ValueMinusOne,_Character);
/*-->forgot to add _Character to ProcGetValueAsString the last time, so no flags for attribute values below the character's exact value were generated.*/


PROC
ProcClearDialogEvents()
AND
DB_CharacterToCount(_Character)
AND
DB_EventSet(_Event)
THEN
DialogClearCharacterEvent(_Event,_Character,0);



It's not extensively tested. But attribute checks in dialog for different characters worked for me.
Posted By: Abraxas* Re: Standalone project template - 25/06/16 05:18 PM
And here's the modified version for the _GLOBAL_Traits file:

Quote


INITSECTION

DB_Traits("Altruistic");
DB_Traits("Blunt");
DB_Traits("Bold");
DB_Traits("Compassionate");
DB_Traits("Considerate");
DB_Traits("Egotistical");
DB_Traits("Forgiving");
DB_Traits("Heartless");
DB_Traits("Independent");
DB_Traits("Materialistic");
DB_Traits("Obedient");
DB_Traits("Pragmatic");
DB_Traits("Renegade");
DB_Traits("Righteous");
DB_Traits("Romantic");
DB_Traits("Spiritual");
DB_Traits("Timid");
DB_Traits("Vindictive");

DB_CharacterToCount(CHARACTER_Player1);
DB_CharacterToCount(CHARACTER_Player2);

KBSECTION

IF
DialogStarted(_DialogName,_InstanceID)
THEN
ProcTriggerTraitCheck();

/*IF
DialogStartRequested(_Character1,_Character2)
THEN
ProcTriggerTraitCheck();*/

PROC
ProcTriggerTraitCheck()
AND
DB_Traits(_Trait)
AND
DB_CharacterToCount(_Character)
AND
CharacterGetTrait(_Character,_Trait,_HasTrait)
THEN
ProcSetTraitFlag(_Trait,_HasTrait,_Character);


PROC
ProcSetTraitFlag((STRING)_Trait,(INTEGER)_HasTrait,(CHARACTER)_Character)
AND
_HasTrait == 0
THEN
DialogClearCharacterEvent(_Trait,_Character,0);

PROC
ProcSetTraitFlag((STRING)_Trait,(INTEGER)_HasTrait,(CHARACTER)_Character)
AND
_HasTrait == 1
THEN
DialogSetCharacterEvent(_Trait,_Character,0);

© Larian Studios forums