Changing ownership to Custom Value

lindenkron

You can change this now in User CP
Reaction score
102
Trigger:
  • Unit - Change ownership of (Last created unit) to (Player((Custom value of (Item being manipulated)))) and Change color


Edit:
Post #13 has a shortterm explanation if you dont want to read the triggers before you know what I'm trying to achieve.

I narrowed it down, this crashes my game. Need the full trigger? let me know.

Anyone know the reason? :)

EDIT:
Full triggers;

Trigger:
  • PlaceC4New
    • Events
      • Unit - A unit Uses an item
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item being manipulated)) Equal to Small C4
        • Then - Actions
          • Wait 0.10 seconds
          • Unit - Create 1 Explosive C4 (Small) for (Owner of (Triggering unit)) at TempPoint[(Player number of (Owner of (Triggering unit)))] facing Default building facing degrees
          • Unit - Change ownership of (Last created unit) to (Player((Custom value of (Item being manipulated)))) and Change color
          • Unit - Make (Last created unit) Invulnerable
          • For each (Integer A) from 1 to 36, do (Actions)
            • Loop - Actions
              • Wait 0.05 seconds
              • Set TempPoint2[(Player number of (Owner of (Hero manipulating item)))] = (TempPoint[(Player number of (Owner of (Hero manipulating item)))] offset by 300.00 towards ((Real((Integer A))) x 10.00) degrees)
              • Special Effect - Create a special effect at TempPoint2[(Player number of (Owner of (Hero manipulating item)))] using Abilities\Spells\Human\SpellSteal\SpellStealMissile.mdl
              • Set SaveSpecialEffect[((Player number of (Owner of (Hero manipulating item))) + ((Integer A) x 12))] = (Last created special effect)
              • Custom script: call RemoveLocation(udg_TempPoint2[GetConvertedPlayerId(GetOwningPlayer(GetManipulatingUnit()))])
        • Else - Actions
          • Do nothing
      • Custom script: call RemoveLocation(udg_TempPoint[GetConvertedPlayerId(GetOwningPlayer(GetManipulatingUnit()))])
      • Custom script: call RemoveLocation(udg_TempLocation)


Trigger:
  • CreateC4Point
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Item-type of (Target item of ability being cast)) Equal to Small C4
    • Actions
      • Set TempLocation = (Target point of ability being cast)
      • Set TempPoint[(Player number of (Owner of (Triggering unit)))] = TempLocation
      • Wait 0.10 seconds


Me and swe_suffer have been trying to figure this out for a while now :p


Edit:
Post #13 has a shortterm explanation if you dont want to read the triggers before you know what I'm trying to achieve.
 

CaptDeath

New Member
Reaction score
103
i suggest using
(player (owner of(triggering unit)))
would that work [^ is free hand]
 

lindenkron

You can change this now in User CP
Reaction score
102
Trigger:
  • CreateC4
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to C4 Explosives (Based off channel)
    • Actions
      • Set TempPoint[1] = (Position of (Triggering unit))
      • If ((Current research level of C4 Explosives for (Owner of (Casting unit))) Equal to 1) then do (Item - Create Small C4 at TempPoint[1]) else do (Do nothing)
      • If ((Current research level of C4 Explosives for (Owner of (Casting unit))) Equal to 2) then do (Item - Create Medium C4 at TempPoint[1]) else do (Do nothing)
      • If ((Current research level of C4 Explosives for (Owner of (Casting unit))) Equal to 3) then do (Item - Create Large C4 at TempPoint[1]) else do (Do nothing)
      • Item - Set the custom value of (Last created item) to (Player number of (Owner of (Casting unit)))
      • Unit - Order (Casting unit) to Right-Click (Last created item)
      • Custom script: call RemoveLocation(udg_TempPoint[1])
      • Set TempUnitGroup[(Player number of (Owner of (Triggering unit)))] = (Units in BuildingSpawn <gen> owned by (Owner of (Casting unit)))
      • Unit Group - Pick every unit in TempUnitGroup[(Player number of (Owner of (Triggering unit)))] and do (If ((Unit-type of (Picked unit)) Equal to Old C4 explosive detonated) then do (Unit - Remove (Picked unit) from the game) else do (Do nothing))
      • Custom script: call DestroyGroup (udg_TempUnitGroup[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))])


The Item custom value is set there.
 

CaptDeath

New Member
Reaction score
103
Trigger:
  • CreateC4
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to C4 Explosives (Based off channel)
    • Actions
      • Set TempPoint[1] = (Position of (Triggering unit))
      • If ((Current research level of C4 Explosives for (Owner of (Casting unit))) Equal to 1) then do (Item - Create Small C4 at TempPoint[1]) else do (Do nothing)
      • If ((Current research level of C4 Explosives for (Owner of (Casting unit))) Equal to 2) then do (Item - Create Medium C4 at TempPoint[1]) else do (Do nothing)
      • If ((Current research level of C4 Explosives for (Owner of (Casting unit))) Equal to 3) then do (Item - Create Large C4 at TempPoint[1]) else do (Do nothing)
      • Item - Set the custom value of (Last created item) to (Player number of (Owner of (Casting unit)))
      • Unit - Order (Casting unit) to Right-Click (Last created item)
      • Custom script: call RemoveLocation(udg_TempPoint[1])
      • Set TempUnitGroup[(Player number of (Owner of (Triggering unit)))] = (Units in BuildingSpawn <gen> owned by (Owner of (Casting unit)))
      • Unit Group - Pick every unit in TempUnitGroup[(Player number of (Owner of (Triggering unit)))] and do (If ((Unit-type of (Picked unit)) Equal to Old C4 explosive detonated) then do (Unit - Remove (Picked unit) from the game) else do (Do nothing))
      • Custom script: call DestroyGroup (udg_TempUnitGroup[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))])


The Item custom value is set there.
but this creates the mine for the owner of triggering unit so there isnt need to change the owner is there?
 

lindenkron

You can change this now in User CP
Reaction score
102
The C4 being placed is an item.

The item changes owner if the person putting the item down is someone else.

I need the item (building being created when using the item) to change to the original owner of the item (The one who created it)

I need this to make my detonation work.
 

darkbeer

Beer is Good!
Reaction score
84
Code:
Unit - Change ownership of (Last created unit) to (Player((Custom value of (Item being manipulated)))) and Change color

this should only crash if the Custom value is a Player that doesnt exist in GUI like 0.
so somehow the Custom value probably returns 0, but i dont now why yet^^

add a message to see what the custom value is.
 

lindenkron

You can change this now in User CP
Reaction score
102
I've been waiting for a day+ now, take your time mate. Thanks for looking into it :)
Edit;
Just made a If Then Else, "If custom value of last created item greater than or equal to 1 then do Game display - Then a text"

It is 1+ (Me being Red, its probably 1) so still don't know why game crashes :(
 

lindenkron

You can change this now in User CP
Reaction score
102
I can use the ability without crashing but it's not functioning as I want it to, no.
If that answers your question :)
 

Weegee

Go Weegee!
Reaction score
102
why is there a 0.10 wait at the end :confused:

Edit: and also every units custom value is 0, were do you actually set it in that trigger :confused:
 

CaptDeath

New Member
Reaction score
103
i dont wanna read your trigger but are you using the items custom value as the index?
 

lindenkron

You can change this now in User CP
Reaction score
102
Problem is a need 2 events, "Unit uses item" and "unit starts casting an ability"

So trying to fuse 2 triggers together to get both points, the wait is to make sure the other triggers get first..
But any solution will be good because this aint working :(

2nd Post:
i dont wanna read your trigger but are you using the items custom value as the index?

What does that mean?


--------------------

Basically:
What I need is;

Bomb (An item) has an ability that is based off "Dispel".

When you place/ uses that item / uses the ability in the item, it creates a building. I need to change ownership of that to be = (equal) to the custom item value of the Bomb (An item).
 

Weegee

Go Weegee!
Reaction score
102
Wait dude you do know there is no setting for the custom value for the unit right? (if I am wrong please let me know)

Edit: let me explain it if you don't get it about the custom value

each time a unit is created it has a 0 point value. SO if you make a unit, it cant change its ownership since there is no player 0 in GUI
 

CaptDeath

New Member
Reaction score
103
lol dragon lance
Trigger:
  • Item - Set the custom value of (Last created item) to (Player number of (Owner of (Casting unit)))

:p
 

CaptDeath

New Member
Reaction score
103
umm its in the first under all the if then dos dragon you need to get out side NAO!
ps i didnt see it immediately after your post so...
GET OUT SIDE NAO!
--edit---
WERED IT GO IM CRAZY TO!!
-edit-edit-
it was in his 4 post
Here
 

Weegee

Go Weegee!
Reaction score
102
I still don't get why he has to make a unit and then change its ownership if he can just make a dummy unit :p

Offtopic
------------
lol I would +rep you (cause im like that :p) but I already randomly +repped you (like I do to everyone on random threads)
 

lindenkron

You can change this now in User CP
Reaction score
102
I got a Detonate ability. For that ability to be able to detonate the bomb, the bomb(building) needs to be owned by the player using the ability detonate.

aka: (also known as) I need that building to be changed to the owner of the custom item value, since the custom item value is the player number of the player who created the bomb (item) aka: The same person who is detonating.

Any of this starting to make sense to anyone .. soon ? :eek:
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top