Jump to content

Scripting Question


clockout1

Recommended Posts

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 damage

Attach 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.

Link to comment
Share on other sites

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 OnHit

if HitWith MyWeapon ==1

Set ActorHealth to ActorHealth - 10

else

Set ActorHealth to GetBaseActorHealth

endif

End

(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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

When I change it to this

set (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

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...