Magic effect to Recognize dropped weapons in world?

Post » Wed Jun 20, 2012 12:08 pm

I have a >Magic Effect with the below script on it.
The magic effect is assigned to an >Enchantment.
The enchantment is assigned to an >Explosion.

When the player pulls a lever, any 'dead bodies' in the area of the explosion are looted and then deleted. (using a placeatme of the explosion object on an XMarker. The script will then run on objects in the explosion range.)

This works perfect for dead bodies.
Does anyone know how I would go about checking if the object is a 'dropped' weapon? Or if it will even momentarily run on a weapon?


 Scriptname LevelersArenaDeathScript extends activemagiceffect ObjectReference Property LevelersArenaChestREF  Auto Event OnEffectStart(Actor akTarget, Actor akCaster) if akTarget.IsDead()    akTarget.RemoveAllItems(akTransferTo = LevelersArenaChestREF)    akTarget.Delete() endifendEvent
User avatar
biiibi
 
Posts: 3384
Joined: Sun Apr 08, 2007 4:39 am

Post » Wed Jun 20, 2012 5:57 am

Well, the only parameters for OnEffectStart are actors, which leads me to believe that only actors can run magic effect scripts. I know it doesn't work on doors at any rate.

EDIT:

A way around this would be to have the explosion spawn an activator, which could be scripted to use http://www.creationkit.com/FindClosestReferenceOfAnyTypeInList_-_Game to remove weapons.
User avatar
loste juliana
 
Posts: 3417
Joined: Sun Mar 18, 2007 7:37 pm

Post » Wed Jun 20, 2012 11:33 am

That just might work, it can be a command on the lever. Thanks, I will try it out now.
User avatar
Mark Hepworth
 
Posts: 3490
Joined: Wed Jul 11, 2007 1:51 pm

Post » Wed Jun 20, 2012 9:36 am

It will not work in my lever's 'ObjectReference' type of script.

What do you mean by 'spawn an activator'? I have not seen the 'Game' type of script and I am not sure how its used.
User avatar
Heather Stewart
 
Posts: 3525
Joined: Thu Aug 10, 2006 11:04 pm

Post » Wed Jun 20, 2012 12:24 pm

Game functions should be available in pretty much any script, you'd just type:

Game.FindClosestReferenceOfAnyTypeInList(parameters)
User avatar
LijLuva
 
Posts: 3347
Joined: Wed Sep 20, 2006 1:59 am

Post » Wed Jun 20, 2012 2:51 pm

You can consider 'Game' a library, same for 'Utility' and 'Math'. You can use the function simply by adding 'import Game' to your script. Or you could just use Game.FindClosestReferenceOfTypeInList(your list property).


I had assumed you were causing your explosions with spells, so maybe it works differently. But by spawning an activator, I mean this:

It's possible to assign explosions to a magic effect, so that when the spell impacts something, an explosion is created (eg the VoiceThrowVoiceEffect magic effect of the VoiceThowVoice shout spawns the ThrowVoiceExplosion). You can assign a placed object to an explosion, so that when the explosion occurs, the object is created at the explosion (eg the VoiceCastMarker is created by the ThrowVoiceExplosion).
User avatar
~Amy~
 
Posts: 3478
Joined: Sat Aug 12, 2006 5:38 am

Post » Wed Jun 20, 2012 12:45 am

:lmao:
Okay, I had the function scripted wrong... Thats why it would not comile.

I had imported the 'Game' so that was covered. I did not use the '=', I used the '.' instead, so it was a 'fail'. :rofl:

As for the magic effect, that is an enchantment attached 'to' the explosion. But I am not using this function in that script. I am adding this function to the lever that creates the explosion.

Now to go test it since its compiling now. I will report later if it works. :)
User avatar
Greg Cavaliere
 
Posts: 3514
Joined: Thu Nov 01, 2007 6:31 am

Post » Tue Jun 19, 2012 11:56 pm

It works. Sort of.

The afRadius (Maximum distance from center to look) does not appear to work. The weapon has to be extremely close to the center of the function call.
I have made the radius 500, 1000 and even 10000 and it only works on weapons in the list that are close. I will give it some more testing, just to make sure its not something else.
User avatar
Luis Longoria
 
Posts: 3323
Joined: Fri Sep 07, 2007 1:21 am

Post » Wed Jun 20, 2012 3:44 am

well it finds the closest one...thus the name of the function? Are you saying that if there are no close ones at all, it doesn't come back with one if there are some others further away?
User avatar
Silencio
 
Posts: 3442
Joined: Sun Mar 18, 2007 11:30 pm

Post » Wed Jun 20, 2012 7:07 am

It will 'grab' them 'if' they are close to the epicenter. I can 'move' the weapons closer and it will then 'grab' them when I pull the lever.
I put the command in a while loop, so it should at least grab the closest 10 weapons.

I am going to try some ridiculously high radius amounts and see if that helps.


ObjectReference Property ObjWeapon Auto Hidden

...

   myLoop = 10  While myLoop > 0      ObjWeapon = FindClosestReferenceOfAnyTypeInList(WeaponList, 2584.0, 4084.0, -408.0, 50000.5000)      LevelersArenaChestREF.AddItem(ObjWeapon)      ObjWeapon.Delete()      myLoop = myLoop - 1  EndWhile
User avatar
Miranda Taylor
 
Posts: 3406
Joined: Sat Feb 24, 2007 3:39 pm

Post » Wed Jun 20, 2012 2:41 pm

A thought...how close is your chest to the lever?
User avatar
carrie roche
 
Posts: 3527
Joined: Mon Jul 17, 2006 7:18 pm

Post » Wed Jun 20, 2012 7:07 am

Not far, its on the ledge above the arena. But the function is not running on the chest, its running at a location on the arena floor.
But that is not the problem since the weapons are not 'deleted' off the floor unless they are 'selected' from the formlist.
I can move the weapons closer to the 'function location' which is down on the arena floor. Not where the chest is.
User avatar
Tamara Dost
 
Posts: 3445
Joined: Mon Mar 12, 2007 12:20 pm

Post » Wed Jun 20, 2012 2:41 am

If the system you use to spawn the gladiators is by placeatme, I see no problem but if you are using spawn zones, deleting the corpses will avoid them being spawned again.
User avatar
Latino HeaT
 
Posts: 3402
Joined: Thu Nov 08, 2007 6:21 pm

Post » Wed Jun 20, 2012 5:42 am

Actor spawn is handled with PlaceAtMe at XmarkerHeadings so there is not problem with them. Been modding Beth games since 2003 with Morrowind. ;)

I tried several different radi and nothing seemed to work unless the weapon was 'right on the function call point'. Unless someone has any idea's I will have to trash this idea.
User avatar
Sheila Esmailka
 
Posts: 3404
Joined: Wed Aug 22, 2007 2:31 am

Post » Wed Jun 20, 2012 9:57 am

Just searched the vanilla game scripts and it appears this function is not used at all.
Perhaps its only in the fragments....
User avatar
Madison Poo
 
Posts: 3414
Joined: Wed Oct 24, 2007 9:09 pm

Post » Wed Jun 20, 2012 1:00 pm

I'd move the chest far far away just to be sure...the find functions CAN locate items inside a chest, and it may be somehow finding them in there. Maybe put the chest in a different cell entirely.
User avatar
Alexandra Ryan
 
Posts: 3438
Joined: Mon Jul 31, 2006 9:01 am

Post » Wed Jun 20, 2012 11:15 am

I will remove the part where it moves the items in the chest and see if that works. That way, they do not exist after being cleaned up.
User avatar
Claudia Cook
 
Posts: 3450
Joined: Mon Oct 30, 2006 10:22 am

Post » Wed Jun 20, 2012 8:23 am

No luck. Its like the radius is at 0. If I can move the weapon in an exact spot, it works.
I suspect the function may not work completely.
User avatar
Strawberry
 
Posts: 3446
Joined: Thu Jul 05, 2007 11:08 am

Post » Wed Jun 20, 2012 12:49 am

Hmn...maybe change to the FindClosestReferenceOfAnyTypeInListFromRef function and put an activator just under the center of the arena to use as your centerpoint?
User avatar
Miss K
 
Posts: 3458
Joined: Sat Jan 20, 2007 2:33 pm

Post » Wed Jun 20, 2012 9:21 am

Tried the REF form of the command with the same results. If its exactly on the marker 'crosshairs' then it works. Otherwise it does not.
User avatar
-__^
 
Posts: 3420
Joined: Mon Nov 20, 2006 4:48 pm


Return to V - Skyrim