Scripts / Command to Change Entities/Characters to Something Else?

Author
Message
geistschatten
12
Years of Service
User Offline
Joined: 10th Apr 2012
Playing: GameGuru
Posted: 7th Jun 2015 11:55
I want to make a script where, after entering a zone (or maybe picking up a collectible), all the instances of a particular entity or character change to a different entity or character.

As an example, you collect one of the runes from the Fantasy pack and then all the characters change to demons.

Is there some kind of switch entity/character command? I tried checking in global.lua and with the forum search but wasn't seeing anything similar.
Tarkus1971
Audio Media Maker
9
Years of Service
User Offline
Joined: 24th Feb 2015
Location: England, UK
Posted: 7th Jun 2015 12:50
If they don't need to spawn in the same place as the runes, just use Destroy(entity number) and use Show(new entity number) pre hide the demons of course, by using Always On set to OFF in the properties panel for each demon, works for me with doors and other stuff so it should work with demons. Just hover the mouse over the entities to get there number in the bottom right of the editor window.
Aftershock Quad Core AMD FM2+ 3.5 GHz 8GB Motherboard and Processor, A7700k apu, AMD HD7870 gfx card.
King Korg Synth, Alesis SR18 Drum Machine, Akai MPX8 sample player, Roland Fantom XA Synth, Axus Digital AXK2 Digital Drum Kit.
geistschatten
12
Years of Service
User Offline
Joined: 10th Apr 2012
Playing: GameGuru
Posted: 7th Jun 2015 13:33
Oh, you're right, I didn't even think of that. I will definitely try that. Thank you for the suggestion!
Tarkus1971
Audio Media Maker
9
Years of Service
User Offline
Joined: 24th Feb 2015
Location: England, UK
Posted: 7th Jun 2015 14:14 Edited at: 7th Jun 2015 14:16
entity number shows in bottom left of editor window, and spawn at start should be NO in the properties also, sorry doh!, Hope it works for you..
Aftershock Quad Core AMD FM2+ 3.5 GHz 8GB Motherboard and Processor, A7700k apu, AMD HD7870 gfx card.
King Korg Synth, Alesis SR18 Drum Machine, Akai MPX8 sample player, Roland Fantom XA Synth, Axus Digital AXK2 Digital Drum Kit.
Tarkus1971
Audio Media Maker
9
Years of Service
User Offline
Joined: 24th Feb 2015
Location: England, UK
Posted: 7th Jun 2015 14:15
You can also use ShowLight() and HideLight() with the entity number of a dynamic light, very useful I find.
Aftershock Quad Core AMD FM2+ 3.5 GHz 8GB Motherboard and Processor, A7700k apu, AMD HD7870 gfx card.
King Korg Synth, Alesis SR18 Drum Machine, Akai MPX8 sample player, Roland Fantom XA Synth, Axus Digital AXK2 Digital Drum Kit.
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 7th Jun 2015 17:34 Edited at: 7th Jun 2015 17:34
as tarkus said the best way would be to place the extra entities in the editor before you start, then when you collect the rune make it Spawn(#) the hidden entities (this can be done with a 'for' loop) and hide(#) or Destroy(#) the originals (depending on if you will want to swap back or not)

i suggest using a variable to store the name in the init(e) part of all the characters then you can easily reference them with the for loop by checking that variable is valid - then you dont need to remember the numbers yourself
(as weapon_name[#] is already part of the global i tend to use that)

so the rune script would look something like this
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11

Login to post a reply

Server time is: 2024-12-22 01:35:23
Your offset time is: 2024-12-22 01:35:23