StartCombat trouble

Post » Wed Jun 20, 2012 2:33 am

Hello,
I'm trying to attach this script to a Skeever
Scriptname AttackPlayer extends ObjectReferenceStartCombat(Game.GetPlayer())

However, I'm receiving the following error:
...\AttackPlayer.psc(2,11): no viable alternative at input '('
I've also tried Skeever1.StartCombat(Game.GetPlayer()) after assigning Skeever1 as a Ref ID to the skeever. Same error.

Any help would be greatly appreciated :smile:

If I'm using the wrong method, then here's my goal: make a skeever I've just enabled (was originally disabled) attack the player, something he usually doesn't do because he's a bit too distant.

Thanks a lot!
User avatar
Mizz.Jayy
 
Posts: 3483
Joined: Sat Mar 03, 2007 5:56 pm

Post » Wed Jun 20, 2012 12:54 pm

You can't use a it just like that. You need to put it inside a function or an event. Example:
Scriptname attackplayer extends objectreferenceEvent OnCellAttach()     startcombat(game.getplayer())endevent
User avatar
Wane Peters
 
Posts: 3359
Joined: Tue Jul 31, 2007 9:34 pm

Post » Wed Jun 20, 2012 5:34 am

Hello,
I'm trying to attach this script to a Skeever
Scriptname AttackPlayer extends ObjectReferenceStartCombat(Game.GetPlayer())

However, I'm receiving the following error:
...\AttackPlayer.psc(2,11): no viable alternative at input '('
I've also tried Skeever1.StartCombat(Game.GetPlayer()) after assigning Skeever1 as a Ref ID to the skeever. Same error.

Any help would be greatly appreciated :smile:

If I'm using the wrong method, then here's my goal: make a skeever I've just enabled (was originally disabled) attack the player, something he usually doesn't do because he's a bit too distant.

Thanks a lot!

Try the following, after you make two properties. Open the properties window, click "aSkeever",and press edit value, then select the Form for your skeever. You don't need to do this for "aPlayer".

Scriptname Test Extends ObjectReferenceObjectReference Property aSkeever AutoObjectReference Property aPlayer AutoEvent OnLoad()   aPlayer = Game.GetPlayer()	  aSkeever.StartCombat(aPlayer)EndEvent
User avatar
WTW
 
Posts: 3313
Joined: Wed May 30, 2007 7:48 pm

Post » Wed Jun 20, 2012 9:43 am

Sorry for bumping this topic, but I couldn't try any of your suggestions till now.

I now am encountering the error:
StartCombat is not a function or does not exist

Script:
Scriptname MultiPhaseAddHelperScript extends ObjectReferenceEvent OnLoad()  Self.StartCombat(Game.GetPlayer())EndEventEvent OnDeath(Actor AkKiller)    (PhaseMarker as DefaultMultiPhaseAddsScript).ReportDead()EndEvent
User avatar
ijohnnny
 
Posts: 3412
Joined: Sun Oct 22, 2006 12:15 am

Post » Wed Jun 20, 2012 1:56 pm

Self is not an actor property. Try Actor.StartCombat(Game.GetPlayer()) where Actor is the actor starting the combat.
User avatar
clelia vega
 
Posts: 3433
Joined: Wed Mar 21, 2007 6:04 pm

Post » Wed Jun 20, 2012 1:27 am

The following works:
Scriptname MultiPhaseAddHelperScript extends ObjectReference ObjectReference Property PhaseMarker autoActor Property ArenaMob AutoEvent OnLoad()  ArenaMob.StartCombat(Game.GetPlayer())EndEventEvent OnDeath(Actor AkKiller)(PhaseMarker as DefaultMultiPhaseAddsScript).ReportDead()EndEvent

However, I see no way of making the ArenaMob the same actor as the script is attached to.

In other words, I have this script attached to EncSkeever. I want EncSkeever to start combat (so I want ArenaMob to have EncSkeever as a value). However, when I try to edit the property, I cannot select it because the script is attached to it.

Also, I don't find it practical to define ArenaMob for every mob I add (I'm adding more than one). Is there no self equivalent?
User avatar
carla
 
Posts: 3345
Joined: Wed Aug 23, 2006 8:36 am

Post » Wed Jun 20, 2012 3:43 am

Sorry for bumping this topic, but I couldn't try any of your suggestions till now.

I now am encountering the error:
StartCombat is not a function or does not exist

Script:
Scriptname MultiPhaseAddHelperScript extends ObjectReferenceEvent OnLoad()  Self.StartCombat(Game.GetPlayer())EndEventEvent OnDeath(Actor AkKiller)	(PhaseMarker as DefaultMultiPhaseAddsScript).ReportDead()EndEvent

I was reading that and was like o.O

lol, you're using the script I gave you @ the nexus :D I so proud.

Anyways for that line, since it is attached to the skeever as intended like you said, try this:

(Self as Actor).StartCombat(Game.GetPlayer())
That should do it. If you're not familiar with casting, it's telling the game to treat 'self' which is type objectreference, as an actor (an extension of object reference) If that doesn't work let us know. How are those encounter tools working out other than this one instance? I've made a few advances with them since then, but not so much in the enemy encounter direction. Come to think of it I never even updated your thread.. forgot about it >.< did you fix what I mentioned and get it working through phase three?
User avatar
Becky Palmer
 
Posts: 3387
Joined: Wed Oct 04, 2006 4:43 am

Post » Wed Jun 20, 2012 1:23 pm

(Self as Actor).StartCombat(Game.GetPlayer()) gives this error:
cannot cast a multiphaseaddhelperscript to a actor, types are incompatible

I've fixed a few things in your script. Was planning to update the nexus thread as soon as I get it fully working. :)
User avatar
Tom
 
Posts: 3463
Joined: Sun Aug 05, 2007 7:39 pm

Post » Wed Jun 20, 2012 5:02 am

oh duh, change the "Scriptname MultiPhaseAddHelperScript extends ObjectReference "

to "Scriptname MultiPhaseAddHelperScript extends Actor"

It should compile just using Self.StartCombat like the previous step(no casting), but check if it functions right. I tested it just now, but I was kinda close to it's spawn point, so I'm not certain it was attacking me due to script or default behavior. It was in my face the moment I loaded in though lol.

Not sure why I made it object reference in the first place. Lucky it ever processed the OnDeath() event to begin with :blink:
User avatar
Vahpie
 
Posts: 3447
Joined: Sat Aug 26, 2006 5:07 pm

Post » Wed Jun 20, 2012 4:09 pm

I actually saved it as another script with extends Actor, but refrained from posting here because the mobs still didn't attack me. I think I'm using the wrong event (OnLoad). Other than that, it compiles fine. Any suggestions?

Note: I'm enabling multiple mobs (skeevers and wolves), and they're attacking each other due to default behavior. Perhaps that's the problem? If so, can I fix that without duplicating the base skeevers/wolves and modifying their behavior?
User avatar
Crystal Clarke
 
Posts: 3410
Joined: Mon Dec 11, 2006 5:55 am

Post » Wed Jun 20, 2012 4:38 am

yeah, I'm finding self really isn't meant to be used in this way. Shame. It's meant to be passed to other scripts and functions versus being used to manipulate the attached object. I keep thinking there's go to be a function like self.GetOwningObject() that would let you use it like this... I don't think GetParent() would work, but haven't tried, i don't think that's the relationship between the script and it's object.

What's wrong with making your own and adding packages? That's probably the way I would have gone anyways :D To be honest the whole encounter I made was mostly an exercise in confining all the actions to script to keep it tiny in scope. Doing that actually helped out with moving on to stuff I'm working on now.

Seems like 80% of scripting in this game, once you get the basics down, is just trying to find the reference you're looking for lol. The doing stuff and controlling the flow is cake compared to having to go through all the hoops to find the references involved. Just look at the web of links and reference properties in the three phase encounter thing if you're still using it. Lots of reference properties is not terribly memory friendly when you start having hundreds and hundreds throughout the game.

You could also get rid of the Startattack in that script and use a defaultLinkRefStartCombatPlayer trigger. You place the trigger, link it to the skeever, and On load(I think it's Onload, check the script) the linked actor will attack the player.
User avatar
Skivs
 
Posts: 3550
Joined: Sat Dec 01, 2007 10:06 pm

Post » Wed Jun 20, 2012 12:50 am

What I did was to duplicate all bases, then set the duplicates' only faction to a custom faction I created (setting interfaction relation to allies), and their AI Data to Very Agressive/Help Allies and Friends.
Works like a charm now :D

Thanks a lot, tho.
User avatar
Dorian Cozens
 
Posts: 3398
Joined: Sat May 26, 2007 9:47 am

Post » Wed Jun 20, 2012 11:50 am

rofl, so now the beasts in your cave are all best friends? I think since you're making specialized behavior, making new types was the right call indeed :D
User avatar
Amy Gibson
 
Posts: 3540
Joined: Wed Oct 04, 2006 2:11 pm


Return to V - Skyrim