whats wrong with this script?

Post » Tue Jun 19, 2012 8:25 pm

I have 2 draugrs set up from the warehouse ambush and i have this script on druagr A
and i have draugr B parented to druagr A(the monster itself) but when i kill draugr A.
druagr B does not wake up after the death of druagr A with the ondeath script what am i doing wrong?
Do i need another script on druagr B to say listen for his death or anything at all?

also do i link ref or link as parent?


Event OnDeath(Actor akKiller)
if (akKiller == Game.GetPlayer())
Debug.Trace("We were killed by the player!")
EndIf
EndEvent

Event onGetUp(ObjectReference myFurniture)
Cell parentCell = GetParentCell()
;trace("in getup")
if (parentCell && parentCell.IsAttached() && (is3DLoaded()))
gotoState("OnDeath")
endif
endEvent

can any one help? thanks if you can
User avatar
Kayla Keizer
 
Posts: 3357
Joined: Tue Dec 12, 2006 4:31 pm

Post » Wed Jun 20, 2012 4:42 am

well right away, events aren't states. Do you actually have a state "OnDeath" defined somewhere?

Linking an NPC to another by default just makes it follow it around. If the second Draugr is turned off, it cannot do so, so it just sits there.

Set the second Draugr as an activate child of the first one, and have the first one's "ondeath" event perform an Activate(Game.GetPlayer()) - That will propogate to all of it's activate children.
User avatar
Dezzeh
 
Posts: 3414
Joined: Sat Jun 16, 2007 2:49 am

Post » Tue Jun 19, 2012 3:48 pm

No? i dont realy understand scripting whats a state? what do you mean. Do you have a state Ondeath?

im not very good at scripting at all. I thort it was such a smiple script to be done.
User avatar
Trey Johnson
 
Posts: 3295
Joined: Thu Oct 11, 2007 7:00 pm

Post » Wed Jun 20, 2012 4:51 am

No? i dont realy understand scripting whats a state? what do you mean. Do you have a state Ondeath?

im not very good at scripting at all. I thort it was such a smiple script to be done.

A state is a kind of "mode" you can use to alter a script's behavior based on events or function calls. A simple example:

; This is the "empty state" - every script has one, and any functions in the states MUST also be defined here.int Property Coins=10 Auto ; How many coins are in our pocket. Start with 10function AddCoins(int MoreCoins) ; Negative values remove coins. Disallows negative numbers of coins.   Coins = Coins + MoreCoins   if Coins < 0	   Debug.Notification("Hey, we don't have that many coins!")	   Coins = Coins - MoreCoins ; Get the coins back   endif   if Coins > 100	  GoToState("OverAHundredCoins")   if Coins == 0	  GoToState("NoCoins")   else	  GoToState("") ; Return to the Empty State   endifEndFunctionFunction HowManyCoins() ; Tells us how many coins we have.   Debug.Notification("We have "+Coins+" Coins!")EndFunctionState OverAHundredCoinsFunction HowManyCoins() ; Tells us we have plenty of coins.   Debug.Notification("We have over a hundred Coins!")EndFunctionEndStateState NoCoinsFunction HowManyCoins() ; Tells us we have no coins.   Debug.Notification("We have no Coins!")EndFunctionEndState

Now this could do the same thing by simply having an if statement in the HowManyCoins() function in the if statement, but by using states, we can change a whole series of functions to behave differently.
User avatar
mishionary
 
Posts: 3414
Joined: Tue Feb 20, 2007 6:19 am

Post » Tue Jun 19, 2012 3:36 pm

I still dont undertand how i make ondeath as a state?
User avatar
Adam
 
Posts: 3446
Joined: Sat Jun 02, 2007 2:56 pm

Post » Tue Jun 19, 2012 7:33 pm

I still dont undertand how i make ondeath as a state?

Well, like this:

State OnDeath; Redefine any functions you want to behave differently here, for example:Event OnHit(akAggressor, akSource, akProjectile, abPowerAttack, abSneakAttack,abBashAttack,abHitBlocked)  if akAggressor == Game.GetPlayer()	 if akProjectile	    Debug.Notification("Nice Shot, But it's not getting any deader.")	 endif	 if abPowerAttack	    Debug.Notification("Very Macho, But it's not getting any deader.")	 endif	 if abSneakAttack	    Debug.Notification("Very Sneaky, But it's not getting any deader.")	 endif	 if abBashAttack	    Debug.Notification("Nice Shield, But it's not getting any deader.")	 endif  endifEndState

but I don't see why you would want to...for one thing, naming it the same as an event may cause you more confusion later on. If you really want to define a state for death, I'd call it "DeadState" or something.

States and events are totally different.
User avatar
OnlyDumazzapplyhere
 
Posts: 3445
Joined: Wed Jan 24, 2007 12:43 am

Post » Tue Jun 19, 2012 4:29 pm

Ok thanks for your help ill give this a try and report back asap
User avatar
Laura
 
Posts: 3456
Joined: Sun Sep 10, 2006 7:11 am

Post » Tue Jun 19, 2012 3:15 pm

It looks like you've misinterpreted the http://www.creationkit.com/GotoState_-_All_Scripts function. If you haven't made a http://www.creationkit.com/States_(Papyrus), then you shouldn't use that function.

If you want to trigger the http://www.creationkit.com/OnDeath_-_Actor event manually, then you can call it like any other function. However, if you call an event manually then it's up to you to pass the correct information (the calling http://www.creationkit.com/Actor_Script killer, in this case) as its parameter(s), unlike when it's called automatically by the game.

If you want to kill the actor, which would also trigger the OnDeath event, then just use the http://www.creationkit.com/Kill_-_Actor function.

P.S. Please take a look at this stickied thread, which explains how to post scripts on this forum - http://www.gamesas.com/topic/1347469-how-to-ask-for-scripting-help/.

Cipscis
User avatar
Steven Hardman
 
Posts: 3323
Joined: Sun Jun 10, 2007 5:12 pm

Post » Wed Jun 20, 2012 5:54 am

Im sorry im ever more confused now i dont realy know anything about scripting.
How do i use the kill function? and what do you mean trigger the event manually?
and whats a parameter? I dont know anyhting about scripting. I have done some tutorial but
from there its just seems to say work it out yourself, and i cant?

Can you please explain things simply like.
what a paramete does how to use it and so on.

I was kind of thort there was allready a script for this this.
Im not even sure if i have the linked refs right as well.
User avatar
Marcus Jordan
 
Posts: 3474
Joined: Fri Jun 29, 2007 1:16 am

Post » Wed Jun 20, 2012 12:42 am

As I understand it, what you want to do is have one Draughr "wake up" when another one is killed?

Put this on the first one, should do it...I'm having trouble getting mobs to even show up in my first attempt at making a dungeon...gotta go back to the tutorials I guess...I place the things in there, then when I COC, no mobs.:
Event OnDeath(ObjectReference Killer)  Activate(Killer)EndEvent

Oh, and go to the second Draughr and set the first one as it's activate parent.
User avatar
Sabrina garzotto
 
Posts: 3384
Joined: Fri Dec 29, 2006 4:58 pm

Post » Wed Jun 20, 2012 2:15 am

Ok redwood i have placed that script on the first druagr.
what next? just to be clear.
User avatar
Sarah MacLeod
 
Posts: 3422
Joined: Tue Nov 07, 2006 1:39 am

Post » Tue Jun 19, 2012 9:05 pm

If you want to trigger the http://www.creationkit.com/OnDeath_-_Actor event manually, then you can call it like any other function. However, if you call an event manually then it's up to you to pass the correct information (the calling http://www.creationkit.com/Actor_Script killer, in this case) as its parameter(s), unlike when it's called automatically by the game.

Sorry to jump in here. But does that mean if I have a script attached to "MyActor" in which I added code for the OnDeath event. I can then call MyActor.OnDeath(referenceToKiller), passing any actor as the killer, to trigger the event?
User avatar
Beast Attire
 
Posts: 3456
Joined: Tue Oct 09, 2007 5:33 am

Post » Tue Jun 19, 2012 8:04 pm

Ok redwood i have placed that script on the first druagr.
what next? just to be clear.

Make sure that the second Draugr is of the "Ambush" type, so it has the OnActivate event already defined to make it "wake up" when it's activated.

Or you could simply attach the "MasterAmbushScript" script to a copy of whatever Draugr type you want to use. (Make sure to use a copy of the type and not the original, or you will add the MAS to every Draugr of that type anywhere in the game.)
User avatar
Annick Charron
 
Posts: 3367
Joined: Fri Dec 29, 2006 3:03 pm

Post » Wed Jun 20, 2012 4:30 am

Ok redwood iv'd done that. next?
User avatar
krystal sowten
 
Posts: 3367
Joined: Fri Mar 09, 2007 6:25 pm

Post » Tue Jun 19, 2012 10:55 pm

Well it works when I try it out...be sure you're putting the scripts on the green mob markers and not the ambush markers, and that the one you want to wake up second has the Parent Only Activate marker checked (That should prevent it from activating when the first one is activated, and only activate it when the parent activates itself...I think. I was just attacking the first one til it died, and then the second one got up)
User avatar
Alexandra Ryan
 
Posts: 3438
Joined: Mon Jul 31, 2006 9:01 am

Post » Wed Jun 20, 2012 6:34 am

Sorry to jump in here. But does that mean if I have a script attached to "MyActor" in which I added code for the OnDeath event. I can then call MyActor.OnDeath(referenceToKiller), passing any actor as the killer, to trigger the event?
Yes, although that won't kill the actor.

Events are just another type of function. Native events, like http://www.creationkit.com/OnDeath_-_Actor, are also called automatically by the game in response to certain things (like an actor dying).

Cipscis
User avatar
Mr.Broom30
 
Posts: 3433
Joined: Thu Nov 08, 2007 2:05 pm

Post » Tue Jun 19, 2012 5:55 pm

Im still having trouble with it. But i am getting there.

Now i have this script on the first one

Event OnDeath(ObjectReference Killer)
Activate (Killer)
EndEvent



But when i activate the triggerbox the first one wakes up, but as soon as i do damage to the first one the
second one wakes up wonted him to wake up on first ones death.

any ideas? thanks
User avatar
Johnny
 
Posts: 3390
Joined: Fri Jul 06, 2007 11:32 am

Post » Wed Jun 20, 2012 5:15 am

Well that's the simple way...here's the complex way:

ObjectReference Property WakeMeUpWhenYouDie Auto ; Assign this to the second Draghr in your render window.Event OnDeath(Actor Killer)	WakeMeUpWhenYouDie.Activate(Killer)EndEvent

Note that the other Draugr will still wake up if you clip it with an area of effect like a fireball or something. In this case, turn off the "activate by parent only" and unlink the activator parent link to prevent it waking up when you hit the first ambush trigger.
User avatar
Maria Leon
 
Posts: 3413
Joined: Tue Aug 14, 2007 12:39 am

Post » Wed Jun 20, 2012 12:29 am

Ok so far so good thansk for your help so far.

Now i have them doing what i wont the second draugr does wake up when the first one dies.
But the first one wont activate with the triggerbox only time it activates is when i go near the first draugr.
then i kill the first one and the the second one wakes up.
But as i said the triggerbox doesent trigger the first.

any idea's? I tried parent only to the trigger box but that didnt work.
User avatar
Add Meeh
 
Posts: 3326
Joined: Sat Jan 06, 2007 8:09 am

Post » Tue Jun 19, 2012 2:53 pm

Ok nevermind i have solved the problem it was because ambush trigger was not ticked on the masterambush script in the properties

They now work the way i wonted to now hopfully i can apply this to some other setups

Thank you for all your support you have all been very helpful.
User avatar
Multi Multi
 
Posts: 3382
Joined: Mon Sep 18, 2006 4:07 pm


Return to V - Skyrim