clockout1 Posted February 4, 2010 Posted February 4, 2010 Is it possible to attach a script to a weapon that will cause damage to a certain creature when nothing else will? It's confusing, so let me rephrase: A creature that is only damaged by one weapon. Can it be done?
Broken_Code Posted February 4, 2010 Posted February 4, 2010 Yes it's possible, but it'd need some nice coding on the script to get it to work. Here's the way I'd do it:Make a weapon - set it to zero damageAttach a script that checks the base ID of the creature/actor and deals damage appropriately. I know there's a way to call the base of the creature/NPC hit but I can't remember it off the top of my head, best bet would be to look it up on the CS wiki. Broken_Code {EDIT}Sorry, got the worng end of the stick, I was thinking a weapon that only damages a certain creature.
clockout1 Posted February 4, 2010 Author Posted February 4, 2010 Couldn't I do a somewhat reverse call from the creature? Like it detects the weapon and if it's the correct one it will do damage?
Broken_Code Posted February 4, 2010 Posted February 4, 2010 Yes, I'm sure it's possible, and I'm quite sure that I've seen a command like that somewhere (CS wiki it). Once you find that the script should be pretty straight foward. eg: Activate OnHitif HitWith MyWeapon ==1 Set ActorHealth to ActorHealth - 10else Set ActorHealth to GetBaseActorHealthendifEnd(If something like an OnHit block doesn't exist for weapons you'll have to do some more elaborate coding.) A script something like that, with all the proper variable names, attached to the creature should do the trick (I think). Broken_Code
clockout1 Posted February 4, 2010 Author Posted February 4, 2010 Interesting. This is the script I came up with: Scn AADungeonCreatureHitDetection short damage ref Actor Begin OnHit set Actor to AAThePlaceholder if getIsID AADungeonSword ==1 set AAThePlaceHolder.GetCurrentHealth to AAThePlaceHolder.GetCurrentHealth - (1 + .2 * GetRandomPercent) endif if getIsID AADungeonSword == 0 set Actor.GetAV (Health) to Actor.GetBaseAV (Health) endif end But when I hit save, it says it is missing "to" on line fourteen when it's clearly there. Do you know why?
zprospero Posted February 4, 2010 Posted February 4, 2010 Try it without the parentheses. Pretty sure they do nothing, and it might be what's confusing it. EDIT: Okay, I just tried that and it didn't work either.
clockout1 Posted February 4, 2010 Author Posted February 4, 2010 I think it's due to the fact that there is a space between AV and Health, which might be confusing it. But I really don't know either.
clockout1 Posted February 4, 2010 Author Posted February 4, 2010 I think it's due to the fact that there is a space between AV and Health, which might be confusing it. But I really don't know either.
zprospero Posted February 4, 2010 Posted February 4, 2010 When I change it to thisset (actor.getactorvalue health) to (actor.getbaseactorvalue health)I get this error:Script 'AADungeonCreatureHitDetection', line 7:Missing variable name in set command. Maybe if you create variables and assign them the necessary values before you do this it will work. so, roughly: short ahealth short abhealth Set ahealth to actor.getactorvalue health Set abhealth to actor.getbasactorvalue health set ahealth to abhealth
clockout1 Posted February 4, 2010 Author Posted February 4, 2010 I would try that, but I got school tomorrow and have to go to bed. So I'll do it when I have the chance.
Recommended Posts