Aller au contenu

Photo

Help with script


51 réponses à ce sujet

#26
DavidSims

DavidSims
  • BioWare Employees
  • 196 messages

Lotion Soronnar wrote...

And yet ANOTHER question.


I want a NPC to move (walk, visibly) after a conversation to a new location.
Now, since this is a npc I added to a singleplayer area with a script, I can't use ambient behavior to move it.
Is there any way to make it happen or should I drop the idea?


Put a script on the end of the conversation. There's a function, I think it's AmbientStart, which you can use to specify whatever behavior you want from the ambient system. If neccessary, you can set the local variables using SetLocalString or SetLocalInt to set up whatever ambient behavior you would have were the creature placed directly in the area.

Or you could call UT_QuickMove to tell the creature to move to the waypoint.

#27
Craig Graff

Craig Graff
  • Members
  • 608 messages
There is also nothing preventing you from just setting the ambient system variables directly on the template if it is a custom creature. Though you would most likely still want to call Ambient_Start after the conversation.

Modifié par Craig Graff, 26 janvier 2010 - 03:52 .


#28
Lotion Soronarr

Lotion Soronarr
  • Members
  • 14 481 messages
Yes, but I cannot add waypoitns via scripts, and IIRC, if I want a NPC to visibly move to a certain location, I need WP's.



Ti's no problem, since I don't really NEED this.



I am wondering about the previous question tough, since I still can't figure out WTF is wrong.

#29
DavidSims

DavidSims
  • BioWare Employees
  • 196 messages
You can order a creature to move to a location rather than a waypoint. As an example:



vector vPosition = Vector(1.0, 2.0, 3.0);

location lMoveTo = Location(GetArea(GetHero()), vPosition, 0.0);

command cMove = CommandMoveToLocation(lMoveTo, FALSE, FALSE);

AddCommand(oCreature, cMove);



As for the earlier question, I think that's a bug in the compiler. Try compiling it again, maybe close and re-open the file. I don't think it's anything you're doing wrong.

#30
Lotion Soronarr

Lotion Soronarr
  • Members
  • 14 481 messages
The creture moving works. :)
Thanks DAvid.


B.t.w. - the redicolous compiler bug is still there. Closing and re-opening doesn't seem to help :(

Modifié par Lotion Soronnar, 30 janvier 2010 - 11:00 .


#31
Lotion Soronarr

Lotion Soronarr
  • Members
  • 14 481 messages
Nope..no dice.





I tried re-loading, re-starting, re-writing and re-compiling a dozen times.



It's still points to an error in sys_traps_h and fails to convert.



And I need to have a flag check right before the human noble origin ends, so that check pretty much has to be on the pantry door to work.





B.t.w Craig, I've been hunting trough files trying to find if the number of attribute points per lvel is specified ANYWHERE. Haven't managed to find anything. Strangely enough, I've been going trough the scripts and so far I haven't found anything that sets it to 4 points per level either...




#32
BrotherJason

BrotherJason
  • Members
  • 99 messages
Hi there Lotion. I've got some answers for you, hopefully helpful ones.

Firstly the sys_trap_h compile error happens if you either haven't patched your game yet, or your dragon age toolset links to an installation that's still 1.0. Version 1.02 has the error fixed. The compile error occurs because the GetCommandObject() function present at line 1521 wasn't implemented in the engine trunk by the time game version 1.0 was built.

The amount of Ability points distributed on level-up is defined in the sys_autoscale script at line 642. Unfortunately you searched for the wrong number, quote: "// Add 3 attribute points" :o

By the way @Bioware: There's a major inconsistency in the scripts when referring to Creature Properties. All except the specialization points are accessed using the defines in the 2da_constants_h. The specialization points however are being referred to as 38. Seems like someone was too lazy to define a new global constant there ;).

Modifié par BrotherJason, 07 février 2010 - 02:26 .


#33
Lotion Soronarr

Lotion Soronarr
  • Members
  • 14 481 messages
I've updated both the toolset and the game (singleplayer module properties show 1.02)



And frak, it doesn't want to compile sys_autoscale either..Friggin errors!

#34
BrotherJason

BrotherJason
  • Members
  • 99 messages
Did you check the path in the Toolset Config? You may as well check the regedit entries manually just in case. So long as the game the Toolset uses is updated, the sys_trap_h error will resolve itself. Do you have multiple installations of Dragon Age?

#35
Craig Graff

Craig Graff
  • Members
  • 608 messages
Another thing to do is clear your Documents/Bioware/packages/core/override directory.

#36
Lotion Soronarr

Lotion Soronarr
  • Members
  • 14 481 messages
I have only one installation of DA, and I'm not sure what path you mean. The resourceBuild path? It points to where I installed DA/tools/ResourceBuild.

I'm gonna re-download the patch and re-apply it...


EDIT: YAAAAY! It works!

Modifié par Lotion Soronnar, 07 février 2010 - 08:18 .


#37
BrotherJason

BrotherJason
  • Members
  • 99 messages
congrats :). Took me a while to figure that one out as well.

#38
Lotion Soronarr

Lotion Soronarr
  • Members
  • 14 481 messages
Wow...this is...odd







E: 21:59:28 - sys_autoscale_h.nss - sys_autoscale_h.nss(?): Script must contain either a main or StartingConditional


#39
BrotherJason

BrotherJason
  • Members
  • 99 messages
that's normal just ignore it. The header scripts aren't real scripts. Their contents are copied into the scripts referencing them, as soon as those are compiled. So just ignore the "warning" :). Oh and remember to recompile every script referrencing the header script or your changes won't have any effect (as said copied on compile, so if you don't recompile the referencer, the header does nothing).

#40
Lotion Soronarr

Lotion Soronarr
  • Members
  • 14 481 messages
Hm....this is...odd.

I still get 3 points per levelup, even tough I set it to 0.25f instead of 3.0f.

#41
Craig Graff

Craig Graff
  • Members
  • 608 messages
It may be an issue of a core script that is loaded into memory before the addins folder and therefor can't be overridden without using packages/core/override.

#42
Lotion Soronarr

Lotion Soronarr
  • Members
  • 14 481 messages
Well, that's where the toolset exports those scripts.



I see both the creature_core and the autoscale_h and autolevelup_h there.

I'll try editing and exporting again.

#43
Lotion Soronarr

Lotion Soronarr
  • Members
  • 14 481 messages
A question - I?m currently trying to put a upper cap on attributes (at 21).

  

case EVENT_TYPE_CHARGEN_ASSIGN_ATTRIBUTES:
        {
            int nAttribute = GetEventInteger(ev,0);
            int nPoints    = GetEventInteger(ev,1);
              
//INSERT CHECK HERE

            // -----------------------------------------------------------------
            // Subtract from available points to spend
            // -----------------------------------------------------------------
            Chargen_ModifyCreaturePropertyBase(oChar, PROPERTY_SIMPLE_ATTRIBUTE_POINTS, IntToFloat(nPoints*-1));
            // -----------------------------------------------------------------
            // Spend it.
            // -----------------------------------------------------------------
            Chargen_SpendAttributePoints(oChar,nAttribute,nPoints,FALSE);
            break;
        }


Now I should put some kind og check up there. Now, is htere any way to chekc for whatever the current attribute is, or fo  Ihave to have a case checking each attribute (STR, DEX, CON, etc..) value?
In other words, any way to use something that will get whatever the current attribute is (something like, PROPERTY _VALUE_CURRENT), so I dont' have to use the lower check for each attribute?

float fAttValue= GetCreatureProperty(oChar, PROPERTY_ATTRIBUTE_STR, PROPERTY_VALUE_BASE)
IF fAttValue >= 21
{
spend it
}
ELSE
{
do nuttin
}

#44
BrotherJason

BrotherJason
  • Members
  • 99 messages

Lotion Soronnar wrote...

Hm....this is...odd.
I still get 3 points per levelup, even tough I set it to 0.25f instead of 3.0f.


Did you make a full script export? It didn't work for me either until I did that.

Btw if you want to introduce an upper-cap there basically are two things you'll have to do as well:

1. Show that the cap is reached, if it is reached. Don't display interface elements suggesting the attribute could still be increased (if possible). Thus the check should be done before the attribute points page is shown.

2. Exclude bonuses from the cap comparism. Eg if the equipement gives +3 to strength and your characters strength is 17 with a cap of 20, he should still be able to spend 3 points until his base stat is 20; The final strength stat will be 23 then.

I'll take a look into the script once I'm back from work and look if I can find some functions that might help you do that :).

Modifié par BrotherJason, 25 février 2010 - 07:40 .


#45
TimelordDC

TimelordDC
  • Members
  • 923 messages
You could change the max value for the attributes in properties.xls to what you want. I don't know if that will display a message when the max value is reached though. If not, you could make a check and display a pop-up message when the cap is reached.

Alternatively, if you are overriding properties.xls. might as well change the description ID and include the information that the max base value is 21.

#46
Lotion Soronarr

Lotion Soronarr
  • Members
  • 14 481 messages
I wasn't aware there WAS an attribute cap at all. There was none that I could see.

Near as I can tell, the game already makes a difference between the players attributes and item bonuses.
All stats are saved as a bonus from the base stat. So a STR of 18 will be saved as (+8)
I better doublecheck, because if not...then changing that would take a lot of conding work and changing many scripts.

@BrotherJason:
You sure I only need to edit autoscale_h and autolevelup_h and nothing else?
It should also work from a saved game, right?

Modifié par Lotion Soronnar, 01 mars 2010 - 08:45 .


#47
TimelordDC

TimelordDC
  • Members
  • 923 messages
In the properties.xls, the Properties sheet has a Min and Max value.



The values selected during chargen/levelup are stored as PROPERTY_VALUE_BASE, I believe. The boosts due to items/skills are stored as PROPERTY_VALUE_MODIFIER and the total value is the sum of both and stored as PROPERTY_VALUE_TOTAL.

The attribute cap is set as 1000 in the excel sheet but I believe the UI restricts it to 100 (there was some mention of this in the respec mod discussion).



Please post what you find in your tests as I think that is not a well-documented area.

#48
Lotion Soronarr

Lotion Soronarr
  • Members
  • 14 481 messages
Back after a long pause with a short report.



Edicting autolevelup.h works, but requires a full export. Which is a pain in the a** if you have modified many area files, since you have to do it again.



In my test I set the points per level to 0.5, and sure enough, on levelup I had 0.5 points available. Thing is, I could still increase my stat by 1 point, leaving me with -0.5 attribute points :P

So I either have to tweak the UI or scripts or just set it to 1 point per level, which is still more than I'd want.

#49
Magic

Magic
  • Members
  • 187 messages
Thread necromancy is strong in these forums. :P

What do you have to do again? Didn't you save the sources of your modifications?

If you're modifying the code anyway, you could easily give 1 point on each odd level after level 1 only, for example.

#50
Lotion Soronarr

Lotion Soronarr
  • Members
  • 14 481 messages
// Add 1 attribute point every 3 levels

if (nNewLevel % 3 == 0)

{

Chargen_ModifyCreaturePropertyBase(oPartyMember,PROPERTY_SIMPLE_ATTRIBUTE_POINTS, 1.0f);

AS_AddclassLevels(oPartyMember, nclass,1, 0.0f, FALSE, FALSE);

}







Is that code correct? I'm not sure if % mean what I think it means.



DAO Toolset can often freeze when I'm making a full export, and loading a game before a levelup acts...crazily.

I either get 3 attribute point or I get 0.5 (which was the previous version of the script). More testing is needed!