Help a scripting retard with his script.

dvukomanovic said:
No, it's just very very VERY usefull magazine. (It's a Playboy :lol: )
Too bad you can't trash it that easilly after you're done...reading... :lol:

Firstly, nobody ever throws away their playboys when they are ... uh .... done with them. Hmm a bed (item) could be made into a container hehe. Secondly, I don't recall any books I have read vanishing after I read them. Perhaps books should be inactive (to you the reader) after reading them "you fail to learn anything new", but you can pass them on or sell them, or put them under your matress :lol:
 
Reading is fun! :lol:

Anyway, what's with books disapearing in the first place?
You know you just gave me an idea!
Every single book for now on will have it's own script, an it's own GVAR... maybe even it's own FRM! And they won't disapear! :P
And onother thing! I'll make script for stimpack, so when you're done using it you'll hava an empty hypo... or whatever!

The world (and your RAM) will be filled with junk...again!!!

And the bed SHOULD be container! It makes sence! I'll make it like that in my never-going-to-be-finished mod. :wink:

EDIT:

:lighten: Could this help in self_removing:

Code:
remove_pid_qty(dude_obj, PID_MAGAZINE, 1);
and while on the subject:

Do i have to define this PID thingy somehere?

EDIT:

Found about PID!
jargo, please make it register automatically (if posible).

EDIT:

Wow, don't do remove_pid doesn't work
and rm_obj_from_inven goes with big boom!
 
dvukomanovic said:
Could this help in self_removing:
Code:
remove_pid_qty(dude_obj, PID_MAGAZINE, 1);

Like I said before, an object cannot remove itself from inventory, some other object (map or critter script) must do that. Think about this: I am RUNNING code telling the system to destroy me. The engine just doesn't allow that. It could have, if they had built the infrastructure to do so, and essentially make the object a NULL reference, whilst some garbage collector code clears the orphaned running process which nobody has a handle to anymore.

dvukomanovic said:
Wow, don't do remove_pid doesn't work

An item cannot remove itself from the player's inventory :D

dvukomanovic said:
rm_obj_from_inven goes with big boom!
Yep, it tried to destroy itself and destroyed the universe in the process hehe. I showed you a method earlier in this thread, where rather than the object itself trying remove itself, it exports a POINTER variable and triggers a timed event on dude_obj. The dude_obj then runs its timed_event_p_proc, imports the POINTER to the book, and it destroys it. This works. Think of a pointer as an actual memory location where that object exists.
 
but i can't edit dude_obj, dude_obj! (ha ha... dude_obj, dude_obj... get it... oh, nevermind)
Well, if understud correctlly rm_obj_from_inven does not destroy object, it just place it at (1,1) (or was it 0,0) map coordinates... I think that answar could be not allowing an item to be used from inventory (only from hands) that way it won't stay after using (cause rm_obj_from_inven works when item in hands)... now, how do i check if it's in hands? I'll try and find that out...
 
critter_inven_obj(Dude_obj,INVEN_TYPE_RIGHT_HAND) - return pointer to object in dude right hand
critter_inven_obj(Dude_obj,INVEN_TYPE_LEFT_HAND) - return pointer to object in dude left hand
critter_inven_obj(Dude_obj,INVEN_TYPE_WORN) - return pointer to object that dude wear.


you can check it this way:

Code:
 if critter_inven_obj(Dude_obj,INVEN_TYPE_RIGHT_HAND) == Self_obj then 
//it has it in hand 
.....
 
Thanks jargo!

I used more "creative" way:

I made my H file with this:

way the minute... your way is better...

oh, well that's why you are an expert and I am... novice?

GOD DAMN IT!!! I can't get out of begin end problem on this script!

Please, sombody tell me how to overcome this problem (how to sort up this script better) I think it could work!
 
dvukomanovic said:
but i can't edit dude_obj

Why not? Because you have a modified version of the script for which you don't have source code? If so, it is still possible. You could decompile the .int file into source, make your changes, and compile it again. You mentioned a mod from teamx that changed dude_obj script. Teamx is usually willing to provide source code. If the mod didn't have it, why not ask for it?
 
too much trouble! I'm trying with rm_obj_from_inven
If that does not work i'll ask for source....
Again i posted one more problem up there if you want to look at :) :) :)
Code:
procedure use_p_proc
begin //procedure starts
if (critter_inven_obj(Dude_obj,INVEN_TYPE_RIGHT_HAND) != Self_obj and critter_inven_obj(Dude_obj,INVEN_TYPE_LEFT_HAND) != Self_obj) then
   begin 
   // **********THIS IS FOR TRUE**********
            if (global_var(GVAR_DVMAG) < 19)then 
               begin
                 script_overrides;
                 gfade_out(ONE_GAME_SECOND);
                 rm_obj_from_inven(Dude_obj, self_obj);
                set_global_var(GVAR_DVMAG, global_var(GVAR_DVMAG)+1);
                critter_mod_skill(dude_obj,random(0,17), 4);
                display_mstr(113);
                display_mstr(100);
                give_exp_points(100);
                display_mstr("You gained 100 exp points!");
                float_msg(dude_obj, mstr(random( 101, 108 )),9);
                gfade_in(ONE_GAME_SECOND);
                scr_return(1);
                end else if (global_var(GVAR_DVMAG) == 19) then
                       begin
                             script_overrides;
                             gfade_out(ONE_GAME_SECOND);
                             rm_obj_from_inven(Dude_obj, self_obj);
                             set_global_var(GVAR_DVMAG, global_var(GVAR_DVMAG)+1);
                             critter_add_trait(dude_obj,TRAIT_PERK, PERK_gain_intelligence_perk, 1);
                             critter_mod_skill(dude_obj,random(0,17), 4);
                             display_mstr(113);
                             display_mstr(100);
                             give_exp_points(100);
                             display_mstr("You gained 100 exp points!");
                             display_mstr(111);
                             float_msg(dude_obj, 112,9);
                             gfade_in(ONE_GAME_SECOND);
                             scr_return(1);
                              end else begin
                                   script_overrides;
                                   gfade_out(ONE_GAME_SECOND);
                                   rm_obj_from_inven(Dude_obj, self_obj);
                                   critter_mod_skill(dude_obj,random(0,17), 4);
                                   display_mstr(113);
                                   display_mstr(100);
                                   give_exp_points(100);
                                   display_mstr("You gained 100 exp points!");
                                   float_msg(dude_obj, mstr(random( 101, 108 )),9);
                                   gfade_in(ONE_GAME_SECOND);
                                   scr_return(1);
                                   end
   end
//**********THIS IS FOR NOT TRUE**********
else begin 
                script_overrides;
                display_mstr(114);
                scr_return(1);

            end // THIS IS WHERE IF ENDS!
end // procedure ends

GODDAMNIT!!!!!
 
Well I said it several times already, some OTHER script can remove an item from player inventory, but the item's script cannot. If you want to bang your head against the table repeatedly that's your business.

Look at the File menu in FSE. Notice those two decompile options. Handy, isn't it?
 
NO! I WON'T DO IT! YOU CAN'T MAKE ME DO IT!! BACKOFF OR I'LL JUMP!!!! :D :D :D

I just need help with begin end order, there seems to be one of them missing in my script (or there's too much of them) but i can't figure it out! :(
 
i didn't touch anything else. Plus script is gone :) And all the item proto are gone! I had it with them! I sent them to Vats!

Now i'll try again from the start! :roll:

Here's my test script:

Code:
procedure use_p_proc
begin
  script_overrides;

   gfade_out(ONE_GAME_SECOND);
      give_exp_points(1000);
      display_mstr(100);
      float_msg(dude_obj, mstr(102),9);
      rm_obj_from_inven(Dude_obj,self_obj);
      //remove_pid_qty(dude_obj, PID_MAGAZINE, 1);
   gfade_in(ONE_GAME_SECOND);
   scr_return(1);

end
And here's the outcome
see1al.gif

Code:
critter_inven_obj(Dude_obj,INVEN_TYPE_RIGHT_HAND) == Self_obj)

this is not valid (script does nothing with it as condition)
 
Sorry but removing items is not working :). You used for this test modified version of one of already existing items from fallout did you? Now you can clear all your use_p_proc and this item will still disappear after use, rm_obj_from_inven(Dude_obj,self_obj); has nothing to do with this. PIDs for all original usable items are hardcoded in engine and if engine see that you used item with that PID then it will destroy it.
Try creating new item and test on that.

Code:
critter_inven_obj(Dude_obj,INVEN_TYPE_RIGHT_HAND) == Self_obj)


this is not valid (script does nothing with it as condition)
Yes it does, and it is working :P
 
jargo said:
Sorry but removing items is not working :). You used for this test modified version of one of already existing items from fallout did you? Now you can clear all your use_p_proc and this item will still disappear after use, rm_obj_from_inven(Dude_obj,self_obj); has nothing to do with this. PIDs for all original usable items are hardcoded in engine and if engine see that you used item with that PID then it will destroy it.
Try creating new item and test on that.

No, I created a new proto! Here it is. and i tried attaching script on other (new) proto numbers and it worked as well! Besides, script has script_overrides, so engine stuff can kiss my pritty butt!

see24we.gif


and here's the whole code:
Code:
/*        Script from item templete*          /

/*
        Name: Test - Remove self!
        Location: mapper
        Description: test for item removing itself

        Log:


           Created: march 17, 2006.

           Updated:
*/

/* Include Files */

#include "headers\define.h"

#define NAME                    SCRIPT_DVREMOVE

#include "headers\command.h"
#include "HEADERS\NEWRENO.H"

procedure start;
procedure use_p_proc;
procedure pickup_p_proc;
procedure destroy_p_proc;
procedure drop_p_proc;

procedure start begin
end

procedure pickup_p_proc
begin

end

procedure destroy_p_proc
begin

end

procedure drop_p_proc
begin

end
 
procedure use_p_proc
begin
  script_overrides;

   gfade_out(ONE_GAME_SECOND);
      give_exp_points(1000);
      display_mstr(100);
      float_msg(dude_obj, mstr(102),9);
      rm_obj_from_inven(Dude_obj,self_obj);
      //remove_pid_qty(dude_obj, PID_MAGAZINE, 1);
   gfade_in(ONE_GAME_SECOND);
   scr_return(1);

end

Item disapear, but only if used from hands, that's why i need those LEFT_HAND RIGHT_HAND conditions to work! (not only in compiler, but in the game as well). It won't work with self_obj pointer, so i'll have to define PID name, or simplly use PID number and try it that way... and using "self PID" is always smelling like big boom!

I realy would not lie to you guys, i mean, that would realy be stupid and would do me no good in cours of my script learning. :eyebrow: And you are my... teachers...:notworthy: :lol:

oh this one too (it's a msg):
Code:
{100}{}{Once again you prove you ar right, enjoy your reward!}
{101}{}{You can't use that from inventory.}
{102}{}{Wow, man! I've done it again! Hey, dude_obj, It's working! Say "HI!" to jargo and Sirren67 for me! ;)}
 
Item disapear, but only if used from hands, that's why i need those LEFT_HAND RIGHT_HAND conditions to work! (not only in compiler, but in the game as well). It won't work with self_obj pointer, so i'll have to define PID name, or simplly use PID number and try it that way... and using "self PID" is always smelling like big boom!

Yes :) You re right it seems it does work if player have this item in hand, must have some Deja Vu.
Here you have working code that you need:
Code:
procedure use_p_proc  
begin  
   script_overrides;  
   if (critter_inven_obj(Dude_obj,INVEN_TYPE_RIGHT_HAND) == Self_obj) or (critter_inven_obj(Dude_obj,INVEN_TYPE_LEFT_HAND) == Self_obj) then  
   begin  
   gfade_out(ONE_GAME_SECOND);  
      give_exp_points(1000);  
      display_mstr(100);  
      float_msg(dude_obj, mstr(102),9);  
      rm_obj_from_inven(Dude_obj,self_obj);  
      //remove_pid_qty(dude_obj, PID_MAGAZINE, 1);  
   gfade_in(ONE_GAME_SECOND);  
   scr_return(1);  
   end  
   else  
     display_msg("Not in the hand");    
  
end
But remember that using rm_obj_from_inven moves this item to tile number 1 in this map and there is something called "to many items bug" in Fallout, so you should still try to destroy this item.
 
Back
Top