Scripting Problem With Activator

Post » Fri Aug 20, 2010 10:49 am

Its been a while since i modded and im trying to create a given effect when the player stands on a tile but i just cant seem to get the condition to trigger didnt know if anyone on the forum has any ideas:
This is my script at the moment:

scn lavatiletrapfloat lavaTimershort activatedbegin onTriggerif activated == 0cast 00TrapLavaDamage playerset activated to 1set lavatimer to 3endifendbegin gameModeif activated == 1if lavaTimer > 0set LavaTimer to LavaTimer - getSecondsPassedendifif LavaTimer <= 0set activated to 0endifendifend

The script is linked to an activator and i want the effect to occur when the player stands on the tile but the spell is not being triggered and i cant understand why i been racking my brain for hours any ideas anyone?
User avatar
Crystal Clarke
 
Posts: 3410
Joined: Mon Dec 11, 2006 5:55 am

Post » Fri Aug 20, 2010 9:26 pm

This would likely get a better response in the Construction Set forum. That being said, let's get down to business:

Part of the problem is from using Begin OnTrigger. Try using Begin OnActivate instead. Also, there is no need for a GameMode block in this instance. You can use timers without it. As for the spell, using cast requires a reference, i.e RefID.Cast SpellID Target. For that to work, the object casting the spell must be set as a Persistent Reference and have a unique RefID. It is also a bad idea to start a spellID (or any new objectID) with numbers, because the game will think it's supposed to look for a FormID instead of an EditorID. Use letters instead.

Edit: Also, make sure the spell's range is set to Target instead of Self. I made that mistake once and didn't figure it out until I used the console to add the spell to my spell list and the cast it.

Hope this helped some.
User avatar
OTTO
 
Posts: 3367
Joined: Thu May 17, 2007 6:22 pm

Post » Fri Aug 20, 2010 9:09 am

Pretty sure the activator's reference will be implicit for the cast statement, that should be OK.

Also pretty sure your problem is that spell's editorID. As Vyper said, you should never ever start those with numbers. :)
User avatar
Jessie Butterfield
 
Posts: 3453
Joined: Wed Jun 21, 2006 5:59 pm

Post » Fri Aug 20, 2010 3:12 pm

Pretty sure the activator's reference will be implicit for the cast statement, that should be OK.

It would be implicit if an OnActivate block was triggered on the casting reference itself, but it doesn't look (to me) like that's the case here.
User avatar
Justin Hankins
 
Posts: 3348
Joined: Fri Oct 26, 2007 12:36 pm

Post » Fri Aug 20, 2010 10:06 pm

begin on activate makes the script trigger when the activator is pressed but i want the effect to occur when the player stands on the square... i was thinking i might have to use a trigger zone but im not entirely sure.
User avatar
sharon
 
Posts: 3449
Joined: Wed Nov 22, 2006 4:59 am

Post » Fri Aug 20, 2010 9:13 pm

begin on activate makes the script trigger when the activator is pressed but i want the effect to occur when the player stands on the square... i was thinking i might have to use a trigger zone but im not entirely sure.

As far as I remember you will need a trigger zone for OnTrigger to work, yes. OnActivate only triggers when "activated" as in pushing a button. Just "touching" an activator will not trigger any event.

And I, too, am pretty sure you don't need explicit references in an object script, because the implicit self is default, no matter what block type you're in. Since this is an activator (I know they can cast) and the script is running on it, there should be no trouble (the activator will be the caster). However, I'm just saying this because I never needed such in my own scripts. I could as well be wrong. (My casting activators always are Persistent References though, so maybe that's indeed a requirement.)

I don't know how you could use a timer, if there are only block types which trigger only "once", though. I think a GameMode block is inevitable to this purpose.

And yes, get rid of those numbers at the beginning of any EditorIDs. They're just known to cause trouble, so it's best not to use them at all to begin with. For some things they work, for some they don't, but you'll just get confused which those are, so why even bother? Prefixing IDs with a special mod-prefix of mine is always my preference anyways.
User avatar
Kirsty Wood
 
Posts: 3461
Joined: Tue Aug 15, 2006 10:41 am


Return to IV - Oblivion