Page 1 of 2

Enemy wont use item [SOLVED]

Posted: March 31st, 2013, 10:38 am
by gametechish
My enemy wont use any item I give him but he will chase me down. here I'll post the code.

Code: Select all

include scripts/1

r_script_signal talk [
  if (!= (r_get_faction self) (r_get_faction actor)) [
    r_action_clear self
    r_action_attack self actor
  ]
]

r_script_signal hit [
  if (!= (r_get_faction self) (r_get_faction actor)) [
    r_action_clear self
    r_action_attack self actor
  ]
]

r_script_signal update [
  if (r_cansee self player) [
    r_action_clear self
    r_action_attack self player 1
  ]
]

r_script_signal collide [
  if (!= (r_get_faction self) (r_get_faction actor)) [
    r_action_clear self
    r_action_attack self actor
  ]
]

r_script_signal spawn [
  r_action_wander self 0 96 0
  r_additem self 8 1
  r_equip self 0
]
Can someone please help soon I even use the RPG tutorial for the enemy just renamed the enemy. I can use the weapon if i kill him. I am really calling for help now. Please anyone. :cry:

Re: Enemy wont use item

Posted: March 31st, 2013, 1:45 pm
by kddekadenz

Code: Select all

r_script_signal spawn [
  r_action_wander self 0 96 0
  r_additem self 8 1
  r_equip self 0
  ]
This part is outdated. I'm not sure about the wander command, I never really used it.
The equip stuff needs to be handled the following way:

Code: Select all

r_script_signal spawn [
 r_additem self 8 1 [ r_equip actor self 0 ]
]

Re: Enemy wont use item

Posted: March 31st, 2013, 8:59 pm
by Hirato
If it's not that, make sure there are NON-FRIENDLY STATUS EFFECTS assigned onto the weapon you're trying to equip

Re: Enemy wont use item

Posted: March 31st, 2013, 9:38 pm
by gametechish
Thank you it now works some one should update the wiki but do Dragons automatically fly or do they need a script if so can someone help me out with this

Re: Enemy wont use item [SOLVED]

Posted: April 1st, 2013, 11:24 am
by kddekadenz
Erh, what?

Re: Enemy wont use item [SOLVED]

Posted: April 1st, 2013, 1:58 pm
by gametechish
when you make a script and use the model for the dragon will the dragon automatically fly up and chase you or will it just stay on the ground

Re: Enemy wont use item [SOLVED]

Posted: April 6th, 2013, 7:37 am
by personman61
The dragon model just looks like its flying, but i don't know how to script it to fly.

Re: Enemy wont use item [SOLVED]

Posted: April 6th, 2013, 12:31 pm
by Leo_V117
I think you have to script that... It isn't actually part of the default engine scripting for a dragon, or any creature for that matter, to fly.

Re: Enemy wont use item [SOLVED]

Posted: April 6th, 2013, 12:56 pm
by kddekadenz
You simply could "fake" flying by increasing the Z value of the model. This can be either done by using a 3D modeling program, such as Blender, or by adding to the cfg of the dragon model (I think it is located in packages/models/rpg/) something like this:

Code: Select all

mdltrans 0 0 40
http://sauerbraten.org/docs/models.html#mdltrans wrote:mdltrans X Y Z

Translate the model's center by (X, Y, Z), where X/Y/Z are in model units.

Re: Enemy wont use item [SOLVED]

Posted: April 6th, 2013, 4:31 pm
by Leo_V117
This could work, but it would be unwise as you would have to package the model as part of your game when you release.