Aller au contenu

Photo

Unlimited arrows


  • Veuillez vous connecter pour répondre
25 réponses à ce sujet

#1
Friar

Friar
  • Members
  • 293 messages
A bow can have the property of unlimited ammo. But what I don't know is, can I make 6 arrows that never run out? I want to give the effect that the arrows return to the player character because of their.. charisma.. not just because they have a magic bow.

make sense?

#2
rjshae

rjshae
  • Members
  • 4 485 messages
The stack of 6 might make it a little tricky to script. If it was just 1 you could use the unequip script to generate a new copy and re-equip it.

#3
MokahTGS

MokahTGS
  • Members
  • 946 messages
Arrows that return to their user after shooting them either would be due to low intelligence (shooting them straight up) or a really bad roll of the d20.  :D

#4
I_Raps

I_Raps
  • Members
  • 1 262 messages
Hmmm. How about this:

(1) Create an unlimited ammo whose natural stack size is 6, not 99.
(2) Create a bow that doesn't have the unlimited ammo property, but instead has an on_equip script that tests for the user's CHA. If successful, it is destroyed and replaced with the unlimited version.

#5
MokahTGS

MokahTGS
  • Members
  • 946 messages

I_Raps wrote...

Hmmm. How about this:

(1) Create an unlimited ammo whose natural stack size is 6, not 99.
(2) Create a bow that doesn't have the unlimited ammo property, but instead has an on_equip script that tests for the user's CHA. If successful, it is destroyed and replaced with the unlimited version.


Wouldn't that just be usable once?

#6
I_Raps

I_Raps
  • Members
  • 1 262 messages

MokahTGS wrote...

I_Raps wrote...

Hmmm. How about this:

(1) Create an unlimited ammo whose natural stack size is 6, not 99.
(2) Create a bow that doesn't have the unlimited ammo property, but instead has an on_equip script that tests for the user's CHA. If successful, it is destroyed and replaced with the unlimited version.


Wouldn't that just be usable once?


When you unequip, replace it with the original testing bow.

[edit]

Or, one bow and on equip/unequip add or remove the unlimited ammo property if CHA is high enough.  I'm not sure that would actually equip the unlimited arrows, though.  Maybe an on_acquire script would be better, but that wouldn't account for loss of CHA in the meantime, though.

Modifié par I_Raps, 24 avril 2013 - 04:43 .


#7
Friar

Friar
  • Members
  • 293 messages
That was pretty funny Mokah!

@I-Raps, thank you
Basically, I can work the CHA part out in a conversation where the character is given the strange arrows, so that isn't so much the issue I'm running into. I just can't seem to be able to give a stack of arrows unlimited use outside of using a specific bow with the property "unlimited arrows."

If what you are suggesting is what I think it is then I am worried that it might actually break the illusion I'm trying to create.

#8
Tchos

Tchos
  • Members
  • 5 042 messages
I'd try starting by seeing which events fire when you shoot an arrow, and pick whatever event looks like a good place to attach a script. The script would check the stack size of the special arrows (which would be tagged something special), and if the stack size is less than 6, it would fire a command to increase the stack size to 6.

If that works, then you can get fancy and delay the command so that the arrows return a few seconds after being fired, with maybe a little special effect and/or a sound or text string.

#9
Friar

Friar
  • Members
  • 293 messages
@Tchos

That sounds cool, if it can be done. But I'm wondering now where I look for these "events."

#10
kevL

kevL
  • Members
  • 4 056 messages
i've looked high & low for the mythical onAttack event ....

#11
Friar

Friar
  • Members
  • 293 messages
Okay Tchos the delay mention gave me another idea.

I wonder if it would be easier to make a container that refills itself with a stack of 6 arrows? When there are no arrows in the players inventory 6 arrows would reappear in the container.

#12
rjshae

rjshae
  • Members
  • 4 485 messages

koundog1 wrote...

Okay Tchos the delay mention gave me another idea.

I wonder if it would be easier to make a container that refills itself with a stack of 6 arrows? When there are no arrows in the players inventory 6 arrows would reappear in the container.


It might be easier to use an item activation; one less step for the player. However, a crafty player may switch the arrows to another character in the party, or store them somewhere. You'll have to put an unacquire script on the arrows to catch that contingency. I'd also set their price to zero so the player can't keep selling the arrows.

#13
Tchos

Tchos
  • Members
  • 5 042 messages
Does the Unacquire event fire if you lose an arrow by shooting it? There's a possibility there.

#14
Friar

Friar
  • Members
  • 293 messages
Good points rshae,
I didn't think about the player creating ammo and then outfitting their party with it.
A glitch like that could interrupt with the believability.

This is harder than I thought. The item activation will probably be easier, but it seems so overused as is.

I'm not sure if it has already been done or thought of, but I wanted to make lethal pet snakes that possess such unwavering discipline that when charmed they can stiffen themselves and be used as an arrow.

I was thinking the player could keep them in a little cage. I could easily make it into a unique item that creates arrows, but I then their is the exploit bug.

I guess the once per day thing would work but then I've totally veered away from my original wanting to make unlimited arrows which don't require a bow. lol!

#15
Friar

Friar
  • Members
  • 293 messages

Tchos wrote...

Does the Unacquire event fire if you lose an arrow by shooting it? There's a possibility there.


I was just looking at that myself. I'm using Lilac Soul script generator and while it is pretty extensive I still wonder if I'm limited by using it. But in fooling around a bit with the Onacquire I'm not seeing how I can replace an arrow.

I'm seeing that if I put my snake cage container in the player's inventory I use it as a condition for creating arrows in the container.

But how do I make a condition for it to create arrows when the player runs out.

This is interesting,
I just created a bow with the unlimited arrows property. I went and changed the base item line to arrows and the property stayed on the item. I'm tempted to test it and see if it worked. I'll probably break something though.

#16
Tchos

Tchos
  • Members
  • 5 042 messages
I don't know if the script generator has this particular command, but when you adjust an item's stack size, it's actually creating or destroying items to match the number, not splitting up or joining stacks. So IF the unacquire event fires when you shoot an arrow (which reduces the stack size of the arrows by 1):

int iArrowStackSize = GetItemStackSize(oArrowStack);

if (iArrowStackSize != 6)
{
// Delay and effect here if you want
SetItemStackSize(oArrowStack, 6);
}


That forces it to 6, so it'll destroy any extra arrows you might have, too. You could use a loop to cycle through the inventory to catch multiple stacks if the player split the stack, and cycle through party members to catch those, too.

P.S. Never mind this.  Use the much more elegant solution by I_Raps!

Modifié par Tchos, 25 avril 2013 - 12:31 .


#17
I_Raps

I_Raps
  • Members
  • 1 262 messages
How about this ...

Again, we have a (now identified) snake ammo type with its stack of six.
We also have an itemproperty for unlimited ammo (snakes).
The player gets a Cage of Snakes. On activation, it gives his equipped bow (or crossbow, for that matter) the unlimited ammo (snakes) property* and replaces itself with an Empty Snake Cage.

* It also sets the bow/crossbow as plot and cursed. It can't be unequipped.

The Empty Snake Cage on activation removes the property etc. from the bow/crossbow.

#18
Friar

Friar
  • Members
  • 293 messages
Both very good ideas.

I found that the medium miscellaneous object item base supports the unlimited arrow. I_Raps did come up with the solution. I'm going to toy with this some more and see if I can make this snake cage even more unique. Thanks everyone!

I adjusted the UV scroll to make the arrow look a little strange wen flying through the air.
I also made the arrows cursed. Not sure what that will do yet but we'll see.

The problem I'm running into now is that the arrows I created aren't showing up in the list of possible ammo types in the

item property
misc
costvalue

...box

Modifié par koundog1, 25 avril 2013 - 01:17 .


#19
Lugaid of the Red Stripes

Lugaid of the Red Stripes
  • Members
  • 955 messages
A round-about way would be to alter the on-physically attacked scripts of all the monsters (easy enough if you just overwrite the default script. When attacked, the script checks to see if the attacker is the PC, has a bow equipped, and then has the special arrows equipped. If so, they spawn a little snake creature. The snake has a heartbeat script that tells it to seek out the PC (set as a local object by the on-physically attacked script). When the snake is close enough to the PC, it adds a arrow to the PC's inventory and destroys itself.

#20
Morbane

Morbane
  • Members
  • 1 883 messages

koundog1 wrote...


The problem I'm running into now is that the arrows I created aren't showing up in the list of possible ammo types in the

item property
misc
costvalue

...box


might have to edit itemprops.2da

?
:blink:

#21
Morbane

Morbane
  • Members
  • 1 883 messages

Lugaid of the Red Stripes wrote...

A round-about way would be to alter the on-physically attacked scripts of all the monsters (easy enough if you just overwrite the default script. When attacked, the script checks to see if the attacker is the PC, has a bow equipped, and then has the special arrows equipped. If so, they spawn a little snake creature. The snake has a heartbeat script that tells it to seek out the PC (set as a local object by the on-physically attacked script). When the snake is close enough to the PC, it adds a arrow to the PC's inventory and destroys itself.



even copying the on-physical script and altering it - would only result in koundog having 2 scripts - he would have to select the new script for every monster and use his local version - 

trial and error tested
:crying:

#22
rjshae

rjshae
  • Members
  • 4 485 messages
This might work: the on-equip script for the arrows could be written to automatically remove all but one copy from the equipment slot, leaving one arrow equipped and placing the remainder in the inventory. When the arrow is fired, the unequip script can then load up the next arrow from the inventory, check whether the first one returned, then add that one back into the inventory stack. (The one thing I'm not sure about is whether the on-equip script will be triggered again if the player tries to move the remainder of the arrows back into the slot.)

It might be a little puzzing to the player at first, but script-wise it seems potentially do-able.

Modifié par rjshae, 25 avril 2013 - 02:44 .


#23
I_Raps

I_Raps
  • Members
  • 1 262 messages

koundog1 wrote...

The problem I'm running into now is that the arrows I created aren't showing up in the list of possible ammo types in the

item property
misc
costvalue

...box


Did you ever get that solved?  You have to add the new ammos* to iprp_ammocost.2da.

* All three - arrow, bolt, and bullet - even if you don't use all three.

Modifié par I_Raps, 26 avril 2013 - 10:30 .


#24
Friar

Friar
  • Members
  • 293 messages
No I was looking for which 2da to peek into... now I know! Thanks yet again! :)

#25
Dann-J

Dann-J
  • Members
  • 3 161 messages
I've created throwing weapons and ammo that return on a successful hit, using a simple tag-based OnHit script:
http://www.neverwint...ds.com/mods/210 

You lose them if you miss though. The last in the stack also doesn't return (since there's no stack left to increase by one).