Jump to content

Script Assistance


kingtitan

Recommended Posts

I hope that I have a rather easy question, but I have no idea if it is easy or not! I am trying to write up a script that makes an NPC travel to a certain reference, and then upon arriving at their destination, the NPC is scripted to picking an idle. I have the first part down pat by using something simple like this:

 


elseif choice == 2
	removescriptpackage	
	addscriptpackage ATBookingFront

 

This is just a snippet of my code, as it is used in a rather lengthy command spell. I assumed this wouldn't work (It didn't), but this is what I wrote out after for my initial test:

 


elseif choice == 2
	removescriptpackage	
	addscriptpackage ATBookingFront
	if GetIsCurrentPackage ATBookingFront == 0
		removescriptpackage
		set ATIdleAnim to 6
		pickidle
		playgroup idle 1
		set ATIdleAnim to 0
	endif

 

My ultimate question is what kind of function should I use in the "if" statement to make the NPC play the specific idle after the travel package has been completed? I'm also a bit fuzzy on the dynamics of calling an idle for an actor to play. If someone could help me out with that as well I would be even more grateful!

Edited by kingtitan
Link to comment
Share on other sites

  • 2 weeks later...

Ok, first off, it would be better if you included the whole script. You can enclose the scripting in a spoiler header if you like.

 

Second, the removepackage won't do anything in this block without defining what you are removing. Obse has a remove all, but you shouldn't need that now.

 

Third, packages do not control the animations. You are trying to call a playgroup function, which is correct. Add a snippet of code which simply says "Player.additem gold001 1" within the sub-block to see if it is even firing. From the Reznod's Mannequins I have torn this bit of code:

 

if ( Pose == 0 )
PlayGroup Idle 1
elseif ( Pose == 1 )
PlayGroup BlockIdle 1
elseif ( Pose == 2 )
PlayGroup CastSelf 1			; left
elseif ( Pose == 3 )
PlayGroup CastSelfAlt 1		; right
elseif ( Pose == 4 )
PlayGroup CastTarget 1		; left
elseif ( Pose == 5 )
PlayGroup CastTargetAlt 1	; right
elseif ( Pose == 6 )
PlayGroup CastTouch 1		; two handed
elseif ( Pose == 7 )
PlayGroup CastTouchAlt 1	; right	
endif

 

I suggest keeping it as simple as you can. I have had to re-write scripts as many as 5 times. Some of them have hundreds of lines of code. Figure out what it is you wish to do. Plan it out on paper if you need. I have found that it helps me to draw pictures, then make the changes with circled numbers. You then figure out what each number is doing, boiling the code down to a fine brew.

 

If you post your code here, I will have a look at it. I can't promise I will fix it, and I will not completely re-write it for you. But there are others aside from myself who would help if more information was given. If you are worried about plageurism, don't be. People don't have enough time to finish all of their own projects, let alone reverse engineer your idea. And it is very cool to see ideas you came up with used in mods when they are. My mod, Castle Tharnstein, has a few elements taken from other mods and has a few ideas wich were shared in others. Mimicry is not flattery. Taking an idea and making it your own is.

 

-edit-

 

the player.additem is a simple way to test your code. If you wish, you can change the gold001 to an item which you use specifically for testing. You can add multiple instances within one code, ammending the ammount from 1 to 10 to 100 to 1,000, etc. That way if the object returns 1021, you know that the 1,000 ran once, the 100 didn't run, the 10 ran twice and the 1 ran only once. This has save me hours, days and weeks of testing.

Edited by theuseless
Link to comment
Share on other sites

  • Recently Browsing   0 members

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