Jump to content

Just Newbie in scripting...


Anthony Xiii

Recommended Posts

Go under Gameplay/Edit Scripts. Open a new script, and select "Magic Effect" from the drop-down box. The text itself should go something like this...

 

scn MySummonCompanionScript
;The script's name

Begin ScriptEffectStart
;ScriptEffectStart will run when the effect first kicks in.  ScriptEffectUpdate runs every frame the effect is active, and ScriptEffectFinish when it ends.
CompanionRef.MoveTo player
end

 

To go with this, create a new spell. It should have one "Script Effect" magic effect, work on self with no duration, and use your new script. (If it doesn't show up as an option, it means it's not a "Magic Effect" script) If you want, you can apply visual effects. I'll leave giving the player the spell up to you, if it's okay.

Link to comment
Share on other sites

Heya! i dunno what is wrong in this script:

Idea is when starting game, i pull a lever and if I'm mage, i get a letter and a key to Arcane University Mage trainer's house.

 

Scn AUGuestScript

Short doOnce

begin OnActivate
if GetIsClass == Mage
	if ( doonce == 0 )
		player.additem AUMageKey
		player.additem AUMageLetter
		setdoOnce to 1
	endif
endif
end

 

And :thanks: for helping me!

Link to comment
Share on other sites

The problem there seems to be that you seem to be asking whether the lever is a mage or not, there should be a space in "Set DoOnce to 1", and the syntax seems to be wrong on GetIsClass. Try this... Alterations capitalized for reference.

 

Scn AUGuestScript
short doOnce
REF LEVERPULLER

Begin OnActivate
 SET LEVERPULLER TO GETACTIONREF
 IF LEVERPULLER.GETISCLASS MAGE
;The game reads this as "If LeverPuller.GetIsClass Mage != 0"
	  if (doonce == 0)
		   player.AddItem AUMageKey
		   player.AddItem AUMageLetter
		  ;you could also use LeverPuller.AddItem, or enable existing (disabled) key and letter 
		  ;references above the lever so it looks like they're falling through a trapdoor or such.
		   SET DOONCE TO 1
	  endif
 endif
end

Link to comment
Share on other sites

The problem there seems to be that you seem to be asking whether the lever is a mage or not, there should be a space in "Set DoOnce to 1", and the syntax seems to be wrong on GetIsClass. Try this... Alterations capitalized for reference.

 

Script 'AUGuestScript', line 10:
Missing parameter Count.
Compiled script not saved!

Continue playing?
...

What should I do?

Link to comment
Share on other sites

The problem there seems to be that you seem to be asking whether the lever is a mage or not, there should be a space in "Set DoOnce to 1", and the syntax seems to be wrong on GetIsClass. Try this... Alterations capitalized for reference.

 

Script 'AUGuestScript', line 10:
Missing parameter Count.
Compiled script not saved!

Continue playing?
...

What should I do?

 

Sorry about that, you know, I'm kinda noob in scripting, so the problem was in the count:

player.AddItem AUMageKey 1*
player.AddItem AUMageLetter 1*

Just only problem i have now is the messagebox buttons what i said before. (I'm from Finland, sorry my english)

Link to comment
Share on other sites

player.AddItem AUMageKey 1*player.AddItem AUMageLetter 1*

Whoops... I always make that mistake until the CS catches it... :sweat:

 

The format for messageboxes goes...

"message", variable 1, variable 2, ... variable 9, "option 1", "option 2", ... "Option 10"

In this case the script would be...

messagebox "How many silver forks would you like to make?" "2", "1", "Nothing"

The Construction Set Wiki has a full list of fuctions and how they work. I find it an incredibly useful reference.

Link to comment
Share on other sites

Archived

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

  • Recently Browsing   0 members

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