Jump to content

Help about scripting


NighTragEl4d

Recommended Posts

Ok guys i have this trigger script:

 

scn EnragedStateTrigger

 

short EnragedStateActive

float timer

 

 

begin GameMode

 

if EnragedStateActive == 0

if (player.IsInCombat && ((player.GetAV Health/player.GetBaseAV Health < 0.1) || GetRandomPercent == 0))

;

; Activate EnragedState script

;

 

player.addspell EnragedStateBonus

set timer to 15

set EnragedstateActive to 1

endif

elseif EnragedStateActive == 1

set timer to timer - GetSecondsPassed

if timer < 0

;

; Deactivate EnragedState script

;

 

player.removespell EnragedStateBonus

player.addspell EnragedStateExhaustion

set timer to 5

set EnragedStateActive to 2

endif

 

elseif EnragedStateActive == 2

set timer to timer - GetSecondsPassed

if timer < 0

player.removespell EnragedStateExhaustion

set EnragedStateActive to 0

endif

endif

 

end

And this is "bullet time" script (EnragedState):

 

scn EnragedState

 

begin scripteffectstart

 

float timer

 

playsound TRPBluntObjectSwish

con_SetIniSetting "fGlobalTimeMultiplier:General" 0.0900

con_SetCameraFOV 76

con_SetCameraFOV 77

con_SetCameraFOV 78

con_SetCameraFOV 79

con_SetCameraFOV 80

con_SetCameraFOV 81

con_SetCameraFOV 82

con_SetCameraFOV 83

con_SetCameraFOV 84

con_SetCameraFOV 85

con_SetCameraFOV 86

con_SetCameraFOV 87

con_SetCameraFOV 88

con_SetCameraFOV 89

con_SetCameraFOV 90

TriggerHitShader 2

Message "You gain Focus"

set timer to 15

end

 

begin scripteffectfinish

 

TriggerHitShader 0.75

if ( player.getdead != 0 )

player.removeSpell EnragedStateS

set timer to timer - getsecondspassed

if timer <0

con_SetIniSetting "fGlobalTimeMultiplier:General" 1.0000

con_SetCameraFOV 75

endif

endif

End

 

 

 

I want to know if i did something wrong?So can you please help

Edited by NighTragEl4d
Link to comment
Share on other sites

First of all, when you post you should put the script inside the code tags ([ code ] and [ /code ] without the spaces) to make it more readable. Secondly, you should explain what the problem is with your script or else it would be really hard to help you.

 

I recognize the first script you posted as a modified one of the one that I gave you. I realize that there was something I left out; a quest script runs at a default interval of every 5 seconds but for your mod, you probably want it to run faster than that. So change your code to this:

 

scn EnragedStateTrigger

short EnragedStateActive
float fquestdelaytime
float timer

Begin GameMode

if fquestdelaytime != 1
	set fquestdelaytime to 1		;Sets the script to run every second
endif

if EnragedStateActive == 0
	if (player.IsInCombat && ((player.GetAV Health/player.GetBaseAV Health < 0.1) || GetRandomPercent == 0))
;
;			Activate EnragedState script
;
		player.addspell EnragedStateBonus
		set timer to 15
		set EnragedstateActive to 1
	endif
elseif EnragedStateActive == 1
	set timer to timer - GetSecondsPassed
	if timer <= 0
;
;			Deactivate EnragedState script
;
		player.removespell EnragedStateBonus
		player.addspell EnragedStateExhaustion
		set timer to 5
		set EnragedStateActive to 2
	endif
elseif EnragedStateActive == 2
	set timer to timer - GetSecondsPassed
	if timer <= 0
		player.removespell EnragedStateExhaustion
		set EnragedStateActive to 0
	endif
endif

End

 

As for your second script, "float timer" is supposed to come before "Begin ScriptEffectStart". And I'm not sure why you want to change the field of view so many times in that block. The whole block runs only once, and I'm not sure that you can actually get the visual effect of a shrinking field of view. I think it's more likely that you'll notice nothing because it changed so fast you didn't catch it. The timer variable is also useless in the script because you're just using the ScriptEffectStart and ScriptEffectFinish blocks.

 

The CS Wiki is down so I can't check exactly how magic effect scripts work on abilities. But from what I remember, it runs the ScriptEffectStart block and only that block.

Edited by fg109
Link to comment
Share on other sites

Hmmm why im alwasy working on complex mods xDDDD,nvm ill work on this,ty for help.

 

Oh yes what worries me is this:

 

This "bullet time" script changes ini setting of a playtime normal its 1 but it changes to 0.09 or smth.So if the bullet time script (EnragedState) runs it modifies time to 0.09 but what accually worries me if this trigger script activates the EnragedState and deactivates it without returning ini setting to default playtime of 1 how can i fix this? :S Sorry i fup here my eng is sometimes bad xD,but i hope you understand.

Anyway what i want is activate Bullet time for 15 seconds then after those 15 seconds the play time should return to normal (with bullet time is (again) 0.09 as stated in script then after bullet time finishes it returns to default 1).

What i thought is to separate bullet time and bullet time finish like spell.

 

First script (spell) (Enraged State):

 

scn EnragedState

begin scripteffectstart


playsound TRPBluntObjectSwish
con_SetIniSetting "fGlobalTimeMultiplier:General" 0.0900
con_SetCameraFOV 76
con_SetCameraFOV 77
con_SetCameraFOV 78
con_SetCameraFOV 79
con_SetCameraFOV 80
con_SetCameraFOV 81
con_SetCameraFOV 82
con_SetCameraFOV 83
con_SetCameraFOV 84
con_SetCameraFOV 85
con_SetCameraFOV 86
con_SetCameraFOV 87
con_SetCameraFOV 88
con_SetCameraFOV 89
con_SetCameraFOV 90
TriggerHitShader 2
end

 

And EnragedStateFinish spell (after those 15 seconds of bullet time) before apply of EnragedStateExhaustion ability:

 

scn EnragedStateFinish
begin scripteffectstart

TriggerHitShader 0.75
if ( player.getdead != 0 )
player.removeSpell EnragedStateS
con_SetIniSetting "fGlobalTimeMultiplier:General" 1.0000
con_SetCameraFOV 75
endif
endif
End

 

EnragedStateS should be the first script (spell) but now im totally confused xD or i can simply put Deactivate EnragedState script?

 

Also can i put this trigger script on suit/armor? Cuz i want to affect only werewolf form? Im modifying curse of hircine ressurected btw.

Edited by NighTragEl4d
Link to comment
Share on other sites

I just checked in the game and I was completely wrong. For abilities, the ScriptEffectStart block runs when the ability is added. The ScriptEffectFinish block runs when it is removed. And the ScriptEffectUpdate block runs every frame while you have the ability. So it's just like a regular spell.

 

But other the last one, all my other points are still valid.

Edited by fg109
Link to comment
Share on other sites

I don't see why you have to worry. When the trigger script removes the ability, it runs the ability's ScriptEffectFinish block. So just put what you have in your "EnragedStateFinish" script as the ScriptEffectFinish block of your "EnragedState" script.

 

And yes, you can use the trigger script on a suit of armor with some modifications.

 

scn EnragedStateTrigger

ref npcref
short EnragedStateActive
short random
float timer
float timer2

Begin GameMode

;You need timer2 or else you'll be doing GetRandomPercent dozens of times per second
;otherwise, suppose you get 100 fps while playing
;it's very likely that GetRandomPercent would return 0 for at least one of those frames
;which would mean that the whole thing would trigger once per second

if (timer2 < 1)
	set timer2 to timer2 + GetSecondsPassed
	set random to 1
else
	set timer2 to 0
	set random to GetRandomPercent
endif

let npcref := GetContainer
	
       if EnragedStateActive == 0
               if (npcref.IsInCombat && ((npcref.GetAV Health/npcref.GetBaseAV Health < 0.1) || random == 0))
;
;                       Activate EnragedState script
;
                       npcref.addspell EnragedStateBonus
                       set timer to 15
                       set EnragedstateActive to 1
               endif
       elseif EnragedStateActive == 1
               set timer to timer - GetSecondsPassed
               if timer <= 0
;
;                       Deactivate EnragedState script
;
                       npcref.removespell EnragedStateBonus
                       npcref.addspell EnragedStateExhaustion
                       set timer to 5
                       set EnragedStateActive to 2
               endif
       elseif EnragedStateActive == 2
               set timer to timer - GetSecondsPassed
               if timer <= 0
                       npcref.removespell EnragedStateExhaustion
                       set EnragedStateActive to 0
               endif
       endif

End

Edited by fg109
Link to comment
Share on other sites

One thing thought CS reports unknown command for Deactivate and Activate commands
Link to comment
Share on other sites

No :S,also i put this trigger script on armor/suit and i dont see Enrage State Ability in ability section :S so it doesnt work.

Btw what shall i add where ";" is?

 

Btw i didnt put them friend did xD.

 

 

scn EnragedStateTrigger

ref npcref
short EnragedStateActive
short random
float timer
float timer2

Begin GameMode

;You need timer2 or else you'll be doing GetRandomPercent dozens of times per second
;otherwise, suppose you get 100 fps while playing
;it's very likely that GetRandomPercent would return 0 for at least one of those frames
;which would mean that the whole thing would trigger once per second

       if (timer2 < 1)
               set timer2 to timer2 + GetSecondsPassed
               set random to 1
       else
               set timer2 to 0
               set random to GetRandomPercent
       endif

       let npcref := GetContainer
               
       if EnragedStateActive == 0
               if (npcref.IsInCombat && ((npcref.GetAV Health/npcref.GetBaseAV Health < 0.1) || random == 0))

                     player.addspell EnragedStateS

                       npcref.addspell EnragedStateBonus
                       set timer to 15
                       set EnragedstateActive to 1
               endif
       elseif EnragedStateActive == 1
               set timer to timer - GetSecondsPassed
               if timer <= 0

                      player.removepell EnragedStateS
                       npcref.removespell EnragedStateBonus
                       npcref.addspell EnragedStateExhaustion
                       set timer to 5
                       set EnragedStateActive to 2
               endif
       elseif EnragedStateActive == 2
               set timer to timer - GetSecondsPassed
               if timer <= 0
                       npcref.removespell EnragedStateExhaustion
                       set EnragedStateActive to 0
               endif
       endif

End

 

this is the script but reports uknown variable/function "removespell" and missmatched begin/end block line 9 and 8

 

Nvm forgot to add letter "s" hahahah xD

Edited by NighTragEl4d
Link to comment
Share on other sites

No :S,also i put this trigger script on armor/suit and i dont see Enrage State Ability in ability section :S so it doesnt work.

 

You need to create ability spells and give them script effects with the scripts you have for the enrage states

 

Your code also appears to have some Pascal in it...

 

       let npcref := GetContainer

 

You probably want to change that to

 

set npcref to GetContainer

 

Can I suggest a good debugging tool for quick helping yourself to know exactly where the code has gone wrong is to add a MessageBox command in key points, so you can see for certain whether certain things are even trying to run. This should help you to walk through the path the script is taking so you can check whether it is doing what you expect it to do, and if it isn't, more importantly, where it diverges from what you want.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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