Jump to content

Determining Object location & explosion ownership


PuceMooose

Recommended Posts

Hello,

 

A couple of questions:

 

Object Location:

 

I have a misc inventory item that the player can activate. It's working as planned, but I'd like to be able to have it activate only when:

  • The player is not 'grabbing' the item
  • The object is stationary on the ground (e.g., not held up in the air by the player and activated, or falling)

 

I suppose I could make a script that continually checks the objects exact location/orientation. Is there an easier way? Is there a way to determine the exact height of the ground at any given time?

 

Explosion ownership

 

This one has plagued me for months. In its current iteration, the problem is centered around a new weapon I've made; it's an orbital strike platform uplink gun, and, when fired, 'paints' the target (the projectile is enchanted, and when the 8-second script effect finishes the fireworks happen) eight seconds later a missile, on the tail of a targeting laser, zooms in from the heavens toward the target. (This is done by moving a markerheading and using fireweapon) The problem is that the player is not receiving XP for anything that's killed by the missile. Is there anyway to trap fireweapon to make it think the player fired the weapon? Or is there another way to get the game to realize that the explosion was a result of a weapon fired by the player?

 

Thanks in advance.

Link to comment
Share on other sites

In your OnActivate script, you could check IsPlayerGrabbedRef to check against the first condition. As for the second condition, I would put a trigger box in the area that you would consider "on the ground" and use OnTriggerEnter and OnTriggerLeave to set that flag.

 

I don't know about explosion ownership. I suppose you could try various things with SetOwnership and maybe use PlaceAtMe to create the explosions rather than firing an actual weapon.

Link to comment
Share on other sites

IsPlayerGrabbedRef ! I'd somehow missed that command. That may be quite helpful. That should take care of the first issue.

 

I've had no lock with SetOwnership so far, but I'll play around with placeatme and see if it helps me get that XP issue working.

 

Thanks for the input.

 

 

In your OnActivate script, you could check IsPlayerGrabbedRef to check against the first condition. As for the second condition, I would put a trigger box in the area that you would consider "on the ground" and use OnTriggerEnter and OnTriggerLeave to set that flag.

 

I don't know about explosion ownership. I suppose you could try various things with SetOwnership and maybe use PlaceAtMe to create the explosions rather than firing an actual weapon.

Link to comment
Share on other sites

I made a little headway in resolving the explosive ownership issue. I'll post what I did just in case anyone else is struggling with a similar issue.

 

I had no luck with damage ownership being assigned to the player with damageav health or placeatme explosions within the effect script. It appeared that only damage applied from an enchant was properly assigning damage ownership to the player. The weapon, when fired, creates an invisible explosion that damages all actors within a radius. That radius is the same as the missile explosion that occurs at the end of the script. Here's an example of the enchant explosion applied when the player shoots a target:

 

http://www.pucemoose.com/pics/eo1.jpg

 

The various levels assign enough damage for the '40% for XP on death' rule, and are dependent on the max & current HP of the target. Then, once the damage is assigned, the damage is almost immediately (<1 seconds) healed by the heal MGEF:

 

scn aa5SCRPainterDamageForOwnership

short Currenthealth
short Health2
short healamount

Begin ScriptEffectStart
set CurrentHealth to getav health
End

Begin ScriptEffectFinish

if getav health > 0
	set health2 to getav health
	if health2 < currenthealth
		set healamount to currenthealth - health2
		restoreav health healamount
	endif
endif

End

 

The only problem with this method is that it only generates XP for those enemies in the range of the initial invisible explosion. If the painted hostile moves to another location in the company of other enemies, those other enemies won't generate XP for the player (since they were not in the initial damage/heal ownership loop.) If I can find a way to force the explosion to trigger again right before impact I might be able to rectify this issue.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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