Jump to content

Scripting question about triggers


gasti89

Recommended Posts

It seems like dead bodies doesn't count as "akActionRef".

 

I have a trigger wich should detect when you throw a dead body (from a quest alias) inside it.

 

Setting his reference as akActionRef doesn't work.

 

If i use this

 

Actor myActor = myAlias.GetActorRef()
    if akActionRef == myActor.IsDead()

 

the trigger works ONLY if both you and the dead body fall into it :O

 

Can someone clarify this? :P

Link to comment
Share on other sites

I've tried with the actor we talk about set as ReferenceAlias property, ObjectReference property and Actor Property.

 

Nothing works, except if i put the script part above, wich means if i have it not set as Actor i have to call the "Actor myActor = myAlias/myReference.GetActorRef()"

 

It just seems that when an actor dies he isn't treated as an ObjectReference anymore.

Edited by gasti89
Link to comment
Share on other sites

Just to make things clear, the script compiles.

 

It's just that it doesn't work ingame ;)

 

Do you think that having the trigger look for an ActorBase will work?

 

Even if i don't know how to make the trigger look for an actorbase instead of a ObjectReference

Link to comment
Share on other sites

Actorbase is the base object of the actor (The thing you see in the Object Window is the ActorBase, what you see in the render window is an Actor Reference).

 

What I am seeing, as that it is triggered by the player somehow, but not the dead NPC. Perhaps you could try looking at one of the trap scripts to get it working on any NPC?

Link to comment
Share on other sites

I know how triggers work.

 

The fact is that a normal trigger script works on a alive NPC, but the trigger simply doesn't work if the same NPC enters it while dead (so if you throw his corpse in it).

 

I'm thinking that when a NPC dies he stops being an ObjectReference or an Actor. That's why i'm thought about using ActorBase as the Trigger.

Link to comment
Share on other sites

Ok, i also tried GetTriggerObjectCount(), just to know if the trigger actually knows that the corpse is there...nothing!

 

When i enter the trigger with the corpse already inside, the message returns only 1 object (me).

 

So why the hell a trigger box doesn't know that it has a dead bosy inside?

Link to comment
Share on other sites

It seems like dead bodies doesn't count as "akActionRef".

 

I have a trigger wich should detect when you throw a dead body (from a quest alias) inside it.

 

Setting his reference as akActionRef doesn't work.

 

If i use this

 

Actor myActor = myAlias.GetActorRef()
    if akActionRef == myActor.IsDead()

 

the trigger works ONLY if both you and the dead body fall into it :O

 

Can someone clarify this? :P

 

Gasti,

 

akActionRef would normally be the actor reference entering the trigger [Event OnTriggerEnter(ObjectReference akActionRef)]

 

However, "myActor.IsDead()" simply queries whether the actor is dead or not by returning either TRUE or FALSE. So comparing akActionRef to TRUE or FALSE (like you did above ^^) does not make sense.

 

You want to try something like this:

 

Event OnTriggerEnter(ObjectReference akActionRef)

Actor myActor = myAlias.GetActorRef()

If (akActionRef as Actor).IsDead() && akActionRef == myActor
	Debug.MessageBox("My dead actor entered the trigger.")
ElseIf (akActionRef as Actor).IsDead()
	Debug.MessageBox("A dead actor entered the trigger, but he was not my alias.")
Else
	Debug.MessageBox("A living actor entered the trigger.")
EndIf

EndEvent

 

Edit: D'oh :facepalm:

Edited by steve40
Link to comment
Share on other sites

That script won't compile cause IsDead() is an Actor Function.

 

I already tried with

 

if (akActionRef as Actor).IsDead()

 

it compiles but simply doesn't work.

 

Another thing i tried is setting a OnTriggerLeave event. I've put the actor inside the trigger and set the script to pop a message on leave.

 

The weird thing is that as soon as i kill the Actor, the script fires like he was leaving the trigger!

Edited by gasti89
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...