comi8903 Posted May 10, 2009 Share Posted May 10, 2009 This may sound like a stupid question or a newbie question, but I'm new to scripting and am stumped. I've made a weapon that does major damage, but I want to balance it with the damage done to the player when fired. I've set an object effect script on the gun so that when it is equipped, it changes a variable from 0 to 1 and then changes the variable back to 0 when unequipped. This script is working. The next part of the whole thing is where I'm stumped. I'm trying to run a gamemode block that checks the variable mentioned above. If it's a 1 then it runs an if statment that checks what the players last action was "if getlastplayeraction=3" If this condition is true, then the player recieves some damage to their health. I've included some debugging info in the gamemode block to see if it is running in game. When I load the game, the gamemode block does not run. Am I missing something. Do I need to start the gamemode block somehow? Please help me. Thanks DC Link to comment Share on other sites More sharing options...
TGBlank Posted May 10, 2009 Share Posted May 10, 2009 == instead of = maybe?Also, when asking for script help. you might as well post the script (use code tags to have it appear in a black box that respects identing, or codebox tags if it's extensive) Link to comment Share on other sites More sharing options...
Cipscis Posted May 10, 2009 Share Posted May 10, 2009 This may sound like a stupid question or a newbie question, but I'm new to scripting and am stumped.If you're new to scripting, then you might want to check out my beginner's scripting tutorial. You can find the link in my signature. I've set an object effect script on the gun so that when it is equipped, it changes a variable from 0 to 1 and then changes the variable back to 0 when unequipped. This script is working."Weapon" type object effects run on the target, not the subject, so a scripted object effect attached to your weapon will run on actors that are shot by it, as opposed to actors that equip it. Because of this, I'm a little confused by what you've said, perhaps if you post the script I'll understand better. The next part of the whole thing is where I'm stumped. I'm trying to run a gamemode block that checks the variable mentioned above. If it's a 1 then it runs an if statment that checks what the players last action was "if getlastplayeraction=3" If this condition is true, then the player recieves some damage to their health.Firstly, you should be using IsPlayerActionActive, and secondly, the correct operator to use here is "==". See the glossary of my tutorial for more information on operators. I've included some debugging info in the gamemode block to see if it is running in game. When I load the game, the gamemode block does not run. Am I missing something. Do I need to start the gamemode block somehow?GameMode blocks in quest scripts will run so long as the quest is running, and GameMode blocks in object scripts will run so long as the scripted object is loaded (either a reference, or an inventory item in the inventory of a loaded reference). If this is not true, or perhaps you've forgotten to attach the script, the block will not run. Once again, as TGBlank said, it'll be easier to help you if you post the script(s) that you're using. Cipscis Link to comment Share on other sites More sharing options...
comi8903 Posted May 10, 2009 Author Share Posted May 10, 2009 Thanks for your replies. First of all, I am using the "==" operator, I just mistyped it in the post. I've made a few changes to my setup since my first post. I've condesed it into one script (should have done that since the beginning.) The script is attached to a weapon that produces a nuclear explosion from a beam. The damage is spectacular but the weapon is overpowered so I want to balance with damage done to the player when fired. The script is as follows ScriptName AMCannonPriceScript short FireStatus short OneDamageAM Begin OnEquip Set AMCannonEquip to 1 End Begin OnUnEquip Set AMCannonEquip to 0 End Begin GameMode If AMCannonEquip != 0 If OneDamageAM < 50 Set OneDamageAM to OneDamageAM +1 Else If IsPlayerActionActive 3 player.DamageActorValue Health -10 showmessage AMDamageAnnounceNoArmor Set OneDamageAM to 0 Endif Endif Endif End Whenever the weapon is fired, it causes between 10 and 20 damage to the PC. This is what I want, though I will eventually increase the damage to 100 steady. The onedamageAM variable is a slowdown variable to prevent overloading of damage to the character and a CTD. It seems to work, though I need to adjust the number 50 to something else to prevent double damage from occurring. Everything works fine up until the point that I actually hit a NPC or creature with the weapon. After that the block ceases to function. I'm debugging right now. Any help would be appreciated. Thanks DC Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.