Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - zutokaza

Pages: [1] 2 3
1
Development / [Solved]How to get the hero in an item script?
« on: June 06, 2017, 04:58:05 am »
I am wondering how to get the hero in an item script.

I want to do this:

Code: ( lua) [Select]
--slow the hero down
function item:on_map_changed(map)
  hero:set_walking_speed(30)
end

I tried:
Code: ( lua) [Select]
local item = ...
local game = item:get_game()
local hero = game:get_hero()

and

Code: ( lua) [Select]
local item = ...
local game = item:get_game()
local map = item:get_map()
local hero = map:get_entity("hero")

and

Code: ( lua) [Select]
local item = ...
local game = item:get_game()
local map = item:get_map()
local hero = map:get_hero()

2
Development / [Solved]Get all map entities?
« on: June 01, 2017, 09:44:18 pm »
Is it possible make a NPC target entities with a prefix?

Code: ( lua) [Select]
target_movement:set_target(map:get_entities("bird_"))

3
How would I do something like this?

Code: ( lua) [Select]
function test(a = 5, b = "hey", c = true)
  if a == 5 then
    print("Letter A is",a)
  end
end

test()

I know it can be done like this:

Code: ( lua) [Select]
function test(a, b, c)
a = 5
b = "hey"
c = true
  if a == 5 then
    print("Letter A is",a)
  end
end

test()

4
Development / [Solved]Create custom entity with script?
« on: May 04, 2017, 03:33:03 pm »
I want to create a custom entity with script, but I am having trouble creating it. I want to create a new entity at the position of an already existing entity.

Code: ( lua) [Select]
  map:create_custom_entity({
    name = "box",
    direction = 2,
    layer = 0,
    x = entity:get_position(),
    y = entity:get_position(),
    sprite = "entities/box",
    })

5
Development / [Solved]Disable spin Attack?
« on: April 12, 2017, 12:16:54 am »
is it possible to disable the spin attack?

6
Development / [Solved]Movements with camera?
« on: April 07, 2017, 04:44:24 am »
I was trying to move the camera, but how do I move an entity without a name? Is it possible to create a name for the camera?

Code: ( lua) [Select]
local straight = sol.movement.create("straight")
straight:set_angle(3)
straight:start(camera)

7
Development / (Solved)Table?
« on: April 03, 2017, 03:23:56 am »
I have been trying to figure out the error with my table for the pixel movement.
Quote
trajectory (table): An array of all successive translations to make. Each translation should be an array of two integers (x and y).


Code: ( lua) [Select]
local table1 = {244,270}
pixel:set_trajectory(table1)
pixel:start(gerf)

and I tried:

Code: ( lua) [Select]
pixel:set_trajectory{244,270}
pixel:start(gerf)


Code: [Select]
[2150] Error: In on_started: [string "maps/Map_4.lua"]:83: bad argument #3 to set_trajectory (table expected, got number)

8
Development / [Solved]How do I make a circle movement?
« on: April 02, 2017, 10:51:06 am »
I am having trouble with this because my npc is not making a circle movement. I want the NPC (gerf) to circle around a entity (chest1).

Code: ( lua) [Select]
local circle = sol.movement.create("circle")
circle:set_center(chest1,248,357)
circle:start(gerf)

9
Development / (Solved)Sword variants?
« on: March 24, 2017, 11:54:20 pm »
Can a sword have different variants? For example, variant 2 for a red sword graphic?

Code: ( lua) [Select]
game:set_ability("sword", 2)

10
Development / Key save error message
« on: March 06, 2017, 05:12:58 am »
I made a key item. I require the key for opening the door, but I get this error message. The door entity never shows.

Code: ( lua) [Select]
2140] Error: In create_door: bad argument #1 to ? (Bad field 'opening_condition' (equipment item 'key' is not saved))

11
Development / Hit box size?
« on: January 10, 2017, 01:26:15 am »
What is the size of the hit box?

12
Development / (Solved)How do I overwrite array strings?
« on: November 28, 2016, 06:44:30 am »
Basically the sol.surface font text is equal to test for displaying words test1,2,3,4, etc. I am trying to overwrite the first 0-7 tests.

Code: ( lua) [Select]
local test = {}
local testing

test[0] = "test1"
test[1] = "test2"
test[2] = "test3"
test[3] = "test4"
test[4] = "test5"
test[5] = "test6"
test[6] = "test7"
test[7] = "test8"

for i = 0,7 do
     show_test[rep] = sol.text_surface.create({
      text = test[i],
    })
end

function sol.main:on_draw(screen)

--clear and overwrite
test = {}

 if testing == true then
 test[0] = "test_overwrite1"
 test[1] = "test_overwrite2"
 test[2] = "test_overwrite3"
 test[3] = "test_overwrite4"
 test[4] = "test_overwrite5"
 test[5] = "test_overwrite6"
 test[6] = "test_overwrite7"
 test[7] = "test_overwrite8"
 end

for i = 0,7 do
    show_text[i]:draw(screen,x_test_pos,y_test_pos[i])
  end
end

end

13
Development / [Solved]How do I print a string to txt file?
« on: November 24, 2016, 09:02:08 pm »
Hello,

I want to print a string to a text file.

For example,

Code: ( lua) [Select]
print("hello world")
txt file:
1 hello world

14
Development / (Solved) For loop embedding question
« on: November 10, 2016, 08:21:59 am »
Is it possible to do this in a shorter way?
Code: ( lua) [Select]
for rep = 1, 15 do
--blah different coordinate calculations
 for rep = 15, 30 do
   --blah different different coordinates calculations
  for rep = 30,45 do
   --blah different coordinates calculations
   for rep = etc....... do
    --blah different coordinates calculations
   end
  end
 end
end

My first thought was to use arrays. Will this work? If yes, how would I have starter begin 0 and ender begin at 15?

Code: ( lua) [Select]
for 1,15 do
it would end up being:
15,30
30,45
45,60
etc

Code: ( lua) [Select]
local starter={}
local ender ={}

for rep 1,15 do
 starter[rep] = 0
 ender[rep] = 0
end

for reprep = 1,15 do
 starter[reprep]=starter[reprep] +15
 ending[reprep] = starter[reprep] +15
 for rep = starter[reprep], ending[reprep] do
 --blah different coordinates calculations arrays
 end
end

15
General discussion / Secret of Mana?
« on: October 30, 2016, 12:38:03 pm »
This is unrelated to Solarus. Has anyone got a gb(secret of mana currency) glitch in the game? I noticed it does not add up correctly and the same glitch happens during item purchase.

Pages: [1] 2 3