English A Chicken/Egg Query

5 replies
Goto Page
To the start Previous 1 Next To the start
30.07.11 07:28:50 pm
Up
aimeewilbury
User
Offline Off
I created a chicken unit which spawns eggs (item 123, for reference). But when using this script, the sound plays but no eggs are dropped:
Code:
1
2
3
4
5
6
7
8
9
10
//Get Eggs on Use
     on:use {
          if (count_stored("self")>0){
               play "RoosterCrow.wav";
               unstore 123,1;
          }else{
               msg "It has no eggs!",3;
               speech "negative";
          }
     }


If I use "exchange "self",0;" instead of unstore you can see the eggs. Any suggestions?
30.07.11 07:32:32 pm
Up
HudaJan
Super User
Offline Off
And you want the chicken to drop eggs on the ground or you want it to store eggs it it's "inventory" ?
New version of "Kidnap mod" I'm sorry to everyone who asked me for permission to use my stuff by PMs, I hadn't been online for a long time. Anyone can use it without permission
30.07.11 07:49:15 pm
Up
aimeewilbury
User
Offline Off
Drop eggs on the ground.
30.07.11 08:33:36 pm
Up
HudaJan
Super User
Offline Off
I can see the problem now. The command "unstore" takes the parameter Item-ID and not Type-ID of the item.
So the easiest way shall be
Code:
1
2
3
4
5
6
7
8
9
10
11
12
on:use {
     if(count_stored("self",123)>0){
          local $x,$z;
          $x=getx("self");
          $z=getz("self");
          create "item",123,$x,$z;
          freestored "self",123,1;
     }else{
          msg "It has no eggs!",3;
          speech "negative";
     }
}

So it basically creates new egg and removes one egg from the chicken's inventory.
Let me know how did it work for you
New version of "Kidnap mod" I'm sorry to everyone who asked me for permission to use my stuff by PMs, I hadn't been online for a long time. Anyone can use it without permission
30.07.11 08:38:31 pm
Up
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
on:start {
local $r,$r2,$z,$x,$count;
}
     on:use {
           if (count_stored("self")>0){
                play "RoosterCrow.wav";
                unstore 123,1;
                $x=getx("self");
                $z=getz("self");
                $count=count_stored("self",$eggid);
                $r=random(-20,20);
                $r2=random(-20,20);                 
create "item",123,$x+$r,$z+$r2,$count;
           }else{
                msg "It has no eggs!",3;
                speech "negative";
           }
      }

I had combined the extent script from S2ext with yours. I hope it works.
Dies ist ein Beitrag zur Füllung der Festplatten bei Prism und Tempora
30.07.11 09:31:18 pm
Up
aimeewilbury
User
Offline Off
Thanks it works now
To the start Previous 1 Next To the start