lfnetwork.com mark read register faq members calendar

Thread: Qui-Gon's Script Shack
Thread Tools Display Modes
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Old 06-17-2012, 04:05 PM   #201
bigdarthbobo
Lurker
 
Join Date: Jun 2012
Posts: 6
This is a request for help and input

Please look at this thread for an idea as to what I would like to do. New Hybrid Saber Crystals Help Please. I am not sure this can be done with a script but if it can be and would be easier I am all for that and very interested in learning how to do it.

I should clarify I am requesting help in the form of 1) is this even possible with a script? 2) a mentor who would help me along the way and work with me on creating the script 3) if it is a good idea and you want to take over to get it posted by all means run with with but please credit me with the idea lol.

I am really new to this never totally scripted before so it could be slow going but with the right input I might surprise myself and go faster than I expect.

Last edited by bigdarthbobo; 06-17-2012 at 04:15 PM.
bigdarthbobo is offline   you may: quote & reply,
Old 06-21-2012, 03:02 PM   #202
JCarter426
Senior Member
 
JCarter426's Avatar
 
Join Date: Feb 2008
Location: Look to your left.
Posts: 1,636
Here are two basic templates that should handle the job (well, two and a half); you just need to replace the stuff in quotes with the correct information, and repeat stuff as needed. The first checks if a container has the crystal you want:
Code:
int StartingConditional() {

	object oPLC = GetObjectByTag("plc", 0);
	string sTag = "tag";
	object oCrystal = GetItemPossessedBy(oPLC, sTag)

if(GetIsObjectValid(oCrystal)) return TRUE;
return FALSE;

}
You would attach this to a dialogue node... I'd do it as a player node; have the computer say "select the crystal you would like to modify" and then you choose one from the list it gives you, conditional script attached to each node. Then the next node gives you the list of which ones you can blend it with, in a similar fashion.

Now, for K1 you would have to create a different conditional script for every crystal. It would just be copy/paste work, put in a different tag. With K2 you wouldn't have to do this, though; you could create a universal script:
Code:
int StartingConditional() {

	object oPLC = GetObjectByTag("plc", 0);
	string sTag = GetScriptStringParameter();
	object oCrystal = GetItemPossessedBy(oPLC, sTag)

if(GetIsObjectValid(oCrystal)) return TRUE;
return FALSE;

}
Then you would just have to enter the appropriate tag in the string parameter of each dialogue node.

You might also want to have different conditionals, like "there aren't any crystals" or "a foreign object is present". That would be a bit more complicated.

The second script destroys two crystals and then creates a new one:
Code:
void main() {

	object oPLC = GetObjectByTag("plc", 0);
	string sTag1 = "tag1";
	object oCrystal1 = GetItemPossessedBy(oPLC, sTag1)
	string sTag2 = "tag2";
	object oCrystal2 = GetItemPossessedBy(oPLC, sTag2)
	string sNewTag = "newtag";

ActionTakeItem(oCrystal1, oPLC);
ActionTakeItem(oCrystal2, oPLC);
CreateItemOnObject(sNewTag, oPLC, 1, 0);

}
It could be converted to delete three, four, and so on; just duplicate the string sTag, object oCrystal, and ActionTakeItem lines, and adjust the information as required.



Now, I have a conundrum of my own. I was working on a script and I thought an efficient way to do it would be to use a switch for the string parameter. However, I wasn't sure if this is possible. I believe I've seen it done before, but I couldn't find anything by searching. I eventually did it with if trees instead... it was probably easier with ifs, actually. But I'm still curious. I believe it should look something like:
Code:
case "whatever":
...but you know how the engine is. Anyway, just curious... not a big deal. If any of you remember seeing something like this, just let me know.


JCarter426 is offline   you may: quote & reply,
Old 06-29-2012, 11:14 PM   #203
Fallen Guardian
Wandering the Galaxy...
 
Fallen Guardian's Avatar
 
Join Date: Aug 2010
Location: Unknown Regions
Posts: 1,287
Current Game: Knights of the Old Republic
Veteran Modder Helpful! 
Alright, so I've come here with an on enter script filled with conditionals. Now my only problem with this script while compiling, at least so far, is that I keep getting syntax errors at the && symbols in lines 52, 78 and 103, or all the lines I've put in red. I believe it has something to do with the parentheses on the ends of each line but I'm not entirely sure. Could anyone please help?

(The commented out lines with stars in them are there to help me keep track of what's happening in the script.)

Code:
#include "k_inc_debug" 
#include "k_inc_utility" 
 
void main() 
{ 

//***** DEFINING THE OBJECTS *****\\

object oPC = GetFirstPC();

object oHound = GetObjectByTag("g_hound01");

object oCantDoor = GetObjectByTag("d_654_dor01");

object oSwooper = GetObjectByTag("swoopmcx01");

//***** DEFINING THE CONDITIONAL CHECKS *****\\

               int ncheck = GetGlobalNumber("dt_num01");

  int iResult = ((GetGlobalBoolean("dt_check01")));

  int iResult2 = ((GetGlobalBoolean("dt_check02")));

  int iResult3 = ((GetGlobalBoolean("dt_check03")));

  int iResult4 = ((GetGlobalBoolean("dt_check04")));

//***** BEGINNING CONDITIONAL FOR SPAWN *****\\

if (!GetLocalBoolean(OBJECT_SELF, 40) && (GetEnteringObject() == GetFirstPC())) { 

   if (ncheck != 5)
   {
 
SetLocalBoolean(OBJECT_SELF, 40, TRUE); 

vector cPosition=Vector(29.7199993133545,-32.4500007629395,0.06339);
location lHound=Location(cPosition,175.01396);
 
    object oCre = CreateObject(OBJECT_TYPE_CREATURE, "g_hound01", lHound); 


    }

	}

//***** CONDITIONAL FOR NEVER TALKING *****\\

   if (iResult == TRUE) && (!GetLocalBoolean(OBJECT_SELF, 41) && (GetEnteringObject() == GetFirstPC())) {

DestroyObject(oHound);

SetLocalBoolean(OBJECT_SELF, 41, TRUE); 


//***** CONDITIONAL FOR CHECKING IF PC ENTERED IN FROM CLOSE TO CUTSCENE POINT *****\\

if( GetDistanceBetween(oCantDoor, oPC) <= 5.0 ) {

AssignCommand(oSwooper, ActionStartConversation(oPC, "dt_man_dist"));

                                                 }

//***** CONDITIONAL FOR DID NOT ENTER THE AREA CLOSE TO CUTSCENE POINT*****\\

if( GetDistanceBetween(oCantDoor, oPC) > 5.0 ) {

SetGlobalBoolean(dt_304_trig, FALSE);

                                                }
                                                                  }

//***** CONDITIONAL IF THE PC TOLD PERSON TO LEAVE *****\\

   if (iResult2 == TRUE) && (!GetLocalBoolean(OBJECT_SELF, 42) && (GetEnteringObject() == GetFirstPC())) {

DestroyObject(oHound);

SetLocalBoolean(OBJECT_SELF, 42, TRUE); 


//***** CONDITIONAL FOR CHECKING IF PC ENTERED IN FROM CLOSE TO CUTSCENE POINT *****\\

if( GetDistanceBetween(oCantDoor, oPC) <= 5.0 ) {

AssignCommand(oSwooper, ActionStartConversation(oPC, "dt_man_hap"));

                                                 }

//***** CONDITIONAL FOR DID NOT ENTER THE AREA CLOSE TO CUTSCENE POINT*****\\

if( GetDistanceBetween(oCantDoor, oPC) > 5.0 ) {

SetGlobalBoolean(dt_304_trig, FALSE);

                                                }
                                                                  }

//***** CONDITIONAL IF THE PC WANTED IT DONE BUT TOOK TOO LONG *****\\

   if (iResult3 == TRUE) && (iResult4 == TRUE) && (!GetLocalBoolean(OBJECT_SELF, 43) && (GetEnteringObject() == GetFirstPC())) {

DestroyObject(oHound);

SetLocalBoolean(OBJECT_SELF, 43, TRUE); 

//***** CONDITIONAL FOR CHECKING IF PC ENTERED IN FROM CLOSE TO CUTSCENE POINT *****\\

if( GetDistanceBetween(oCantDoor, oPC) <= 5.0 ) {

AssignCommand(oSwooper, ActionStartConversation(oPC, "dt_man_sdlor"));

                                                 }

//***** CONDITIONAL FOR DID NOT ENTER THE AREA CLOSE TO CUTSCENE POINT*****\\

if( GetDistanceBetween(oCantDoor, oPC) > 5.0 ) {

SetGlobalBoolean(CC_207_TRIGGER, FALSE);

                                                }
                                                                  }




}


The truly fallen cannot return to the light. If someone "falls" and "returns," they never really, truly fell.

Current Work in Progress: Dantooine Tension

Released Works
Blaster Pistol Enhancement
Dustil Restoration
Ebon Hawk Texture Enhancement
Gaffi Stick Improvement
Weapon Model Overhaul Texture Rework (Thanks to Toasty Fresh!)
Sunry Murder Recording Enhancement
VP's Hi Poly Tin Cans - KotOR 1 Version
Fallen Guardian is offline   you may: quote & reply,
Old 06-29-2012, 11:19 PM   #204
JCarter426
Senior Member
 
JCarter426's Avatar
 
Join Date: Feb 2008
Location: Look to your left.
Posts: 1,636
The proper syntax (at least what I use, and it seems to work) is:
Code:
if(	whateverwhateverwhateverwhatever &&
	whateverwhateversomethingelse &&
	whateverwhateverandanotherthing ) {
		dostuff
	}


JCarter426 is offline   you may: quote & reply,
Old 06-29-2012, 11:21 PM   #205
Fallen Guardian
Wandering the Galaxy...
 
Fallen Guardian's Avatar
 
Join Date: Aug 2010
Location: Unknown Regions
Posts: 1,287
Current Game: Knights of the Old Republic
Veteran Modder Helpful! 
Okay I'll give that a try and report back.

EDIT: It compiles! Thanks JC. Now to see if it works in-game...


The truly fallen cannot return to the light. If someone "falls" and "returns," they never really, truly fell.

Current Work in Progress: Dantooine Tension

Released Works
Blaster Pistol Enhancement
Dustil Restoration
Ebon Hawk Texture Enhancement
Gaffi Stick Improvement
Weapon Model Overhaul Texture Rework (Thanks to Toasty Fresh!)
Sunry Murder Recording Enhancement
VP's Hi Poly Tin Cans - KotOR 1 Version

Last edited by Fallen Guardian; 06-30-2012 at 12:26 AM. Reason: Reported back...
Fallen Guardian is offline   you may: quote & reply,
Old 07-01-2012, 07:51 AM   #206
Hassat Hunter
Forumite
 
Join Date: Jan 2010
Posts: 560
Quote:
Originally Posted by Fallen Guardian View Post
Okay I'll give that a try and report back.

EDIT: It compiles! Thanks JC. Now to see if it works in-game...
Doesn't look like you use an addition () around the whole function... so
if (iResult == TRUE) && (!GetLocalBoolean(OBJECT_SELF, 41) && (GetEnteringObject() == GetFirstPC())) {

would become;

if ((iResult == TRUE) && (!GetLocalBoolean(OBJECT_SELF, 41) && (GetEnteringObject() == GetFirstPC()))) {
Hassat Hunter is offline   you may: quote & reply,
Old 07-01-2012, 12:04 PM   #207
JCarter426
Senior Member
 
JCarter426's Avatar
 
Join Date: Feb 2008
Location: Look to your left.
Posts: 1,636
In theory that should work, but I find it easier to use a line for each part of the condition. Makes adding, changing, and removing them a lot easier, as well as detecting errors.


JCarter426 is offline   you may: quote & reply,
Old 07-01-2012, 01:20 PM   #208
Hassat Hunter
Forumite
 
Join Date: Jan 2010
Posts: 560
I generally prefer it all in one line, makes it easier to go through scripts if containing a lot of code, and easier to see what's wrong if the compiler gives a line error.

But since both work fine, it's really just a matter of preference...
Hassat Hunter is offline   you may: quote & reply,
Old 07-01-2012, 02:44 PM   #209
JCarter426
Senior Member
 
JCarter426's Avatar
 
Join Date: Feb 2008
Location: Look to your left.
Posts: 1,636
Quote:
Originally Posted by Hassat Hunter View Post
I generally prefer it all in one line, makes it easier to go through scripts if containing a lot of code, and easier to see what's wrong if the compiler gives a line error.
The debugger is sometimes pretty vague about what's wrong, though. In Fallen Guardian's case, it probably just said "syntax error at &&" or whatever, and since there are a handful on those lines, figuring out what's wrong is that much harder. If you have every condition on a different line, then you get more useful data - it would flag all of them.


JCarter426 is offline   you may: quote & reply,
Old 07-06-2012, 01:12 PM   #210
Fair Strides 2
Witty Programmer
 
Fair Strides 2's Avatar
 
Join Date: Jan 2012
Location: Oregon, United States
Posts: 595
Current Game: Master of Orion 2
Helpful! 
Well, I'm back. And with a scripting problem. I'm doing a request that requires adding the items to the locker on the Endar Spire. I edited the k_inc_end.nss script, which details the Endar Spire, and when I compile it with KT, saving it as k_inc_end.ncs, it compiles, but there's no output file. I try it with HazardX's compiler, and it's an include file and becomes ignored. The specific parts of code I added were these:
Show spoiler


Before you ask, yes I have the tags correct, the files in the override, and yes they all work in-game. But I can't find a solution. Nothing else has been modified, so it's not a capitalization error. It is an include file, but in what should I include it? Thanks for the help in advance guys.


EDIT2:
I read this thread about compiling scripts, and discovered that the "_CompileAll.bat" file included in HazardX's compiler download is faulty, at least for me. I copied down the code in the thread linked above and made my own "Compile.bat" It worked, but the script didn't. I ended up slagging the above script and used this one instead:

Show spoiler


This was taken and modified right from the "k_inc_end.nss". And yet, I hit compile in KT, and try the compile.bat I made, and I get
Show spoiler


Any suggestions, guys?

EDIT3:I slagged everything, as far as the script went. I went with the following:[HIDDEN]
Show spoiler

It all compiled fine. No more worries.

Last edited by Fair Strides 2; 07-08-2012 at 09:58 PM. Reason: Edit1:Had to highlight my code; Edit2:Clarification
Fair Strides 2 is offline   you may: quote & reply,
Old 07-10-2012, 02:09 AM   #211
Fair Strides 2
Witty Programmer
 
Fair Strides 2's Avatar
 
Join Date: Jan 2012
Location: Oregon, United States
Posts: 595
Current Game: Master of Orion 2
Helpful! 
Quote:
Originally Posted by JCarter426 View Post
Well, you need the semicolon. Every command has to end with a semicolon. However, you're also missing a close parenthesis.


Hmm. I'm afraid I can't be of much help, because I've never messed around with k_inc_force. Frankly I don't like including scripts, generally; too easy to mess things up. The amount of work including saves is countered by the amount of work it takes to get it to work. So the only thing I can suggest is you look at k_inc_force and make sure you've done everything right; if I had to guess, I'd say the first P in "Sp_RemoveSpellEffectsGeneral" has to be capitalized.

As for VFX_IMP_BATTLE_MED_III, I'm not entirely sure what's going wrong there, but you can easily resolve it by looking at visualeffects.2da and finding the actual line number of VFX_IMP_BATTLE_MED_III and input that in its place.
Just thought that you might like to know, I finally revisited this script, and spent the last few hours pouring over this conversation and NWNLexicon(which is VERY helpful), and managed to get the script to work. Here's the code:
Show spoiler


Had to change a few things, like the visual effect entirely, but oh well. The only issue, which I'm happy to overlook at this time, unless you know how to correct it, is that the script increases your base CON by 30 and reduces your base CON by 9, as opposed to what the intention was.
Fair Strides 2 is offline   you may: quote & reply,
Old 07-10-2012, 12:10 PM   #212
JCarter426
Senior Member
 
JCarter426's Avatar
 
Join Date: Feb 2008
Location: Look to your left.
Posts: 1,636
I'm just guessing, but it might be hard coded to round. I'd suggest testing a few different numbers to see if there's a pattern.


JCarter426 is offline   you may: quote & reply,
Old 07-10-2012, 03:08 PM   #213
Fair Strides 2
Witty Programmer
 
Fair Strides 2's Avatar
 
Join Date: Jan 2012
Location: Oregon, United States
Posts: 595
Current Game: Master of Orion 2
Helpful! 
Quote:
Originally Posted by JCarter426 View Post
I'm just guessing, but it might be hard coded to round. I'd suggest testing a few different numbers to see if there's a pattern.
I tried by adjusting it to 20 CON increase, and 18 CON decrease, on account of how far it was off to either side, and nothing. I tried something outrageous like 60 CON increase and 40 CON decrease, and nothing. Could it be Spells.2da?

Here's the line(Whatever info I skip is ****):
Code:
Row:177
Label:FORCE_POWER_LAST_STAND
name:49332
spelldesc:49333
good/evil:-(neutral)
usertype:1(same as cure, valor,etc.)
guardian,consular,sentimel,inate:15
maxcr:6
range:P
using "ip_ lightning"
script is correct
conjtime and anim are the same as everything else.
casttime and anim are the same as everything else.
castsound is default.
Everything else is the same, except "Forcefriendly"is 27, to make it in it's own row in the level-up gui.
And "pips" is 1(though who knows what the pips have to do with anything.)
Fair Strides 2 is offline   you may: quote & reply,
Old 07-10-2012, 10:08 PM   #214
JCarter426
Senior Member
 
JCarter426's Avatar
 
Join Date: Feb 2008
Location: Look to your left.
Posts: 1,636
Well, I've determined that your CON will never drop below 3. Probably hard coded. So if you have a CON of 12, it will only decrease it by 9. I also believe invulnerability makes you immune from CON decreases, but not CON increases. I really should turn it off... it screwed up other test results in a similar manner just yesterday.

However, I've reported no problems regarding CON increase of any kind. Here's the script I used:
Code:
void main() {

	float fDelay = IntToFloat(GetScriptParameter(1));
	int iAbility = GetScriptParameter(2);
	int iAmount = GetScriptParameter(3);
	float fDuration = IntToFloat(GetScriptParameter(4));

switch(GetScriptParameter(5)) {

	case 0:
		DelayCommand(fDelay, ApplyEffectToObject(1, EffectAbilityDecrease(iAbility, iAmount), GetSpellTargetObject(), fDuration));
		break;

	case 1:
		DelayCommand(fDelay, ApplyEffectToObject(1, EffectAbilityIncrease(iAbility, iAmount), GetSpellTargetObject(), fDuration));
		break;

	}
		
}
I really can't see anything fundamentally different. So I'm not sure what the problem is. Are you sure you're doing your math correctly?


JCarter426 is offline   you may: quote & reply,
Old 09-05-2012, 05:06 PM   #215
Fallen Guardian
Wandering the Galaxy...
 
Fallen Guardian's Avatar
 
Join Date: Aug 2010
Location: Unknown Regions
Posts: 1,287
Current Game: Knights of the Old Republic
Veteran Modder Helpful! 
Okay so I've been setting up an onenter script for one of my areas in KotOR 1 and in this area I've decided to include sitting placeables. So here's the part of the script that sets up the sitters:

Code:
    int nNth = 0;
    object oPlaceable = GetObjectByTag("d50ab_sitter",nNth);
    while (GetIsObjectValid(oPlaceable))
    {
        AssignCommand(oPlaceable,ActionPlayAnimation(ANIMATION_PLACEABLE_ANIMLOOP01));
        nNth++;
        oPlaceable = GetObjectByTag("d50ab_sitter",nNth);
    }
Now the issue is only one of the placeables will actually sit down, the other just stands there in the default model pose with its arms stretched out. Now I'm thinking this may have to do with the nNth but I copied this code straight from Manaan, where'd they'd set up multiple sitters.


The truly fallen cannot return to the light. If someone "falls" and "returns," they never really, truly fell.

Current Work in Progress: Dantooine Tension

Released Works
Blaster Pistol Enhancement
Dustil Restoration
Ebon Hawk Texture Enhancement
Gaffi Stick Improvement
Weapon Model Overhaul Texture Rework (Thanks to Toasty Fresh!)
Sunry Murder Recording Enhancement
VP's Hi Poly Tin Cans - KotOR 1 Version
Fallen Guardian is offline   you may: quote & reply,
Old 09-05-2012, 05:24 PM   #216
JCarter426
Senior Member
 
JCarter426's Avatar
 
Join Date: Feb 2008
Location: Look to your left.
Posts: 1,636
That's the same problem I ran into on the first page. I'll quote to save you the trouble of going back:
Quote:
Originally Posted by JCarter426 View Post
My problem was that one NPC seemed to be excluded 95% of the time, which I resolved by using GetNearestObjectByTag rather than GetObjectByTag, which is screwy... clearly why GetNearestObjectByTag exists. However, GetObjectByTag does recognize 0, and inputting 0 doesn't immediately crash the game. So there's that.
And the essential code:
Quote:
Originally Posted by JCarter426 View Post
Code:
	int i = 1;

	for(;;) {
		i++;
		object oCreature1 = GetNearestObjectByTag(sTag, OBJECT_SELF, i);
		if( GetIsObjectValid(oCreature1) ){
			ChangeToStandardFaction(oCreature1, iFaction);
			DelayCommand(1.0, AssignCommand(oCreature1, ActionAttack(GetNearestCreature(CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY, oCreature1, 1, -1, -1, -1, -1 ), 0)));
			}
		else break;
		}
So something like this should work:
Code:
	sTag = "d50ab_sitter";
	int i = 1;

	for(;;) {
		i++;
		object oPlaceable = GetNearestObjectByTag(sTag, OBJECT_SELF, i);
		if( GetIsObjectValid(oPlaceable) ){
			AssignCommand(oPlaceable,ActionPlayAnimation(ANIMATION_PLACEABLE_ANIMLOOP01));
			}
		else break;
		}
You might have to fiddle with it a bit. I can't remember all of the details.



Last edited by JCarter426; 09-05-2012 at 05:31 PM.
JCarter426 is offline   you may: quote & reply,
Old 09-05-2012, 05:45 PM   #217
Ferc Kast
Modder
 
Ferc Kast's Avatar
 
Join Date: Jan 2007
Location: Tython
Posts: 1,586
Current Game: SWTOR
Helpful! Forum Veteran Contest winner - Fan Fiction Veteran Modder 
I've been having trouble recently with a WIP to get the following script to run off a dialog that starts when the player enters the module.

Code:
void main() {

string sTemplate = "ke_crpse001";
object oContainer=GetObjectByTag("EchoCorpse");
vector vCorpse = Vector(-21.23365, -6.85682, 0.0);
location lCorpse = Location(vCorpse, 0.0);

  CreateObject(OBJECT_TYPE_PLACEABLE, sTemplate, lCorpse);
}
Any thoughts about what I'm doing wrong? As far as I can tell, it looked right and it compiled without giving me any errors.

Ferc Kast is offline   you may: quote & reply,
Old 09-05-2012, 06:02 PM   #218
JCarter426
Senior Member
 
JCarter426's Avatar
 
Join Date: Feb 2008
Location: Look to your left.
Posts: 1,636
Well, for one thing...
Code:
object oContainer=GetObjectByTag("EchoCorpse")
is not doing anything, so you can remove that.

Apart from that, there are three things that could be wrong. First, make sure you got the template right. I know, I know... but you wouldn't believe how much time I've wasted before noticing a typo. Second, make sure the coordinates are correct, particularly the Z value. It could be spawning in some part of the module you can't see, like below. Finally, if those two are correct, then I'd blame it on the vector. I've found them to be particularly unreliable, and I can only suggest to find a way to do it without using one, such as spawning near something that's already in the module.


JCarter426 is offline   you may: quote & reply,
Old 09-05-2012, 07:14 PM   #219
Fallen Guardian
Wandering the Galaxy...
 
Fallen Guardian's Avatar
 
Join Date: Aug 2010
Location: Unknown Regions
Posts: 1,287
Current Game: Knights of the Old Republic
Veteran Modder Helpful! 
Or you could make a waypoint in the GIT, and make the waypoint's location the location of your vector. Then grab that waypoint's location via the script and use it for location lCorpse. So something like this:

Code:
void main()
{

string sTemplate = "ke_crpse001";

object oWP = GetObjectByTag("sp_point");

location lCorpse = GetLocation(oWP);

  CreateObject(OBJECT_TYPE_PLACEABLE, sTemplate, lCorpse);

}
Also, JC, it appears that my script works it's just that SittingSelkath placeable does not.


The truly fallen cannot return to the light. If someone "falls" and "returns," they never really, truly fell.

Current Work in Progress: Dantooine Tension

Released Works
Blaster Pistol Enhancement
Dustil Restoration
Ebon Hawk Texture Enhancement
Gaffi Stick Improvement
Weapon Model Overhaul Texture Rework (Thanks to Toasty Fresh!)
Sunry Murder Recording Enhancement
VP's Hi Poly Tin Cans - KotOR 1 Version

Last edited by Fallen Guardian; 09-05-2012 at 07:32 PM.
Fallen Guardian is offline   you may: quote & reply,
Old 09-05-2012, 08:26 PM   #220
JCarter426
Senior Member
 
JCarter426's Avatar
 
Join Date: Feb 2008
Location: Look to your left.
Posts: 1,636
Quote:
Originally Posted by Fallen Guardian View Post
Or you could make a waypoint in the GIT, and make the waypoint's location the location of your vector. Then grab that waypoint's location via the script and use it for location lCorpse.
Well, if you're going to edit the module, you could just put the placeable in it that way.
Quote:
Also, JC, it appears that my script works it's just that SittingSelkath placeable does not.
Ah well... that would explain it. Nothing I can do about that, I'm afraid. I take it the Selkath don't have the regular sitting animation?


JCarter426 is offline   you may: quote & reply,
Old 09-06-2012, 06:29 AM   #221
Fallen Guardian
Wandering the Galaxy...
 
Fallen Guardian's Avatar
 
Join Date: Aug 2010
Location: Unknown Regions
Posts: 1,287
Current Game: Knights of the Old Republic
Veteran Modder Helpful! 
Quote:
Originally Posted by JCarter426 View Post
Well, if you're going to edit the module, you could just put the placeable in it that way.
Oh yeah, I forgot about that.

Quote:
Originally Posted by JCarter426 View Post
Ah well... that would explain it. Nothing I can do about that, I'm afraid. I take it the Selkath don't have the regular sitting animation?
Yeah, they don't have the drinking animation either. I don't know about the Pazaak one.


The truly fallen cannot return to the light. If someone "falls" and "returns," they never really, truly fell.

Current Work in Progress: Dantooine Tension

Released Works
Blaster Pistol Enhancement
Dustil Restoration
Ebon Hawk Texture Enhancement
Gaffi Stick Improvement
Weapon Model Overhaul Texture Rework (Thanks to Toasty Fresh!)
Sunry Murder Recording Enhancement
VP's Hi Poly Tin Cans - KotOR 1 Version
Fallen Guardian is offline   you may: quote & reply,
Old 09-06-2012, 07:09 AM   #222
JCarter426
Senior Member
 
JCarter426's Avatar
 
Join Date: Feb 2008
Location: Look to your left.
Posts: 1,636
That's... unfortunate. I know Ithorians don't have them either.


JCarter426 is offline   you may: quote & reply,
Old 09-15-2012, 07:57 PM   #223
Fair Strides 2
Witty Programmer
 
Fair Strides 2's Avatar
 
Join Date: Jan 2012
Location: Oregon, United States
Posts: 595
Current Game: Master of Orion 2
Helpful! 
Just thought I'd add some scripting knowledge of my own on here, especially since we're supposed to be helping each other out and sharing knowledge...

Here's an easy, foolproof(as far as I have tested it with death field) to add a command dependent on how big the current party is:
Show spoiler


In place of the orange text, you could add anything you want. I think this script would be ideal for certain force powers, and also it could be quite useful in convos...
Fair Strides 2 is offline   you may: quote & reply,
Old 09-15-2012, 09:18 PM   #224
JCarter426
Senior Member
 
JCarter426's Avatar
 
Join Date: Feb 2008
Location: Look to your left.
Posts: 1,636
This should do the same as the above... well, not entirely as I'm not sure what all your ifs are checking, but it will heal the whole party by nHealCount:
Code:
int i;
int n = ( GetPartyMemberCount() - 1 );

for( i = 0; 0 <= n; i++) {

	ApplyEffectToObject(0, EffectHeal(nHealCount), GetPartyMemberByIndex(i));

	}
I really hate repeated lines of code.

Rather than checking how many party members there are and then doing different functions depending on that, and then applying it to each party member... this simply does one thing to every party member, repeating until there aren't any left.


JCarter426 is offline   you may: quote & reply,
Old 09-15-2012, 10:05 PM   #225
Fair Strides 2
Witty Programmer
 
Fair Strides 2's Avatar
 
Join Date: Jan 2012
Location: Oregon, United States
Posts: 595
Current Game: Master of Orion 2
Helpful! 
Show spoiler


The very first 'if', along with the 'else if' and the 'else' checks how many people are in the party. The set of 'ifs' in the conditionals check to see if a person has less than their maximum health, and if so heals them for nHealcount. If their current and maximum health points are the same, nothing happens. I used this bit of code to heal the entire party with death field instead of just the PC, as part of a mod request I picked up.

Last edited by Fair Strides 2; 09-15-2012 at 10:12 PM. Reason: add-on
Fair Strides 2 is offline   you may: quote & reply,
Old 09-16-2012, 09:25 AM   #226
JCarter426
Senior Member
 
JCarter426's Avatar
 
Join Date: Feb 2008
Location: Look to your left.
Posts: 1,636
Ah, I see. Well, I don't think you need to check first; if they're already at maximum health it should simply do nothing.


JCarter426 is offline   you may: quote & reply,
Old 09-22-2012, 03:04 PM   #227
bead-v
Rookie
 
bead-v's Avatar
 
Join Date: Dec 2009
Posts: 47
It does heal them if they have max VP, but for 0 points and then you get the floating green zero and a report in the feedback screen. You might not want that in some situations.
bead-v is offline   you may: quote & reply,
Old 09-22-2012, 08:21 PM   #228
Fallen Guardian
Wandering the Galaxy...
 
Fallen Guardian's Avatar
 
Join Date: Aug 2010
Location: Unknown Regions
Posts: 1,287
Current Game: Knights of the Old Republic
Veteran Modder Helpful! 
Okay, so I'm making a script for KotOR II to work in the onEndRound field for a character. Basically, this would make it so that every time you're in combat, and someone is currently attacking you, then you get a decrease to your attack stats and accuracy (dexterity). But, if you're in combat and no one is attacking you, then you get a bonus to your to your attack stats and accuracy (dexterity). And if you're not in combat, it returns your stats to their normal state. What I would like to know is if this script is actually set up correctly to do that, and if there are any holes in my scripting.

Code:
void main()
{

   object oAttacker = GetGoingToBeAttackedBy(OBJECT_SELF);

   effect eAtkBonusM = EffectAttackIncrease(3, ATTACK_BONUS_ONHAND);

   effect eAtkBonusO = EffectAttackIncrease(4, ATTACK_BONUS_OFFHAND);

   effect eDamBonus = EffectDamageIncrease(3, DAMAGE_TYPE_UNIVERSAL);

   effect eDexBonus = EffectAbilityIncrease(ABILITY_DEXTERITY, 2);

   effect eAtkBonusMN = EffectAttackDecrease(3, ATTACK_BONUS_ONHAND);

   effect eAtkBonusON = EffectAttackDecrease(4, ATTACK_BONUS_OFFHAND);

   effect eDamBonusN = EffectDamageDecrease(3, DAMAGE_TYPE_UNIVERSAL);

   effect eDexBonusN = EffectAbilityDecrease(ABILITY_DEXTERITY, 2);

      if( oAttacker == OBJECT_INVALID)
      {

         if( GetIsInCombat(OBJECT_SELF, TRUE)
         {   

            ClearAllEffects();

            ApplyEffectToObject(DURATION_TYPE_PERMANENT, eAtkBonusM, OBJECT_SELF);

            ApplyEffectToObject(DURATION_TYPE_PERMANENT, eAtkBonusO, OBJECT_SELF);

            ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDamBonus, OBJECT_SELF);

            ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDexBonus, OBJECT_SELF);

         }

      }

      if( oAttacker != OBJECT_INVALID)
      {
         ClearAllEffects();

         ApplyEffectToObject(DURATION_TYPE_PERMANENT, eAtkBonusMN, OBJECT_SELF);

         ApplyEffectToObject(DURATION_TYPE_PERMANENT, eAtkBonusON, OBJECT_SELF);

         ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDamBonusN, OBJECT_SELF);

         ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDexBonusN, OBJECT_SELF);
      }

      if( !GetIsInCombat(OBJECT_SELF, TRUE)
      {
         ClearAllEffects();
      }

}


The truly fallen cannot return to the light. If someone "falls" and "returns," they never really, truly fell.

Current Work in Progress: Dantooine Tension

Released Works
Blaster Pistol Enhancement
Dustil Restoration
Ebon Hawk Texture Enhancement
Gaffi Stick Improvement
Weapon Model Overhaul Texture Rework (Thanks to Toasty Fresh!)
Sunry Murder Recording Enhancement
VP's Hi Poly Tin Cans - KotOR 1 Version
Fallen Guardian is offline   you may: quote & reply,
Old 09-23-2012, 01:01 PM   #229
JCarter426
Senior Member
 
JCarter426's Avatar
 
Join Date: Feb 2008
Location: Look to your left.
Posts: 1,636
Quote:
Originally Posted by bead-v View Post
It does heal them if they have max VP, but for 0 points and then you get the floating green zero and a report in the feedback screen. You might not want that in some situations.
Aaaaaaaah, I hadn't considered that.


Quote:
Originally Posted by Fallen Guardian View Post
Okay, so I'm making a script for KotOR II to work in the onEndRound field for a character. Basically, this would make it so that every time you're in combat, and someone is currently attacking you, then you get a decrease to your attack stats and accuracy (dexterity). But, if you're in combat and no one is attacking you, then you get a bonus to your to your attack stats and accuracy (dexterity). And if you're not in combat, it returns your stats to their normal state.
All right, interesting premise.
Quote:
What I would like to know is if this script is actually set up correctly to do that, and if there are any holes in my scripting.
All right, first thing that comes to mind is ClearAllEffects might clear stuff you don't want cleared. There are a few ways to get around that, though.

Second thing that comes to mind is these are permanent effects but the OnEndRound script fires every three seconds during combat. This would lead to a slippery slope, with more and more bonuses or penalties applied until they're ridiculously high or low in a matter of seconds. Change those duration types to temporary and set a duration of three seconds and you should be fine.

Third thing is I'm not sure if OnEndRound ever fires if you aren't in combat, so the reset might never happen. I could be wrong though.

Last thing is GetGoingToBeAttackedBy. The notes say not to use it. But maybe it works like it seems.


JCarter426 is offline   you may: quote & reply,
Old 09-23-2012, 03:47 PM   #230
Fallen Guardian
Wandering the Galaxy...
 
Fallen Guardian's Avatar
 
Join Date: Aug 2010
Location: Unknown Regions
Posts: 1,287
Current Game: Knights of the Old Republic
Veteran Modder Helpful! 
What are the ways to get around the clear all effects issues?

Also, revised the scripting as per your suggestions, here it is:

Code:
void main()
{

   object oAttacker = GetGoingToBeAttackedBy(OBJECT_SELF);

   effect eAtkBonusM = EffectAttackIncrease(3, ATTACK_BONUS_ONHAND);

   effect eAtkBonusO = EffectAttackIncrease(4, ATTACK_BONUS_OFFHAND);

   effect eDamBonus = EffectDamageIncrease(3, DAMAGE_TYPE_UNIVERSAL);

   effect eDexBonus = EffectAbilityIncrease(ABILITY_DEXTERITY, 2);

   effect eAtkBonusMN = EffectAttackDecrease(3, ATTACK_BONUS_ONHAND);

   effect eAtkBonusON = EffectAttackDecrease(4, ATTACK_BONUS_OFFHAND);

   effect eDamBonusN = EffectDamageDecrease(3, DAMAGE_TYPE_UNIVERSAL);

   effect eDexBonusN = EffectAbilityDecrease(ABILITY_DEXTERITY, 2);

      if( oAttacker == OBJECT_INVALID)
      {

         if( GetIsInCombat(OBJECT_SELF, TRUE)
         {   

            ClearAllEffects();

            ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eAtkBonusM, OBJECT_SELF, 3.0);

            ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eAtkBonusO, OBJECT_SELF, 3.0);

            ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDamBonus, OBJECT_SELF, 3.0);

            ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDexBonus, OBJECT_SELF, 3.0);

            SetLocalBoolean(OBJECT_SELF, 60, TRUE);

            SetLocalBoolean(OBJECT_SELF, 61, FALSE);

         }

      }

      if( oAttacker != OBJECT_INVALID)
      {
         ClearAllEffects();

         ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eAtkBonusMN, OBJECT_SELF, 3.0);

         ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eAtkBonusON, OBJECT_SELF, 3.0);

         ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDamBonusN, OBJECT_SELF, 3.0);

         ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDexBonusN, OBJECT_SELF, 3.0);

         SetLocalBoolean(OBJECT_SELF, 60, FALSE);

         SetLocalBoolean(OBJECT_SELF, 61, TRUE);
      }

}
And to remove all effects after combat, I put this into the heartbeat script:

Code:
void main()
{

   if( !GetIsInCombat(OBJECT_SELF, TRUE)
   {

      if( GetLocalBoolean(OBJECT_SELF, 60, TRUE) || GetLocalBoolean(OBJECT_SELF, 61, TRUE)
      {
         ClearAllEffects();

         SetLocalBoolean(OBJECT_SELF, 60, FALSE);

         SetLocalBoolean(OBJECT_SELF, 61, FALSE);
      }
   }
}


The truly fallen cannot return to the light. If someone "falls" and "returns," they never really, truly fell.

Current Work in Progress: Dantooine Tension

Released Works
Blaster Pistol Enhancement
Dustil Restoration
Ebon Hawk Texture Enhancement
Gaffi Stick Improvement
Weapon Model Overhaul Texture Rework (Thanks to Toasty Fresh!)
Sunry Murder Recording Enhancement
VP's Hi Poly Tin Cans - KotOR 1 Version
Fallen Guardian is offline   you may: quote & reply,
Old 09-23-2012, 03:54 PM   #231
JCarter426
Senior Member
 
JCarter426's Avatar
 
Join Date: Feb 2008
Location: Look to your left.
Posts: 1,636
RemoveEffect should work since it's all in one script:
Code:
// 87: Remove eEffect from oCreature.
// * No return value
void RemoveEffect(object oCreature, effect eEffect);
K2 also has RemoveEffectByID and RemoveEffectByExactMatch if that doesn't work.

I also forgot to mention before you should probably check if applying effects to both hands stacks when you're using a two-handed weapon.


JCarter426 is offline   you may: quote & reply,
Old 09-23-2012, 03:56 PM   #232
Fallen Guardian
Wandering the Galaxy...
 
Fallen Guardian's Avatar
 
Join Date: Aug 2010
Location: Unknown Regions
Posts: 1,287
Current Game: Knights of the Old Republic
Veteran Modder Helpful! 
Quote:
Originally Posted by JCarter426 View Post
RemoveEffect should work since it's all in one script:
Code:
// 87: Remove eEffect from oCreature.
// * No return value
void RemoveEffect(object oCreature, effect eEffect);
K2 also has RemoveEffectByID and RemoveEffectByExactMatch if that doesn't work.

I also forgot to mention before you should probably check if applying effects to both hands stacks when you're using a two-handed weapon.
All right, will do. Thanks JC. I'll report back in a bit.


The truly fallen cannot return to the light. If someone "falls" and "returns," they never really, truly fell.

Current Work in Progress: Dantooine Tension

Released Works
Blaster Pistol Enhancement
Dustil Restoration
Ebon Hawk Texture Enhancement
Gaffi Stick Improvement
Weapon Model Overhaul Texture Rework (Thanks to Toasty Fresh!)
Sunry Murder Recording Enhancement
VP's Hi Poly Tin Cans - KotOR 1 Version
Fallen Guardian is offline   you may: quote & reply,
Old 09-30-2012, 03:52 PM   #233
Fair Strides 2
Witty Programmer
 
Fair Strides 2's Avatar
 
Join Date: Jan 2012
Location: Oregon, United States
Posts: 595
Current Game: Master of Orion 2
Helpful! 
I'm trying to invent a 'smart script' to automatically heal yourself(Here I mean your companion to auto-heal themselves), but it doesn't do anything at all in-game. The script is K1, though if it ever works, I'll adapt a TSL version:

Show spoiler


EDIT: I'll expand and explain the script. Sorry for not doing so earlier.

This script is to be placed inside, or related to, the heartbeat script. It is supposed to check if you meet the prerequisites for the force power cure and then checks if you have the advanced form, Heal, and if yes, it casts it; if you don't have Heal, it casts cure.

IF you don't have either power, it embarks on a jpourney to see if you have a medpac, then an advanced medpac, and finally a lifepack. If one of the tiers of healing items returns false, the script will use the previous tier item, or if tier one fails, nothing happens.

I might also mention that all of this only happens if you have less than half your max health(I hope I set that part up right with
"
int CHEALTH = GetCurrentHitPoints(oPC);
int MHEALTH = GetMaxHitPoints(oPC);
MHEALTH/2;

while(CHEALTH < MHEALTH)
").

Last edited by Fair Strides 2; 09-30-2012 at 09:29 PM. Reason: Expansion
Fair Strides 2 is offline   you may: quote & reply,
Old 10-03-2012, 04:27 PM   #234
JCarter426
Senior Member
 
JCarter426's Avatar
 
Join Date: Feb 2008
Location: Look to your left.
Posts: 1,636
Try replacing this:
Code:
while(CHEALTH < MHEALTH);
	{
with this:
Code:
if(CHEALTH < MHEALTH) {


JCarter426 is offline   you may: quote & reply,
Old 10-03-2012, 05:03 PM   #235
Canderis
Mercenary
 
Canderis's Avatar
 
Join Date: Jun 2008
Location: Unknown
Posts: 2,510
Current Game: Skyrim
Veteran Modder Helpful! 
How can i get an npc to move near the pc during dialog?

This is my code currently
Code:
 location lMe=GetLocation(GetFirstPC());
 ActionDoCommand(SetCommandable(TRUE,oNPC));
 AssignCommand (oNPC,ActionForceMoveToLocation(lMe,FALSE));
It works, but he ends up inside the pc, not near him. This is for k1.




Canderis is offline   you may: quote & reply,
Old 10-03-2012, 05:08 PM   #236
JCarter426
Senior Member
 
JCarter426's Avatar
 
Join Date: Feb 2008
Location: Look to your left.
Posts: 1,636
Code:
// 383: Force the action subject to move to oMoveTo.
void ActionForceMoveToObject(object oMoveTo, int bRun=FALSE, float fRange=1.0f, float fTimeout=30.0f);
So something like this:
Code:
AssignCommand(oNPC, ActionForceMoveToObject(GetFirstPC(), 0, 1.0, 30.0));
You shouldn't have to use SetCommandable() as creatures are always set to commandable by default, and it doesn't affect movement anyway. All it affects is whether the character can queue actions; setting it to false is essentially stunning them without the stun effect. Since you haven't done that (I think) you can ignore it.


JCarter426 is offline   you may: quote & reply,
Old 10-03-2012, 05:16 PM   #237
Canderis
Mercenary
 
Canderis's Avatar
 
Join Date: Jun 2008
Location: Unknown
Posts: 2,510
Current Game: Skyrim
Veteran Modder Helpful! 
Still the same issue. Is it suppose to teleport him or is he suppose to walk the distance?




Canderis is offline   you may: quote & reply,
Old 10-03-2012, 05:19 PM   #238
JCarter426
Senior Member
 
JCarter426's Avatar
 
Join Date: Feb 2008
Location: Look to your left.
Posts: 1,636
If it's doing that, it means there isn't a clear path between you and the NPC.


JCarter426 is offline   you may: quote & reply,
Old 10-03-2012, 05:25 PM   #239
Canderis
Mercenary
 
Canderis's Avatar
 
Join Date: Jun 2008
Location: Unknown
Posts: 2,510
Current Game: Skyrim
Veteran Modder Helpful! 
Huh, i guess my door isn't opening in time.
I have, in another code, fired from another node,
Code:
  ActionPauseConversation();
  object oDoor = GetObjectByTag("door1_elv01");
  SetLocked(oDoor,FALSE);
  AssignCommand(oDoor, ActionOpenDoor(oDoor));
  ActionWait(3.0);
  ActionResumeConversation();
The door opens, but i think its not working right.




Canderis is offline   you may: quote & reply,
Old 10-03-2012, 05:29 PM   #240
JCarter426
Senior Member
 
JCarter426's Avatar
 
Join Date: Feb 2008
Location: Look to your left.
Posts: 1,636
It might not just be the door. That sort of thing largely depends on the area, though I've never really had any problems with it, guess I've just been lucky. You could try opening the door earlier, or maybe commanding the NPC to go to the door, then to the player.


JCarter426 is offline   you may: quote & reply,
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Go Back   LucasForums > Network > Knights of the Old Republic > Editing / Modding > Holowan Laboratories > Qui-Gon's Script Shack

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:08 AM.

LFNetwork, LLC ©2002-2011 - All rights reserved.
Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.