D'Jinni Scripting: add/remove placeables

+
D'Jinni Scripting: add/remove placeables

I've some questions about scripting, I didn't find something about that here or in the wiki. Sorry if that was discussed earlier.

Is it possible to add/remove placeables and effects with a script?
I've planned two things, at first I would add corpses and fire in a village after returning from an other area.
My other plan is, to remove a golem placeable and activate a spawnset like in the swamps in the original game.
I opened the module containing the swamp but without the scripts i've no idea how it works.

Thx for help.
 
Yes, it's possible.
Here's an example how to create a placeable :

void main()
{
object oWP=GetObjectByTag("wp_body1");
location lLoc=GetLocation(oWP);
CreateObject(OBJECT_TYPE_PLACEABLE,"ob_body01",lLoc);
}

Two things to consider:
1) you have to place in the area a Waypoint with a tag named whatever you wish to name it, e.g. "wp_body1" and use the name in the script;
2) you need to create your own placeable template called whatever you want and use the name in the script or you need to use the name of one of the placeables from The Witcher resources - in the script above I used one of the Witcher placeables, the placeables depicting corpses begin with "ob_body" plus a number.

As for destroying you can try something like this:

void main()
{
object oGolem=GetObjectByTag("my_golem");
DestroyObject(oGolem);
}
Of course, first you need to place a golem placeable in the area and give it a tag, e.g. "my_golem"
 
Top Bottom