Author Topic:  is this possible? script help  (Read 433 times)

0 Members and 1 Guest are viewing this topic.

oAizen

  • Jr. Member
  • **
  • Posts: 13
    • View Profile
    • Awards
is this possible? script help
« on: January 11, 2017, 01:55:23 AM »
So i was thinking about making a spell script that freezes people like the ring of ice does, but i couldn't find anything on the forum related to it. Instead i tried using a script that put a ring of ice in your inventory and wanted to set the durability to only 1 use, however whenever my script activates it has the item at full durability :/ heres what i got so far. If anyone has a similar script they wouldn't mind sharing or a spell varient of it then it would be greatly appreciated from this miner :)

Script name: Ring of ice pvp
If
HasHistory (roi) (player) (true)
Then
History (roi) (clear) (player)
Inventory (player) (add) (ring of ice) (1)
Item (ring of ice) (durability=10)
notify (you have obtained a ring of ice!) (local)
wait (2000)
Notify (you hear a voice in your head....use the ring!) (local)
----------------------------------
 So thats what i got so far and sometimes it will add the item in my inventory with 10% durability but if i use it again it adds a ring with full durability not 10% if anyone could help me out with this that has experience with these types of script then id be very thankful :) Thanks in advanced!

 Would it be possible to make a spell similar to Ice barrage/Ice blitz from runescape?

TheDestinedCrab

  • Legendary Member
  • *****
  • Posts: 1310
  • Did you see that? Me neither.
  • Awards 3 years on site+600 posts Donated a giveaway prize. (Must be a prize of cash value.) 2 years on site+300 posts 1 year on site+100 posts
    • View Profile
    • Awards
Re: is this possible? script help
« Reply #1 on: January 11, 2017, 02:22:10 AM »
Script name: Ring of ice pvp
If
HasHistory [roi] [player] [true]
Then
History [player] [roi] [clear]
Inventory [player] [add] [ring of ice] [1]
Item [ring of ice] [durability=1]
notify [you have obtained a ring of ice!] [local]
wait [2000]
Notify [you hear a voice in your head....use the ring!] [local]


I fixed up a few history bugs for you, try the script above.
Thanks Gold Knight for the amazing sig!

Craig

  • Developer
  • Extreme Member
  • ******
  • Posts: 6501
  • Dig Deep
  • Awards Developer 4 years on site+1000 posts 3 years on site+600 posts 2 years on site+300 posts Was in the top 10 of the forum stats page as of 4/12/15 Members who have unlocked the robotic avatar 1 year on site+100 posts Day 1 w/25+ posts (4/12/13)
    • View Profile
    • Twitter
    • Awards
Re: is this possible? script help
« Reply #2 on: January 11, 2017, 03:04:49 AM »
You'd need to set the durability before adding the item to inventory.

But setting the durability is global, so you cannot achieve what you want on an individual player/item basis.

TM Charles

  • Supreme Member
  • *****
  • Posts: 2079
  • Awards Donated a giveaway prize. (Must be a prize of cash value.) 3 years on site+600 posts 2 years on site+300 posts 1 year on site+100 posts Was in the top 10 of the forum stats page as of 4/12/15
    • View Profile
    • ::)
    • Awards
  • Xbox: ETTP & Mr Zincy
Re: is this possible? script help
« Reply #3 on: January 11, 2017, 03:17:25 AM »
Setting the durability sets it for everyone so you are better of doing it is this way.

Create a script that you will run when you want the player to get the Ring of Ice and set the item swing event of it to the script below.


Then create another script that will carry out the swing event.
Here we remove the Ring of Ice, thus only allow one use.



Craig

  • Developer
  • Extreme Member
  • ******
  • Posts: 6501
  • Dig Deep
  • Awards Developer 4 years on site+1000 posts 3 years on site+600 posts 2 years on site+300 posts Was in the top 10 of the forum stats page as of 4/12/15 Members who have unlocked the robotic avatar 1 year on site+100 posts Day 1 w/25+ posts (4/12/13)
    • View Profile
    • Twitter
    • Awards
Re: is this possible? script help
« Reply #4 on: January 11, 2017, 03:32:40 AM »
@TM Charles

There's 3 problems with that.
1. You're adding 1 ROI, but clearing all, so if they had other ROI's in their inventory beforehand then they'd lose them. Use Inventory [take] instead.
2. You're setting an event script at some arbitrary point in time, and not unsetting it.
3. It's still not really going to work well. SetEventScript is also global, so everyone will be running that script if they swing their own ROI regardless of their history or other state, until it is unset. Because SetEventScripts are global, generally they ought to be set only on the PlayerJoin event.
« Last Edit: January 11, 2017, 04:06:04 AM by Craig »

crazytater94

  • Supreme Member
  • *****
  • Posts: 2586
  • Mastering TM since 2011
  • Awards Awarded to exemplary forum members Members who have unlocked the robotic avatar 3 years on site+600 posts 2 years on site+300 posts Was in the top 10 of the forum stats page as of 4/12/15 Former MotM winners Week 1 members w/25+ posts (4/13/13-4/20/13) 1 year on site+100 posts
    • View Profile
    • Awards
  • Xbox: crazytater94
  • PSN: crazytater94 (Inactive)
  • Steam: crazytater94
Re: is this possible? script help
« Reply #5 on: January 11, 2017, 04:45:45 AM »
Why not skip all the hassle and just spawn a temp zone on the player with .0001 speed and 10 gravity, then delete it after X seconds?

Platinum Dryym

  • Supreme Member
  • *****
  • Posts: 4254
  • What's yours is mine. ~TM's Resident Master Thief~
  • Awards Members who have unlocked the robotic avatar Awarded to exemplary forum members 2 years on site+300 posts 3 years on site+600 posts Site art contributions/TPs in-game/Contest winners 1 year on site+100 posts
    • View Profile
    • Awards
  • Xbox: dryym
Re: is this possible? script help
« Reply #6 on: January 11, 2017, 08:35:06 AM »
@TM Charles

There's 3 problems with that.
1. You're adding 1 ROI, but clearing all, so if they had other ROI's in their inventory beforehand then they'd lose them. Use Inventory [take] instead.
2. You're setting an event script at some arbitrary point in time, and not unsetting it.
3. It's still not really going to work well. SetEventScript is also global, so everyone will be running that script if they swing their own ROI regardless of their history or other state, until it is unset. Because SetEventScripts are global, generally they ought to be set only on the PlayerJoin event.

4 problems actually.
He's also setting a swing event for the ring of ice, Which does not do anything to help the OP, Who wants to use the freezing effect of the ring.


Why not skip all the hassle and just spawn a temp zone on the player with .0001 speed and 10 gravity, then delete it after X seconds?

That doesn't freeze the player's camera.


Honestly, What I would do is something similar to the original script.

Eg.
Item [RingOfIce] [durability=1]
Inventory [player] [add] [RingOfIce]
Item [RingOfIce] [durability=default]


This should give you a ring of ice that is defaulted to 1 durability.
Yes, Item commands are global. However, Most scripts have a running time of fractions of a millisecond. So the only time this would affect other players is if another player got an ice ring within a fifth of a millisecond of this script running.


The likelihood of that happening is so low that I really don't think that it would ever affect gameplay.



Here's the thing though. Are you making a map where you want people to get full durability ice rings anyway? If not, Why not just make an item command that changes the durability on player join?

Creator of the term "Deathmine "
Jared [19|Oct 07:12 PM]: "It changes everything" Dryym

oAizen

  • Jr. Member
  • **
  • Posts: 13
    • View Profile
    • Awards
Re: is this possible? script help
« Reply #7 on: January 11, 2017, 12:04:16 PM »
@Father dryymas, ya im not wanting them to get full durability ice rings. I wanted it to be like a 1 time use kinda thing.

Platinum Dryym

  • Supreme Member
  • *****
  • Posts: 4254
  • What's yours is mine. ~TM's Resident Master Thief~
  • Awards Members who have unlocked the robotic avatar Awarded to exemplary forum members 2 years on site+300 posts 3 years on site+600 posts Site art contributions/TPs in-game/Contest winners 1 year on site+100 posts
    • View Profile
    • Awards
  • Xbox: dryym
Re: is this possible? script help
« Reply #8 on: January 11, 2017, 12:37:32 PM »
@Father dryymas, ya im not wanting them to get full durability ice rings. I wanted it to be like a 1 time use kinda thing.

Then just set the durability for the ring as a whole to be 1.

Creator of the term "Deathmine "
Jared [19|Oct 07:12 PM]: "It changes everything" Dryym