I’m using variables for archetypes to spawn items and pawns, but their values can only set in the default properties, I can’t modify them during the gameplay.
This is what I have:
var archetype Pawn Compa;
and in the default properties:
Compa=NPC’archetypes.NPC.compa’
to spawn it:
EP = spawn(Compa.class,Location, , Compa);
all working fine.
But when I try to change the value of the “Compa” var with this:
Compa=NPC’archetypes.NPC.compa2’;
the engine return this error: "Error, bad or missing expression for token: NPC, in ‘=’
There is some way to do this, some “set” command or something similar?
I don’t know. I’ve never bothered with “var archetype pawn …” I didn’t even know you could do that. I would just always use “var pawn …” and then if I wanted that variable to refer to an archetype, I would just set the variable to the intended archetype. It works fine, so long as you don’t try calling functions on or deleting a variable that refers to an archetype. Would your game work OK if you just declared the variable as a pawn instead of “archetype pawn”?
Umm… no, it gives the same error if I try to assign the archetipe reference to a pawn variable instead the archetype pawn variable.
I need to use archetypes because they contains all the customization for the pawn and items. I can use several variables for all the actors that I need to spawn, but I think it’s a dirt way to do.