Jump to content

What is wrong with this trap script


oc3

Recommended Posts

Time to beg for help again! This script is for a large boulder that when it strikes the player or NPC, causes them to fly backward as a ragdoll and after 3 seconds get up. Everything else about the script works Fine for now. The only part I need help with is knocking out the actor. The boulder pushes them back a bit but does not do the ragdoll thing....

Thanks!

 

EDIT: Don't pay too much attention to the indentation. The editor F***ed it all up when I pasted. I fixed it the best I could, but the editor is seriously lacking in usability.

 

 

 

scn CTMBoulderScript



float fTrapDamage

float flevelledDamage

float fTrapPushBack

float fTrapMinVelocity

float fTrapDeathPushBack

short bTrapContinuous

short activated

Short BaseFatigue

short doonce

float hitTimer

float TrapTimer ; Starts when actor is hit



begin onactivate


set fTrapPushBack to 2000
set fTrapDeathPushBack to 4000
set fTrapMinVelocity to 80
set bTrapContinuous to 0
set fTrapDamage to 95
set flevelledDamage to 1.1
set activated to 1
set hitTimer to 12.5 ; To time the sounds and hit shader to the tempo of the stone
set TrapTimer to 0
end



Begin Gamemode
TrapUpdate

If activated == 1

Set BaseFatigue to GetActorValue Fatigue
ModActorValue Fatigue -100




if hitTimer > 0
set hitTimer to hitTimer - GetSecondsPassed
set TrapTimer to TrapTimer + GetSecondsPassed



if doonce == 0
PlaySound CTMStoneRoll
set doonce to 1
endif



If TrapTimer > 3
ModActorValue Fatigue BaseFatigue
endif


if hitTimer <= 12.4 && hitTimer >= 12.35
TriggerHitShader .7
endif


if hitTimer <= 10.52 && hitTimer >= 10.47
TriggerHitShader 3
endif



if hitTimer <= 4.25 && hitTimer >= 4.2
TriggerHitShader 1.7
endif


if hitTimer <= 4.25 ; It has hit the wall and is moving slowly by then
set fTrapPushBack to 1000
set fTrapMinVelocity to 50
set fTrapDamage to 10
endif


if hitTimer <= 0
set activated to 2
endif



endif

endif

end



begin onReset

Reset3DState
Set doonce to 0
set activated to 0
set hitTimer to 0

end

 

Link to comment
Share on other sites

This may not be possible as I intended. It looks like the trapupdate system is hard coded to only allow certain special variables for trap damage.

 

I was hoping that by putting the modactorvalue function under trapupdate that it would work without an actor reference (since the trap already knows what hit it) but it doesn't work.

 

Unfortunately, I can't even use getactionref to find out what is in contact with the trap since that is only useful inside an onactivate block.

And since the player and other creatures are both present, the script must know who hit the boulder to use modav.

 

I wonder if anyone knows how to modify the trapupdate system to allow new variables like pushback pushactoraway or something else that would give a ragdoll effect.

Edited by oc3
Link to comment
Share on other sites

  • Recently Browsing   0 members

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