Hassat Hunter Posted April 25, 2012 Share Posted April 25, 2012 Pretty sure the , should be outside the "" markings. Also, you lack a quantity. Link to comment Share on other sites More sharing options...
Fallen Guardian Posted May 1, 2012 Share Posted May 1, 2012 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? Link to comment Share on other sites More sharing options...
Hassat Hunter Posted May 1, 2012 Share Posted May 1, 2012 Kotor2 has this script by default... it's c_lightsaber_eq. Content; // 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; } Link to comment Share on other sites More sharing options...
Fallen Guardian Posted May 2, 2012 Share Posted May 2, 2012 Do you know if I were to change the "Lightsaber" to say Blaster Pistol, if it would work or not? Link to comment Share on other sites More sharing options...
Fair Strides 2 Posted May 2, 2012 Share Posted May 2, 2012 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: #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. Link to comment Share on other sites More sharing options...
JCarter426 Posted May 2, 2012 Share Posted May 2, 2012 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. #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)); } 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: 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 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. Link to comment Share on other sites More sharing options...
Fair Strides 2 Posted May 2, 2012 Share Posted May 2, 2012 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: 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 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 eBuff = EffectLinkEffects(eBuff, EffectAbilityIncrease(ABILITY_CONSTITUTION, 25)); and 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 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. Link to comment Share on other sites More sharing options...
JCarter426 Posted May 3, 2012 Share Posted May 3, 2012 Also, the object of the script at eBuff = EffectLinkEffects(eBuff, EffectAbilityIncrease(ABILITY_CONSTITUTION, 25)); and 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 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: 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: 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: 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. Do you know if I were to change the "Lightsaber" to say Blaster Pistol, if it would work or not? Since you want to check for any sort of blaster, you'll need to use something else. I found something: // 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. Link to comment Share on other sites More sharing options...
Fair Strides 2 Posted May 3, 2012 Share Posted May 3, 2012 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: 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! Link to comment Share on other sites More sharing options...
JCarter426 Posted May 3, 2012 Share Posted May 3, 2012 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. 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! 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. Link to comment Share on other sites More sharing options...
Fallen Guardian Posted May 3, 2012 Share Posted May 3, 2012 I found something: // 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: 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. Link to comment Share on other sites More sharing options...
Hassat Hunter Posted May 3, 2012 Share Posted May 3, 2012 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... Link to comment Share on other sites More sharing options...
JCarter426 Posted May 4, 2012 Share Posted May 4, 2012 Either one works. int StartingConditional() { object oWeap = GetItemInSlot(INVENTORY_SLOT_RIGHTWEAPON, GetPartyLeader()); if ( GetBaseItemType(oWeap) == 12 ) { return TRUE; } return FALSE; } That should do it. Link to comment Share on other sites More sharing options...
Fallen Guardian Posted May 4, 2012 Share Posted May 4, 2012 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... Either one works. 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. Link to comment Share on other sites More sharing options...
Fair Strides 2 Posted May 5, 2012 Share Posted May 5, 2012 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. #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. #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". Link to comment Share on other sites More sharing options...
JCarter426 Posted May 6, 2012 Share Posted May 6, 2012 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: 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. 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. Link to comment Share on other sites More sharing options...
Fallen Guardian Posted May 6, 2012 Share Posted May 6, 2012 Hey, just tested the conditional scripts for the weapons. They all work, thanks JC and HH. Link to comment Share on other sites More sharing options...
Fair Strides 2 Posted May 6, 2012 Share Posted May 6, 2012 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. 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. Link to comment Share on other sites More sharing options...
JCarter426 Posted May 6, 2012 Share Posted May 6, 2012 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. 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. 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. Link to comment Share on other sites More sharing options...
Fallen Guardian Posted May 18, 2012 Share Posted May 18, 2012 I've brought more scripting woes. Anyway, here's a long userdefined script of mine (Ignore the poor spacing... please.): 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? Link to comment Share on other sites More sharing options...
Hassat Hunter Posted May 18, 2012 Share Posted May 18, 2012 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?? if( Should be if { GetIsDead(oNPC1) && GetIsDead(oNPC2) ) { There's an extra closing bracket (to compensate for the if(?) but no opening bracket to go with it... Link to comment Share on other sites More sharing options...
Fallen Guardian Posted June 12, 2012 Share Posted June 12, 2012 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. 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 [color="Red"]Or if the above conditional is not met, it goes to this next one.[/color] 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 [color="Black"]Or if the above conditional is not met, it goes to this next one.[/color] 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. Link to comment Share on other sites More sharing options...
JCarter426 Posted June 14, 2012 Share Posted June 14, 2012 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: void main() { object oPC = GetFirstPC(); [color=red]int nLocal = #; string sGlobal = "****" string sScript1 = "****1" string sScript2 = "****2" string sScript3 = "****3"[/color] 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); } } } Link to comment Share on other sites More sharing options...
Fallen Guardian Posted June 15, 2012 Share Posted June 15, 2012 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: void main() { object oPC = GetFirstPC(); [color=red]int nLocal = #; string sGlobal = "****" string sScript1 = "****1" string sScript2 = "****2" string sScript3 = "****3"[/color] 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? Link to comment Share on other sites More sharing options...
JCarter426 Posted June 15, 2012 Share Posted June 15, 2012 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: 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). 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. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.