Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

General Script Questions #1


WillieSea
 Share

Recommended Posts

General Script Questions

1. Use this thread to ask question about scripts.

2. Use this thread to request classes on scripting topics.

3. Use this thread to ask if something you want to do can be scripted.

4. Just need to say something about anything, use this thread.

NOTE: Only vanilla scripts are discussed in this forum. I do not code using OBSE.

Link to comment
Share on other sites

You made mention of and/or statements in the if class.  But no explanations.  Doesn't the oblivion scripting language use && for and statements, and || for or statements?  Or something like that?

And sorry for posting a question there.  Didn't notice the disclaimer at the bottom saying not to.

Link to comment
Share on other sites

Ah yes, I sort of only brushed on the use of AND and OR as they are used in scripts.

Since I am trying to explain what they are in simple english, I have not put their official code use in the page yet. I have a feeling it may span a couple more pages...

I will add the AND and OR to the place where I specify the equals and stuff.

Thanks for the comment.  aa_biggrin.gif

Link to comment
Share on other sites

I was just wondering if I should continue with the explanation if IF logic in english, or just dive into scripting?

IF what I have explains the concept enough, THEN I will continue, ELSE I will try to explain the IF concept some more. I think if you don't get the concept by the time you read what I have there, you probably should not be scripting? Its hard to tell since I understand it, and it almost drives me mad to try and explain it at this level...

Questions, comments, concerns?

Or should I just take an english class and learn grammer?  aa_biggrin.gif

Link to comment
Share on other sites

I would say go ahead and dive into scripting. In the VAP workshops I use the SMARTY icon with Smarty Says (viewable for you in the headmaster's office) to add in little quips of info that might be relevant. You might consider using a similar technique, i.e. go ahead and start delving into scripting, but add a "tip" to clarify something that might not have been covered in depth in the basics lesson.  :simba:

Link to comment
Share on other sites

  • 2 weeks later...

The classes have been great so far, well ok both of them :wave: They were very simple and easy to understand. I think your idea for very basic classes is great as I have spent more time trying to read the CSWiki than actually script because the tutorials there are either incomplete, wrong, too advanced for a novice or the information is so well hidden it may as well be secret (how many lines of code can a script hold?)

Personally I like to tear things up to see how they work, I've started doing this with some of the mods I have installed, but there are so many functions, variables and game settings used that even a very simple if block can be overwhelming when everything between the if/endif is ref.function.var.stage 1 cos 4 tan 7 arc flippertygibbet != wotchamatcallit.

I would like to see code snippets at the end of each class, like homework :lmao: so that once you have taught us an aspect we can go off and try to figure out how short simple scripts work with real world examples. Like a sword that only Orcs can wield, or a spell that will only work on male npcs. We can always come back here and ask if we have issues I would like to think that if everyone asking for help on the bethsoft forums could be directed here it would take a lot of the work out as we are a very helpful bunch, but I think that being able to understand what some of the actual variables and constants are and how they are used would be a big step for many of us newbs.

Link to comment
Share on other sites

There are so many variations on what you can put in a script, it would be difficult to even go over a few of them.

I will put a Homework script in the IF/ELSE/ELSEIF/ENDIF class. And give an answer.

Then some possible variations using different functions.

Link to comment
Share on other sites

  • 2 weeks later...

hmm...i see that you are not going to be dealing with any questions about OBSE. While i am stll learning scripting myself, i have got a bit of experiance using OBSE functions, so send a PM my way if anyone asks about or is using an OBSE function.

PS: damn my 'k' key seems to be getting stuc.

Link to comment
Share on other sites

)_) (_(

Pssst... what's wrong with my script?

Currently, I have is a script attached to a pearl with this in it;

scriptname WilsonSummonScript

Begin OnEquip

; WilsonRef.MoveTo Player 128,0,0

End

The actor Wilson wont move to my location, however, when I press the item. What have I done wrong? x_X

Link to comment
Share on other sites

Scholar!

I had a question concerning a basic moveto script. I have a scripted ladder in an exterior cell. I want it so that when the player or NPC activates the ladder they will be moved to the top of it. This is my script.

scn RCCatsCradleLadder01SCRIPTbegin onactivate     player.MoveTo Ladder01Markend

I have one issue and one question. First, the current script designates the player activating, will this still work for NPCs or will I need a second command to include other actors? Second, my strange issue, the script properly deposits the player at the mark designated, but the weather spontaneously changes (bottom of the ladder sunshine top of the ladder thunderstorm) it breaks immersion. Is there a way to change that effect?

Thanks!

Link to comment
Share on other sites

NPC's WILL NOT activate your ladder, no matter what! (capital case used for emphasis) (unless they are 'scipted' to do so which is not really feasible)

I suggest you turn the ladder into a 'door' object and use the normal door teleporting routine. NPC's WILL use doors. But since the door does not go to another cell, you will HAVE to set one of the doors in its own 'sub-space' area so the AI knows to look for a door when calculating how to move in a single cell.

I believe using the 'door' will eliminate the rapid weather change as well. Otherwise, you may need to script that gets the current weather at the start. and forces the same weather at the destination.

Link to comment
Share on other sites

Quote

NPC's WILL NOT activate your ladder, no matter what! (capital case used for emphasis) (unless they are 'scipted' to do so which is not really feasible)I suggest you turn the ladder into a 'door' object and use the normal door teleporting routine. NPC's WILL use doors. But since the door does not go to another cell, you will HAVE to set one of the doors in its own 'sub-space' area so the AI knows to look for a door when calculating how to move in a single cell.I believe using the 'door' will eliminate the rapid weather change as well. Otherwise, you may need to script that gets the current weather at the start. and forces the same weather at the destination.


I suspected that would be my road, thanks.  :wave:
Link to comment
Share on other sites

  • 1 month later...

I'm having a little trouble with a rouge script and I was hoping someone could help me out. :woot:

I've been hammering together a large number of mods, and I'm encountering an odd problem: the activation script for COBL ingredient sorters (cobAlsTriggerOS) is being activated at random on 4-5 minute intervals. So I'll be running through the forest minding my own business , and all of a sudden I a get a message box with 'What would you like to do?' 'Put away ingredients'... etc. Choosing any option has no apparent effect, and there isn't an ingredient shelf anywhere near me or the cell I'm in. My current theory is that an NPC in another cell is activating a container, and I'm getting the message.

So it's my own fault. Strange things happen when you have too many mods installed. Fine. But I'm determined to hunt this bug down. I don't have much experience with oblivion scripting, so please forgive me if I sound noobish. This is what I think I need to know:

  • 1. Is there anything which commonly causes incorrect scripts to be executed? (References to scripts within scripts that can become misaligned when mods are added, perhaps??)2. Ingame, I'd like to get the 'Reference Editor ID' and 'Base Object' or at least name of whomever is causing the onactivate event of this script to fire. Is there a standard way to do this? How about the script owner? I.E. If somebody else is accessing a container, causing me to get this message, I'd like to figure out which container is being accessed, and who is accessing it. 3. How 'active' are NPCs in unloaded areas? Do they still run around using objects, etc? Are there perhaps some areas which are always loaded, no matter where I am in the game? 4. [i realize this thread isn't expressly for OBSE, but it has apparently become a big part of Oblivion scripting, so perhaps someone would PM or we could start another thread... etc]I noticed OBSE has a GetName command. I've altered the offending script as follows:

ref   rActivatorref  sActivatorNameBegin onactivate	set rActivator to GetActionRef	if (rActivator.GetCurrentAIProcedure == 10) || (rActivator.GetCurrentAIProcedure == 2)		Activate rActivator		return	endif	set sActivatorName to rActivator.GetName	Message "cobAlsTriggerOS triggered by %.0f" sActivatorName	...

I have no idea if I have coded this properly because I am getting a compilation error: "Unknown variable or function 'GetName'"

I am using OBSE v0015a and launching the editor via 'obse_loader.exe -editor'

Thanks for taking the time to read over all of that! If you have any ideas, I would love to hear them. :rofl:

Link to comment
Share on other sites

This is a NON-COBL and NON-OBSE scripting forum, mainly because I feel they are not part of the vanilla game scripting. Those two items are very specialized and help with them can be had from the developers of the same. And the fact that I use neither of them for my own very good reasons.

After saying that, let me give you some of my thoughts and ideas on your question DemonFire.

1. Are you sure the scripts are ONLY run by an activation script? The 4 or 5 minute interval could be a quest script kicking off as well, and the quest could be activating the object.

2. I do not think this is possible. Since I do not use COBL ( or need it :woot: ), I do not know how they set up the scripts on the ingredient sorters. I use my own scripts for the 'common' functions that COBL performs. I know my scripts work! :rofl:

3. It is my understanding that NPC's in unloaded zones do nothing. But, when you enter a new zone/cell, they are all evaluated to determine if they should be in any of the loaded zones based on their AI packages. Once loaded, they could potentially activate objects if they had an AI package that explicitily told them to activate it. They will not randomly activate objects.

4. GetName is OBSE v0012. Either you are not running OBSE with the correct version, or you are not loading it with the CS. The command should not be 'Not Found' if you have OBSE running. Since I do not muck with OBSE, I could not help more than that with this issue. I also do not know how GetName should be used since the WIKI does not specify how to use it. Perhaps you cannot use it the way you are trying to use it. You are trying to put the 'actual name' of an object in a reference variable. I do not think you can do that.

RefVar = "Ebony Shortsword"

This would not work since a reference variable would not hold a string of characters, it would be used to hold the reference ID of the object.

RefVar = 0145324

I think your biggest problem may come from combining the mods, especially multiple mods with COBL in them. You might check with the COBL threads to see if that is an issue or not.

Link to comment
Share on other sites

  • 2 months later...

for a spell im making i want to summon shadows to swarm the opponent...

currently im using the script below on the creature so that it's a black show that spawns three more when it dies (yes i have scripts on the others as well).  anyway, what i wanted to ask is if the placeatme function is really as bad as they say? would it be fine in my case? if not, could someone write me a new script which does the same thing?

scn AGFlameScript1

Ref AGRef

begin ScriptEffectStart

PlayMagicShaderVisuals effectDarkFlame

end

begin ScriptEffectFinish

If GetDead == 1

StopMagicShaderVisuals effectDarkFlame

Set  AGRef to GetSelf

AGCaster.Moveto AGRef

Placeatme AGFlame2 3

AGCaster.Cast AGFlameExplod1 AGRef

EndIf

End

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...