Jump to content

Need some scripting help :(


Recommended Posts

Posted

The mod I am creating requires a script which for the most part works correctly until the last section is to be used. After that the game CTD.

 

The line in blue works but at the end of it the game crashes before the lines in red seem to work. This is the only issue at the moment which is stopping my mod from being released.

 

If anyone knows what is wrong with this script and can fix it or can create a better more stable one I would be extremely greatful.

 

 

scn aaadisease2

 

ref dvictim2

float stimer

short fase

float numeggs

short sdone1

short fasedone

float sfatigue

short ofase

ref sanim

float fasetimer

short cured

ref attacker

float soundt

short rdmdamage

 

begin ScriptEffectStart

set dvictim2 to GetSelf

dvictim2.setfactionrank aaaSwarmFaction 1

dvictim2.setfactionrank dremorafaction 3

dvictim2.setfactionrank daedrafaction 3

dvictim2.modav aggression 50

set attacker to getfirstref 69 1

while (attacker)

if attacker.isincombat

if attacker.getcombattarget == dvictim2

attacker.stopcombat

dvictim2.stopcombat

endif

endif

set attacker to getnextref

loop

end

 

begin scripteffectupdate

 

 

if dvictim2.hasspell aaaSwarmInfection

set cured to 0

else

set cured to 1

endif

 

 

 

set stimer to stimer + ScriptEffectElapsedSeconds

 

 

if stimer < 600

set fase to 0

elseif stimer >= 600 && stimer < 620

set fase to 1

elseif stimer >= 620 && stimer < 1200

set fase to 2

elseif stimer >= 1200 && stimer < 1500

set fase to 3

elseif stimer >= 1500 && stimer < 1800

set fase to 4

elseif stimer >= 1800

set fase to 5

 

endif

 

if fase == 0

if dvictim2.getitemcount aaaSwarmHost1 == 0

dvictim2.additemns xLoversPkrDisableH 1

dvictim2.additemns aaaSwarmHost1 1

if dvictim2 == player

message " A strange creature has seperated from the queen and has wrapped itself around me !!! " 5

endif

endif

if cured == 1

dvictim2.unequipitemns aaaSwarmHost1

dvictim2.removespell aaademondisease2

set sdone1 to 0

set ofase to 0

dvictim2.removeitemns xLoversPkrDisableH 10

dvictim2.removeitemns aaademonegg 1

dvictim2.setfactionrank dremorafaction -1

dvictim2.setfactionrank daedrafaction -1

if dvictim2 == player

message " That strange creature has finally died along with it´s eggs " 5

endif

endif

endif

 

if fase == 1

if sdone1 == 0

if dvictim2.isincombat == 0

set sfatigue to dvictim2.getav fatigue

set sfatigue to -250 - sfatigue

dvictim2.modav2 health -10

dvictim2.modav2 fatigue sfatigue

dvictim2.unequipitemns aaaSwarmHost1

dvictim2.additemns aaaSwarmFuck 1

set sdone1 to 1

if dvictim2 == player

message " That strange creature has started thrusting into my vagina !!! " 5

endif

playsound3d aaatent01

else

set stimer to 30

endif

endif

set soundt to soundt + ScriptEffectElapsedSeconds

if soundt > 4

playsound3d aaatent01

playsound3d aaatentsc2

set soundt to 0

dvictim2.modav2 health -10

endif

 

endif

 

if fase == 2

if dvictim2.getitemcount aaaSwarmFuck > 0

dvictim2.unequipitemns aaaSwarmFuck

set numeggs to 1

if dvictim2.getitemcount aaademonegg == 0

dvictim2.additemns aaademonegg numeggs

endif

dvictim2.removeitemns aaaSwarmFuck 1

dvictim2.additemns aaaSwarmHost2 1

if dvictim2 == player

message " I feel something is inside me !!!" 5

endif

endif

endif

 

if fase == 3

if dvictim2.getitemcount aaaSwarmHost2 > 0

dvictim2.unequipitemns aaaSwarmHost2

dvictim2.additemns aaaSwarmHost3 1

if dvictim2 == player

message " That creature has laid eggs within me !!!" 5

endif

endif

endif

 

if fase == 4

if dvictim2.getitemcount aaaSwarmHost3 > 0

dvictim2.unequipitemns aaaSwarmHost3

dvictim2.additemns aaaSwarmHost4 1

if dvictim2 == player

message " Mmmpphhh, my belly is painfully distended !!!" 5

endif

endif

endif

 

 

if fase == 5

 

if dvictim2.isincombat == 0

if ofase == 0

set fasetimer to fasetimer + ScriptEffectElapsedSeconds

if fasedone == 0

set sanim to ovi1

dvictim2.additemns aaademonovi1 1

dvictim2.playidle sanim 1

set fasedone to 1

set fasetimer to 0

if dvictim2 == player

message " I'm about to give birth to the eggs !!!" 5

endif

endif

if fasetimer > 5.95

set ofase to 2

set fasetimer to 0

set fasedone to 0

endif

elseif ofase == 2

set fasetimer to fasetimer + ScriptEffectElapsedSeconds

if fasedone == 0

set sanim to ovi2

dvictim2.additemns aaademonovi1 1

dvictim2.playidle sanim 1

set fasedone to 1

endif

if fasetimer > 5.95

set ofase to 3

set fasetimer to 0

set fasedone to 0

endif

elseif ofase == 3

set fasetimer to fasetimer + ScriptEffectElapsedSeconds

if fasedone == 0

set sanim to ovi3

dvictim2.additemns aaademonovi1 1

dvictim2.playidle sanim 1

set fasedone to 1

endif

if fasetimer > 5.95

set ofase to 4

set fasetimer to 0

set fasedone to 0

endif

 

elseif ofase == 4

set fasetimer to fasetimer + ScriptEffectElapsedSeconds

if fasedone == 0

set sanim to ovi4

dvictim2.additemns aaademonovi1 1

dvictim2.playidle sanim 1

set fasedone to 1

dvictim2.drop aaaDemonEgg 1

dvictim2.additem aaaSwarmQueenEgg 10

dvictim2.drop aaaSwarmQueenEgg 1

dvictim2.drop aaaSwarmQueenEgg 1

dvictim2.drop aaaSwarmQueenEgg 1

dvictim2.drop aaaSwarmQueenEgg 1

dvictim2.drop aaaSwarmQueenEgg 1

dvictim2.drop aaaSwarmQueenEgg 1

dvictim2.drop aaaSwarmQueenEgg 1

dvictim2.drop aaaSwarmQueenEgg 1

dvictim2.drop aaaSwarmQueenEgg 1

dvictim2.drop aaaSwarmQueenEgg 1

dvictim2.additem aaaSwarmQueenEggM 10

dvictim2.drop aaaSwarmQueenEggM 1

dvictim2.drop aaaSwarmQueenEggM 1

dvictim2.drop aaaSwarmQueenEggM 1

dvictim2.drop aaaSwarmQueenEggM 1

dvictim2.drop aaaSwarmQueenEggM 1

dvictim2.drop aaaSwarmQueenEggM 1

dvictim2.drop aaaSwarmQueenEggM 1

dvictim2.drop aaaSwarmQueenEggM 1

dvictim2.drop aaaSwarmQueenEggM 1

dvictim2.drop aaaSwarmQueenEggM 1

dvictim2.additem aaaSwarmQueenEggS 10

dvictim2.drop aaaSwarmQueenEggS 1

dvictim2.drop aaaSwarmQueenEggS 1

dvictim2.drop aaaSwarmQueenEggS 1

dvictim2.drop aaaSwarmQueenEggS 1

dvictim2.drop aaaSwarmQueenEggS 1

dvictim2.drop aaaSwarmQueenEggS 1

dvictim2.drop aaaSwarmQueenEggS 1

dvictim2.drop aaaSwarmQueenEggS 1

dvictim2.drop aaaSwarmQueenEggS 1

dvictim2.drop aaaSwarmQueenEggS 1

dvictim2.additem aaaSwarmEggC 10

dvictim2.drop aaaSwarmEggC 1

dvictim2.drop aaaSwarmEggC 1

dvictim2.drop aaaSwarmEggC 1

dvictim2.drop aaaSwarmEggC 1

dvictim2.drop aaaSwarmEggC 1

dvictim2.drop aaaSwarmEggC 1

dvictim2.drop aaaSwarmEggC 1

dvictim2.drop aaaSwarmEggC 1

dvictim2.drop aaaSwarmEggC 1

dvictim2.drop aaaSwarmEggC 1

set rdmdamage to getrandompercent + 50

set rdmdamage to 0 - rdmdamage

dvictim2.modav2 health rdmdamage

if dvictim2.getitemcount aaademonegg >0

dvictim2.unequipitemns aaaSwarmHost4

dvictim2.additemns aaaSwarmHost1 1

elseif dvictim2.getitemcount aaademonegg == 0

dvictim2.unequipitemns aaaSwarmHost4

dvictim2.removeitemns aaaSwarmHost4 1

endif

endif

if fasetimer > 10

set ofase to 5

set fasetimer to 0

set fasedone to 0

endif

 

elseif ofase == 5

if fasedone == 0

set fasedone to 1

set sanim to ovi5

dvictim2.additemns aaademonovi1 1

dvictim2.playidle sanim 1

dvictim2.removeitemns aaademonovi1 10

if dvictim2.getitemcount aaademonegg <= 0

dvictim2.removespell aaademondisease2

dvictim2.removespell aaaSwarmInfection

set sdone1 to 0

set ofase to 0

dvictim2.removeitemns xLoversPkrDisableH 1

dvictim2.setfactionrank aaaSwarmFaction -1

dvictim2.setfactionrank dremorafaction -1

dvictim2.setfactionrank daedrafaction -1

set rdmdamage to getrandompercent

set rdmdamage to 0 - rdmdamage

dvictim2.modav2 health rdmdamage

if dvictim2 == player

message " That strange creature has finally died " 5

endif

else

set fasedone to 0

set stimer to 0

set sdone1 to 0

set ofase to 0

if dvictim2 == player

message " That strange creature has reappeared and wrapped around me again !!!" 5

endif

endif

endif

endif

endif

endif

 

end

 

begin ScriptEffectFinish

set dvictim2 to GetSelf

dvictim2.setfactionrank aaaSwarmFaction -1

dvictim2.setfactionrank dremorafaction -1

dvictim2.setfactionrank daedrafaction -1

 

end

;

; 1060

;

 

 

 

What the script is supposed to do.

 

 

 

When being attacked by the queen the player has a chance of catching an disease (That script is already done).

 

The disease should only work for a female PC and should only last for 16 hours, during those 16 hours the script should automatically add and equip armors onto the PC to show that the PCs body is changing. After each cycle the PC lays eggs.

 

 

 

If you need any more information just reply here or send me a PM. There's a text file containing the script attached to this post as placing in spoilers removes the indents.

 

Cheers.

Posted

You clearly are far more knowledgeable at scripting than I likely will ever be, but wasn't there a big deal about using pick idle instead of play idle, or am I not remembering things correctly (or is that for vegas...too many damn games/mods)?

Posted

Well the script is someone else, but unless you know what it is doing its hard.

 

Well the animation play flawlessly it just after the animation it crashes. So annoying.

Posted

The only thing I can note on it is maybe the modav2 health.

On the cswiki-

Of critical note is that attempting to mod positive-only stats like health and attributes to negative values will cause the game to crash to desktop.

 

So maybe a check against the base value before modding the health?

 

Mem

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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