Talk:Activate

From GECK
Jump to: navigation, search

It seems that the "Guaranteed CTD" no longer applies, added 2 scripted items, 1 of them with a gamemode block to a dead ant and called activate player 1 on it. No CTD. Did i missed something? does it only happen with specific blocks?. Anyone care to confirm?.

Tips and Tricks

(From CS Wiki)

  • If the ObjectToActivateRef flag isn't set then the object will activate itself (as with most functions).

There are a couple of tricks you can pull with this:

  1. You can use Activate inside of an object's OnActivate block to make it also perform it's default activation.
  2. You can use Activate player, 1 inside of an object's onActivate block to make it run it's OnActivate block again (see Nesting below).
  3. You can use Activate player, 1 to make an item activate itself while inside an inventory. By having the item continuously check a persistent variable, you can make external scripts "activate" the item by controlling the persistent variable.

Nesting

You can nest activations within other activations. For instance, a quest script activates an activator

SomeActivator.Activate player, 1

which in turn activates another activator

scn SomeActivatorScript

begin onActivate
  SomeOtherActivator.Activate player, 1
end

You can only nest 5-6 activations at a time. At a time is a little hard to define here, since OnActivate blocks run instantly and before the next line of code is processed. This really means that if 4 other scripts are still being processed and an activation is made during the 5th script, that last activation will be ignored (the script skips the line). This applies to any activation, even if they'r different objects or different scripts.

  • Using a result script to activate the next script, the limit is still 5-6.

Using Activate Function for Force Greeting

The activate function can be used as an alternative method to make NPC's force-greet the player. However you must remember to disable player controls in the line before the activate function, with the no-crouching flag set, otherwise the activate function will pickpocket the NPC, if the player is in crouching mode. For example:

Begin ontrigger player


DisablePlayerControls 0 0 0 0 0 0 1

MyNpcREF.activate player

disable

END

You must also remember to use 'enableplayercontrols', in the result script of the Greeting line for that NPC, so controls are restored once the Greet has been successful.

RJHelms84