Can somebody tell me why this code will not run?
String SPZ_GetWeaponString(weapon paramWeapon){
if (paramWeapon is "ColdFlame_Sword"){
return "\cgCold\ctFlame \chSword";
} else if (paramWeapon is "ExorSword"){
return "\cgE\cmx\cgo\cmr \ccSword";
} else if (paramWeapon is "IceyStaff"){
return "\cnIcey Staff";
} else if (paramWeapon is "FireyStaff"){
return "\cgFirey Staff";
} else if (paramWeapon is "Cerebral_Displacer_Staff"){
return "\ceCerebral Displacer";
} else if (paramWeapon is "Lightning_Staff"){
return "\ckLightning Staff";
}
}
Return type mismatch with String [ZScript]
Moderator: GZDoom Developers
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
- 22alpha22
- Posts: 308
- Joined: Fri Feb 21, 2014 5:04 pm
- Graphics Processor: nVidia with Vulkan support
- Location: Montana, USA
Re: Return type mismatch with String [ZScript]
You don't have a return value outside of your if and else if statements, meaning that if all the if and else if statements failed, there wouldn't be anything for the function to return. You just need to add a return outside of your if and else if statements. It can be a simple empty string like return "".
Re: Return type mismatch with String [ZScript]
Thank you for the tip! All is working now. 
