Help with Factions and Weapons 1.2.8

Chat and ask questions about the RPG Maker Mode here.
coopziana
Member
Member
Posts: 27
Joined: July 23rd, 2012, 9:58 am
Name: Ben

Help with Factions and Weapons 1.2.8

Postby coopziana » January 16th, 2013, 6:53 am

Hi,
I need to set a faction to hate me as soon as I enter the game, for example; walking around a nice field you come across a nasty wolf... we he doesn't want to attack me unless I attack him first. But i would like it so that from the start of the game he wants to kill me with no way to change the faction.

Secondly I'm having some trouble in 1.2.8 with giving enemies weapons. For example I'd like to make a fire breathing dragon, I followed the RPG tutorial and all i get is an error in game:

Code: Select all

//Dragon Script
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 50 0
  r_additem self 2 1
  r_equip self 2 0
]


Naturally I have the same issue that it won't attack me unless I attack it first, however that's an issue in itself as my first weapon doesn't actually cause any damage, It simply just pushes things around. The idea is to push the dragon into a huge lava pit... Without it killing you first! Now When I load the game and drop the waypoints and everything, the dragon charges at me (which I don't really want it to be face to face with me, so is there a way to stop it from charging at you and just stay at a certain distance?) but then i get an error that states

Code: Select all

r_equip; invalid reference "2" or of incompatible type


Now I've tested the weapon in question and I can equip it no problem and can use it. After killing the dragon (using another weapon that does damage) I went over and looted it and the weapon appears in it's inventory for me to loot... so the "r_additem" is working, it just doesn't want to equip the weapon.

I'm currently just testing it with the tutorial "fangs" and then I will change it later once i can get it working.

Code: Select all

r_item_name "Fangs"
r_item_description "If you see this, submit a bug report."

r_item_use_new_weapon // 0
r_item_use_cooldown 100
r_item_use_chargeflags $CHARGE_MAG
r_item_use_new_status 1 $ATTACK_SLASH .075

r_item_use_slots (| $SLOT_LHAND $SLOT_RHAND |)
r_item_use_skill $SKILL_MELEE

r_item_use_range 4
r_item_use_angle 8 //degrees
r_item_use_lifetime 0
r_item_use_cost 0
r_item_use_target $T_HORIZ
r_item_use_recoil -10
r_item_use_projeffect -1
r_item_use_traileffect -1
r_item_use_deatheffect -1


Any help on this post would be most appreciated!

coopziana
Member
Member
Posts: 27
Joined: July 23rd, 2012, 9:58 am
Name: Ben

Re: Help with Factions and Weapons 1.2.8

Postby coopziana » January 16th, 2013, 7:18 am

ok I think I fixed the Faction problem:

Code: Select all

r_faction_name "Enemy Faction"
r_faction_base 2
r_faction_set_relation self 0 other 0 friendliness -1


I have no idea if that is even good coding but it works with no errors so that'll do for now!

~ Still can't get the weapon to equip on the enemy though! :(
~ Also bit bored of the enemy just wanting to hug me, there must be a way to get it to stay at a certain distance?

coopziana
Member
Member
Posts: 27
Joined: July 23rd, 2012, 9:58 am
Name: Ben

Re: Help with Factions and Weapons 1.2.8

Postby coopziana » January 16th, 2013, 7:51 am

ok, So as you can probably see I'm trying to figure as much of this out as I can on my own and then I'll keep updating this post. More to help anyone else out with this issue too.

After reading the change-log for 1.2.8 it seems that the old way of scripting "r_equip" has changed and now must be referenced by "T_INV" which I'm guessing is something to do with inventory numbers. So basically I can load the enemy with a certain item (items/2.cfg) using the old way as below:

Code: Select all

r_additem self 2 1

As a small reference this tells the script to add "item/2.cfg" to the enemy as a quantity of "1" naturally if you change the numbers at the end it will change which item the NPC has and how many he will hold on him.

Now to make him equip the item that is now help in slot 1 (or 0 depending on if the first slot is actually classed as 0?) we need to define it with the T_INV command (as stated in the change log for 1.8.1) However I have trolled Google and the forum to try and find a reference to this command to give me a clue as to how it works and have come up empty handed. I could play around with this command forever and never get it right.

Could someone throw me a lifeline here and tell me how to use the T_INV command?
Do I add it to my Item.cfg or to my script.cfg?

An example script would be very useful!

Hirato
Developer
Developer
Posts: 689
Joined: May 30th, 2009, 1:23 pm
IRC Username: hirato

Re: Help with Factions and Weapons 1.2.8

Postby Hirato » January 16th, 2013, 2:00 pm

r_faction_base sets that faction's default relationships with the other factions;
`r_faction_base 0` for example will make it attack anything in sight.

The AI scripting itself is very limited and primitive, the only way to get it to stand still right now is to not drop any waypoints.
As for r_equip, you pass it two references, and a use, ie, r_equip player item 0
But that's inconvenient and painful, so r_additem now takes an extra optional argument as well, as script to execute!

Code: Select all

r_additem self 2 1 [
    //self here refers to the item; it's weird
    r_equip actor self 0
]
This is not a url, clicking it is pointless

coopziana
Member
Member
Posts: 27
Joined: July 23rd, 2012, 9:58 am
Name: Ben

Re: Help with Factions and Weapons 1.2.8

Postby coopziana » January 20th, 2013, 7:49 am

Thanks for the info Hirato,

At the moment I'm still playing around with this Enemy as he is still happy to charge after me, but still will not throw his boulder at me. Here is the script I'm using:

Code: Select all

r_item_name "Golem Bouder"
r_item_value 0
r_item_weight 0
r_item_mdl "dcp/chest"

r_item_use_new_weapon
r_item_use_name "Golem Boulder"
r_item_use_description "Golem WILL throw this at you!"
r_item_use_icon ""
r_item_use_cooldown 900
r_item_use_chargeflags $CHARGE_MAG
r_item_use_new_status 2 $ATTACK_FIRE 1.0

r_item_use_slots (| $SLOT_LHAND $SLOT_RHAND |)
r_item_use_skill $SKILL_MAGIC
r_item_use_pflags P_TIME
r_item_use_range 50
r_item_use_angle 180
r_item_use_lifetime 1200
r_item_use_gravity 90
// the projectile defines the particle effects
r_item_use_projeffect 3
r_item_use_traileffect -1
r_item_use_deatheffect -1
r_item_use_cost 0
r_item_use_target $T_MULTI
r_item_use_radius 25
r_item_use_recoil 0
r_item_use_kickback 20
r_item_use_speed 1.1


Code: Select all

//Darkmore Golem Script
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 50 0
  r_additem self 18 1
  r_equip [u]actor[/u] self [*]18 0[/*]
]


Sadly I'm now getting an error:

Code: Select all

r_equip; invalid reference "actor" or of incompatible type

I've underlined where the code is getting the error from above, It's odd that it's just this one line of code that is making life difficult for my little RC... He longs to have a boulder thrown at him :( hehe.

I've tried numerous different scripts to try and fix this but had no luck. Mainly I've been playing with the numbers at the end of the script as I'm not really sure what they refer to, are they a reference to Inventory Items or Directory Items? and the second number is that reference to the Position that it will be equipped E.G. Hands or is that number not needed?

In the meantime I could be getting on with map creations... However I'm a little loathed to press on with making maps while I haven't got the NPC's doing what I need them to do, if you get me?

Also just a quick off0topic question: I would like it that I cannot attack a certain faction. For example, I have a castaway on an island who is harmless and gives you some help (basically a glorified Tutor), if you shoot him he turns against you. I will be setting up his base stats to make him Regen HP super fast so you cannot kill him, but how do I get my Faction back to normal with him once I shoot him? I'd like to be able to just press "E" (Action) on him and be able to chat with him to say "sorry" and Faction back to friendly. Or just the ability not change his faction at all.

I tried setting him up as a Trigger instead of a critter, but the script doesn't work as a trigger and only works as a critter, regardless that they are both set up exactly the same. I have changed the:

Code: Select all

include scripts/1

to a /2, /3 and /4 as described in the help file:

Code: Select all

0 - null script
1 - Default/Generic NPC script
2 - Default/Generic item/pickup script
3 - default/generic trigger script // <---- That one Right?
4 - Player's Script

But it still doesn't work, but as I say the script runs perfectly fine if he is set up as a critter!

Any suggestions on both questions would be appreciated.

Hirato
Developer
Developer
Posts: 689
Joined: May 30th, 2009, 1:23 pm
IRC Username: hirato

Re: Help with Factions and Weapons 1.2.8

Postby Hirato » January 20th, 2013, 9:02 am

Firstly, the low range may be inhibiting the critter from launching.
At least that'd be my thoughts, if it weren't for some glaring scripting mistakes.
So let's have a quick game of spot the difference...

My example above

Code: Select all

r_additem self 2 1 [
    r_equip actor self 0
]

2 and 0 respectively refer to the item index, and the use index.

Yours

Code: Select all

r_additem self 18 1
r_equip [u]actor[/u] self [*]18 0[/*]



Also just a quick off0topic question: I would like it that I cannot attack a certain faction. For example, I have a castaway on an island who is harmless and gives you some help (basically a glorified Tutor), if you shoot him he turns against you. I will be setting up his base stats to make him Regen HP super fast so you cannot kill him, but how do I get my Faction back to normal with him once I shoot him? I'd like to be able to just press "E" (Action) on him and be able to chat with him to say "sorry" and Faction back to friendly. Or just the ability not change his faction at all.


Friendly fire protection is still on the todo list, at present it will only protect the origin from friendly fire.
Additional options for faction wide protection and, then extending these onto allies are planned.

If you don't want him to use the default NPC script with the faction logic, don't use the default script, or override the relevant signals, like "hit".
Using the Player's factino will probably be good enough to deter hostilities too.

Also, for your golem, don't use "update" that way, use the "ai update" signal instead for those purposes.
This is not a url, clicking it is pointless

coopziana
Member
Member
Posts: 27
Joined: July 23rd, 2012, 9:58 am
Name: Ben

Re: Help with Factions and Weapons 1.2.8

Postby coopziana » January 20th, 2013, 4:06 pm

Hirato You are a genius!

Didn't realise that i needed the [ ] <--- them!

Further to to my factions question. I'm sure I can work something out that works for me, naturally I'll keep this post updated with any solutions i come across that might help other PAS users.

At present I'm working on editing the HUD to see if I can make it a little bit different.

Be prepared to to get lots of questions regarding KeyBinds and Hotkeys hehe.

coopziana
Member
Member
Posts: 27
Joined: July 23rd, 2012, 9:58 am
Name: Ben

Re: Help with Factions and Weapons 1.2.8

Postby coopziana » January 22nd, 2013, 4:48 am

So I figured out the issue with the factions.

It was as simple as setting the ally faction to "0", then you can shoot them as much as you like and they don't turn hostile against you!

coopziana
Member
Member
Posts: 27
Joined: July 23rd, 2012, 9:58 am
Name: Ben

Re: Help with Factions and Weapons 1.2.8

Postby coopziana » January 27th, 2013, 10:46 am

Hi, I have another question with regards to weapons.

I would like to set the cooldown period separately to each other. So just to put that into context. I have 2 weapons a Blaster (Left Hand) and a Fire Spell (Right Hand). Now The Fire spell causes and AoE damage and has a cooldown period set above the effect time.

So Basicially:
Effect time = 5 seconds
Cooldown = 7.5 seconds

I've done it this way to prevent stacking of the Fire Spell!

Now I've come up against the issue that While the fire spell is cooling I can't use my Blaster either... Which leaves me a sitting duck.

Is it possible to set the cooldown for each weapon separately so that while the Fire spell cools I can still use my Blaster which has it's own cooldown time?

Basically I don't want one weapons cooldown affecting the other. I've tried changing the Chargeflag's and that doesn't have any effect. The codes for each weapon are below... just in case you can see a glaring error:

Code: Select all

r_item_name "Red Gem"
r_item_value 500
r_item_weight 0.2
r_item_mdl "quad"
r_item_icon "items/RedGem"
r_item_description "It's a Red Gem that Appears to have the Power of Fire!"

r_item_use_new_weapon
r_item_use_name "Red Gem"
r_item_use_description "Creates a fire at target location, burning enemies in the Area."
r_item_use_icon "items/RedGem"
r_item_use_cooldown 7500
r_item_use_chargeflags $CHARGE_MAG
r_item_use_new_status 9 $ATTACK_FIRE 1.0
r_item_use_slots $SLOT_RHAND
r_item_use_skill $SKILL_MAGIC
r_item_use_pflags $P_VOLATILE
r_item_use_range 25
r_item_use_angle 0
r_item_use_lifetime 5
r_item_use_gravity 0
r_item_use_projeffect -1
r_item_use_traileffect -1
r_item_use_deatheffect 2
r_item_use_cost 50
r_item_use_ammo -1
r_item_use_target $T_AREA
r_item_use_radius 25
r_item_use_kickback 0
r_item_use_speed 100


Code: Select all

r_item_name "Blaster Lvl1"
r_item_value 1000
r_item_weight 20.0
r_item_mdl "vwep/pistol/norm"
r_item_icon "items/Blaster"
r_item_description "A Blaster that doesn't seem to be lethal."
r_item_script 26

r_item_use_new_weapon
r_item_use_name "Blaster"
r_item_use_description "A Blaster that doesn't seem to be lethal."
r_item_use_icon "items/Blaster"
r_item_use_cooldown 1000
r_item_use_chargeflags $CHARGE_SPEED
r_item_use_new_status 0 $ATTACK_BLUNT 0.0
r_item_use_slots $SLOT_LHAND
r_item_use_skill $SKILL_MARKSMAN
r_item_use_pflags $P_VOLATILE

r_item_use_projeffect 0
r_item_use_traileffect -1
r_item_use_deatheffect 1
r_item_use_cost 2
r_item_use_ammo -1
r_item_use_target $T_SINGLE
r_item_use_radius 5
r_item_use_kickback 100
r_item_use_speed 3


Return to “RPG Maker Mode”

Who is online

Users browsing this forum: No registered users and 1 guest