Destroying Objects

dude_obj

Vault Senior Citizen
Moderator
I made a new kind of book that behaves like the books that add skill points. Everything is fine except the book doesn't disappear. If I try to do a destroy_obj within the book's script the mapper/game crashes. I guess its kind of a referential thing because I'm telling the running object to destroy itself (no can do). I can make that object destroy other objects but not itself.

Does anyone know how to "use up" an item ... so when it's "used" (use_p_proc is invoked) it disappears from inventory?

At the moment the only thing I can think of is having global variables that get watched by another script, and having some other script (not the book) destroy the book. There must be a better way.

Any ideas?
 
Maybe this will help you; this is a sample extract of a book script I made.
gfade_out(600);
gfade_in(600);
critter_mod_skill(dude_obj, 2, 6);
game_time_advance(240 * (60 * 10));
rm_obj_from_inven(source_obj, self_obj);
destroy_object(self_obj);
 
This is strange, when I use that code ... after "using" the book ...

The book doesn't get removed from inventory. I can still see it, using the "look at" function still gives me a description. But if I select "drop" the object doesn't drop, and if I select "use" a second time, I get the message "that does nothing". Its like the object is there but it isn't there LOL. Also, sometimes I get an "assertion failed in proto.c" error.

I noticed that the standard books in FO2 (guns and bullets etc) don't have scripts, they must be handled by game engine code. There is one (cats paw issue 5), which has a script, but it doesn't do the remove/destroy (maybe because you can't in use_p_proc?)

This is the exact script code I am using:

#include "..\headers\define.h"
#define NAME SCRIPT_BOOK1
#include "..\headers\command.h"

procedure start;
procedure use_p_proc;

procedure start begin
end

variable item;

procedure use_p_proc begin

script_overrides;

gfade_out(600);
gfade_in(600);
display_mstr(100);
critter_mod_skill(dude_obj, SKILL_LOCKPICK, 10);
game_time_advance(240 * (60 * 10));
rm_obj_from_inven(source_obj, self_obj);
destroy_object(self_obj);

scr_return(1);
end

You have this remove/destroy working in a use_p_proc function?
 
I remember running into the same problem but if I remember right, moving the action from Use_obj procedure to a new procedure seemed to make it work.

Here is the full script but it's in Noid's format.

variable ProtoOfItemGiven := 0;
variable ValueOfRollCheck := 1;
variable Scenery_Creation := 0;
variable Scenery_Creation_Hex := 0;
variable Scenery_Creation_Count := 0;
variable Temp_Scenery_Creation_Hex := 0;
variable Scenery_Creation_Ptr := 0;
variable How_Many_Party_Members_Are_Injured := 0;
variable How_Many_Party_Members_Armed := 0;
variable PartyHealingItem := 0;

procedure checkPartyMembersNearDoor;

variable global_temp := 0;
variable dest_tile := 0;
variable step_tile := 0;
variable in_dialog := 0;
variable forced_node := 0;
variable restock_amt := 0;
variable restock_obj := 0;
variable restock_trash := 0;
variable removed_qty := 0;

procedure start;
procedure use_p_proc;
procedure timed_event_p_proc;
procedure map_enter_p_proc;
procedure pickup_p_proc;
procedure destroy_p_proc;
procedure look_at_p_proc;
procedure description_p_proc;
procedure Node001;
procedure Node002;
procedure Node003;
procedure Node004;
procedure Node005;
procedure Node006;
procedure Node007;
procedure Node008;

procedure checkPartyMembersNearDoor
begin
if (op_party_member_obj(16777278) != 0) then
begin
if (op_tile_distance_objs(op_self_obj(), op_party_member_obj(16777278)) <= 5) then
return(1);
end
if (op_party_member_obj(16777376) != 0) then
begin
if (op_tile_distance_objs(op_self_obj(), op_party_member_obj(16777376)) <= 5) then
return(1);
end
if (op_party_member_obj(16777377) != 0) then
begin
if (op_tile_distance_objs(op_self_obj(), op_party_member_obj(16777377)) <= 5) then
return(1);
end
if (op_party_member_obj(16777305) != 0) then
begin
if (op_tile_distance_objs(op_self_obj(), op_party_member_obj(16777305)) <= 5) then
return(1);
end
if (op_party_member_obj(16777313) != 0) then
begin
if (op_tile_distance_objs(op_self_obj(), op_party_member_obj(16777313)) <= 5) then
return(1);
end
if (op_party_member_obj(16777323) != 0) then
begin
if (op_tile_distance_objs(op_self_obj(), op_party_member_obj(16777323)) <= 5) then
return(1);
end
if (op_party_member_obj(16777352) != 0) then
begin
if (op_tile_distance_objs(op_self_obj(), op_party_member_obj(16777352)) <= 5) then
return(1);
end
if (op_party_member_obj(16777378) != 0) then
begin
if (op_tile_distance_objs(op_self_obj(), op_party_member_obj(16777378)) <= 5) then
return(1);
end
if (op_party_member_obj(16777368) != 0) then
begin
if (op_tile_distance_objs(op_self_obj(), op_party_member_obj(16777368)) <= 5) then
return(1);
end
if (op_party_member_obj(16777379) != 0) then
begin
if (op_tile_distance_objs(op_self_obj(), op_party_member_obj(16777379)) <= 5) then
return(1);
end
if (op_party_member_obj(16777380) != 0) then
begin
if (op_tile_distance_objs(op_self_obj(), op_party_member_obj(16777380)) <= 5) then
return(1);
end
if (op_party_member_obj(16777295) != 0) then
begin
if (op_tile_distance_objs(op_self_obj(), op_party_member_obj(16777295)) <= 5) then
return(1);
end
if (op_party_member_obj(16777381) != 0) then
begin
if (op_tile_distance_objs(op_self_obj(), op_party_member_obj(16777381)) <= 5) then
return(1);
end
if (op_party_member_obj(16777407) != 0) then
begin
if (op_tile_distance_objs(op_self_obj(), op_party_member_obj(16777407)) <= 5) then
return(1);
end
if (op_party_member_obj(16777411) != 0) then
begin
if (op_tile_distance_objs(op_self_obj(), op_party_member_obj(16777411)) <= 5) then
return(1);
end
if (op_party_member_obj(16777412) != 0) then
begin
if (op_tile_distance_objs(op_self_obj(), op_party_member_obj(16777412)) <= 5) then
return(1);
end
if (op_party_member_obj(16777413) != 0) then
begin
if (op_tile_distance_objs(op_self_obj(), op_party_member_obj(16777413)) <= 5) then
return(1);
end
if (op_party_member_obj(16777481) != 0) then
begin
if (op_tile_distance_objs(op_self_obj(), op_party_member_obj(16777481)) <= 5) then
return(1);
end
if (op_party_member_obj(16777558) != 0) then
begin
if (op_tile_distance_objs(op_self_obj(), op_party_member_obj(16777558)) <= 5) then
return(1);
end
if (op_party_member_obj(16777600) != 0) then
begin
if (op_tile_distance_objs(op_self_obj(), op_party_member_obj(16777600)) <= 5) then
return(1);
end
return(0);
end

procedure start
begin
end

procedure use_p_proc
begin
if (op_get_critter_stat(op_dude_obj(), 4) < 4) then
begin
op_display_msg(op_msg_string(14, 965));
end
else if ((op_get_critter_stat(op_dude_obj(), 4) >= 4) and (op_get_critter_stat(op_dude_obj(), 4) < 6)) then
begin
if (op_has_trait(0, op_dude_obj(), 106) == 0) then
begin
if ((op_get_critter_stat(op_dude_obj(), 5) >= 5) and (op_has_skill(op_dude_obj(), 1) >= 75) and (op_has_skill(op_dude_obj(), 0) >= 75)) then
begin
op_display_msg(op_msg_string(14, 967));
call Node008();
end
else if ((op_get_critter_stat(op_dude_obj(), 5) <= 5) or (op_has_skill(op_dude_obj(), 1) < 75) or (op_has_skill(op_dude_obj(), 0) < 75)) then
begin
if ((op_has_skill(op_dude_obj(), 1) <= 95) and (op_has_trait(0, op_dude_obj(), 81) == 0)) then
begin
op_display_msg(op_msg_string(14, 957));
call Node001();
end
else if ((op_has_skill(op_dude_obj(), 1) >= 95) and (op_has_trait(0, op_dude_obj(), 81) == 0)) then
begin
op_display_msg(op_msg_string(14, 956));
call Node007();
end
else if ((op_has_skill(op_dude_obj(), 1) <= 105) and (op_has_trait(0, op_dude_obj(), 81) >= 1)) then
begin
op_display_msg(op_msg_string(14, 957));
call Node004();
end
else if ((op_has_skill(op_dude_obj(), 1) >= 105) and (op_has_trait(0, op_dude_obj(), 81) >= 1)) then
begin
op_display_msg(op_msg_string(14, 956));
call Node007();
end
end
end
else if (op_has_trait(0, op_dude_obj(), 106) >= 1) then
begin
if ((op_has_skill(op_dude_obj(), 1) <= 95) and (op_has_trait(0, op_dude_obj(), 81) == 0)) then
begin
op_display_msg(op_msg_string(14, 957));
call Node001();
end
else if ((op_has_skill(op_dude_obj(), 1) >= 95) and (op_has_trait(0, op_dude_obj(), 81) == 0)) then
begin
op_display_msg(op_msg_string(14, 956));
call Node007();
end
else if ((op_has_skill(op_dude_obj(), 1) <= 105) and (op_has_trait(0, op_dude_obj(), 81) >= 1)) then
begin
op_display_msg(op_msg_string(14, 957));
call Node004();
end
else if ((op_has_skill(op_dude_obj(), 1) >= 105) and (op_has_trait(0, op_dude_obj(), 81) >= 1)) then
begin
op_display_msg(op_msg_string(14, 956));
call Node007();
end
end
end
else if ((op_get_critter_stat(op_dude_obj(), 4) >= 6) and (op_get_critter_stat(op_dude_obj(), 4) <= 8)) then
begin
if (op_has_trait(0, op_dude_obj(), 106) == 0) then
begin
if ((op_get_critter_stat(op_dude_obj(), 5) >= 5) and (op_has_skill(op_dude_obj(), 1) >= 70) and (op_has_skill(op_dude_obj(), 0) >= 70)) then
begin
op_display_msg(op_msg_string(14, 967));
call Node008();
end
else if ((op_get_critter_stat(op_dude_obj(), 5) <= 5) or (op_has_skill(op_dude_obj(), 1) < 70) or (op_has_skill(op_dude_obj(), 0) < 70)) then
begin
if ((op_has_skill(op_dude_obj(), 1) <= 100) and (op_has_trait(0, op_dude_obj(), 81) == 0)) then
begin
op_display_msg(op_msg_string(14, 957));
call Node002();
end
else if ((op_has_skill(op_dude_obj(), 1) >= 100) and (op_has_trait(0, op_dude_obj(), 81) == 0)) then
begin
op_display_msg(op_msg_string(14, 956));
call Node007();
end
else if ((op_has_skill(op_dude_obj(), 1) <= 110) and (op_has_trait(0, op_dude_obj(), 81) >= 1)) then
begin
op_display_msg(op_msg_string(14, 957));
call Node005();
end
else if ((op_has_skill(op_dude_obj(), 1) >= 110) and (op_has_trait(0, op_dude_obj(), 81) >= 1)) then
begin
op_display_msg(op_msg_string(14, 956));
call Node007();
end
end
end
else if (op_has_trait(0, op_dude_obj(), 106) >= 1) then
begin
if ((op_has_skill(op_dude_obj(), 1) <= 100) and (op_has_trait(0, op_dude_obj(), 81) == 0)) then
begin
op_display_msg(op_msg_string(14, 957));
call Node002();
end
else if ((op_has_skill(op_dude_obj(), 1) >= 100) and (op_has_trait(0, op_dude_obj(), 81) == 0)) then
begin
op_display_msg(op_msg_string(14, 956));
call Node007();
end
else if ((op_has_skill(op_dude_obj(), 1) <= 110) and (op_has_trait(0, op_dude_obj(), 81) >= 1)) then
begin
op_display_msg(op_msg_string(14, 957));
call Node005();
end
else if ((op_has_skill(op_dude_obj(), 1) >= 110) and (op_has_trait(0, op_dude_obj(), 81) >= 1)) then
begin
op_display_msg(op_msg_string(14, 956));
call Node007();
end
end
end
else if ((op_get_critter_stat(op_dude_obj(), 4) >= 8) and (op_get_critter_stat(op_dude_obj(), 4) <= 10)) then
begin
if (op_has_trait(0, op_dude_obj(), 106) == 0) then
begin
if ((op_get_critter_stat(op_dude_obj(), 5) >= 5) and (op_has_skill(op_dude_obj(), 1) >= 65) and (op_has_skill(op_dude_obj(), 0) >= 65)) then
begin
op_display_msg(op_msg_string(14, 967));
call Node008();
end
else if ((op_get_critter_stat(op_dude_obj(), 5) <= 5) or (op_has_skill(op_dude_obj(), 1) < 65) or (op_has_skill(op_dude_obj(), 0) < 65)) then
begin
if ((op_has_skill(op_dude_obj(), 1) <= 105) and (op_has_trait(0, op_dude_obj(), 81) == 0)) then
begin
op_display_msg(op_msg_string(14, 957));
call Node003();
end
else if ((op_has_skill(op_dude_obj(), 1) >= 105) and (op_has_trait(0, op_dude_obj(), 81) == 0)) then
begin
op_display_msg(op_msg_string(14, 956));
call Node007();
end
else if ((op_has_skill(op_dude_obj(), 1) <= 115) and (op_has_trait(0, op_dude_obj(), 81) >= 1)) then
begin
op_display_msg(op_msg_string(14, 957));
call Node006();
end
else if ((op_has_skill(op_dude_obj(), 1) >= 115) and (op_has_trait(0, op_dude_obj(), 81) >= 1)) then
begin
op_display_msg(op_msg_string(14, 956));
call Node007();
end
end
end
else if (op_has_trait(0, op_dude_obj(), 106) >= 1) then
begin
if ((op_has_skill(op_dude_obj(), 1) <= 105) and (op_has_trait(0, op_dude_obj(), 81) == 0)) then
begin
op_display_msg(op_msg_string(14, 957));
call Node003();
end
else if ((op_has_skill(op_dude_obj(), 1) >= 105) and (op_has_trait(0, op_dude_obj(), 81) == 0)) then
begin
op_display_msg(op_msg_string(14, 956));
call Node007();
end
else if ((op_has_skill(op_dude_obj(), 1) <= 115) and (op_has_trait(0, op_dude_obj(), 81) >= 1)) then
begin
op_display_msg(op_msg_string(14, 957));
call Node006();
end
else if ((op_has_skill(op_dude_obj(), 1) >= 115) and (op_has_trait(0, op_dude_obj(), 81) >= 1)) then
begin
op_display_msg(op_msg_string(14, 956));
call Node007();
end
end
end
end

procedure timed_event_p_proc
begin
end

procedure map_enter_p_proc
begin
end

procedure pickup_p_proc
begin
end

procedure destroy_p_proc
begin
end

procedure look_at_p_proc
begin
end

procedure description_p_proc
begin
end

procedure Node001
begin
op_gfade_out(600);
op_gfade_in(600);
op_critter_mod_skill(op_dude_obj(), 1, 3);
op_game_time_advance(240 * (60 * 10));
op_rm_obj_from_inven(op_source_obj(), op_self_obj());
op_destroy_object(op_self_obj());
end

procedure Node002
begin
op_gfade_out(600);
op_gfade_in(600);
op_critter_mod_skill(op_dude_obj(), 1, 4);
op_game_time_advance(240 * (60 * 10));
op_rm_obj_from_inven(op_source_obj(), op_self_obj());
op_destroy_object(op_self_obj());
end

procedure Node003
begin
op_gfade_out(600);
op_gfade_in(600);
op_critter_mod_skill(op_dude_obj(), 1, 5);
op_game_time_advance(240 * (60 * 10));
op_rm_obj_from_inven(op_source_obj(), op_self_obj());
op_destroy_object(op_self_obj());
end

procedure Node004
begin
op_gfade_out(600);
op_gfade_in(600);
op_critter_mod_skill(op_dude_obj(), 1, 6);
op_game_time_advance(240 * (60 * 10));
op_rm_obj_from_inven(op_source_obj(), op_self_obj());
op_destroy_object(op_self_obj());
end

procedure Node005
begin
op_gfade_out(600);
op_gfade_in(600);
op_critter_mod_skill(op_dude_obj(), 1, 8);
op_game_time_advance(240 * (60 * 10));
op_rm_obj_from_inven(op_source_obj(), op_self_obj());
op_destroy_object(op_self_obj());
end

procedure Node006
begin
op_gfade_out(600);
op_gfade_in(600);
op_critter_mod_skill(op_dude_obj(), 1, 10);
op_game_time_advance(240 * (60 * 10));
op_rm_obj_from_inven(op_source_obj(), op_self_obj());
op_destroy_object(op_self_obj());
end

procedure Node007
begin
op_gfade_out(600);
op_gfade_in(600);
op_game_time_advance(60 * (60 * 10));
end

procedure Node008
begin
op_gfade_out(600);
op_gfade_in(600);
op_critter_add_trait(op_dude_obj(), 0, 106, 1);
op_game_time_advance(120 * (60 * 10));
op_rm_obj_from_inven(op_source_obj(), op_self_obj());
op_destroy_object(op_self_obj());
end

Try calling a different procedure and if that doesn't work, send me the script you are making and I'll try to determine what's wrong.
 
Doing a call to another procedure doesn't seem to change anything. The book doesn't disappear, and like before, I can look at it but I can't drop it or use it a second time (after the first use). This is the code:

#include "..\headers\define.h"
#define NAME SCRIPT_BOOK1
#include "..\headers\command.h"

procedure use_p_proc;
procedure remove_book;

variable item;

procedure use_p_proc begin
script_overrides;
gfade_out(600);
gfade_in(600);
display_mstr(100);
critter_mod_skill(dude_obj, SKILL_LOCKPICK, 10);
game_time_advance(240 * (60 * 10));
call remove_book;
end

procedure remove_book begin
rm_obj_from_inven(source_obj, self_obj);
destroy_object(self_obj);
end
 
Though I don't see a reason for your script failing to work, I 'm going to suggest you try leaving just a few commands in the use_obj proc; leave the script overrides and call a display msg or anything of the sort. Call the next proc where you should group all the commands starting from gfade to destroy object.

If that still does not work, I don't know what else could be the problem unless I test it myself.
 
Yes I already stripped most of the commands out last night. The only problem is the remove and destroy. I think the script_override needs to be there, because it indicates to use the script rather than the default action in the engine. The docs say this about script_overrides:

Tells the C-engine that the script will override default behavior for the object. What this means is that the C-engine will not attempt to do things that it would normally do, in expectation that the script will handle those things itself. This is an IMPORTANT command! It is commonly used for the general player actions upon objects, such as looking at them (requesting a description), using them (opening doors, for example), or using items ON them (using a picklock or a key on a door lock).

So ... completely stripped ... neither of these below work ...

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

#include "..\headers\define.h"
#define NAME SCRIPT_BOOK1
#include "..\headers\command.h"

procedure use_p_proc;

procedure use_p_proc begin
script_overrides;
rm_obj_from_inven(source_obj, self_obj);
destroy_object(self_obj);
end

--------------------------------------------------------------------
// Remove in a called procedure

#include "..\headers\define.h"
#define NAME SCRIPT_BOOK1
#include "..\headers\command.h"

procedure use_p_proc;
procedure remove_book;

procedure use_p_proc begin
script_overrides;
call remove_book;
end

procedure remove_book begin
rm_obj_from_inven(source_obj, self_obj);
destroy_object(self_obj);
end

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

I just can't seem to remove an object after it is used.
It can be removed from some other script, but not from itself
(ie not in the running script that does the use command).
I have tried this dozens of different ways, no success :cry:
 
I remember it worked for me but it did take me a while and a lot of tinkering to make it happen; it's been a while since I did it last so I'll have a look through my notes and see if I can find a reason why it's not working for you.

EDIT: I'm going to have to dig through my backups to find the working scripts but I figured out another way you could get around this problem.

First add an export variable called book_ptr.
-On the first line, define the variable book_ptr as self_obj
-Add your skill bonuses and other lines.
-Not sure if you will need to add the command to remove the item from your inventory but if you experience a crash, do so.
-Make the last lines trigger a timed procedure on obj_dude

Now edit Obj_dude,
-Add an import variable called book_ptr
-Add the destroy obj to the timed procedure you pointed to like this.
destroy_obj(book_ptr);
If this does not work let me know.
 
Yes! This appears to work. Thanks Corpse.
Here are stripped down book and obj_dude scripts with just the remove operation:

BOOK1.SSL
--------------
#include "..\headers\define.h"
#define NAME SCRIPT_BOOK1
#include "..\headers\command.h"
procedure use_p_proc;
export variable book_ptr;

procedure use_p_proc begin
script_overrides;
book_ptr := self_obj;
add_timer_event(dude_obj, 3, 1 );
end


OBJ_DUDE.SSL
-------------------
#include "..\headers\define.h"
#define NAME SCRIPT_OBJ_DUDE
#include "..\headers\command.h"
procedure timed_event_p_proc;
import variable book_ptr;

procedure timed_event_p_proc begin
destroy_object(book_ptr);
end


The book doesn't get destroyed until I close the inventory screen, but at least it's getting destroyed.

Thanks again. Pointers are always fun in C :)
 
No problem, just still trying to figure out why it's not letting you do it from within the same script but glad this worked for you.
 
Well it seems to make sense that dude_obj has a pointer to the book object that he is carrying. The book object script fires, and when it encounters a destroy (of itself), the pointers get messed up. In most cases (or maybe all) some other object destroys an object (rather than an object destroying itself). Searching the FO2 source I didn't find any examples where an object destroys itself.
 
Well obj_dude (the player script) can do anything on the object. The problem is that in this case the script of the actual object (book) is running. So there are some threading and pointer reference issues here. If the book object tries to do a remove from inventory (of itself), it doesn't work. And if it tries to do a destory (of itself), that doesn't work either. It puts the object into a weird transitive state where its still there but nothing can be done with it. I think this is sort of a circular reference issue, the object trying to destroy itself, leaving hanging object references. There is probably a "garbage collector" thread (process) that cleans up destroyed objects, and this one is not getting cleaned up, because its a pointer that wasn't destroyed properly (just guessing). Its all guesswork because we really don't know how the "C Engine" (as they call it in the docs) handles threading, synchronization, object pointers, etc etc. We can only try things to see if they work.
 
Hmmm, why not just make a seprate delete script ?

have the books script open the new one, then shut down.

The new one deletes the book then goes dormant until anotehr book needs deleting.
 
Its not so simple as that. The action at the moment is "use" (use the book). At that point the book's script is running, and its use_p_proc procedure is being invoked. There is only one script associated with an object, and I don't think it can just call any other script. It can call another object using the set_timer command. But that's exactly what Corpse's solution was, save the pointer to self (book) in an export variable, call the obj_dude, and have it delete the book. This works and is basically exactly what you said, except its not a delete script, its part of the timed_p_proc in the obj_dude script. The only thing I don't like about this is that the book doesn't disappear until the inventory screen is closed. I assume that this is a thread synchronization issue. The game engine has control, because its displaying the inventory GUI screen (and associated functions) . Its not until that thread stops (the window is closed) that control returns to the dude_obj, which then does the delete and the book is gone.

Unfortunately there are some pretty strict limits on programming with scripts. Unlike a generic programming language, we can't just have a nice set of functions that can be called at any time. If there is a way for a script to simply call another script, I'd like to hear about it, because I haven't seen that type of call. Afaik scripts are always bound to an object. They are not just plain old code, they are very specialized for the game engine.
 
to dude_obj

>> If there is a way for a script to simply call another script, I'd like to hear about it, because I haven't seen that type of call.

Don`t you know about exec, spawn and fork commands?
spawn("111.int");
would start data/111.int script, start procedure.

There three bad things:
1. parental script would be stoped. Until you do
exit;
from spawned script.
2. spawned script has no art attached to him. So you must do
metarule3(107,self_obj,SOME_FID,0);
3. worstest: there is no msg file associated to spawned script, so you stil need to place entry (not exactly for this script, you can create fake entries) for it to the scripts list to access to .msg


Example.
Parrent:
Code:
procedure start begin end

procedure talk_p_proc begin
	spawn("scripts/111.int");
end
procedure description_p_proc begin
	display_msg("Hi");
end

Compile it and put to scripts dir, add entry to scripts.lst.

Child (111.ssl):
Code:
procedure start begin end

procedure map_update_p_proc begin
	metarule3(107,self_obj,obj_art_fid(dude_obj),0);
	move_to(self_obj,tile_num(dude_obj)+1,elevation(dude_obj));
end

Compile it, place to scripts dir, but don`t add entry to scripts.lst. Run the game, talk to "Parent".

If you don`t want to interrupt parrent script than use fork() instead of spawn().

BTW, there a lot of digging/hacking of game engine and it`s script part are done in Russia. If there would be a man that can do english-russian translate of such stuff...
 
Raven_2 said:
Don`t you know about exec, spawn and fork commands?

No, that's all news to me. Thanks! What I really want is ability to use arrays in scripts. Is there some undocumented way to do that also?
 
Oh, fcuk... Sorry for that post...

Yes, you can use spawn and fork but this functions are totally useless.

Well, it really start int-script. But it *do not create any objects and don`t bind called script to any object*. It was an error at my side when i test them (copy of the script that I was try to spawn was already binded to object on the map, so metarule and move_to was called from *that* object script, not from spawned script). self_obj from child script return 0. You can do nothing with spawned script.

So this functions are almost useless. All that you can do with it is something like that:
------------------------------
procedure start begin end

procedure talk_p_proc begin fork("111.int"); end
------------------------------
111.ssl:
------------------------------
procedure start begin display_msg("Spawned"); end
------------------------------

Again, sorry for desinformation. Argh, how can I mised that this script are already on the map?...
 
If I can help solve this problem, here is a simple script for book by you can teach i.e. Unarmed Skill by random number (1,10) %. The new item must be as [drug]. All is working fine but the text (in Polish: "nic się nie dzieje", in English: "there is nothing"- I don't know). sorry my English ;-).

#include "..\headers\define.h"
#define NAME SCRIPT_UNMRD_BOOK
#include "..\headers\command.wy"

procedure start;
procedure destroy_hp_proc;

variable k;

procedure start begin
end

/* here put this instuctions and the item must be as [drug] to good work */
procedure destroy_hp_proc begin
ka:=random(1,10);
critter_mod_skill(dude_obj,SKILL_UNARMED_COMBAT,k);
float_msg(dude_obj,"Unarmed Skill is increased by "+k+ " %",9);
end

V21-Poland
www.vault21.glt.pl[/url]
 
Back
Top