Equipping a script created item crash the game?

myocytebd

First time out of the vault
I tried to create some item in sfall global script (during repeated callback), e.g.
add_mult_objs_to_inven(dude_obj,create_object(20,0,0),1); //crowbar

An weapon is created and added to inventory, but equipping it will crash game.

What did I do wrong?
Or did someone know how to solve or workaround this issue?

[Solved]
Silly mistake in testing.
Read #4.
 
Last edited:
Have you tried adding it using "add_obj_to_inven"? Post your whole script. Also, when you experiencing crashes while modding, first thing you need to do is to enable debugging in sfall and study your debug.log.
 
Have you tried adding it using "add_obj_to_inven"? Post your whole script. Also, when you experiencing crashes while modding, first thing you need to do is to enable debugging in sfall and study your debug.log.

debug.log didn't has anything relevant.
Simplified script to reproduce:
Code:
procedure start;

#include "..\HEADERS\DEFINE.H"
#include "..\HEADERS\COMMAND.H"

procedure periodical_callback begin
    if (get_sfall_global_int(31000) == 0) then begin
        add_obj_to_inven(dude_obj,create_object(PID_COMBAT_KNIFE,0,0));
    end
    begin
        set_sfall_global(31000, get_sfall_global_int(31000)+1);
    end
end

procedure start begin
    if (game_loaded) then begin
        call periodical_callback();
        display_msg("gl_test.start");
        set_global_script_repeat(1001);
    end else begin
        call periodical_callback();
    end
end
Apparently the created item is broken.
When the item is equipped, PC disappeared. Click mouse on map => crash
Drop the item => save => load => picked the item and retry => still make PC disappear and crash
Create the item on map without add_obj_to_inven, e.g. create_object(XXX,19093,0) in ARTEMPLE, also reproduce the problem.
 
Last edited:
When the item is equipped, PC disappeared. Click mouse on map => crash
Drop the item => save => load => picked the item and retry => still make PC disappear and crash
Create the item on map without add_obj_to_inven, e.g. create_object(XXX,19093,0) in ARTEMPLE, also reproduce the problem.
Uh, by default the PC tribal appearance has very limited weapon animations (spear and unarmed). If you equip other types of weapons with the tribal appearance, it will cause PC disappearing and crashing the game when you move.
To avoid the issue you can change your default/starting player appearance in ddraw.ini (MaleStartModel and other lines) or via script, or just give yourself an armor (equip the armor before equipping any weapon).
 
Last edited:
Back
Top