Jump to content

Need help with basic scripting!


jaymosuke

Recommended Posts

I just started scripting this morning and got a simple grasp on it.

 

Basically, it enables objects by referance, and it does work! But it only works with the first if. So Only the Dark01Knife Quest enables the objects by their referance. I tested the others and they all work, but it only uses the first if referance.

 

So if I put MS49 at the top, only that one will work. Please give me some speedy help and advice, thank you :)

 

Scriptname PTTrophiesScript


short ptt
short ptt1
short ptt2
short ptt3


begin gamemode



if ( GetStage Dark01Knife < 115 ) && ( ptt == 0 )
return
endif
set ptt to 1
PTDBA.enable




if ( GetStage FGC05Stone < 100 ) && ( ptt1 == 0 )
return
endif
set ptt1 to 1
FightersBanner.enable
PTdeeds.additem PTBuyFighters 1




if ( GetStage MG08MagesStaff < 10 ) && ( ptt2 == 0 )
return
endif
set ptt2 to 1
MageBanner.enable
PTdeeds.additem PTBuyMage 1




if ( GetStage MS49 < 90 ) && ( ptt3 == 0 )
return
endif
set ptt3 to 1
KvatchTrophy.enable
PTdeeds.additem PTBuyKvatch 1


end

Link to comment
Share on other sites

The command "return" is used to prevent everything below that command from running and using computer power. I would guess that one of your "returns" is killing the whole rest of your script. If you commented them all out to disable them for testing, and made sure your "endifs" were in the right places, I would expect your script to work. I have not really studied optimization much, because grass, rain, and intersecting light radii cause more lag than scripting. I don't really know the best way to do it. You might copy how the vanilla Oblivion scripts use "return."

 

I am sort of surprised your script compiles and runs. I don't think my copy of the CS would let me do what you do. It looks kind of like there are lots of lines of code outside of if-endif blocks.

 

I would try something like this:

 

SCN PTTrophiesScript

short ptt
short ptt1
short ptt2
short ptt3

begin gamemode

  if GetStage Dark01Knife < 115 && ptt == 0 
       set ptt to 1
       PTDBA.enable
  endif

  if GetStage FGC05Stone < 100 && ptt1 == 0
       set ptt1 to 1
       FightersBanner.enable
       PTdeeds.additem PTBuyFighters 1
  endif

  if GetStage MG08MagesStaff < 10 && ptt2 == 0 
       set ptt2 to 1
       MageBanner.enable
       PTdeeds.additem PTBuyMage 1
  endif

  if GetStage MS49 < 90 && ptt3 == 0 
       set ptt3 to 1
       KvatchTrophy.enable
       PTdeeds.additem PTBuyKvatch 1
  endif

end

Link to comment
Share on other sites

  • Recently Browsing   0 members

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