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 #2


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 scriptwise, use this thread.

5. Anyone can reply to questions asked in this thread.

NOTE regarding OBSE:

I do not code using OBSE but you may get help from others that do. So there are no guarantees that an OBSE question will be answered.

Link to comment
Share on other sites

I do have a question on scripting. I got a creature to act as a statue(thanks to the mod/resource out there I'm using the script) this isn't the problem, the problem is I can't seem to figure out how to get the creature to no longer be a statue when the player either walks close enough or passes through an activator/trigger zone. Now sure how possible it is or how hard it really is. I'd think that it's setting the unconscious, restrained and ghosts to 0 instead of one. It make sense to do that, the problem I have is how to bring them back to life to attack the player.

Link to comment
Share on other sites

Scn aaNexusStatueScript


Float Timer

Short doOnce


Begin onLoad


; resets timer for current cell load

    set Timer to 0


; resets var for current cell load, so setRestrained/setGhost aren't called every frame

    set doOnce to 0


; need to input values for these or else actor will spawn in between path grid nodes. Find these values in the CS.

    setPos x -498

   setPos y -566

    setPos z 9451

    setAngle z 0


; pick group from list provided

    PlayGroup CastSelf, 1


End


Begin GameMode


; change value for desired pose

    if ( Timer < 1.5 )


; this increments timer var to be able to stop anim

        set Timer to ( Timer + GetSecondsPassed )


    else


; these only need to be set once when player enters cell

        if doOnce == 0


            set doOnce to 1


; Unconscious actors do not "think" at all; this is not absolutely necessary, but can't hurt

            setUnconscious 1


; Restrained actors will not move from their current position, but will continue to "think" (pick packages, run detection so they could yell alarms) & go into dialogue

            setRestrained 1


; no combat, not harmed by hits/spells, will talk, cannot be pickpocketed

            setGhost 1


        endif


; causes the current animation to not be played for this frame

    skipAnim


    endif


End

for the statue, using the creature resource script for it here's what I have for the trigger. so far I got it so the lich can take damage, but his animations don't come back.
scn aavounexusTriggerstatueScript01


short doonce


Begin OnTrigger Player


If doonce == 0

     ; aavounexuslichstatue01.enable

aavounexuslichstatue01.setUnconscious 0

aavounexuslichstatue01.setRestrained 0

aavounexuslichstatue01.setGhost 0

       set doonce to 1

endif


End

killed the enable with a comment for now to make it work. so far only works partially. Only other idea I have is to use the statues, then put a activator nearby so it "summons" a monster. I was hoping not to have to do that, if I do okay.

Link to comment
Share on other sites

Yay for uncovering bugs! :lol: So I presume the best thing I could do is create statues then use activators to make the spawns appear as if the statues summoned them. It could still make for a very interesting event to see and all the more frightening when they realize the statues summoned creatures to attack

Link to comment
Share on other sites

I don't know if you ever saw the mod that had the 'chests' that would come alive with snapping lids and crab-like feet. That takes a static chest and replaces it quite nicely with a creature in the same spot. (I wrote that script). Now if I could just figure out what the name of the mod was. It was based on the novels by Terry Pratchett, which had a chest called 'The Luggage' that follows Rincewind around.

Link to comment
Share on other sites

Well, 'I' did script that little gem. (not sure how much it has changed since I wrote it.)

What it does is run on a static chest. When activated, it disables the chest, plays some magical effects and places the creature in the same spot the chest was in. I don't remember much more about it since its been so many years since I wrote that.

Link to comment
Share on other sites

Greetings Will, I'm back into modding after a couple of months devoted to a mod called Real Life. :)

I have a quick scripting question that does not require its own topic.

I'm simulating the "Go To Jail" mechanics in a prison controlled by knights. I am simulating it because I do not want imperial legionnaires to throw the players in there since the prison does not belong to them.

So the player is moved to the prison cell and succesfully managed to script any regular jail mechanics. Such as the equipment is removed from the player and put in a chest, if the prison cell door is picklocked, the guards will be aware of your escape, etc.

When the player uses the bedroll to serve his time, he gets teleported to the front of the keep and is free to go.

But there's one issue I have.

As mentioned, the player's equipment is removed by using the RemoveAllItems function and calling a chest as the target container. That works fine.

But what I'm trying to do is when the player has served his time, I want the equipment in the chest to return to the player. I have noticed no specific commands to do that.

Would it be possible to do so without having the player to manually go take back his equipment from the chest?

EDIT: Hmm maybe I could use the RemoveAllItems on the chest and target the player as the receiver? I just thought about it.

EDIT2: Okay. It actually works. It does not work if the chest is another cell, as my previous plans, but I decided to move the evidence chest to the prison cell.

Well. Case resolved. :smug:

Edited by Cliffworms
Link to comment
Share on other sites

I got a little problem. I'm trying to get a button to activate a specific set within 192 moving walls to create the layout for a maze. If I get it to work the projected plan is to create 3 more buttons to reconfigure the maze as each specifies. I would like to know if this is possible and if so how would I go about scripting....

Link to comment
Share on other sites

Activator: ARSecretWallFAST01 is a secret wall with a up and down option. Specifics do waste less time I suppose :smug: But, When I try to activate a wall in a parent scenario it just won't serve my purpose. I still need just one button with say....like 196 walls attached to it. But then another button with 100 walls or so attached to it, yet I'd prefer that the script function toggled each wall in order to bring up the old walls and put down the new ones so that re-pushing the button would reset back and forth. ugh...just trying to make up a way to say this is tiring... :unsure: Anywho, I'm still learning by doing and reading and then doing some more, but limitations seem to creep up on me. :noway: Hopefully that was a good amount of info to aid in a helpfull reply.

Link to comment
Share on other sites

That object has two animation on it, "Forward" to open it and "Backward" to close it.

About your 'hundreds' of objects you want to activate on one button push. You may find that the game engine will not allow that many to be activated. Or not. I have run into issues with the Oblivion engine not being able to handle that many objects being changed.

So, you would use the PlayGroup command on each and every wall you want to be changed using the command I gave you above.

Open:

myWall001REF.PlayGroup Forward 1
Close:
myWall001REF.PlayGroup Backward 1

You need to give each wall a unique reference ID.

In your button script, you need to know which state you are in, state 1 or state 2. This way you know to open or close the walls.

Link to comment
Share on other sites

  • 1 month later...

Okay, I have a mildly embarrassing scripting problem. When I try to save this script, it simply doesn't work- it doesn't come up with any error messages, the script is just not saved. After a discussion in the shouty, it seems that this is caused by my lack of knowledge regarding scripting syntax (although why the Cs isn't telling me like it usually does is anyone's guess). Anyway, all I want to do is to make an activator check whether or not the reference is enabled, then disable it if it is, and enable it if it isn't. Basically a simple switch to turn the reference "on or off". Here's the script:


scn *NAME*


begin onactivate

 if

*OBJECTREF*.getdisabled == 1

*OBJECTREF*.enable 

 elseif

*OBJECTREF*.getdisabled == 0

*OBJECTREF*.disable

 endif

end

Where am I going wrong?

Link to comment
Share on other sites

you can't divide lines as you see fit, oblivion's scripts are very restrictive in terms of syntax.

each comparison needs to be in the same line as if / elseif:

scn *NAME*


begin onactivate


if *OBJECTREF*.getdisabled == 1

	*OBJECTREF*.enable 

elseif *OBJECTREF*.getdisabled == 0

	*OBJECTREF*.disable

endif


end
anyway you can write it in slightly shorter way:
scn *NAME*


begin onactivate


if *OBJECTREF*.getdisabled

	*OBJECTREF*.enable 

else

	*OBJECTREF*.disable

endif


end

  • Upvote 1
Link to comment
Share on other sites

One note.

When putting your scirpt on the forum, avoid using 'markers' for your scripts. That would cause me to also say that is the problem. :rofl:

I know I am being picky, but its like throwing a wrench into my logically wired brain to see it this way:

scn *NAME* 
begin onactivate
if *OBJECTREF*.getdisabled [/code] Instead of this way:
[code]scn myScript
begin onactivate
if myObject01Ref.getdisabled

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...