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 04-17-2012, 09:35 PM   #161
Fallen Guardian
Wandering the Galaxy...
 
Fallen Guardian's Avatar
 
Join Date: Aug 2010
Location: Unknown Regions
Posts: 1,286
Current Game: Knights of the Old Republic
Veteran Modder Helpful! 
Cool, but how would I take note of the module the PC was in before the cutscene so I could warp back to it?


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 04-18-2012, 05:53 AM   #162
Hassat Hunter
Forumite
 
Join Date: Jan 2010
Posts: 560
Quote:
Originally Posted by JCarter426 View Post
Revan taking his mask off is a proper cutscene module (side note: I believe they did this for people who disable Bink videos, so they would know what the hell was going on).
Not really. They did it that way so when the mask goes off, the PC's face is revealed. Seeing the amount of faces a PC can choose, well, doing biks for all of them is a bit too much, no?
Hassat Hunter is offline   you may: quote & reply,
Old 04-18-2012, 05:58 AM   #163
Hassat Hunter
Forumite
 
Join Date: Jan 2010
Posts: 560
From KOTOR2's k_align_movie.ncs;
Code:
CreateObject(32, "g_lastlocal", GetLocation(GetFirstPC()), 0);
	SetGlobalString("K_LAST_MODULE", GetModuleName());
Hassat Hunter is offline   you may: quote & reply,
Old 04-18-2012, 10:36 AM   #164
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
Not really. They did it that way so when the mask goes off, the PC's face is revealed. Seeing the amount of faces a PC can choose, well, doing biks for all of them is a bit too much, no?
What? I don't follow you at all. Why would they make a Bink video for every face? Obviously they'd need to do that in the game... but that wasn't stricly necessary for the scene; it could have been done another way. What I meant is that someone who has disabled the Bink videos will only see this part. Anyway, this is all irrelevant.
Quote:
Originally Posted by Fallen Guardian View Post
Cool, but how would I take note of the module the PC was in before the cutscene so I could warp back to it?
Either a global as mentioned above, or if it's all in a single script you might not have to do even that.


JCarter426 is offline   you may: quote & reply,
Old 04-18-2012, 10:40 AM   #165
Hassat Hunter
Forumite
 
Join Date: Jan 2010
Posts: 560
How would they reveal Revan was the PC without actually showing the PC? Sure they could just use the .bik itself, but that scene would have lost so much without that ingame cutscene afterwards...
Hassat Hunter is offline   you may: quote & reply,
Old 04-18-2012, 10:57 AM   #166
JCarter426
Senior Member
 
JCarter426's Avatar
 
Join Date: Feb 2008
Location: Look to your left.
Posts: 1,636
I don't know, maybe my perspective is foggy since I already knew. But my thought was the combination of Bink and cutscene was necessary, because if you disable the Bink videos you would only see the cutscene.


JCarter426 is offline   you may: quote & reply,
Old 04-18-2012, 11:01 AM   #167
Hassat Hunter
Forumite
 
Join Date: Jan 2010
Posts: 560
Wonder how that works with Kreia's Fall and Visas' Introduction in KOTOR2 (never turned off the movies).
Of course with TLSRCM the second one is ingame, but the first still is only a cutscene...
Hassat Hunter is offline   you may: quote & reply,
Old 04-19-2012, 11:55 AM   #168
JCarter426
Senior Member
 
JCarter426's Avatar
 
Join Date: Feb 2008
Location: Look to your left.
Posts: 1,636
Well, if you disable movies, you're still going to be a bit lost. However, Kreia's fall and Visas' introduction were both originally in the game. I believe the scripts are set up to save your location and such already - at least it seemed that way when I glanced at them many moons ago - but obviously they decided to do a Bink video instead, likely to cut down on the loading time. There's still some of that nonsense with the Atris interludes.


JCarter426 is offline   you may: quote & reply,
Old 04-19-2012, 03:20 PM   #169
UltimateHK47
Forumite
 
UltimateHK47's Avatar
 
Join Date: Nov 2011
Location: In a Galaxy, far far away...
Posts: 500
Current Game: Kotor 1
Just out of intrest how would you go about creating a script for endgame? You know, after the last k1 movie has played and you return to the main menu. This is my idea of how it would look (note that im the worst scripter holowan has known),

Code:
void main() 
{
StartNewModule("ENDGAME");
}
    }


http://www.lucasforums.com/showthrea...12#post2807812
The Turret Arcade 1.2 ^^


USED TO BE KNOWN AS DARTH JANGO/WEASLEY
UltimateHK47 is offline   you may: quote & reply,
Old 04-19-2012, 04:31 PM   #170
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 
Quote:
Originally Posted by UltimateHK47 View Post
Just out of intrest how would you go about creating a script for endgame? You know, after the last k1 movie has played and you return to the main menu. This is my idea of how it would look (note that im the worst scripter holowan has known),

Code:
void main() 
{
StartNewModule("ENDGAME");
}
    }
Here's the code to return to the main menu:
Code:
    // NOTE: If you put EndGame(TRUE); or EndGame(1); or if you don't put a 
    // variable, it will default to displaying the death GUI. To not display 
    // the death GUI, you have to put EndGame(FALSE); or EndGame(0);
void main()
{
    EndGame(0);
}

Ferc Kast is offline   you may: quote & reply,
Old 04-19-2012, 05:36 PM   #171
UltimateHK47
Forumite
 
UltimateHK47's Avatar
 
Join Date: Nov 2011
Location: In a Galaxy, far far away...
Posts: 500
Current Game: Kotor 1
Ahh, cheers Ferc, what was I thinking :/


http://www.lucasforums.com/showthrea...12#post2807812
The Turret Arcade 1.2 ^^


USED TO BE KNOWN AS DARTH JANGO/WEASLEY
UltimateHK47 is offline   you may: quote & reply,
Old 04-20-2012, 02:52 PM   #172
Qui-Gon Glenn
Necessary Roughneck
 
Qui-Gon Glenn's Avatar
 
Join Date: May 2007
Location: Thessia
Posts: 1,465
Current Game: ME3MP, Arkham Origins
Folder extraordinaire Helpful! Forum Veteran Veteran Modder 
Whoa.


The Shack has been stickied?!???!1!!?

Very cool 8)

Glad to see that you folks have kept the lights on; between work and some personal/familial issues, I have had very limited and precious personal time, and have been unable to keep up with my friends (and responsibilities) here. For those of you with an unanswered PM, I will get to my inbox this weekend - my apologies for my absence!

Carry on, see you soon, and MTFBWYA!


Want to play a game of ME3MP?
Qui-Gon_Glenn on the software of which we shall not name.... add me and the enemy shall fall in chunks of crimson salsa
Qui-Gon Glenn is offline   you may: quote & reply,
Old 04-23-2012, 11:36 AM   #173
UltimateHK47
Forumite
 
UltimateHK47's Avatar
 
Join Date: Nov 2011
Location: In a Galaxy, far far away...
Posts: 500
Current Game: Kotor 1
Ok,

Instead of just fixxing and compiling scripts, im gonna have a go at making them. Without looking at examples. (for the simple scripts)
Just need to know if these scripts ar correct if not why...

voidmain ()
{
CreateItemOnObject,("g_w_lghtsbr10," oPC) ;
}

Ive got a good feeling its wrong (my ktool has gone funny and I dont know how to compile with the other program).
Thanks for reading.

Changed it, is it right now?
Again, oPC is Pc ( I assume) so would that give the pc an lightsabre? Again, its my first script (I wanna learn useful, basic scripts :)


http://www.lucasforums.com/showthrea...12#post2807812
The Turret Arcade 1.2 ^^


USED TO BE KNOWN AS DARTH JANGO/WEASLEY

Last edited by UltimateHK47; 04-25-2012 at 12:03 PM.
UltimateHK47 is offline   you may: quote & reply,
Old 04-24-2012, 05:26 PM   #174
Hassat Hunter
Forumite
 
Join Date: Jan 2010
Posts: 560
You haven't specified an object which should get that item...
Hassat Hunter is offline   you may: quote & reply,
Old 04-25-2012, 12:00 PM   #175
UltimateHK47
Forumite
 
UltimateHK47's Avatar
 
Join Date: Nov 2011
Location: In a Galaxy, far far away...
Posts: 500
Current Game: Kotor 1
How about now?


http://www.lucasforums.com/showthrea...12#post2807812
The Turret Arcade 1.2 ^^


USED TO BE KNOWN AS DARTH JANGO/WEASLEY
UltimateHK47 is offline   you may: quote & reply,
Old 04-25-2012, 12:55 PM   #176
Hassat Hunter
Forumite
 
Join Date: Jan 2010
Posts: 560
Pretty sure the , should be outside the "" markings. Also, you lack a quantity.
Hassat Hunter is offline   you may: quote & reply,
Old 04-30-2012, 08:35 PM   #177
Fallen Guardian
Wandering the Galaxy...
 
Fallen Guardian's Avatar
 
Join Date: Aug 2010
Location: Unknown Regions
Posts: 1,286
Current Game: Knights of the Old Republic
Veteran Modder Helpful! 
Okay, so today I was writing a dialogue file and was wondering if it was possible to check if the PC has a certain item class in his/her right hand. See, if I were to make an option that has the PC talking about using his/her lightsaber even though the PC doesn't have on equipped, it'd look kind of strange.

So would it be possible to have a script that checks if the PC has any sort of blaster pistol equipped in the right hand, or any sort of blaster rifle equipped etc. and return true if the PC has a blaster or a rifle equipped, but false if the PC 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
Fallen Guardian is offline   you may: quote & reply,
Old 05-01-2012, 04:18 AM   #178
Hassat Hunter
Forumite
 
Join Date: Jan 2010
Posts: 560
Kotor2 has this script by default... it's c_lightsaber_eq. Content;
Code:
//  c_lightsaber_eq
/*
    Does the Party Leader have a Lightsaber equipped?
*/
//  Created By:  Tony Evans 10/25/04

int StartingConditional()
{
    object oWeap = GetItemInSlot(INVENTORY_SLOT_RIGHTWEAPON, GetPartyLeader());

    if (FindSubString(GetName(oWeap), "Lightsaber") != -1)
        return TRUE;

    return FALSE;
}
Hassat Hunter is offline   you may: quote & reply,
Old 05-01-2012, 11:34 PM   #179
Fallen Guardian
Wandering the Galaxy...
 
Fallen Guardian's Avatar
 
Join Date: Aug 2010
Location: Unknown Regions
Posts: 1,286
Current Game: Knights of the Old Republic
Veteran Modder Helpful! 
Do you know if I were to change the "Lightsaber" to say Blaster Pistol, if it would work or 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
Fallen Guardian is offline   you may: quote & reply,
Old 05-02-2012, 12:13 AM   #180
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 tried scripting, using this, and got as far as needing to compile the script.

I'm trying to make/replicate a mod that was made for K1, but was either at PCGM or never hosted. I cannot compile it due to errors with the Syntax at "{" and "SWFP_HARMFUL"

Also, the script is for TSL!!!

Note:1st ever script, took me about an hour and a half in all, counting getting my head to understand it, so I think I did a pretty fair job so far. Only issue is it won't compile, with KT or HazardX's tool.

Here's the source code, and I want to add in the following:
Jedi Guardian, Weaponmaster, and Sith Marauder need to be level 20.
Jedi Sentinel, Watchmen, and Sith Assassin need to be level 16
Jedi Consular, Master, and Sith Lord need to be level 14.

Also, is the cost determined by the script or the .2DA? I put 175 in the force point cost for the .2DA...

Anyways, the source code:
Code:
#include "k_inc_force"

int FORCE_POWER_FINAL_STAND = 16;

void main()
(

    object oTarget = GetSpellTargetObject();   
    effect eTargetVisual;                      
    effect eBuff;                              
    SWFP_HARMFUL = FALSE;



    if(GetHasSpell(FORCE_POWER_FINAL_STAND))
    {
          Sp_RemoveSpellEffectsGeneral(FORCE_POWER_FINAL_STAND, oTarget);
    }

    SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF. GetSpellId(), SWFP_HARMFUL));


    eBuff = SetEffectIcon(eBuff, 69);
    eTargetVisual = EffectVisualEffect(VFX_IMP_BATTLE_MED_III);

          eBuff = EffectLinkEffects(eBuff, EffectAbilityIncrease(ABILITY_CONSTITUTION, 25));

    ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eTargetVisual, oTarget, 3.0);
    ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eBuff, oTarget, 30.0);

    fDelayInSeconds = 30.0;
    DelayCommand(fDelayInSeconds, eBuff = EffectLinkEffects(eBuff, EffectAbilityDecrease(ABILITY_CONSTITUTION, 15));
}

Thanks for any help you guys can offer, which means that you might as well have already finished the script!

P.S.: I have everything but the script:spells.2DA, Dialog.TLK, and icon.
Fair Strides 2 is offline   you may: quote & reply,
Old 05-02-2012, 03:11 PM   #181
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
Do you know if I were to change the "Lightsaber" to say Blaster Pistol, if it would work or not?
I don't thinks o. I believe it's checking the actual name of the item - i.e. what it is called in the inventory, determined in the UTI somewhere - and it only works in this instance because every lightsaber has "Lightsaber" somewhere in its name. This isn't true of all blasters - the plasma thrower and mining lasers, for example. Since you want to check for any sort of blaster, you'll need to use something else.
Quote:
Originally Posted by Fair Strides 2 View Post
#include "k_inc_force"

int FORCE_POWER_FINAL_STAND = 16;

void main()
(

object oTarget = GetSpellTargetObject();
effect eTargetVisual;
effect eBuff;
SWFP_HARMFUL = FALSE;



if(GetHasSpell(FORCE_POWER_FINAL_STAND))
{
Sp_RemoveSpellEffectsGeneral(FORCE_POWER_FINAL_STA ND, oTarget);
}

SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF. GetSpellId(), SWFP_HARMFUL));


eBuff = SetEffectIcon(eBuff, 69);
eTargetVisual = EffectVisualEffect(VFX_IMP_BATTLE_MED_III);

eBuff = EffectLinkEffects(eBuff, EffectAbilityIncrease(ABILITY_CONSTITUTION, 25));

ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eTargetVisual, oTarget, 3.0);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eBuff, oTarget, 30.0);

fDelayInSeconds = 30.0;
DelayCommand(fDelayInSeconds, eBuff = EffectLinkEffects(eBuff, EffectAbilityDecrease(ABILITY_CONSTITUTION, 15));
}
These parts are problematic. You've defined one variable multiple times, and even used the variable in the definition. I'm not entirely sure what you're trying to do here, but for one thing you'll need to use multiple variables - eBuff1, eBuff 2, and so on (or something more appropriate - the names are entirely up to you). Anyway, it looks like you're trying to increase Constitution, and then decrease it after 30 seconds, along with some visual effects and stuff. This is a rough guess of what it should look like, then:
Code:
object oTarget = GetSpellTargetObject(); 
effect eVFX = EffectVisualEffect(VFX_IMP_BATTLE_MED_III);
effect eConI = EffectAbilityIncrease(ABILITY_CONSTITUTION, 25));
effect eConD = EffectAbilityDecrease(ABILITY_CONSTITUTION, 15));

ApplyEffectToObject(1, eVFX, oTarget, 3.0);
ApplyEffectToObject(0, eConI, oTarget, 0.0);
SetEffectIcon(eConI, 69);
DelayCommand(30.0, ApplyEffectToObject(0, eConD, oTarget, 0.0);
I'm not sure what the rest is supposed to be, but I don't see anything obviously wrong - except in one case I think you used a period instead of a comma. You also have it increase by 25, then decrease by only 15, though that might be intentional. I also don't think increasing Constitution actually increases a character's current HP, so you might want to look into that. Not bad for a first attempt, in any case; Force powers are especially tricky, after all.
Quote:
Originally Posted by Fair Strides 2 View Post
I want to add in the following:
Jedi Guardian, Weaponmaster, and Sith Marauder need to be level 20.
Jedi Sentinel, Watchmen, and Sith Assassin need to be level 16
Jedi Consular, Master, and Sith Lord need to be level 14.
I believe the cost is in the 2DA, and the class level stuff is in another 2DA, not in the script - I don't think you want someone to be able to select the power and then for it to do nothing when they activate it.

I'd help you both further, but unfortunately I don't have access to my files... I can't even check NWScript. I'll get back to you... eventually.



Last edited by JCarter426; 08-17-2012 at 10:25 PM.
JCarter426 is offline   you may: quote & reply,
Old 05-02-2012, 04:34 PM   #182
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
These parts are problematic. You've defined one variable multiple times, and even used the variable in the definition. I'm not entirely sure what you're trying to do here, but for one thing you'll need to use multiple variables - eBuff1, eBuff 2, and so on (or something more appropriate - the names are entirely up to you). Anyway, it looks like you're trying to increase Constitution, and then decrease it after 30 seconds, along with some visual effects and stuff. This is a rough guess of what it should look like, then:
Code:
object oTarget = GetSpellTargetObject(); 
effect eVFX = EffectVisualEffect(VFX_IMP_BATTLE_MED_III);
effect eConI = EffectAbilityIncrease(ABILITY_CONSTITUTION, 25));
effect eConD = EffectAbilityDecrease(ABILITY_CONSTITUTION, 15));

ApplyEffectToObject(1, eVFX, oTarget, 3.0);
ApplyEffectToObject(0, eConI, oTarget, 0.0);
SetEffectIcon(eConI, 69);
DelayCommand(30.0, ApplyEffectToObject(0, eConD, oTarget, 0.0);
I'm not sure what the rest is supposed to be, but I don't see anything obviously wrong - except in one case I think you used a period instead of a comma. You also have it increase by 25, then decrease by only 15, though that might be intentional. I also don't think increasing Constitution actually increases a character's current HP, so you might want to look into that. Not bad for a first attempt, in any case; Force powers are especially tricky, after all.

I believe the cost is in the 2DA, and the class level stuff is in another 2DA, not in the script - I don't think you want someone to be able to select the power and then for it to do nothing when they activate it.

I'd help you both further, but unfortunately I don't have access to my files... I can't even check NWScript. I'll get back to you... eventually.
Well, thanks for the help. I messaged Mandalore at DeadlyStream as well. He mentioned the issue of
Quote:
First problem that jumped out at me: after the

void main()

, you used ( instead of {. That's why the compier said there was a syntax error at line 6.

I'll think on the line 11 error, as that seems to be the same as the turorial one.
So, I'll check out the tut one.

Also, the object of the script at
Code:
eBuff = EffectLinkEffects(eBuff, EffectAbilityIncrease(ABILITY_CONSTITUTION, 25));
and

Code:
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eBuff, oTarget, 30.0);
was to increase one's CON by 25 for 30 seconds, or 10 combat rounds, and the revert to normal, at which point this

Code:
fDelayInSeconds = 30.0;
DelayCommand(fDelayInSeconds, eBuff = EffectLinkEffects(eBuff, EffectAbilityDecrease(ABILITY_CONSTITUTION, 15));
would administer a penalty of 15 CON below the normal value for 15 seconds.
Fair Strides 2 is offline   you may: quote & reply,
Old 05-03-2012, 11:12 AM   #183
JCarter426
Senior Member
 
JCarter426's Avatar
 
Join Date: Feb 2008
Location: Look to your left.
Posts: 1,636
Quote:
Originally Posted by Fair Strides 2 View Post
Also, the object of the script at
Code:
eBuff = EffectLinkEffects(eBuff, EffectAbilityIncrease(ABILITY_CONSTITUTION, 25));
and

Code:
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eBuff, oTarget, 30.0);
was to increase one's CON by 25 for 30 seconds, or 10 combat rounds, and the revert to normal, at which point this

Code:
fDelayInSeconds = 30.0;
DelayCommand(fDelayInSeconds, eBuff = EffectLinkEffects(eBuff, EffectAbilityDecrease(ABILITY_CONSTITUTION, 15));
would administer a penalty of 15 CON below the normal value for 15 seconds.
Oh, I see. I just checked and you can do that. So you were on the right track, ignore my previous advice (I made some typing errors anyway ) and go with this:
Code:
object oTarget = GetSpellTargetObject(); 
effect eVFX = EffectVisualEffect(VFX_IMP_BATTLE_MED_III);
effect eConI = EffectAbilityIncrease(ABILITY_CONSTITUTION, 25);
effect eConD = EffectAbilityDecrease(ABILITY_CONSTITUTION, 15);

ApplyEffectToObject(1, eVFX, oTarget, 3.0);
ApplyEffectToObject(1, eConI, oTarget, 30.0);
SetEffectIcon(eConI, 69);
DelayCommand(30.0, ApplyEffectToObject(1, eConD, oTarget, 15.0));
I also realized you were trying to link the effects. You did part of it right, but some of it was out of order, or not applicable, hence my confusion.

The primary purpose is to set up a "save and ignore" system; if a creature is immune to one of the effects, none of the effects will be applied. For example, movement speed decrease is a debilitating effect of poison; if you are immune to poison, your movement speed should not be decreased because you weren't poisoned. Its other purpose is to enable lazy coders. When you link effects, you just need to fire the link effect and then all the others will be fired at the same time - meaning you only need to apply one effect. So if you have a bunch of effects of the same type that will all be applied to the same object at the same time and will have the same duration type and length, then you can link all the effects into one and apply them all at once. It's a lot of work in the setup, but the reward is a more streamlined script. Of course, there are a lot of limitations; the effects must meet all the above criteria, and in general it's very sensitive - some effects just won't work.

Now, you have three effects (well, four, but visuals can't be linked) - two are fired at different times and last for different durations, and one is simply an icon. So you really don't need to link them. But if you insist on it, then it would look something like this:
Code:
object oTarget = GetSpellTargetObject(); 
effect eVFX = EffectVisualEffect(VFX_IMP_BATTLE_MED_III);
effect eConI = EffectAbilityIncrease(ABILITY_CONSTITUTION, 25);
effect eIcon = SetEffectIcon(eConI, 69);
effect eLink = EffectLinkEffects(eConI, eIcon);
effect eConD = EffectAbilityDecrease(ABILITY_CONSTITUTION, 15);

ApplyEffectToObject(1, eVFX, oTarget, 3.0);
ApplyEffectToObject(1, eLink, oTarget, 30.0);
DelayCommand(30.0, ApplyEffectToObject(1, eConD, oTarget, 15.0));
That should simply link the icon and the CON increase. I don't believe it's necessary because SetEffectIcon should already function like that, but I could be wrong.

Let's say you want to add something like poison at the end of the spell, in addition to the Constitution penalty... and just for good measure, decreased movement speed. And if the character is immune to poison, their CON will simply return to normal, with no debilitating effects. Here's an example of what it should look like:
Code:
object oTarget = GetSpellTargetObject(); 
effect eVFX = EffectVisualEffect(VFX_IMP_BATTLE_MED_III);
effect eConI = EffectAbilityIncrease(ABILITY_CONSTITUTION, 25);
effect eConD = EffectAbilityDecrease(ABILITY_CONSTITUTION, 15);
effect ePoison = EffectPoison(POISON_ABILITY_SCORE_AVERAGE);
effect eMoveD = EffectMovementSpeedDecrease(50);
effect eIcon = SetEffectIcon(eLink, 69);

effect eLink;
eLink = eConD;
eLink = EffectLinkEffects(eLink, ePoison);
eLink = EffectLinkEffects(eLink, eMoveD);

ApplyEffectToObject(1, eVFX, oTarget, 3.0);
ApplyEffectToObject(1, eConI, oTarget, 30.0);
SetEffectIcon(eConI, 69);
DelayCommand(30.0, ApplyEffectToObject(1, eLink, oTarget, 15.0));
That's where linking comes in handy.

I also looked at k_inc_force and I believe you got the rest right, except for the aforementioned typos.
Quote:
Originally Posted by Fallen Guardian View Post
Do you know if I were to change the "Lightsaber" to say Blaster Pistol, if it would work or not?
Quote:
Originally Posted by JCarter426 View Post
Since you want to check for any sort of blaster, you'll need to use something else.
I found something:
Code:
// 397: Get the base item type (BASE_ITEM_*) of oItem.
// * Returns BASE_ITEM_INVALID if oItem is an invalid item.
int GetBaseItemType(object oItem);
So just set it up to check if the base item type is BASE_ITEM_BLASTER_PISTOL (12). The full list is in NWScript. You might want to repeat it for ion pistols, sonic pistols, and the like.


JCarter426 is offline   you may: quote & reply,
Old 05-03-2012, 05:02 PM   #184
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
Code:
object oTarget = GetSpellTargetObject(); 
effect eVFX = EffectVisualEffect(VFX_IMP_BATTLE_MED_III);
effect eConI = EffectAbilityIncrease(ABILITY_CONSTITUTION, 25);
effect eConD = EffectAbilityDecrease(ABILITY_CONSTITUTION, 15);

ApplyEffectToObject(1, eVFX, oTarget, 3.0);
ApplyEffectToObject(1, eConI, oTarget, 30.0);
SetEffectIcon(eConI, 69);
DelayCommand(30.0, ApplyEffectToObject(1, eConD, oTarget, 15.0));
I also realized you were trying to link the effects. You did part of it right, but some of it was out of order, or not applicable, hence my confusion.

Now, you have three effects (well, four, but visuals can't be linked) - two are fired at different times and last for different durations, and one is simply an icon. So you really don't need to link them. But if you insist on it, then it would look something like this:


Code:
object oTarget = GetSpellTargetObject(); 
effect eVFX = EffectVisualEffect(VFX_IMP_BATTLE_MED_III);
effect eConI = EffectAbilityIncrease(ABILITY_CONSTITUTION, 25);
effect eIcon = SetEffectIcon(eConI, 69);
effect eLink = EffectLinkEffects(eConI, eIcon);
effect eConD = EffectAbilityDecrease(ABILITY_CONSTITUTION, 15);

ApplyEffectToObject(1, eVFX, oTarget, 3.0);
ApplyEffectToObject(1, eLink, oTarget, 30.0);
DelayCommand(30.0, ApplyEffectToObject(1, eConD, oTarget, 15.0));
That should simply link the icon and the CON increase. I don't believe it's necessary because SetEffectIcon should already function like that, but I could be wrong.
Thanks. As was stated in my original post, I used this Which clearly stated that if I wanted to make my own buff Power, to simply substitute my stuff in. I copied and pasted the code into Notepad and saved it as a make-shift tutorial. I did so for each code box and labeled them "Buff_Power-Extended" and "Buff_Power" accordingly. Then when I did mine, I skipped the level checks, and now that I think about it, the linked effects were probably used to relate to each level check.

Hence my confusion as well. I'll re-do the script as soon as I fix my TSL game. I'm using the factory discs, no torrents, and when I insert the play disc(after Disc 4 of course),...AND MY COMPUTER EMERGENCY RESTARTS!!!

I might have to re-install Windows...


Also, how would I script that if I was to not link it, and what would be the difference between the linked and not-linked versions? Thank you, JC!
Fair Strides 2 is offline   you may: quote & reply,
Old 05-03-2012, 06:40 PM   #185
JCarter426
Senior Member
 
JCarter426's Avatar
 
Join Date: Feb 2008
Location: Look to your left.
Posts: 1,636
Quote:
Originally Posted by Fair Strides 2 View Post
Thanks. As was stated in my original post, I used this Which clearly stated that if I wanted to make my own buff Power, to simply substitute my stuff in. I copied and pasted the code into Notepad and saved it as a make-shift tutorial. I did so for each code box and labeled them "Buff_Power-Extended" and "Buff_Power" accordingly. Then when I did mine, I skipped the level checks, and now that I think about it, the linked effects were probably used to relate to each level check.
Ah I see. You had most of it right; mainly it was the last effect, which couldn't be linked to the others because of the reasons I specified.
Quote:
Also, how would I script that if I was to not link it, and what would be the difference between the linked and not-linked versions? Thank you, JC!
Code:
object oTarget = GetSpellTargetObject(); 
effect eVFX = EffectVisualEffect(VFX_IMP_BATTLE_MED_III);
effect eConI = EffectAbilityIncrease(ABILITY_CONSTITUTION, 25);
effect eConD = EffectAbilityDecrease(ABILITY_CONSTITUTION, 15);

ApplyEffectToObject(1, eVFX, oTarget, 3.0);
ApplyEffectToObject(1, eConI, oTarget, 30.0);
SetEffectIcon(eConI, 69);
DelayCommand(30.0, ApplyEffectToObject(1, eConD, oTarget, 15.0));
That's the unlinked version. There should be no functional difference in this case unless I'm completely wrong about the icon thing and you really do have to link them. For the record, when scripting I always assume I'm wrong and double check... the engine is a fickle and unpredictable mistress. And I do believe you're right, the linked effects in the tutorial were related to the level checks; it applies different stat bonuses depending on the character's level, with the stat bonuses nested in if/else statements, all linked to some stuff defined earlier on. Frankly I wouldn't do it that way; I'd rather use a subroutine, with the stat bonus as a variable... but that's an entirely different tutorial. And I wasn't sure if you want that or not. This is for having one spell with multiple effects that depend on your level - a 20 point bonus at level 6 and above, a 25 point bonus for level 12 and above, 30 for level 18, and so on; if you simply want to give classes access to the spell at different times, you need a 2DA for that. But if you do want the first thing, come back and I can give you that other tutorial, or you could look at Qui-Gon's.

Good luck.


JCarter426 is offline   you may: quote & reply,
Old 05-03-2012, 07:25 PM   #186
Fallen Guardian
Wandering the Galaxy...
 
Fallen Guardian's Avatar
 
Join Date: Aug 2010
Location: Unknown Regions
Posts: 1,286
Current Game: Knights of the Old Republic
Veteran Modder Helpful! 
Quote:
Originally Posted by JCarter426 View Post
I found something:
Code:
// 397: Get the base item type (BASE_ITEM_*) of oItem.
// * Returns BASE_ITEM_INVALID if oItem is an invalid item.
int GetBaseItemType(object oItem);
So just set it up to check if the base item type is BASE_ITEM_BLASTER_PISTOL (12). The full list is in NWScript. You might want to repeat it for ion pistols, sonic pistols, and the like.
Hey thanks JC. Though, not being the best scripter in the world, I don't really have an idea how to set it up. Here's my attempt:

Code:
int StartingConditional()
{
    if (GetItemInSlot(INVENTORY_SLOT_RIGHTWEAPON, GetFirstPC()) == GetBaseItemType(12));
    {
        return TRUE;
    }
    return FALSE;
}
The compiler is telling me that I have a type mismatch in paramter 1 when attempting to get the base item, as well as an if or else statement followed by a blank statement.


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 05-03-2012, 07:33 PM   #187
Hassat Hunter
Forumite
 
Join Date: Jan 2010
Posts: 560
Don't have ; after the if (after all, it's no end).

Also pretty sure JC's posts tells to use GetBaseItemType(BASE_ITEM_BLASTER_PISTOL), not GetBaseItemType(12), though not sure on that one...
Hassat Hunter is offline   you may: quote & reply,
Old 05-03-2012, 08:06 PM   #188
JCarter426
Senior Member
 
JCarter426's Avatar
 
Join Date: Feb 2008
Location: Look to your left.
Posts: 1,636
Either one works.
Code:
int StartingConditional() {
object oWeap = GetItemInSlot(INVENTORY_SLOT_RIGHTWEAPON, GetPartyLeader());

if ( GetBaseItemType(oWeap) == 12 ) {
        return TRUE;
    }
return FALSE;
}
That should do it.


JCarter426 is offline   you may: quote & reply,
Old 05-03-2012, 08:35 PM   #189
Fallen Guardian
Wandering the Galaxy...
 
Fallen Guardian's Avatar
 
Join Date: Aug 2010
Location: Unknown Regions
Posts: 1,286
Current Game: Knights of the Old Republic
Veteran Modder Helpful! 
Quote:
Originally Posted by Hassat Hunter View Post
Don't have ; after the if (after all, it's no end).

Also pretty sure JC's posts tells to use GetBaseItemType(BASE_ITEM_BLASTER_PISTOL), not GetBaseItemType(12), though not sure on that one...
Quote:
Originally Posted by JCarter426 View Post
Either one works.
Code:
int StartingConditional() {
object oWeap = GetItemInSlot(INVENTORY_SLOT_RIGHTWEAPON, GetPartyLeader());

if ( GetBaseItemType(oWeap) == 12 ) {
        return TRUE;
    }
return FALSE;
}
That should do it.
Thanks both of you.

EDIT: I've made conditional script for all weapons in the game, I'll test them out and report back whether it works.


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; 05-03-2012 at 11:33 PM.
Fallen Guardian is offline   you may: quote & reply,
Old 05-05-2012, 07:54 PM   #190
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
Code:
object oTarget = GetSpellTargetObject(); 
effect eVFX = EffectVisualEffect(VFX_IMP_BATTLE_MED_III);
effect eConI = EffectAbilityIncrease(ABILITY_CONSTITUTION, 25);
effect eConD = EffectAbilityDecrease(ABILITY_CONSTITUTION, 15);

ApplyEffectToObject(1, eVFX, oTarget, 3.0);
ApplyEffectToObject(1, eConI, oTarget, 30.0);
SetEffectIcon(eConI, 69);
DelayCommand(30.0, ApplyEffectToObject(1, eConD, oTarget, 15.0));
Good luck.
I tried and I'm not sure how to splice that into my messed up script. On the other hand, though, My messed up script is almost fixed. One error at present.
Code:
#include "k_inc_force"

int FORCE_POWER_FINAL_STAND = 16;

void main()
{

        object oTarget = GetSpellTargetObject();        
        effect eTargetVisual;                           
        effect eBuff;                                   



        if(GetHasSpell(FORCE_POWER_FINAL_STAND))
        {
        Sp_RemoveSpellEffectsGeneral(FORCE_POWER_FINAL_STAND, oTarget);
        }

        SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, GetSpellId()));


        eBuff = SetEffectIcon(eBuff, 69);
        eTargetVisual = EffectVisualEffect(VFX_IMP_BATTLE_MED_III);

        eBuff = EffectLinkEffects(eBuff, EffectAbilityIncrease(ABILITY_CONSTITUTION, 25));

        ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eTargetVisual, oTarget, 3.0);
        ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eBuff, oTarget, 30.0);

        fDelayInSeconds = 30.0;
        DelayCommand(fDelayInSeconds(eBuff, EffectAbilityDecrease(ABILITY_CONSTITUTION, 15))
        ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eBuff, oTarget, 15.0);
}
I hit compile, and I get an error at line 32 because of the "ApplyEffectToObject" in the beginning.


Here's my attempt to splice it. Yes, I know it looks bad.

Code:
#include "K_inc_force"

int FORCE_POWER_FINAL_STAND = 16;

void main()
{
     object oTarget = GetSpellTargetObject();
     effect eTargetVisual; 


     if(GetHasSpell(FORCE_POWER_FINAL_STAND))
     {
      Sp_RemoveSpellEffectsGeneral(FORCE_POWER_FINAL_STAND, oTarget);
     }


 
     effect eVFX = EffectVisualEffect(VFX_IMP_BATTLE_MED_III);
     effect eConI = EffectAbilityIncrease(ABILITY_CONSTITUTION, 25);
     effect eConD = EffectAbilityDecrease(ABILITY_CONSTITUTION, 15);


     SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, GetSpellId()));
     ApplyEffectToObject(1, eVFX, oTarget, 3.0);
     ApplyEffectToObject(1, eConI, oTarget, 30.0);
     SetEffectIcon(eConI, 69);
     DelayCommand(30.0, ApplyEffectToObject(1, eConD, oTarget, 15.0));
}
With errors at line 13 for undeclared identifier for "Sp_RemoveSpellEffectsGeneral" and line 18 at undeclared identifier for "VFX_IMP_BATTLE_MED_III" and required argument missing in call to "EffectVisualEffect".
Fair Strides 2 is offline   you may: quote & reply,
Old 05-05-2012, 08:18 PM   #191
JCarter426
Senior Member
 
JCarter426's Avatar
 
Join Date: Feb 2008
Location: Look to your left.
Posts: 1,636
Quote:
Originally Posted by Fair Strides 2 View Post
I hit compile, and I get an error at line 32 because of the "ApplyEffectToObject" in the beginning.
You're missing a semicolon on the previous line.

But the second one looks fine apart for two things:
Quote:
With errors at line 13 for undeclared identifier for "Sp_RemoveSpellEffectsGeneral" and line 18 at undeclared identifier for "VFX_IMP_BATTLE_MED_III" and required argument missing in call to "EffectVisualEffect".
The K in "k_inc_force" shouldn't be capitalized. Everything is case sensitive. EVERYTHING. Because you didn't include it properly, it can't find stuff that's defined in it.
Quote:
effect eTargetVisual;
Delete that, you aren't using it anywhere.

Nothing else jumps out at me... but often nothing jumps out at me when other stuff is jumping out at me... I usually have to fix one error at a time until it goes through.


JCarter426 is offline   you may: quote & reply,
Old 05-05-2012, 08:39 PM   #192
Fallen Guardian
Wandering the Galaxy...
 
Fallen Guardian's Avatar
 
Join Date: Aug 2010
Location: Unknown Regions
Posts: 1,286
Current Game: Knights of the Old Republic
Veteran Modder Helpful! 
Hey, just tested the conditional scripts for the weapons. They all work, thanks JC and HH.


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 05-06-2012, 12:04 AM   #193
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
You're missing a semicolon on the previous line.
Because I had tried to compile it with the semicolon, but it gave a syntax error with it.

Quote:
Originally Posted by JCarter426 View Post
But the second one looks fine apart for two things:

The K in "k_inc_force" shouldn't be capitalized. Everything is case sensitive. EVERYTHING. Because you didn't include it properly, it can't find stuff that's defined in it.

Delete that, you aren't using it anywhere.
Lower-cased the K, but still no dice. Even rearranged it so that the SignalEvent line was above everything after the effect stuff, and nothing.
Fair Strides 2 is offline   you may: quote & reply,
Old 05-06-2012, 12:19 PM   #194
JCarter426
Senior Member
 
JCarter426's Avatar
 
Join Date: Feb 2008
Location: Look to your left.
Posts: 1,636
Quote:
Originally Posted by Fair Strides 2 View Post
Because I had tried to compile it with the semicolon, but it gave a syntax error with it.
Well, you need the semicolon. Every command has to end with a semicolon. However, you're also missing a close parenthesis.

Quote:
Lower-cased the K, but still no dice. Even rearranged it so that the SignalEvent line was above everything after the effect stuff, and nothing.
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.
Quote:
Originally Posted by Fallen Guardian View Post
Hey, just tested the conditional scripts for the weapons. They all work, thanks JC and HH.
Nice! Such a conditional sounds very useful indeed. I might make a universal one for K2 when I have my stuff sorted out. Thanks to K2's script parameters, it would be able to check if you have any of several different types, just by inputting the number of each type into the dialogue file.


JCarter426 is offline   you may: quote & reply,
Old 05-18-2012, 12:34 AM   #195
Fallen Guardian
Wandering the Galaxy...
 
Fallen Guardian's Avatar
 
Join Date: Aug 2010
Location: Unknown Regions
Posts: 1,286
Current Game: Knights of the Old Republic
Veteran Modder Helpful! 
I've brought more scripting woes. Anyway, here's a long userdefined script of mine (Ignore the poor spacing... please.):

Code:
void main()
{
	object oNPC = GetObjectByTag("n_comm");

	object oNPC1 = GetObjectByTag("n_merc01");

     object oNPC2 = GetObjectByTag("n_merc02");

     object oNPC3 = GetObjectByTag("n_laz");

     object oNPC4 = GetObjectByTag("n_kar");

     object oPM1 = GetPartyMemberByIndex(1);

     object oPM2 = GetPartyMemberByIndex(2);

     object oPM3 = GetPartyMemberByIndex(0);


    object oPC = GetFirstPC();

    int nCurrentHP;
    int nUser = GetUserDefinedEventNumber();
    if(nUser == 1006)
    {
       nCurrentHP=GetCurrentHitPoints();
       if (nCurrentHP<2) {

           ChangeToStandardFaction(OBJECT_SELF, 9);
      AssignCommand(OBJECT_SELF, ClearAllActions());
           CancelCombat (oNPC);
      AssignCommand(OBJECT_SELF, ClearAllEffects());
          SetLocalBoolean(OBJECT_SELF, 21, TRUE);
     AssignCommand(oNPC, ActionPlayAnimation(26, 1.0, (145.0)));
  AssignCommand(oNPC, SetLockOrientationInDialog(oNPC, TRUE));
   DelayCommand(0.2, SetCommandable(FALSE, oNPC));


if(
	GetIsDead(oNPC1) &&
	GetIsDead(oNPC2) ) {

 ExecuteScript("dt_fadeout", OBJECT_SELF);

SetPartyLeader(NPC_PLAYER);

  DelayCommand(2.0, AssignCommand((GetObjectByTag("n_ethan")), ActionDoCommand(ActionStartConversation(oPC))));

      }     
   DelayCommand(0.2, SetCommandable(FALSE, oNPC));

CancelCombat(oNPC3);
CancelCombat(oNPC4);
CancelCombat(oPM1);
CancelCombat(oPM2);
CancelCombat(oPM3);

if (GetIsDead(oNPC1))

 AssignCommand(oNPC3, ActionAttack(oNPC2));
 AssignCommand(oNPC4, ActionAttack(oNPC2));
 AssignCommand(oPM1, ActionAttack(oNPC2));
 AssignCommand(oPM2, ActionAttack(oNPC2));
 AssignCommand(oPM3, ActionAttack(oNPC2));

else

 AssignCommand(oNPC3, ActionAttack(oNPC1));
 AssignCommand(oNPC4, ActionAttack(oNPC1));
 AssignCommand(oPM1, ActionAttack(oNPC1));
 AssignCommand(oPM2, ActionAttack(oNPC1));
 AssignCommand(oPM3, ActionAttack(oNPC1));


       }
   
    }

}
The main issue with this lies in the last conditional at the bottom. The compiler tells me I have a syntax error at else.

Any ideas?


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 05-18-2012, 04:27 AM   #196
Hassat Hunter
Forumite
 
Join Date: Jan 2010
Posts: 560
Quote:
if(nUser == 1006)
{
nCurrentHP=GetCurrentHitPoints();
if (nCurrentHP<2) {
I see 2 opening tags here, but further on just one closing tag.
Or maybe the spacing makes it hard for me to see what you try to do and they're both at the end??
Quote:
if(
Should be if {
Quote:
GetIsDead(oNPC1) &&
GetIsDead(oNPC2) ) {
There's an extra closing bracket (to compensate for the if(?) but no opening bracket to go with it...
Hassat Hunter is offline   you may: quote & reply,
Old 06-12-2012, 07:17 PM   #197
Fallen Guardian
Wandering the Galaxy...
 
Fallen Guardian's Avatar
 
Join Date: Aug 2010
Location: Unknown Regions
Posts: 1,286
Current Game: Knights of the Old Republic
Veteran Modder Helpful! 
Hey, I've come to ask for help in the making of a script. Basically, I have an idea on what I'd like to do and I'm pretty sure it's possible, I just wouldn't know how to write it up. So I'll write what I'd like to happen as if I were writing a script, just with words, no functions.

Code:
void main()
{

Check to see if the on perception event has been fired and to see if the distance between the PC and OBJECT_SELf is 7 meters or less and checks to see if a local boolean of OBJECT_SELF is false.

ActionWait(5.0);

ExecuteOtherScript

Or if the above conditional is not met, it goes to this next one.

Check to see if the on perception event has been fired and to see if the distance between the PC and OBJECT_SELf is 10 meters or less and checks to see if a local boolean of OBJECT_SELF is false and checks to see if a global boolean has been set true.

ActionWait(5.0);

ExecuteOtherScript2

Or if the above conditional is not met, it goes to this next one.

Check to see if the on perception event has been fired and to see if the distance between the PC and OBJECT_SELF is 5 meters or less and checks to see if a local boolean of OBJECT_SELF is false and checks to see if a global boolean has been set true.

ActionWait(5.0);

ExecuteOtherScript3

End Script

So I just really need help in setting up those conditionals all into one script. If anyone could help, it'd be much appreciated.


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-14-2012, 01:16 AM   #198
JCarter426
Senior Member
 
JCarter426's Avatar
 
Join Date: Feb 2008
Location: Look to your left.
Posts: 1,636
Not sure what you want for the perception event... I think if you want to make something happen when an object perceives something, you have to modify its OnPerception script. Also, what you described will never trigger #3. Here it is anyway though, minus the perception stuff:

Code:
void main() {

object oPC = GetFirstPC();
int nLocal = #;
string sGlobal = "****"
string sScript1 = "****1"
string sScript2 = "****2"
string sScript3 = "****3"

if( !GetLocalBoolean(OBJECT_SELF, nLocal) ){

	if( GetDistanceBetween(OBJECT_SELF, oPC) <= 7.0 ) {
		ActionWait(5.0);
		ExecuteScript(sScript1, OBJECT_SELF, -1);
		}

	else if( GetGlobalBoolean(string sGlobal) ){
		if( GetDistanceBetween(OBJECT_SELF, oPC) <= 10.0 ) {
			ActionWait(5.0);
			ExecuteScript(sScript3, OBJECT_SELF, -1);
			}
		else if ( GetDistanceBetween(OBJECT_SELF, oPC) <= 5.0 ){
			ActionWait(5.0);
			ExecuteScript(sScript2, OBJECT_SELF, -1);

		}

	}

}


JCarter426 is offline   you may: quote & reply,
Old 06-15-2012, 12:24 AM   #199
Fallen Guardian
Wandering the Galaxy...
 
Fallen Guardian's Avatar
 
Join Date: Aug 2010
Location: Unknown Regions
Posts: 1,286
Current Game: Knights of the Old Republic
Veteran Modder Helpful! 
Quote:
Originally Posted by JCarter426 View Post
Not sure what you want for the perception event... I think if you want to make something happen when an object perceives something, you have to modify its OnPerception script. Also, what you described will never trigger #3. Here it is anyway though, minus the perception stuff:

Code:
void main() {

object oPC = GetFirstPC();
int nLocal = #;
string sGlobal = "****"
string sScript1 = "****1"
string sScript2 = "****2"
string sScript3 = "****3"

if( !GetLocalBoolean(OBJECT_SELF, nLocal) ){

	if( GetDistanceBetween(OBJECT_SELF, oPC) <= 7.0 ) {
		ActionWait(5.0);
		ExecuteScript(sScript1, OBJECT_SELF, -1);
		}

	else if( GetGlobalBoolean(string sGlobal) ){
		if( GetDistanceBetween(OBJECT_SELF, oPC) <= 10.0 ) {
			ActionWait(5.0);
			ExecuteScript(sScript3, OBJECT_SELF, -1);
			}
		else if ( GetDistanceBetween(OBJECT_SELF, oPC) <= 5.0 ){
			ActionWait(5.0);
			ExecuteScript(sScript2, OBJECT_SELF, -1);

		}

	}

}
Thanks JC. The reason I want the perception event is because this is a userdefined script for an NPC. Just out of curiosity, why wouldn't the 3rd condition ever be met?


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-15-2012, 08:52 AM   #200
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
Thanks JC. The reason I want the perception event is because this is a userdefined script for an NPC.
I still don't get what you want. I don't think there's a generic "check if NPC has seen something" function. I'm not sure if you can even check if a specific NPC has seen a specific object, unless it's a trap. Perhaps someone else can clarify; I tend to stay away from this area, I prefer predictable scripting, like cutscenes.

EDIT: I looked into it more out of curiosity and it appears to have confirmed my suspicions. Here's a bit from Atton's user defined events:

Code:
                    object oSeen = GetLastPerceived();
                    if(GetIsPC(oSeen) && GetLastPerceptionSeen())
                    {
That checks if the PC was the last object Atton saw, but it doesn't trigger anything on its own. You'd need to trigger the user defined event via the perception script (apparently it's called "OnNotice" in KOTOR Tool).
Quote:
Just out of curiosity, why wouldn't the 3rd condition ever be met?
Because if it's less than 5 meters away then it's also less than 7 or 10 meters away, and those are checked first. I could recommend some changes, but I'd need more specifics; as I said I'm not quite sure what you're doing here.



Last edited by JCarter426; 06-16-2012 at 12:02 AM.
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 04:42 PM.

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