Adding an item

The place to post your WML questions and answers.

Moderator: Forum Moderators

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Post Reply
Vonkex
Posts: 11
Joined: July 17th, 2017, 2:42 am
Location: Uruguay

Adding an item

Post by Vonkex »

Well, I'm having troubles with adding items in my scenario. I have read cfg files everywhere, copied all the file and I have modified some lines but when I start the scenario the item appears but has no effects or it doesn't appear and pops up an error saying something that went wrong with lua and i don't know what... Basically, i don't know how to put an item with effects.

Here is a cfg file which i was trying to make from my macros folder:

Code: Select all


[item]
  image=items/sceptre-of-fire.png
[filter]
x=4
y=5
[/filter]
[/item]
[if] 
[event]
 name=moveto
[filter]
x=4
y=5
[/filter]
[/event]
[/if]

[then]    
        [effect]
        apply_to=new_attack
        name=sceptre of fire
        description= _ "sceptre of fire"
        icon=attacks/fireball.png
        type=fire
        range=ranged
        [specials]
            {WEAPON_SPECIAL_MAGICAL}
        [/specials]
        damage=14
        number=4
    [/effect]

    [effect]
        apply_to=new_animation

        [attack_anim]
            [filter_attack]
                name=sceptre of fire
            [/filter_attack]

            {MISSILE_FRAME_FIREBALL_XY 0 0}

            start_time=-200
            [frame]
                sound=fire.wav
            [/frame]
        [/attack_anim]
    [/effect]
[/then]
I know that this file is horrible for starter beginners xD
User avatar
Pentarctagon
Project Manager
Posts: 5564
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Adding an item

Post by Pentarctagon »

I think you might need to take another look at whatever cfg files you used as examples. [event] can't be used like that, period - other tags go inside the [event] tag, not the other way around(for the most part). The [if] tag can only be used with conditional tags, and the [then] tag goes inside the [if] tag. Also, [effect] is (if I'm remembering correctly) supposed to be used as part of [object].

So something closer to this(completely untested):

Code: Select all

[event]
  name=start
  
  [item]
    image=items/sceptre-of-fire.png
    x=4
    y=5
  [/item]
[/event]

[event]
  name=moveto
  first_time_only=yes
  
  [filter]
    x=4
    y=5
  [/filter]
  
  [object]
    id=some_item_1
    [filter]
      x=$x1
      y=$y1
    [/filter]
    [effect]
      apply_to=new_attack
      name=sceptre of fire
      description= _ "sceptre of fire"
      icon=attacks/fireball.png
      type=fire
      range=ranged
      [specials]
        {WEAPON_SPECIAL_MAGICAL}
      [/specials]
      damage=14
      number=4
    [/effect]
    [effect]
      apply_to=new_animation
      
      [attack_anim]
        [filter_attack]
          name=sceptre of fire
        [/filter_attack]
        
        {MISSILE_FRAME_FIREBALL_XY 0 0}
        
        start_time=-200
        [frame]
            sound=fire.wav
        [/frame]
      [/attack_anim]
    [/effect]
  [/object]
[/event]
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
Vonkex
Posts: 11
Joined: July 17th, 2017, 2:42 am
Location: Uruguay

Re: Adding an item

Post by Vonkex »

Pentarctagon wrote:I think you might need to take another look at whatever cfg files you used as examples. [event] can't be used like that, period - other tags go inside the [event] tag, not the other way around(for the most part). The [if] tag can only be used with conditional tags, and the [then] tag goes inside the [if] tag. Also, [effect] is (if I'm remembering correctly) supposed to be used as part of [object].

So something closer to this(completely untested):

Code: Select all

[event]
  name=start
  
  [item]
    image=items/sceptre-of-fire.png
    x=4
    y=5
  [/item]
[/event]

[event]
  name=moveto
  first_time_only=yes
  
  [filter]
    x=4
    y=5
  [/filter]
  
  [object]
    id=some_item_1
    [filter]
      x=$x1
      y=$y1
    [/filter]
    [effect]
      apply_to=new_attack
      name=sceptre of fire
      description= _ "sceptre of fire"
      icon=attacks/fireball.png
      type=fire
      range=ranged
      [specials]
        {WEAPON_SPECIAL_MAGICAL}
      [/specials]
      damage=14
      number=4
    [/effect]
    [effect]
      apply_to=new_animation
      
      [attack_anim]
        [filter_attack]
          name=sceptre of fire
        [/filter_attack]
        
        {MISSILE_FRAME_FIREBALL_XY 0 0}
        
        start_time=-200
        [frame]
            sound=fire.wav
        [/frame]
      [/attack_anim]
    [/effect]
  [/object]
[/event]
It worked, thank you!.
Post Reply