• Announcements

    • Ashal

      SITE MOVED - IN READ ONLY MODE   12/08/2015

      Please use http://www.loverslab.com moving forward. Site has been restored to a previous version, and this one placed into a read-only mode. This is available for a limited time so users may reference/copy content that has been lost in the transition. This will no longer be accessible by December 22nd, 2015.

Archived

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

tolerance

looking for advice on mesh swaps and magic

     ok, so I found these wonderful  spinning stars made by this site's resident lusty argonian, Movomo  http://www.loverslab.com/topic/12895-my-testinghall-2013-10-19/


 


    and I was wondering what would be the best way of adding these to the head for the duration of, say.... paralysis.


 


    I'm thinking of some kind of mesh swap for the duration of the spell effect, maybe the eyes or the mouth ,


 


but I'm not sure if it can be done in such a way that will return everything to normal afterwards.


 


 


    hell, don't even know the syntax/ structure of a script let alone what commands I would need,


 


but it just seems like such a waste to not be using such a wonderful mesh.


0

Share this post


Link to post

Wut!
A resident lusty maid! Now time to change my avatar and become a tlusty argonian meat onahole.

Back to topic, doesn't look too dificult actually. However scripting in oblivion can be quite a pain to start.
Here's a rough idea though..

Rather than mesh swap, just give the ring item when needed and remove it back when the duration expires. That stars need to be a ring slot item and the ring slot only. No amulet or tail or hair etc, unless you modify it somehow.

The first thing that jumps into my head is to use an event handler.
There is a good one called "OnMagicEffectHit" if you take a look on the obse command documentation file (or cs wiki anyway)
First you create a initialization quest and its script, and register this event handler there whenever the game loaded.

Read these articles to understand what the script structure should be.

http://cs.elderscrolls.com/index.php?title=Scripting_for_beginners

http://cs.elderscrolls.com/index.php?title=Begin

 

For example, your init script should look something like:

Begin GameMode	if GetGameLoaded == 0		return	endif		SetEventHandler "OnMagicEffectHit" someScriptName "object"::"PARA"End

http://cs.elderscrolls.com/index.php?title=SetEventHandler

 

we need an user function that will be called when this "OnMagicEffectHit" event fires. What do we do when an actor gets paralyzed? Probably we want to add a stars ring and equip it.

http://cs.elderscrolls.com/index.php?title=User_Functions

 

Lastly, we need to properly remove those rings when not needed anymore, to avoid potential save game bloat.

There are several ways to do this ( there always are several ways to achieve the same thing). The simplest way may be to attach an object script to the stars ring and make it removed by itself, when "paralysis" effect can no more be found on the actor. For example, HasMagicEffect command can be used to determine whether the actor is currently affected by paralysis effect.

http://cs.elderscrolls.com/index.php?title=HasMagicEffect

 

Good luck with that, You'll probably get stuck at some point I'll help then..  It's a funny idea. This reminds me Monster Hunter series :D

0

Share this post


Link to post

the script that you gave me, I put the id of the item (zzstarring) for "object"::"PARA"

 

and where you where it says "somescriptname", made a script like this

 

scriptname zzSeeingStars

begin OnMagicEffectHit
 if getself (getitemcount zzstarring ==0)
 additem zzstarring 1
 equipitem zzstarring 1
 endif
 end

 

i'm not quite sure if "getself" is the right way to get target ref, i'm hoping that's my only problem...

 

also, kind of odd question but do I need those " marks, I tried saving without them, and got "invalid operands for operator ::. "

 

0

Share this post


Link to post

No, you have to assign a function ID , not the item ID. Whenever the event invoked, obse tries to call the "function" that you'd assigned.

"OnMagicEffect" is not a vanilla event unlike OnEquip or GameMode etc. So you need to define your own function first.

http://cs.elderscrolls.com/index.php?title=User_Functions

For example..

scn zzYourFunctionNameref var1int var2	;int or longBegin Function {var1 var2}	doSomethingEnd
According to obse command doc, OnMagicEffectHit event sends 2 parameters to the called function. The first one is target(ref) and the second is effect code(int). So var1 in the above example is a reference variable, and var2 is an integer (or long)

From here, you need to figure out who is being affected by paralysis effect. You don't need to think about it because the "target" information (var1) is already provided. So something like var1.GetItemCount zzstarring < 1 should work.

The double quote mark is to tell obse compiler that the expression inside them is a string. Yeah, you need to.

On some important note, I haven't actually tested any of my examples. Some of syntax may be wrong.. keep in mind that and test every last line,, don't ever assume that any of functions will work as expected. Spam "PrintToConsole" commands and check everything.

0

Share this post


Link to post

*edit* just have to fix the remove item script

thanks for all the help, will post file when finished

 

oh and I set the stars as a right ring, but they just spin around the hand (actually one npc wore it around his hand went through a door and then came back with it around his head, also when I loaded with an npc already having it)

 

well, this is the un-equip script I have now, I don't see what's wrong with it

 

 

scriptname zzremoveStarsRing

ref actor

begin OnActorEquip zzstarring
  if (actor.hasmagiceffect PARA ==0)
  actor.unequipitem zzstarring 1
 actor.removeitem zzstarring 1
 endif
  if (player.HasMagicEffect PARA ==0)
  player.unequipitem zzstarring 1
   player.removeitem zzstarring 1
   endif

end

 

if anyone sees what's wrong, please say so, otherwise I could always realize a simple solution after

 2 weeks :P

 

0

Share this post


Link to post

Well that's strange. I've never updated that thing, and as far as I remember I had set it as a right ring either. I'll have to see myself.


 


The wrong part in your script is.. OnActorEquip is not a built-in event. It's one of the OBSE event handlers. So an OnActorEquip event script should use Function{} block instead, and you have to register it like OnMagicEffectHit event.


Furthermore, OnActorEquip is fired at the moment that an actor *try to* equip an item, right before actually equip it. If you have read the CS wiki carefully, you must have seen a note that reads "attempting to unequip an item before it's actually equipped will always fail".


 


If I were you, I'd just create a GameMode object script and will attach it to the ring.


In that script, I'll check if the actor is currently being affected by that effect once every frame(GameMode script usually runs once every frame). If not, I then can unequip & remove it.



Let rActor := GetSelf
if rActor.HasMagicEffect PARA
return
endif

...
...

*Edit*


????


It shows up over the head normally. :huh:


what's going on.


0

Share this post


Link to post