• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Pet System?

Status
Not open for further replies.
Level 6
Joined
Apr 1, 2010
Messages
190
A few months ago I played a lot of Torchlight, there were several things I liked, for example the idea with the pet.
So I wondered if it is possible to make a pet system similiar to Torchlight. The pet there always followed and was not need to be controlled by player, can be equipped and removes automatically from combat (so it never dies) and can fight. Could be interesting specially for Rpg-Maps.
So if anyone know how its possible....
 
Last edited:
Level 13
Joined
Sep 14, 2008
Messages
1,407
The AoS map "eota" features a hero which can summon a familar. It does exactly the thing you described.

Basicly you will have to create a whole AI for that creep. making it follow is not that difficult.

Every 1 sec check if the distance between you and the creep it too far and if just order it to follow you.
 
Level 13
Joined
Mar 4, 2009
Messages
1,156
btw i think this would be easier
make hero have dummy aura ability with X range
than ever 1 sec of game
if pet does not have buff AURA
order pet to move to position of his owner

and you can check his hp so if he has less than 50% also make him go pack to his owner

you can also play with this event
unit is issued targeting a object/point
so if your hero is ordered to move than you order pet to move too
 
Level 6
Joined
Apr 1, 2010
Messages
190
Hi thx for the fast reply. I still havent took a look at the eos map, but I´ve tried the Buff-trigger-thing ALiEN95 suggested and it work quite good. By changing the Aura range you can adjust the distance when your pet returns. I´m still figuring out if its possible to give the unit, two different item slots. One where it just carries items and one where it can use them. And the next thing is about writing the flee-trigger, when the pet is hurt too much - I´d rather trigger it cause I really don´t know how to write a custom KI.
 
Level 13
Joined
Mar 4, 2009
Messages
1,156
check his hit points while you are checking the aura buff

note - buff thing will not allow you much custom distanced
maybe like 200,500,1000,2000 with level increase


for item thing you will need to play with IssuedOrderId

here are some Custom Script: codes

<[GAME TEXT OF ISSUED ORDER]>

call DisplayTimedTextToForce( GetPlayersAll(), 30, ( "Order Id: " + I2S(GetIssuedOrderId())

<[SETTING INTEGER TO ISSUED ORDER]>
set udg_YourInteger = (GetIssuedOrderId())

<[NO TARGET order]>
call IssueImmediateOrderById( YourUnit, (GetIssuedOrderId()))
<[POINT TARGET order]]>
Set YourPoint = (Target point of issued order)
call IssuePointOrderByIdLoc ( YourUnit, (GetIssuedOrderId()), udg_YourPoint)
Custom script: call RemoveLocation(udg_YourPoint)
<[OBJECT TARGET order]]>
<target unit order>
call IssueTargetOrderById( GetTriggerUnit(), (GetIssuedOrderId()), ( GetOrderTargetUnit()))
<target item order>
call IssueTargetOrderById( GetTriggerUnit(), (GetIssuedOrderId()), GetOrderTargetItem() )
<target destructible>
call IssueTargetOrderById( GetTriggerUnit(), (GetIssuedOrderId()), GetOrderTargetDestructable() )
 
Level 13
Joined
Mar 4, 2009
Messages
1,156
check his hit points while you are checking the aura buff

note - buff thing will not allow you much custom distanced
maybe like 200,500,1000,2000 with level increase


for item thing you will need to play with IssuedOrderId

here are some Custom Script: codes

<[GAME TEXT OF ISSUED ORDER]>
call DisplayTimedTextToForce( GetPlayersAll(), 30, ( "Order Id: " + I2S(GetIssuedOrderId())) )

<[SETTING INTEGER TO ISSUED ORDER]>
set udg_YourInteger = (GetIssuedOrderId())

<[NO TARGET]>
call IssueImmediateOrderById( YourUnit, (GetIssuedOrderId()))
<[POINT TARGET]>
Set YourPoint = (Target point of issued order)
call IssuePointOrderByIdLoc ( YourUnit, (GetIssuedOrderId()), udg_YourPoint)
Custom script: call RemoveLocation(udg_YourPoint)
<[OBJECT TARGET]>
<target unit order>
call IssueTargetOrderById( GetTriggerUnit(), (GetIssuedOrderId()), ( GetOrderTargetUnit()))
<target item order>
call IssueTargetOrderById( GetTriggerUnit(), (GetIssuedOrderId()), GetOrderTargetItem() )
<target destructible>
call IssueTargetOrderById( GetTriggerUnit(), (GetIssuedOrderId()), GetOrderTargetDestructable() )

EDIT:
...here is the trigger,just increase the number to increase the slot

  • stop unit to use item in slot 1
    • Events
      • Unit - A unit Is issued an order targeting an object
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order with no target
    • Conditions
    • Actions
      • Custom script: set udg_YourInteger = (GetIssuedOrderId())
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • YourInteger Equal to 852008
        • Then - Actions
          • Trigger - Turn off (This trigger)
          • Unit - Pause (Triggering unit)
          • Unit - Unpause (Triggering unit)
          • Unit - Order (Triggering unit) to Stop
          • Trigger - Turn on (This trigger)
        • Else - Actions
 
Level 6
Joined
Apr 1, 2010
Messages
190
Hm looks quite complex, will take me some time to figure it out.
Spell-Id how up when I press D in the We, right?
And btw is there a list of script codes....
 
Level 6
Joined
Apr 1, 2010
Messages
190
I still haven´t figured out, how to configure the two different Inventories, but I´m going to use the advanced bag system found on clan-cbs
http://www.clancbs.com/downloads_seperate.php?id=1106
I´ve made the pet thing work so far and I will post my triggers here, but be warned, there may be some bugs - cause I´m not that good with setting trigger.

A) First of all, I took a Hero as base unit for my pet, so I got an Interface-icon for my pet.

B) Second thing is making an Aura(simply used tornado-slow aura). If the pet loses buff provided by the Aura it return to the hero.

  • PetFollow
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • If ((Stormdruid´s Pet 0073 <gen> has buff Pet (Langsam-Aura)) Equal to False) then do (Unit - Order Stormdruid´s Pet 0073 <gen> to Right-Click Stormdruid 0071 <gen>) else do (Do nothing)
      • Special Effect - Destroy (Last created special effect)
C) After that I made a Pet-Disappear trigger, when its Hitpoints sink under a definded value. I also combined it with a special effect

  • PetDisappear
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Life of Stormdruid´s Pet 0073 <gen>) Less than 125.00
        • Then - Actions
          • Special Effect - Create a special effect at (Position of Stormdruid´s Pet 0073 <gen>) using Abilities\Spells\Orc\FeralSpirit\feralspiritdone.mdl
          • Unit - Make Stormdruid´s Pet 0073 <gen> Invulnerable
          • Unit - Pause Stormdruid´s Pet 0073 <gen>
          • Unit - Hide Stormdruid´s Pet 0073 <gen>
          • Special Effect - Destroy (Last created special effect)
          • Trigger - Turn off PetFollow <gen>
          • Trigger - Turn on PetReturn <gen>
        • Else - Actions
          • Do nothing
D) Last but not least I need the pet to return after some time, when some of its Hitpoints were restored. This trigger is notactivated with the map ini, and is initially off !

  • PetReturn
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Life of Stormdruid´s Pet 0073 <gen>) Greater than 200.00
        • Then - Actions
          • Special Effect - Create a special effect at (Position of Stormdruid´s Pet 0073 <gen>) using Abilities\Spells\Orc\FeralSpirit\feralspiritdone.mdl
          • Unit - Unhide Stormdruid´s Pet 0073 <gen>
          • Unit - Unpause Stormdruid´s Pet 0073 <gen>
          • Unit - Make Stormdruid´s Pet 0073 <gen> Vulnerable
          • Unit - Order Stormdruid´s Pet 0073 <gen> to Right-Click Stormdruid 0071 <gen>
          • Trigger - Turn off (This trigger)
          • Trigger - Turn on PetFollow <gen>
        • Else - Actions
          • Do nothing
Please correct me if you find leaks or if you know a way how to do it better.
Thx for helping!
 
Level 13
Joined
Mar 4, 2009
Messages
1,156
here is the pet system but i cannot start this map,dunno why

btw you have a trigger example to stop using inventory slot - (increase or decrease) integer "N" to (increase or decrease) slot
EDIT: wait,i have to fix its,tough its because of new computer
Fixed:
http://www.mediafire.com/?gejodzaw4wm

-if pet is hurt he will run back to his owner,he will be ignored by enemies,he will run if he is attack by enemies (like when you attack unit with invulnerable unit),he will not attack enemies until he is recovered (you can also replace triggering unit to add him attack ability if he issued an order to attack it an low health - if you want so)
-what i don't like is that you need to replace the unit once when he is recovered or try using grunt orc´s ability with new unit type option
-i don't like that pets will stare at their owner 0_0 (you change this by adding a small aura and make facing point same as owner´s facing point)
-you can also check distances instead of using to much auras

and something for you :D

you can go to tutorial section too
http://www.hiveworkshop.com/forums/tutorials/

you need to learn about:

Variables !
Array Variables !
Hash tables are also very good (they are 2d Arrays)
and so called Fake Multi-Array variables would be good too (1-12,13-24,25-36....)

to use from 1 to 12
1 x 12 - 11 <-----> 1 x 12 (1 can be integer A)
to use from 13 to 24
2 x 12 - 11 <-----> 2 x 12 (2 can be integer A)
to use from 25 to 36
3 x 12 - 11 <-----> 3 x 12 (3 can be integer A)
-for example if you need save that TriggeringPlayer likes SomePlayer xD
make Boolean Array Variable - Like[X]
set Like[((Number of Triggering Player x 12) - 11) + (Player Number of (SomePlayer))] = True

What you can do with all those Integer and Real values - degrease,distance,custom value ...etc

Use Pick Every Player/Unit/Item... and do actions
loop - do something about Picked Player/Unit/Item...


IF/THAN/ELSE actions are really needed
they are very good and with it you can make all triggers with same event in one trigger

For each integer A from X to X
loop - your actions


For each integer B from X to X
loop - your actions

(integer B actions are used if you need to put it in loop of integer A actions)

sub strings X,X are good for command triggers (and array-string variables are good for it too,if you want player color detect or something like that)
(you should also have all command triggers in one trigger,and only event player types "-" as a sub string
than you check what is the rest of it (for example)
sub string(entered cheat string) 2,6 Equal to "kick " (6 because of space)

Removing Memory Leaks (i think you don't really need to remove player group leaks,i never did and nothing happens,maybe after 1.000.000 times -.-)

it is good to know for Events - Unit issued targeting an object/point/no target

but to stop TriggeringUnit on that events you need to do this:
(i think it is best combination for it)

-turn off this trigger
-pause TriggeringUnit
-unpause TriggeringUnit
-order TriggeringUnit to stop
-turn on this trigger


and some more :D

 
Last edited:
Level 6
Joined
Apr 1, 2010
Messages
190
Yeah thx a lot :xxd: thats exactly what I had in mind. Will give you credits when I´m going to use it in my new Rpg-Map.

...very happy user...
 
Status
Not open for further replies.
Top