newbiemodder Posted September 4, 2009 Share Posted September 4, 2009 I'm working on a new force power..Force Grab...hopefully it allows the pc to take the weapons of his/her attacker..ie Darth Vader taking Han's blaster at Cloud City...except w/o actually seeing the weapon fly through the air. I have this compiled script: #include "k_inc_force" int FORCE_POWER_FORCE_GRAB = 284; void main() { object oTarget = GetLastHostileTarget(); SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, GetSpellId(), FALSE)); ActionUnequipItem(GetItemInSlot(INVENTORY_SLOT_LEFTWEAPON, oTarget), TRUE); ActionUnequipItem(GetItemInSlot(INVENTORY_SLOT_RIGHTWEAPON, oTarget), TRUE); effect eVis2 = EffectVisualEffect( VFX_IMP_STUN ); ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eVis2, GetLocation(oTarget)); } It hasn't worked yet in game. When I check the combat feedback..it sometimes says a will or fortitude save...but not always. 2 questions: 1. Is what I'm trying to do even possible within structure of the game, and 2. if it is possible, could someone fix my script to make it better? Any help is appreciated. Link to comment Share on other sites More sharing options...
jonathan7 Posted September 4, 2009 Share Posted September 4, 2009 I can't really help with the scripting as I'm not a scripter, that said I don't see why its not possible considering you can throw a lightsaber/grenade and see it fly, and follow its course. I did want to say also that this is an awesome idea Link to comment Share on other sites More sharing options...
VarsityPuppet Posted September 5, 2009 Share Posted September 5, 2009 If you mean making it LOOK like you're taking your opponent's gun away, I'm not sure it's possible... as far as fixing your script, I can't help you, I would have scripted it much differently Link to comment Share on other sites More sharing options...
stoffe Posted September 5, 2009 Share Posted September 5, 2009 I'm working on a new force power..Force Grab...hopefully it allows the pc to take the weapons of his/her attacker..ie Darth Vader taking Han's blaster at Cloud City...except w/o actually seeing the weapon fly through the air. You'd need to transfer the wielded weapon from the victim to the force user as well, your script was only unequipping it from what I could see. You also need to verify that the weapon isn't an undroppable NPC-only weapon that the player isn't supposed to be able to get. Further you should allow the victim to use Force Resistance and a saving throw (reflex makes most sense I think) to avoid the effects. This would be a pretty powerful power when used against most opponents since it pretty much permanently stops them from attacking, after all, and I doubt the combat AI would handle their predicament gracefully. Implementing the above the script could be something like this (untested, but in theory it should work ) #include "k_inc_force" int ST_SnatchWeapon(object oWeapon, object oGiveTo=OBJECT_SELF); void main() { object oTarget = GetSpellTargetObject(); // ST: Signal AI event so the enemy knows they just got attacked. SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, GetSpellId(), TRUE)); // ST: Give victim a chance to resist the force power if(ResistForce(OBJECT_SELF, oTarget)) { DisplayFeedBackText(oTarget, 0); ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectForceResisted(OBJECT_SELF), oTarget); return; } // ST: Allow reflex save to avoid the effect SWFP_PRIVATE_SAVE_TYPE = SAVING_THROW_REFLEX; if (Sp_MySavingThrows(oTarget) == FALSE) { object oRight = GetItemInSlot(INVENTORY_SLOT_RIGHTWEAPON, oTarget); object oLeft = GetItemInSlot(INVENTORY_SLOT_LEFTWEAPON, oTarget); int bSuccess = FALSE; // ST: Snatch the off-hand weapon first if dual-wielding, otherwise the mainhand one. if (ST_SnatchWeapon(oLeft)) { bSuccess = TRUE; } else if (ST_SnatchWeapon(oRight)) { bSuccess = TRUE; } if (bSuccess) { // ST: Disorient the victim briefly when their weapon gets snatched ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectCutSceneStunned(), oTarget, 2.0); } else { // ST: Victim had no weapon to steal; the power fizzles. ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectForceFizzle(), OBJECT_SELF); } } } int ST_SnatchWeapon(object oWeapon, object oGiveTo=OBJECT_SELF) { if (GetIsObjectValid(oWeapon)) { string sTag = GetTag(oWeapon); object oOwner = GetItemPossessor(oWeapon); // ST: Check that the weapon isn't an undroppable NPC-only weapon. if ((GetStringLowerCase(GetSubString(sTag, 0, 4)) != "prop") && (GetStringLowerCase(GetSubString(sTag, 0, 8)) != "g_w_null")) { AssignCommand(oOwner, GiveItem(oWeapon, oGiveTo)); SendMessageToPC(oGiveTo, "Pulled weapon " + GetName(oWeapon) + " from " + GetName(oOwner) + "!"); return TRUE; } } return FALSE; } Link to comment Share on other sites More sharing options...
newbiemodder Posted September 5, 2009 Author Share Posted September 5, 2009 Stoffe..you're awesome...I'll give it a try. Link to comment Share on other sites More sharing options...
Slstoev Posted September 5, 2009 Share Posted September 5, 2009 Any luck yet? Link to comment Share on other sites More sharing options...
newbiemodder Posted September 6, 2009 Author Share Posted September 6, 2009 script compiles...doesn't seem to be working...a couple of times the attacker had a reflex save..but there was a couple reflex failure saves and nothing happened. Link to comment Share on other sites More sharing options...
VarsityPuppet Posted September 6, 2009 Share Posted September 6, 2009 Stoffe comes to the rescue with a beautiful-looking script! er.. it's not working though??? Link to comment Share on other sites More sharing options...
stoffe Posted September 6, 2009 Share Posted September 6, 2009 script compiles...doesn't seem to be working...a couple of times the attacker had a reflex save..but there was a couple reflex failure saves and nothing happened. Well, I did say it was untested. Now you've made me dig out my old TSL discs to try this out properly. Seems like a few things didn't quite work as I remembered it, must have mixed it up with NWScript behavior from Neverwinter Nights. Anyway, this one is fixed, tested and works in my game at least: #include "k_inc_force" int ST_SnatchWeapon(object oWeapon, object oGiveTo=OBJECT_SELF); void main() { object oTarget = GetSpellTargetObject(); // ST: Signal AI event so the enemy knows they just got attacked. SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, GetSpellId(), TRUE)); // ST: Give victim a chance to resist the force power if(ResistForce(OBJECT_SELF, oTarget)) { DisplayFeedBackText(oTarget, 0); ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectForceResisted(OBJECT_SELF), oTarget); return; } // ST: Allow reflex save to avoid the effect SWFP_PRIVATE_SAVE_TYPE = SAVING_THROW_REFLEX; if (Sp_MySavingThrows(oTarget) == FALSE) { object oRight = GetItemInSlot(INVENTORY_SLOT_RIGHTWEAPON, oTarget); object oLeft = GetItemInSlot(INVENTORY_SLOT_LEFTWEAPON, oTarget); int bSuccess = FALSE; // ST: Snatch the off-hand weapon first if dual-wielding, otherwise the mainhand one. if (ST_SnatchWeapon(oLeft)) { bSuccess = TRUE; } else if (ST_SnatchWeapon(oRight)) { bSuccess = TRUE; } if (bSuccess) { // ST: Disorient the victim briefly when their weapon gets snatched ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectCutSceneStunned(), oTarget, 2.0); } else { // ST: Victim had no weapon to steal; the power fizzles. ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectForceFizzle(), OBJECT_SELF); } } } int ST_SnatchWeapon(object oWeapon, object oGiveTo=OBJECT_SELF) { if (GetIsObjectValid(oWeapon)) { string sTag = GetTag(oWeapon); object oOwner = GetItemPossessor(oWeapon); // ST: Check that the weapon isn't an undroppable NPC-only weapon. if ((GetStringLowerCase(GetSubString(sTag, 0, 4)) != "prop") && (GetStringLowerCase(GetSubString(sTag, 0, 8)) != "g_w_null")) { AssignCommand(oOwner, GiveItem(oWeapon, oGiveTo)); SendMessageToPC(oGiveTo, "Pulled weapon " + GetName(oWeapon) + " from " + GetName(oOwner) + "!"); return TRUE; } } return FALSE; } It allows force resistance, a reflex saving throw and then pulls a weapon from the victim. If they're dual wielding it will take the off-hand weapon, if they're not (or if their off-hand weapon got taken by a previous cast) it takes their main hand weapon. Link to comment Share on other sites More sharing options...
newbiemodder Posted September 6, 2009 Author Share Posted September 6, 2009 cool..I'll give it a try EDIT: Great job Stoffe...this one works..you are the best...we'd be lost without your scripting help...now get some sleep, you've been up way too long Link to comment Share on other sites More sharing options...
deathdisco Posted September 7, 2009 Share Posted September 7, 2009 Kudos to Stoffe for sitting through an install of TSL to help out a fellow modder. Always going above and beyond. Great idea for a new FP newbiemodder! Link to comment Share on other sites More sharing options...
VarsityPuppet Posted September 7, 2009 Share Posted September 7, 2009 the only way to make it awesomer would be to figure out how to actually make the gun travel from opponent to caster. If there was a way to make projectile models.. I believe there is (SithSpecter's Cheese gun for instance)... you could make a projectile that's a clone of the gun and have it shoot towards the caster and play a "catching animations". Idk, am I on to something here, or am I just dreaming? Link to comment Share on other sites More sharing options...
R2-X2 Posted September 7, 2009 Share Posted September 7, 2009 You might could try to edit the lightsaber throw effect to use it with a gun, and cast the effect from the target to the caster. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.