Jump to content

Script Examples


Samurai190

Recommended Posts

I need help with scripting since I have never done it before, only got consumables part right.

 

The problem is weapon script effects, for example I want that a hit from the weapon causes Setunconscious 1.

Another example is that hit from the weapon causes the creature to be added to player's faction and be friendly/helpful to the player, perhaps follow the player too?

 

If someone would be kind enough to offer me examples of these so I can get down scripting myself. :biggrin:

Link to comment
Share on other sites

The best thing I can suggest is to look at how the other scripts are made in the game itself and base your ideas on that.

For example, if you want something that will cause an enemy to follow you around, look at the scripts linked to the animal friend perk and adjust them slightly for your needs, applying them to weapons.

 

Weapon scripts are a bit complicated because they can be achieved in many ways. You have ammo effects, and scipts that can either be attached to the weapon or the ammo. Let's break it down:

 

1. Ammo effects

For example, if you want an ammo type called 'rubber bullet' to knock an enemy unconscious, make an ammo effect with whatever ID you want it to have ('MyRubberBullet', let's say). Set the type to 'Damage Fatigue', operation to 'add' and value to 1,000.

Obviously, fatigue is what keeps an enemy awake, so damaging it will make them more tired. You have to make sure you're adding to the fatigue (when I first tried it, I subtracted from fatigue, which had the opposite effect). 1,000 damage to fatigue is enough to knock out pretty much anything.

 

So that's an ammo effect, less complicated in some ways to scripts, but very constricting. There's only so much you can do with ammo effects.

 

2. Scripts for ammo

 

Obviously, you need to make a script. An example fro my dart gun script is:

 

------------------------------------------------------------------------

SCN ParalysisDartSCRIPT

 

Begin ScriptEffectStart

CIOS PerkParalyzingPalm

 

End

 

-------------------------------------------------------------------------

 

It's simple, but does the job. You have to make the effect yourself using the 'actor effect' menu (or use a perk effect like I did) and save the script as an effect type.

Now, effects always have Begin ScriptEffectStart to tell the game to start when the item hits (in this case, the bullet).

CIOS is shorthand for CastImmediateOnSelf, which is also a valid line in a script. Follow it with the effect you want.

Go to your ammo, and attach this script to the 'impact script' part.

There you have it, your ammo will have the effect!

 

3. Weapon Effects

If you want the weapon itself to make the effect, you need to create an 'object effect' under the menu of the same name. It's a bit complicated, because you need to make a base effect (which is like a branch) and call it into being with the object effect (which is like a tree, so one object effect can have many base effects). This requires little scripting, and is all databasing. It's less complicated than it sounds, but requires practise. Then attach the object effect onto your weapon by double clicking on its ID and adding it through the 'object effect' box.

 

I hope I helped a little, if you have any more questions, please feel free to ask :)

Link to comment
Share on other sites

Now I need examples of Weapon effect and example how to make something follow you.

 

Weapon Effect wouldn't help you make an effect of something following you. As mentioned, they're very limited to changing the stats of those they hit.

If it was me, I'd make a behavioral Follow package, then make a script that changes the target's package to the follow one. You would then need to add a bit onto the script to add the target to the PlayerFaction.

Check the official geck website under 'functions' for help on how to add packages and factions via scripting :)

Link to comment
Share on other sites

Anyone know if Packet that makes something follow you exists already?

 

They're very easy to make once you know how:

 

Actor Data --> Package

 

MyFollowPackage (example ID name)

 

Set the 'Package Type' in the top right corner to 'Follow'

 

Under the 'Travel' tab, click the big 'Near Editor Location' button, check 'Near Reference'

 

Choose 'Ref' as PlayerRef (' Player ' )

 

Back on the main 'Travel' tab, choose Radius for the target to follow you (about 350 is good, but it's up to you close you want them).

 

You then have to add this package (via a script) to the weapon or ammo. Use the command 'AddScriptPackage' (more info on the Geck wiki under functions, as stated).

 

That's the basic idea, anyway :)

Link to comment
Share on other sites

  • Recently Browsing   0 members

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