Jump to content

FOSE script question


SpeedyB64

Recommended Posts

I've experimented with it a bunch but all I could get where CTDs

 

The example is set up like a spell effect, how could I make that work on a weapon (I pretty much just want people to die when I look at them when this weapon is equipped, preferably explode ;) )

 

Basically what this is is a radio that you carry around like a rocket launcher and any npc you point it at will have their head explode >:)

Link to comment
Share on other sites

You simply set up the gun to give the enchantment when the player haves it equipped.

Then you want to remove the activate and add isactor, isdead == 0, target.kill player.

 

Note that the effect was made for 1 time activation. You'd need to rework it a little to keep it functional (remove the frame cap, add a if(target) security check....)

Link to comment
Share on other sites

Making someone's head explode is fairly easy, as the KillActor function can be used to dismember body parts (causing them to explode by default).

 

To make the effect active only when the player is wielding the weapon, the script would have to be attached to the weapon itself, and it would utilise a "switch" variable that would be toggled in OnEquip and OnUnequip blocks.

 

I didn't think of this before, but if the effect is to be active continuously then using GetCrosshairRef mightn't be the best solution, as increasing "iActivatePickLength" will (obviously) result in an increase in the player's "activate pick length". GetCombatTarget is the other obvious option, but it's not really all that reliable, unfortunately. One more option would be to use a scripted explosion that checks GetHeadingAngle, possible along with some trigonometry to check X angle as well, to see what NPC(s) the player is looking at. It would be less exact, but it might just work...

 

Cipscis

Link to comment
Share on other sites

The iActivatePickLength pick-length thing is mostly a non-issue, as you can disablecontrol 5 so that players can't pick/activate, and toy with conditions to activate it if the "target" is close in range.

I've discovered that getcrosshairref acts directly with line of sight and collision boxes, while getcombattarget uses the auto-aim bot. Not only does it fail to pick non-hostiles, but it also fails completely if you use mods that reduce the autoaim, or disable the foe aimbot.

Link to comment
Share on other sites

The main reason why I don't want to use GetCrosshairRef is that, in order to prevent graphical bugs and activation of distant objects, GetDistance will have to be called every frame in which GetCrosshairRef returns a true value.

 

With most functions, this wouldn't be a problem, but I've seen GetDistance referred to as a very "CPU-heavy" function, and calling it every frame might cause performance issues (reference). However, if it can be used without noticeable performance issues, then it is probably the best choice, unless SpeedyB wants it to be slightly inaccurate.

 

Cipscis

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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