PlaceAtMe issues...

Post » Sat Sep 03, 2011 7:45 am

In attempting to make the characteristic knock-you-on-your-ass effect of the Noisy Cricket, I have set up a script...

scn CicadaKnockdownScriptfloat timershort GunFiredbegin OnFire     if (GunFired == 0)          set GunFired to 1     endifendbegin gamemodeif GunFired != 0     if ( timer < 2.4166 )         set timer to timer + getSecondsPassed     else                                                                         set GunFired to 0		player.placeatme CicadaKnockbackActivator 1 100 0         ShowMessage CidadaKnockdownTestMessage     endifendifend


The PlaceAtMe object is placed, and its simple little PushActorAway and MarkForDelete command work as intended. However, the PlaceAtMe command in the actual object script on the gun... isn't. It places the activator object directly at the player's position. I want it to appear a distance in front of the player since making the pushed actor and push source be the same thing just throws the actor up into the air, I want the force to go backwards.

The syntax for PlaceAtMe is as follows accordign to the Wiki:
[Object].PlaceAtMe ObjectID:ref Count:int Distance:float Direction:int{0, 1, 2, 3}


I seem to have the parameters all placed correctly: calling ref is Player, objectID is the kickback activator, count is 1, distance is 100, and position is 0 (forward from calling ref). However, as I sad, it just plops it right at the player position and then kicks the player up into the air.

So what's going on? Why is it not working?

EDIT: Dammitsomuch... I just read the notes that the distance and direction parameters don't work.

Anyone have any alternative ideas? I'll use NVSE if that's the only choice, but would rather keep it NVSE-less if I can.
User avatar
Kate Schofield
 
Posts: 3556
Joined: Mon Sep 18, 2006 11:58 am

Post » Sat Sep 03, 2011 3:51 am

Oh, the position stuff doesn't work any more? That kinda svcks.

There's trig functions in the vanilla scripts now, so you don't need NVSE.
User avatar
Janine Rose
 
Posts: 3428
Joined: Wed Feb 14, 2007 6:59 pm

Post » Sat Sep 03, 2011 6:23 am

Trig functions.... oh fun. :bonk:

It's been a long while since I did trig stuff...

EDIT: Well, I found out a way to do it without enduring trigonometric derp... PlaceAtReticle. No clue what the first two numerical parameters are, but the third (valued 12000 here) is range or something. I just copied the usage as seen in Euclid's C-Finder's object script.

scn CicadaKnockdownScriptfloat timershort GunFiredshort KnockerBackerbegin OnFire     if (GunFired == 0)          set GunFired to 1     endifendbegin gamemodeif GunFired != 0     if ( timer < 2.5 )         set timer to timer + getSecondsPassed     else                                                                         set GunFired to 0		set KnockerBacker to PlaceAtReticle CicadaKnockbackActivator 1 0 12000         ;ShowMessage CidadaKnockdownTestMessage     endifendifend


One downside though: no knockback if you point it into the sky and fire or the target is out of range. Can't win it all... :shrug:
User avatar
naome duncan
 
Posts: 3459
Joined: Tue Feb 06, 2007 12:36 am

Post » Sat Sep 03, 2011 6:05 am

Aw c'mon, trig isn't hard.

float zAnglefloat offsetXfloat offsetYset zAngle.player.GetAngle Zset offsetX to 100 * -sin zAngleset offsetY to 100 * cos zAngle

I think that's right, although the +/- signs may need shuffling as the game has an infuriating coordinate system where z angle 0 is along the Y axis and it turns clockwise, and I can't remember if I've got them right.
Whoever made the decision on how to setup the coordinates for this game should be shot.

E: I'd gotten sin and cos the wrong way around. THEY SHOULD BE SHOT.
User avatar
Guy Pearce
 
Posts: 3499
Joined: Sun May 20, 2007 3:08 pm

Post » Sat Sep 03, 2011 12:23 am

I've always converted the angles to trig angles before doing the trig functions

			set zAngle to player.GetAngle Z			if (zAngle < 90 )				set zTrigAngle to 90 - zAngle			else				set zTrigAngle to 450 - zAngle			endif			set offsetX to 100 * cos zTrigAngle			set offsetY to 100 * sin zTrigAngle	

User avatar
Ashley Campos
 
Posts: 3415
Joined: Fri Sep 22, 2006 9:03 pm

Post » Sat Sep 03, 2011 12:11 pm

What is done with these after the trig's done its work? I'm presuming not PlaceAtMe since it's ascertained it's busted.
User avatar
Steeeph
 
Posts: 3443
Joined: Wed Apr 04, 2007 8:28 am

Post » Sat Sep 03, 2011 10:42 am

Well, they'll give you an offset from the player. So
Set ThingRef to player.PlaceAtMe Thing 1ThingRef.MoveTo Player OffsetX OffsetY

User avatar
NeverStopThe
 
Posts: 3405
Joined: Tue Mar 27, 2007 11:25 pm

Post » Sat Sep 03, 2011 4:09 am

Well here's the functional script.

scn CicadaKnockdownScriptfloat timershort GunFired;short KnockerBackerref KnockerBacker2float zTrigAnglefloat zAnglefloat offsetXfloat offsetYbegin OnFire       player.PlaySound3d WPNRiflePlasmaFire3D ; A test sound to see when it actually runs this block	if (GunFired == 0)          set GunFired to 1     endifendbegin gamemodeif GunFired != 0     if ( timer < 2.5 )         set timer to timer + getSecondsPassed     else                                                                         set GunFired to 0         set zAngle to player.GetAngle Z          if (zAngle < 90 )                   set zTrigAngle to 90 - zAngle          else                    set zTrigAngle to 450 - zAngle         endif         set offsetX to 100 * cos zTrigAngle         set offsetY to 100 * sin zTrigAngle    	    set KnockerBacker2 to player.placeatme CicadaKnockbackActivator 1	    KnockerBacker2.MoveTo Player OffsetX OffsetY 50     endifendifend


An interesting observation and a perplexing enigma: It seems that the OnFire block doesn't actually fire until the animation signals it's time to emit the projectile. However... it somehow manages to trigger the placement of the knocker-backer in sync with firing the projectile. :blink: This causes me problems because my attempt to duplicate the 1hpattack4 set and use it as attack9 while editing the text keys to play a different sound failed, which means I need to use a script to play the warmup sound I want it to play. What's even more perplexing is that it worked before... I fiddled with animations, borked something, and then had to replace them from backups (I'm using Joefoxx's). I'll be investigating what's going on with that next.

If I can't get it to trigger when I want, I may end up having to use NVSE anyway to detect the actual time of trigger press to start playing the desired warmup sound via scripts. :glare:

EDIT: Nevermind on the sound problem, it turns out I wasn't doing something I should have when I was tweeking the KFs. The mysterious disparity between the OnFire trigger time and kickback event that should exist but doesn't is still there, but it isn't impeding things now.
User avatar
x_JeNnY_x
 
Posts: 3493
Joined: Wed Jul 05, 2006 3:52 pm


Return to Fallout: New Vegas